Report ID
#29338
Report type
Smart Contract
Has PoC?
Yes
Target
https://etherscan.io/address/0xBEA0e11282e2bB5893bEcE110cF199501e872bAd
Impacts
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
This is a critical bug whereby all funds can be stolen from the contract .
The issue is with the shift function . The bug is very bad. If I transfer lets say 1000 bean tokens , and then call the shift function , what will happen is that the function transfer at up to 99.99 tokens back to me in weth . Of couse weth is far more valuable than the bean token , this means I get far more than what I have sent to the contract The function does not check that there are different values between tokens . In This is very dangerous this happens because in the function there is no checks that determines whether
n the poc I have provided as you can see I have transferred token 0 to the wells contract. I have then called the shift contract and stated I want a certain amount of token 1 in return . The contract than gives me a certain amount of token 1 to my address.
How to solve the bug , the way to solve the bug is to have a check in the shift function in regards to the tokenOut and then evaluate how much token a user should be sent from the wells contract depending on that tokens value . This bug is very bad and all funds can be stolen from the contract
Proof of concept