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.
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.
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
grantCompInternalas well asclaimCompwill revert.Because the functionality is hampered, I agree with High Severity.
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
- A user calls claimComp() to claim COMP rewards.
- claimComp() calls grantCompInternal().
- grantCompInternal() uses getWETHAddress() which returns the wrong hardcoded address.
- 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.