Closed code423n4 closed 2 years ago
https://github.com/RubiconDeFi/rubicon-protocol-v1/blob/6a0e1d89ff710f81428228d132e7d0c42de3a3cd/contracts/RubiconRouter.sol#L505
Users can lose funds
In the swapWithEth() function there is a pay amount input value is used to make the swap. msg.value is required to be greater than or equal to the pay amount plus the fee. If msg. value is greater then the extra ETH will be lost.
require msg.value == amtWithFee instead of >= or directly set pay amount equal to msg.value - fee
Duplicate of #15.
Duplicate of #15
Lines of code
https://github.com/RubiconDeFi/rubicon-protocol-v1/blob/6a0e1d89ff710f81428228d132e7d0c42de3a3cd/contracts/RubiconRouter.sol#L505
Vulnerability details
Impact
Users can lose funds
Proof of Concept
In the swapWithEth() function there is a pay amount input value is used to make the swap. msg.value is required to be greater than or equal to the pay amount plus the fee. If msg. value is greater then the extra ETH will be lost.
https://github.com/RubiconDeFi/rubicon-protocol-v1/blob/6a0e1d89ff710f81428228d132e7d0c42de3a3cd/contracts/RubiconRouter.sol#L505
Recommended Mitigation Steps
require msg.value == amtWithFee instead of >= or directly set pay amount equal to msg.value - fee