-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zap contract's mint() allows minting ibbtc tokens for free #1
Comments
We should totally add the |
Disagree with the finding, the finding claims that a user would be able to mint ibBTC with any token, this is not correct. Using any token beside the supported ones, would cause a revert when adding liquidity to the pool or when we deposit in the yearn vault. See code for revert: |
agree with sponsor, user's tx will revert if |
Will keep as |
Handle
Ruhum
Vulnerability details
Impact
The user can call the
mint()
function with any contract address that implements thesafeTransferFrom()
function. Thus, they can mint as many ibbtc tokens for free as they want.Proof of Concept
https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L100
Technically, they can deploy a contract that has a
safeTransferFrom()
function that simply returns true. They then call themint()
function and pass the contract address and an arbitrary value for theamount
parameter. Themint()
function will then go ahead and mint them the passed amount of ibbtc tokens without receiving anything in return.There are no checks that verify that the passed token address is either the wBTC or renBTC token.
Tools Used
Manual Analysis
Recommended Mitigation Steps
Add the following check to the beginning of the function:
require(token == address(ren) || token == address(wbtc);
The text was updated successfully, but these errors were encountered: