LiquidationAccountant.claim may revert for some tokens
The claim function in LiquidationAccountant can attempt a token transfer of zero when the withdrawal ratio is 100 percent. For tokens that revert on zero-value transfers, this makes the funds unclaimable, causing a loss of funds.
Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/83
Found by
0x4141
Summary
LiquidationAccountant.claim may initiate a transfer with the amount 0, which reverts for some tokens.
Vulnerability Detail
Some tokens (e.g., LEND -> see https://github.com/d-xo/weird-erc20#revert-on-zero-value-transfers) revert when a transfer with amount 0 is initiated. This can happen within claim when the withdrawRatio is 100%.
Impact
In such a scenario, the funds are not claimable, leading to a loss of funds.
Code Snippet
https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LiquidationAccountant.sol#L88
Tool used
Manual Review
Recommendation
Do not initiate a transfer when the amount is zero.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code calls the token transfer unconditionally without checking whether the computed amount is zero.
Impact
For tokens that revert on zero-value transfers, the funds are not claimable, leading to a loss of funds.
What the attacker needed
WithdrawRatio reaches 100%; token reverts on zero-value transfers
The fix
The transfer should be skipped when the amount is zero.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Some tokens refuse to process a transfer of zero tokens and return an error instead. This contract can end up asking for exactly such a zero transfer, so the claim fails and the user cannot get their money out.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.