# Redacted Cartel wxBTRFLY: transferFrom allowance bug drains users

wxBTRFLY's custom transferFrom approved msg.sender against the recipient's allowance, letting any caller grant themselves an allowance over a victim's tokens and steal them.

- Payout: Real-world hack
- Severity: high
- Program: Redacted Cartel
- Analysis by: DeFiHackLabs
- Disclosed: 2022-03-29
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2022-03/RedactedCartel_exp.sol
- Library page: http://bugbountylibrary.com/r/dhl%3A20220329-redactedcartel
- Tags: area:web3 domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** wxBTRFLY ERC-20 token contract (transferFrom)
**Root cause:** Custom transferFrom calls _approve(sender, msg.sender, allowance(sender, recipient).sub(amount)) — it debits the recipient's allowance but credits msg.sender's allowance, so the spender and allowance-holder are mismatched.
**Steps:**
1. Victim Alice calls `wxBTRFLY.approve(AliceContract, balance)` granting an allowance to a contract.
2. Attacker Bob calls `wxBTRFLY.transferFrom(Alice, AliceContract, 0)`; no tokens move but `_approve(Alice, Bob, allowance(Alice, AliceContract).sub(0))` sets Bob's allowance to Alice's full balance.
3. Bob calls `wxBTRFLY.transferFrom(Alice, Bob, balanceOf(Alice))` to drain Alice's wxBTRFLY.
**How found:** Code review of the overridden transferFrom: the _approve arguments use `recipient` for the allowance lookup but `msg.sender` as the spender, an inconsistency with standard ERC-20 semantics.
**Exploitation:** Attacker needs only a victim who has granted any allowance to any address. Calling transferFrom with amount 0 against that recipient copies the victim's allowance to the attacker, who then pulls the full balance. PoC forks mainnet at block 13908185 and pranks the owner to unfreeze the token first.
**Insight:** When a token overrides transferFrom, check that the allowance debited belongs to msg.sender, not the recipient; a zero-amount transferFrom is a cheap probe that reveals allowance-accounting mismatches without moving funds.

