Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deposits don't work with ERC20 tokens that has fee-on-transfer/re-basing mechanism #442

Closed
code423n4 opened this issue Jan 19, 2023 · 2 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-424 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L251-L265
https://github.com/AstariaXYZ/astaria-gpl/blob/4b49fe993d9b807fe68b3421ee7f2fe91267c9ef/src/ERC4626-Cloned.sol#L19-L36

Vulnerability details

Impact

The vaults supports ERC20 tokens as the underlying assets but does not appear to handle customised ERC20 tokens that supports fee-on-transfer or rebasing mechanism.

There are fee-on-transfer ERC20 tokens that are deflationary and charges a fee on every transfer (e.g. STA, PAXG). And some tokens (e.g. USDT) has fee-on-transfer support disabled currently but may enable it in the future.

Also, there could be re-basing ERC20 tokens that have their value increased over time like Aave's aToken (where balanceOf changes over time).

Refer to the deposit() functions in PublicVault.sol and ERC4626-Cloned.sol below.
https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L251-L265
https://github.com/AstariaXYZ/astaria-gpl/blob/4b49fe993d9b807fe68b3421ee7f2fe91267c9ef/src/ERC4626-Cloned.sol#L19-L36

Recommended Mitigation Steps

One potential mitigation is to check the amount of token deposited by the contract after transfer. Another option is to block these customised tokens.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Jan 19, 2023
code423n4 added a commit that referenced this issue Jan 19, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #424

@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-424 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants