-
Notifications
You must be signed in to change notification settings - Fork 2
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
Lack of support for fee-on-transfer token #51
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
M-33
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Comments
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 9, 2023
Picodes marked the issue as primary issue |
c4-judge
added
the
primary issue
Highest quality submission among a set of duplicates
label
Jan 23, 2023
This was referenced Jan 23, 2023
SantiagoGregory marked the issue as sponsor acknowledged |
c4-sponsor
added
the
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
label
Feb 2, 2023
USDC and USDT fees would break other contracts as well, and we won't be supporting other tokens with fees at a UI level. @androolloyd |
c4-judge
added
the
satisfactory
satisfies C4 submission criteria; eligible for awards
label
Feb 23, 2023
Picodes marked the issue as satisfactory |
Picodes marked the issue as selected for report |
c4-judge
added
the
selected for report
This submission will be included/highlighted in the audit report
label
Feb 23, 2023
This was referenced Feb 24, 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
M-33
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/TransferProxy.sol#L34
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/LienToken.sol#L181
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/LienToken.sol#L643
Vulnerability details
Impact
Lack of support for fee-on-transfer token.
Proof of Concept
In the codebase, the usage of safeTransfer and safeTransferFrom assume that the receiver receive the exact transferred amount.
However, according to https://github.com/d-xo/weird-erc20#fee-on-transfer
Some tokens take a transfer fee (e.g. STA, PAXG), some do not currently charge a fee but may do so in the future (e.g. USDT, USDC).
So the recipient address may not receive the full transfered amount, which can break the protocol's accounting and revert transaction.
The same safeTransfer and safeTransferFrom is used in the vault deposit / withdraw / mint / withdraw function.
Let us see a concrete example,
the transfer Proxy also use
this transfer is used extensively
If the token used charge transfer fee, the accounting below is broken:
When _payDebt is called
which calls _paymentAH
not that the code
s.TRANSFER_PROXY.tokenTransferFrom(token, payer, payee, payment);
if the token charge transfer fee, for example, the payment amout is 100 ETH, 1 ETH is charged as fee, the recipient only receive 99 ETH,
but the wrong value payment 100 ETH is returned and used to update the accounting
then the variable totalSpent and payment amoutn will be not valid.
Tools Used
Manual Review
Recommended Mitigation Steps
We recommend the protocol whitelist the token address or use balance before and after check to make sure the recipient receive the accurate amount of token when token transfer is performed.
The text was updated successfully, but these errors were encountered: