Skip to content
Access control Audit finding Beginner

Stealing Wrapped Manifest in WETH.sol

The WETH contract had an approve function that let any caller set an allowance on behalf of any token owner. An attacker could therefore approve themselves to spend another user's tokens and then use transferFrom to steal them.

Soosh Follow

Originally disclosed on Code4rena

Submitted by Soosh, also found by 0x52, 0xDjango, cccz, saian, TerrierLover, WatchPug, and zzzitron

https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/WETH.sol#L85

Allows anyone to steal all wrapped manifest from the WETH.sol contract. Attacker can also withdraw to convert Wrapped Manifest to Manifest.

Issue in approve(address owner, address spender) external function. This allows an attacker to approve themselves to spend another user’s tokens.

Attacker can then use transferFrom(address src, address dst, uint wad) function to send tokens to themself.

Proof of Concept

See warden’s full report for further details.

Tools Used

VScode, hardhat

Recommended Mitigation Steps

I believe there is no need for this function. There is another approve(address guy, uint wad) function that uses msg.sender to approve allowance. There should be no need for someone to approve another user’s allowance.

Remove the approve(address owner, address spender) function.

tkkwon1998 (Canto) confirmed

Alex the Entreprenerd (judge) commented:

The warden has shown how, for whatever reason, an approve function which allows to pass the “approver” as parameter was present in the WETH contract.

This allows anyone, to steal all WETH from any other holder.

For that reason, High Severity is appropriate.


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

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

The approve function took an arbitrary owner address instead of using msg.sender, so any caller could set an allowance for any token holder.

Impact

An attacker could steal all wrapped tokens from any holder and convert them to the underlying token.

What the attacker needed

None

The fix

The vulnerable approve function should be removed, leaving only the standard approve function that uses msg.sender.

How it was found

  1. Call the approve function, passing the victim's address as owner and the attacker's address as spender.
  2. Call transferFrom to move the victim's tokens to the attacker's address.
  3. Optionally withdraw to convert the wrapped tokens back to the underlying token.

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.

In many token contracts, an owner can let another address spend their tokens by calling an approve function. Here, the approve function also accepted the owner's address as a parameter, so anyone could pretend to be the owner and grant themselves permission to spend that person's tokens. They could then transfer those tokens to themselves.

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 Soosh

View all

7 more disclosed reports, best first.

More from Canto

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.