-
Notifications
You must be signed in to change notification settings - Fork 2
devScrooge - DOS for supplyPToken due to not approving 0 amount first #420
Comments
First, pToken is a standard ERC20 token so this issue is invalid. We use OZ's ERC20.sol to implement it. Many issues relate to FlashLoan.sol about DoS of USDT (#13 #52 #63 #136 #241 #359 ). They're also invalid. The |
Agree with the |
Yes, usually we shouldn't approve max to any smart contract for safety. However, the flashLoan adaptor here is not upgradable. If the review is done, this could save a lot of gas consumption for users since only the first user needs to approve for the flashLoan adaptor. Also, the approval is made from the flashLoan contract to the ironBank contract. Both contracts are controlled by us and normally there should be no funds in the flashLoan contract to be drained. |
In this edge case approving max should be fine because it is inside the same codebase. But always take extreme care for approving max |
Invalid |
devScrooge
medium
DOS for supplyPToken due to not approving 0 amount first
Summary
There are some tokens like, USDT, which will revert when approving or executing
safeIncreaseAllowance
is the allowance was not previosuly set to 0Vulnerability Detail
The
TxBuilderExtension.sol
contract implements a function calledsupplyPToken
which is used for the users to supply tokens for a market on theIronBank
contract:There is a specific line which is increase the allowance of the
pToken
for the IronBank to be able to execute the supply function:The problem is that if
pToken
is one of the tokens that reverts if the allowance was not first set to 0 before increasing it to other amount, such as USDT, the transaction will revert and a denial of service will take place.Impact
Denial of service for the users that execute the
supplyPToken
function in on theTxBuilderExtension
contract by callingexecute
for supplying tokens to a market which has a token that reverts, such as USDT, as underlying token.Code Snippet
https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/extensions/TxBuilderExtension.sol#L380
Tool used
Manual Review
Recommendation
Approve 0 amount first.
The text was updated successfully, but these errors were encountered: