# STRAC: business logic flaw drains PancakeSwap liquidity

STRAC token contract had a business logic flaw allowing an attacker to drain ~12 ETH from its PancakeSwap liquidity pool via a crafted call.

- Payout: Real-world hack
- Severity: high
- Program: STRAC
- Analysis by: DeFiHackLabs
- Disclosed: 2023-06-27
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2023-06/STRAC_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20230627-strac
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm technique:source-review vuln:business-logic

**Target:** STRAC token contract on BSC
**Root cause:** The STRAC token contract contained a business logic flaw that allowed an attacker to manipulate token balances or transfer logic, enabling them to drain the PancakeSwap liquidity pool.
**Steps:**
1. Attacker contract approves PancakeRouter to spend STRAC.
2. Attacker calls vulnerable contract at `0x1F90BDeB5674833868EE9b36707B929024E7A513` with selector `0x4a75084c`, passing attacker address, STRAC token address, and the contract's STRAC balance.
3. The vulnerable contract presumably transfers its STRAC balance to the attacker (via a function that calls `transferFrom` on the attacker, which returns true without transferring).
4. Attacker swaps the received STRAC for ETH on PancakeSwap pair `0x2976bD3774622367CE7A575D28201480e640966F` using the router.
5. Attacker receives ~12 ETH.
**Exploitation:** The attacker deployed a contract that implements a fake `transferFrom` returning true. They called the vulnerable contract's function (selector `0x4a75084c`) with their address, STRAC token, and the contract's STRAC balance. The vulnerable contract likely attempted to pull STRAC from the attacker via `transferFrom`, but the fake implementation returned true without moving tokens, while the vulnerable contract transferred its own STRAC to the attacker. The attacker then sold the STRAC on PancakeSwap for ETH.
**Insight:** When a contract calls `transferFrom` on an arbitrary address, ensure the call actually transfers tokens; a malicious contract can return true without moving funds, tricking the caller into releasing its own assets.

