Skip to content
Smart contracts Write-up Beginner

The Dark Side Of Approve

The write-up explains how ERC-20 approve/allowance works and how attackers abuse it. In the Badger DAO case, the attacker tampered with the contract address shown in the project's web interface, so victims who approved the dapp granted allowance to the attacker's contract, which then drained their tokens.

0xarshia Follow

Published on systemweakness.com

In this writing, I want to talk about the “approve” function in the EIP-20 Ethereum token standard,

0xarshia, on systemweakness.com

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 project's web interface was compromised so it presented an attacker-controlled contract address for the approval step, and users approved it without verifying the address.

Impact

Victims who approved the tampered contract lost their tokens, with the text citing around $120M stolen.

What the attacker needed

Victim connects a wallet to the dapp; victim approves the tampered contract

The fix

Users should verify the spender address and limit the approved amount, and revoke old approvals; the text does not say how the site itself was fixed.

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.

Tokens on Ethereum can let another address spend them on your behalf, but only up to a limit you set with an 'approve' step. If a website tricks you into approving a bad address, that address can move your tokens without ever needing your password or private key. Always check which address and how much you are approving.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.