Improper implementation of arbitraryCall() allows protocol gov to steal funds from users’ wallets
The arbitraryCall function allows the protocol governor to call any contract with any data, and because the incentive token address is not blocked after an incentive is claimed, a malicious or compromised governor could use transferFrom to steal users' tokens up to their allowance.
Submitted by WatchPug, also found by Jujic and hack3r-0m
function arbitraryCall(address who, bytes memory data) public lock externallyGoverned {
// cannot have an active incentive for the callee
require(incentives[who] == 0, "inc");
...
When an incentiveToken is claimed after endStream, incentives[who] will be 0 for that incentiveToken.
If the protocol gov is malicious or compromised, they can call arbitraryCall() with the address of the incentiveToken as who and transferFrom() as calldata and steal all the incentiveToken in the victim’s wallet balance up to the allowance amount.
Proof of Concept
- Alice approved
USDCto the streaming contract; - Alice called
createIncentive()and added1,000 USDCof incentive; - After the stream is done, the stream creator called
claimIncentive()and claimed1,000 USDC;
The compromised protocol gov can call arbitraryCall() and steal all the USDC in Alice’s wallet balance.
Recommendation
Consider adding a mapping: isIncentiveToken, setting isIncentiveToken[incentiveToken] = true in createIncentive(), and require(!isIncentiveToken[who], ...) in arbitraryCall().
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 arbitraryCall function only checks that the target address has no active incentive, but after an incentive is claimed the mapping is set to zero, so the incentive token address is no longer blocked.
Impact
A malicious or compromised protocol governor could steal all incentive tokens from users' wallets up to the allowance amount.
What the attacker needed
Compromised or malicious protocol governor; user has approved tokens to the contract
The fix
The fix should add a mapping to track incentive tokens and require that the target address is not an incentive token in arbitraryCall.
How it was found
- Alice approved USDC to the streaming contract
- Alice called createIncentive() and added 1,000 USDC of incentive
- After the stream is done, the stream creator called claimIncentive() and claimed 1,000 USDC
- The compromised protocol gov can call arbitraryCall() and steal all the USDC in Alice’s wallet balance
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.
The protocol has a special function that lets the governor make arbitrary calls to other contracts. After a user claims their incentive, the contract forgets that the token was used for incentives, so the governor can call that token's transferFrom function to move the user's tokens. This means a bad governor could take tokens from users who have approved the contract.
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.