RubiconRouter: Excess ether did not return to the user
The RubiconRouter contract's swapWithETH, buyAllAmountWithETH, offerWithETH, and depositWithETH functions do not return excess ether to the user when msg.value exceeds the required amount. An attacker could exploit this to cause users to lose funds, though the report does not specify an attacker action.
Submitted by cccz, also found by fatherOfBlocks, Ruhum, csanuragjain, gzeon, IllIllI, GimelSec, dipp, berndartmueller, pedroais, horsefacts, AlleyCat, Bahurum, and shenwilly
In swapWithETH/buyAllAmountWithETH/offerWithETH/depositWithETH functions of the RubiconRouter contract, when msg.value > max_fill_withFee/pay_amt/amount/amtWithFee, the excess ether will not be returned to the user.
Proof of Concept
Recommended Mitigation Steps
Return excess ether to msg.sender, or require msg.value == maxfillwithFee/pay_amt/amount/amtWithFee.
KenzoAgada (warden) commented:
Marking this as main for all issues with various functions in RubiconRouter not sending excess ether back to the user as this issue contains all the examples.
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 functions do not check if msg.value exceeds the required amount and do not refund the difference.
What the attacker needed
User sends more ether than required
The fix
Return excess ether to msg.sender, or require msg.value to equal the exact required amount.
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 you send ether to a smart contract, you might send more than needed. Normally, the contract should send back the extra. Here, the contract keeps the extra ether, so users lose money.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.