Kaoya Swap Hack

TOTAL LOST $118K
Low Flash Loan Attack

Summarize with AI

Affected Chain 2022 Incident surface
Recovered - No recovery reported
All-Time Rank #1473 By amount stolen
Protocol Type Dexs Target category

Incident Overview

On August 24th, 2022, KaoyaSwap, a decentralized transaction protocol built on the Binance Smart Chain, was attacked due to a bug in the swapExactTokensForETHSupportingFeeOnTransferTokens function. The vulnerability allowed the attacker to steal approximately $118,000 worth of 37,294 BUSD and 271.2 wBNB.

The bug was found in the swapExactTokensForETHSupportingFeeOnTransferTokens function, which was used to swap Fee-On-Transfer-Tokens. These tokens charge a fee for every transfer() or transferFrom(), causing the receiver to get less than the sent amount. The function miscalculated the amount to be transferred to the user when the last pair appeared multiple times in the swap path, allowing the attacker to steal funds.

The Attack Process:

The attacker designed a swap path that included two self-constructed tokens, resulting in the tokenA and wBNB pair being included twice in the swap path. The attacker borrowed a flash loan of 1800 wBNB and added liquidity to newly constructed token pairs. After the swap and removing liquidity, the attacker profited around 271 wBNB and 37,295 BUSD.

After the Exploit:

KaoyaSwap has yet to release an official statement. BlockSec identified several addresses that profited from the attack.

Exploit tx:

https://bscscan.com/tx/0xc8db3b62…208d74

Involved addresses:

https://etherscan.io/address/0x8df3dd42…749ca1

https://etherscan.io/address/0x236b6150…c891e5

https://etherscan.io/address/0xb77e7ee8…208589

https://etherscan.io/address/0xe946bc15…36df09

https://etherscan.io/address/0x50fc7d75…0b4d28

Incident Report

Protocol / Project Kaoya Swap
Date of Incident
Attack Technique Flash Loan Attack
Classification Exchange (DEX)
Primary Source View Post-Mortem

Protocol Information

Protocol Type Dexs
Affected Token KALP
Protocol Twitter/X @Kaoyaswap
Team Anonymous
Source Code Unverified

What the Attacker Needed to Succeed

Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.

Technical Knowledge Deep understanding of flash loan attack and Solidity and EVM internals
Capital Required Flash loan capital (borrowed atomically, zero upfront cost)
On-Chain Access Ability to interact with smart contracts and deploy a custom exploit contract
Protocol Analysis Identification of the exploitable vulnerability in Kaoya Swap's contract logic - root cause: exchange (dex)
Execution Speed Precise transaction ordering and timing to exploit the vulnerability within a single atomic block
Obfuscation Plan A strategy to launder and move stolen funds - typically through mixers, cross-chain bridges, or decentralized DEX swaps to resist tracing

What Auditors Should Check

Could this have been caught in audit? Yes — skilled auditors routinely flag Flash Loan Attack vulnerabilities in code review

If you're auditing a protocol with similar architecture to Kaoya Swap, these are the critical security checks that could have prevented this incident (August 2022).

  • Verify all logic paths related to Flash Loan Attack are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
  • Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs

Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.

Free Trial

Related Attack Classes

The technique used in this hack maps to these vulnerability classes in our security curriculum:

See all Flash Loans Attacks examples →

Sources & References

Learn to Prevent the Next Kaoya Swap

The Kaoya Swap hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.

Recreate exploit patterns safely Free Trial