Pool: approveAndCall sets unnecessary approval
The Pool.approveAndCall function grants the recipient contract an unlimited token allowance instead of only the specified amount. An attacker controlling the recipient contract could spend more tokens than intended.
Submitted by cmichel
The Pool.approveAndCall function approves the recipient contract with the max value instead of only the required amount.
For safety, the approval should not be set to the max value, especially if the amount that the contract may use is already known in this call, like this is the case for approveAndCall.
Recommend only approving amount.
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 function approves the maximum token value rather than the specific amount passed to the call.
Impact
A malicious or compromised recipient contract could spend more tokens than the caller intended, potentially draining the caller's balance.
What the attacker needed
Attacker controls the recipient contract
The fix
The approval should be limited to the exact amount required for the call.
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 a smart contract lets another contract spend its tokens, it sets an allowance. This report says the allowance was set to the maximum possible number instead of just the amount needed for that one call. That means the other contract could take far more tokens than it should.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.