Skip to content
Business logic Audit finding Intermediate

IERC20.transfer wil fail for USDT

0xKartikgiri00 Follow with 0xLogos, 0xShitgem and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-03-amphor-judging/issues/126

Found by

0xKartikgiri00, 0xLogos, 0xShitgem, offside0011, rekxor

Summary

Some tokens do not return bool on transfer, e.g. USDT on mainnet

Vulnerability Detail

USDT on mainnet do not return bool on transfer: https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7#code#L126

But but because of IERC20 interface solidity will try to parse bool from nothing thus reverting.

Impact

Unable to claim requested redeem if underlying asset is USDT

Code Snippet

https://github.com/sherlock-audit/2024-03-amphor/blob/6c797025ffe296e04607abf74400ff2bb36a7de3/asynchronous-vault/src/AsyncSynthVault.sol#L771

Tool used

Manual Review

Recommendation

Instead transfer directly to receiver

Diff
_asset.safeTransferFrom(address(claimableSilo), receiver, assets);
- _asset.transfer(receiver, assets);

Discussion

sherlock-admin4

The protocol team fixed this issue in the following PRs/commits: https://github.com/AmphorProtocol/asynchronous-vault/pull/103

sherlock-admin2

Escalate there is no case this will cause an issue, because the supposedly "insecure" transfer it predeced by safeTransfer of the same amount and the same token. Therefore if there is wrong amount of token, if will fail on first transfer attempt, so transfer() is protected anyway

The escalation could not be created because you are not exceeding the escalation threshold.

You can view the required number of additional valid issues/judging contest payouts in your Profile page, in the Sherlock webapp.

0xLogos

Escalate

Should be high bcz _asset.transfer(receiver, assets) will always fail for usdt => unable to claim.

Also I think #53 is about return value not checked, but actual root case is usdt is incompatible with erc20 interface => should be info

sherlock-admin2

Escalate

Should be high bcz _asset.transfer(receiver, assets) will always fail for usdt => unable to claim.

Also I think #53 is about return value not checked, but actual root case is usdt is incompatible with erc20 interface => should be info

You've created a valid escalation!

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.

0xCryptoSan

this issue https://github.com/sherlock-audit/2024-03-amphor-judging/issues/35 should be also linked as duplicate of this issue

WangSecurity

We actually wanted to make it high, but the sponsor (@blablalf scepcifically) noted that the vaults will be upgradeable, therefore, if this vulnerability were to take place, the funds would be easily retrieved. That is the reason we decided for this one to be medium instead of high.

rekxor

We actually wanted to make it high, but the sponsor (@blablalf scepcifically) noted that the vaults will be upgradeable, therefore, if this vulnerability were to take place, the funds would be easily retrieved. That is the reason we decided for this one to be medium instead of high.

I don't think so it was mentioned in the Readme of the protocol at time of contest. So, shouldn't it be remained high! @WangSecurity

WangSecurity

Don't think so, to me it looks like this: if it happened in real life, then there would be no permanent lock of funds and they could be easily retrieved. Plus, we can add that they're not planning to make USDT vault straight away (I know it's not mentioned in the README and they shared it on discord, therefore, under Sherlock's hierarchy of truth it doesn't count, I know, I'm just elaborating on it, so it's easier for the head of judging to make the decision).

Evert0x

Will revisit this issue, but tentatively planning to reject escalation and keep issue state as is because of the argument put forward by Wang.

0xLogos

Agree with rekxor

We actually wanted to make it high, but the sponsor noted...

Judgement should be done based only on available information

Also I don't think that upgradeability was a reason to downgrade similar issues in the past

rekxor

Don't think so, to me it looks like this: if it happened in real life, then there would be no permanent lock of funds and they could be easily retrieved. Plus, we can add that they're not planning to make USDT vault straight away (I know it's not mentioned in the README and they shared it on discord, therefore, under Sherlock's hierarchy of truth it doesn't count, I know, I'm just elaborating on it, so it's easier for the head of judging to make the decision).

It is mentioned in the readme that the protocol has decided to use the tokens - weth, usdc, usdt and wbtc.

WangSecurity

The decision was made based on README, as you see I've said that it's only an add-on on top, but it wasn't the decider. Otherwise, this issue would remain low/info. It was mentioned to give the additional insight, but it doesn't change anything

The only reason for this issue to be downgraded to med is that the vaults are upgradeable. And this note about the upgradeability was added cause LSW asked specifically about it (I'm unsure it changes anything, but it feels like my previous message meant that the sponsor just said it themselves, but they were asked specifically if the vault is upgradeable and it would be able to retrieve funds in such situation if it happened irl).

rekxor

The fact that it wasn't stated publicly in the readme file that the vaults are meant to be upgradeable doesn't makes it valid point to downgrade imo.

WangSecurity

But as I remember protocols rarely say in the README file that their contracts are upgradeable. And if it happens it's rather an exception than the rule + sherlocks readme doesn't have any question specifically related to upgradeability of the contracts. Moreover, if upgradeability is not mentioned in the README, then all the reports about upgradeability vulns should be invalid by default (not talking about this contest specifically, but about mentioning upgradeability in README in general)?

Therefore, I don't think this is a valid argument that the upgradeability is not mentioned in the README file.

Plus contracts use upgradeable contracts by OpenZeppelin (for example, OwnableUnpgradeable, not talking about ERC20Upgradeable here) therefore, it's reasonable to assume the vault is upgradeable.

But of course I can be wrong, I don't say I'm 100% right, just expressing my point and maybe indeed you're right and I'll accept it with no remorse (also sorry if I'm harsh, don't mean to do that, thank you bringing up all these arguments).

Odhiambo526

@WangSecurity I think issue #55 is a duplicate of the same issue

Evert0x

Based on the contracts in scope, upgradeability is possible.

As it's possible, I would judge this as Medium. It breaks core functionality but funds are recoverable.

WangSecurity

@Odhiambo526 unfotunately, it's not a duplicate, it talks about transfer in general, when this issue is about USDT sepcifically.

Evert0x

Result: Medium Has Duplicates

sherlock-admin3

Escalations have been resolved successfully!

Escalation status:

sherlock-admin3

The Lead Senior Watson signed off on the fix.

The original report as published on Sherlock, by 0xKartikgiri00. 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.

What is known

A medium-severity business logic bug in Amphor. Sherlock made it public on 29 March 2024. Found in the 244 audit contest (finding M-2), also found by 4 other wardens.

About Business logic

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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 by 0xKartikgiri00

View all

1 more disclosed report, best first.

More from Amphor

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.