Skip to content
Business logic Audit finding Intermediate

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.

0x4141 Follow

Originally disclosed on Sherlock

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.

The original report as published on Sherlock, by 0x4141. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More from Astaria

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.