Redacted Cartel Custom Approval Logic Bug Fix Review
A faulty implementation of the ERC-20 transferFrom function in the wxBTRFLY token allowed an attacker to reassign a user's allowance to themselves, enabling theft of that user's funds. The bug put just under $6 million at risk.
immunefi.com
Published on immunefi.com
Whitehat Tommaso Pifferi submitted a vulnerability in Redacted Cartel via Immunefi on January 11. The vulnerability was rated as critical because it would have allowed a malicious attacker to assign a user’s allowance to themselves, enabling the attacker to steal that user’s funds.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the transferFrom function read the allowance from the sender to the recipient but wrote the updated allowance from the sender to the operator (msg.sender), instead of consistently using the operator.
Impact
An attacker could steal a user's funds by reassigning the user's allowance to themselves; funds at risk were just under $6 million.
What the attacker needed
Victim has an allowance set; attacker can call transferFrom
The fix
The vulnerable FrozenToken contract was removed and the token now relies on OpenZeppelin's ERC-20 implementation.
How it was found
- Alice approves her contract to spend 1000 wxBTRFLY on her behalf.
- Bob calls transferFrom(Alice, aliceContract, 0), which transfers nothing but gives Bob an allowance of 1000 wxBTRFLY due to the bug.
- Bob calls transferFrom(Alice, bob, 1000) and steals all of Alice's funds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In Ethereum tokens, an 'allowance' lets someone else spend your tokens. This bug let an attacker change who was allowed to spend a victim's tokens, so the attacker could take them. The mistake was in a function that updates allowances after a transfer.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.