Open sherlock-admin opened 1 year ago
Thank you for your feedback. This is very similar / essentially the same as the 'collateral poisoning' issue that had been identified in the README of this contest as a known-issue: it had been explained and known that collateral could be made impossible to withdraw which could impact the ability to do the last repayment of a loan. This is a slight variation in that it describes that the collateral could be so vast that withdrawing it would exceed the gas limit of a block. Thank you for this perspective. In any case we do plan to separate the repayment logic from the collateral withdraw logic to mitigate such an issue.
Escalate for 10 USDC. this is low / medium issue.
As the sponsor say
his is very similar / essentially the same as the 'collateral poisoning' issue that had been identified in the README of this contest as a known-issue: it had been explained and known that collateral could be made impossible to withdraw which could impact the ability to do the last repayment of a loan.
according to the previous description, the issue should be marked as low and non-reward
but DOS and exceed the gas limit of block make this a medium, definitely not a high finding
According to https://docs.sherlock.xyz/audits/judging/judging
Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
and
Could Denial-of-Service (DOS), griefing, or locking of contracts count as a Medium (or High) issue? It would not count if the DOS, etc. lasts a known, finite amount of time <1 year. If it will result in funds being inaccessible for >=1 year, then it would count as a loss of funds and be eligible for a Medium or High designation. The greater the cost of the attack for an attacker, the less severe the issue becomes.
The cost of making the collateral loop for exceed block gas limit is clearly very high + it only impact single lendering / borrow loan, not all loan states.
So this should be a medium / low finiding, definitely not high severity issue.
Escalate for 10 USDC. this is low / medium issue.
As the sponsor say
his is very similar / essentially the same as the 'collateral poisoning' issue that had been identified in the README of this contest as a known-issue: it had been explained and known that collateral could be made impossible to withdraw which could impact the ability to do the last repayment of a loan.
according to the previous description, the issue should be marked as low and non-reward
but DOS and exceed the gas limit of block make this a medium, definitely not a high finding
According to https://docs.sherlock.xyz/audits/judging/judging
Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
and
Could Denial-of-Service (DOS), griefing, or locking of contracts count as a Medium (or High) issue? It would not count if the DOS, etc. lasts a known, finite amount of time <1 year. If it will result in funds being inaccessible for >=1 year, then it would count as a loss of funds and be eligible for a Medium or High designation. The greater the cost of the attack for an attacker, the less severe the issue becomes.
The cost of making the collateral loop for exceed block gas limit is clearly very high + it only impact single lendering / borrow loan, not all loan states.
So this should be a medium / low finiding, definitely not high severity issue.
You've created a valid escalation for 10 USDC!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
This issue differs from the known issue as it highlights a scenario where the loan was successfully accepted but can't be withdrawn due to the gas limit. However, this situation is unlikely, so I agree that it should be a medium issue.
Escalation accepted
Valid medium This can be considered as a valid medium.
Escalation accepted
Valid medium This can be considered as a valid medium.
This issue's escalations have been accepted!
Contestants' payouts and scores will be updated according to the changes made on this issue.
0xmuxyz
high
A borrower/lender or liquidator will fail to withdraw the collateral assets due to reaching a gas limit
Summary
Within the TellerV2#
submitBid()
, there is no limitation that how many collateral assets a borrower can assign into the_collateralInfo
array parameter.This lead to some bad scenarios like this due to reaching gas limit:
Vulnerability Detail
Within the ICollateralEscrowV1, the
Collateral
struct would be defined line this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/interfaces/escrow/ICollateralEscrowV1.sol#L10-L15Within the CollateralManager, the CollateralInfo struct would be defined like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L34-L37
Within the CollateralManager, the
_bidCollaterals
storage would be defined like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L27When a borrower submits a bid, the TellerV2#
submitBid()
would be called. Within the TellerV2#submitBid()
, multiple collaterals, which are ERC20/ERC721/ERC1155, can be assigned into the_collateralInfo
array parameter by a borrower. And then, these collateral assets stored into the_collateralInfo
array would be associated withbidId_
through internally calling the CollateralManager#commitCollateral()
like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/TellerV2.sol#L311 https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/TellerV2.sol#L325Within the CollateralManager#
commitCollateral()
, each collateral asset (info
) would be associated with a_bidId
respectively by calling the CollateralManager#_commitCollateral()
in the for-loop like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L127Within the CollateralManager#
_commitCollateral()
, the_collateralInfo
would be stored into the_bidCollaterals
storage like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L428 https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L430-L434When the deposited-collateral would be withdrawn by a borrower or a lender, the CollateralManager#
withdraw()
would be called. Within the CollateralManager#withdraw()
, the CollateralManager#_withdraw()
would be called like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L253 https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L255When the deposited-collateral would be liquidated by a liquidator, the CollateralManager#
liquidateCollateral()
would be called. Within the CollateralManager#liquidateCollateral()
, the CollateralManager#_withdraw()
would be called like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L278Within the CollateralManager#
_withdraw()
, each collateral asset (collateralInfo._collateralAddress
) would be withdrawn by internally calling the ICollateralEscrowV1#withdraw()
in a for-loop like this: https://github.com/sherlock-audit/2023-03-teller/blob/main/teller-protocol-v2/packages/contracts/contracts/CollateralManager.sol#L394-L409However, within the TellerV2#
submitBid()
, there is no limitation that how many collateral assets a borrower can assign into the_collateralInfo
array parameter.This lead to a bad scenario like below:
_collateralInfo
array parameter when the borrower call the TellerV2#submitBid()
to submit a bid.lenderAcceptBid()
withdraw()
. Or, a liquidator try to withdraw the collateral, which is liquidated, by calling the CollateralManager#liquidateCollateral()
withdraw()
or the CollateralManager#liquidateCollateral()
will be reverted in the for-loop of the CollateralManager#_withdraw()
because that transaction will reach a gas limit.Impact
Due to reaching gas limit, some bad scenarios would occur like this:
Code Snippet
Tool used
Manual Review
Recommendation
Within the TellerV2#
submitBid()
, consider adding a limitation about how many collateral assets a borrower can assign into the_collateralInfo
array parameter.