Skip to content
Access control Audit finding Intermediate

Escrow approvals are not cleared when club is transferred allowing for abuse after transfer

Escrow approvals for ERC20 and ERC721 tokens were not cleared when a club token was transferred, so a malicious club owner could set approvals to themselves, sell the club, and then drain all players and tokens using the persistent approvals.

0x52 Follow with BenRai, Brenzee and 13 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-footium-judging/issues/289

Found by

0x52, BenRai, Brenzee, CMierez, J4de, MiloTruck, PokemonAuditSimulator, Quantish, cergyk, ctf_sec, mstpr-brainbot, pengun, sashik_eth, shaka, shogoki, toshii

Summary

Escrow approvals remain even across club token transfers. This allows a malicious club owners to sell their club then drain everything after sale due to previous approvals.

Vulnerability Detail

ERC20 and ERC721 token approval persist regardless of the owner of the club. The result is that approvals set by one owner can be accessed after a token has been sold or transferred. This allows the following attack:

  1. User A owns clubId = 1
  2. User A sets approval to themselves
  3. User A sells clubId = 1 to User B
  4. User A uses persistent approval to drain all players and tokens

Impact

Malicious approvals can be used to drain club after sale

Code Snippet

FootiumEscrow.sol#L75-L81

FootiumEscrow.sol#L90-L96

Tool used

Manual Review

Recommendation

Club escrow system needs to be redesigned

The original report as published on Sherlock, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the escrow contract did not revoke existing token approvals when the club token was transferred to a new owner.

Impact

A malicious club owner could drain all players and tokens from a club after selling it.

What the attacker needed

Attacker owns a club; Attacker sets approval to themselves; Attacker sells club to victim

The fix

The club escrow system should be redesigned to clear approvals when the club is transferred.

How it was found

  1. User A owns clubId = 1
  2. User A sets approval to themselves
  3. User A sells clubId = 1 to User B
  4. User A uses persistent approval to drain all players and tokens

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 report has not been written yet. The Original tab links to the source.

When you approve someone to spend your tokens, that permission stays until you revoke it, even if the tokens change hands. Here, the club's escrow contract kept old approvals after the club was sold, so the previous owner could still take everything out. The fix is to clear approvals whenever ownership changes.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0x52

View all

211 more disclosed reports, best first.

More from Footium

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.