Skip to content
Smart contracts Audit finding Intermediate

Comptroller uses the wrong address for the WETH contract

The Comptroller contract hardcodes an incorrect WETH address, so when users try to claim COMP rewards, the transaction either reverts or has no effect, preventing them from receiving rewards.

Ruhum Follow

Originally disclosed on Code4rena

Submitted by Ruhum, also found by 0xf15ers, cccz, hake, Soosh, and WatchPug

The Comptroller contract uses a hardcoded address for the WETH contract which is not the correct one. Because of that, it will be impossible to claim COMP rewards. That results in a loss of funds so I rate it as HIGH.

Proof of Concept

The Comptroller’s getWETHAddress() function: https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Comptroller.sol#L1469

It’s a left-over from the original compound repo: https://github.com/compound-finance/compound-protocol/blob/master/contracts/Comptroller.sol#L1469

It’s used by the grantCompInternal() function: https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Comptroller.sol#L1377

That function is called by claimComp(): https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Comptroller.sol#L1365

If there is a contract stored in that address and it doesn’t adhere to the interface (doesn’t have a balanceOf() and transfer() function), the transaction will revert. If there is no contract, the call will succeed without having any effect. In both cases, the user doesn’t get their COMP rewards.

Recommended Mitigation Steps

The WETH contract’s address should be parsed to the Comptroller through the constructor or another function instead of being hardcoded.

tkkwon1998 (Canto) confirmed

Alex the Entreprenerd (judge) commented:

The warden has shown how the address for WETH / comp is hardcoded and the address is pointing to Mainnet’s COMP.

This misconfiguration will guarantee that any function calling grantCompInternal as well as claimComp will revert.

Because the functionality is hampered, I agree with High Severity.


The original report as published on Code4rena, by Ruhum. 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 Comptroller contract hardcodes an incorrect WETH address, likely left over from the original Compound repository, instead of using the correct address for the deployed network.

Impact

Users cannot claim COMP rewards, resulting in a loss of funds for them.

What the attacker needed

User has COMP rewards to claim

The fix

The WETH contract’s address should be passed to the Comptroller through the constructor or another function instead of being hardcoded.

How it was found

  1. A user calls claimComp() to claim COMP rewards.
  2. claimComp() calls grantCompInternal().
  3. grantCompInternal() uses getWETHAddress() which returns the wrong hardcoded address.
  4. The call to the wrong address either reverts (if a contract exists but lacks balanceOf/transfer) or succeeds without effect (if no contract), so the user does not receive COMP rewards.

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.

A smart contract has a function that sends reward tokens to users. It uses a fixed address for one token (WETH) that is wrong. So when someone tries to claim rewards, the transaction fails or does nothing, and they never get their tokens.

What is Smart contracts?

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

More by Ruhum

View all

55 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.

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.