You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
sherlock-admin opened this issue
Jul 3, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Token Amount is scaled up twice in depositAndAllocate() causing the amount to be inflated
Summary
In AccountFacet.depositAndAllocate() the token amount to be allocated is scaled up twice which causes the amount to be inflated.
Vulnerability Detail
The depositAndAllocate() allows Party A to deposit and allocate the amount they wish to engage in trading. However, the said amount deposited is first scaled when depositAndAllocate() calls AccountFacetImpl.deposit() with the said amount (and msg.sender) and deposits it into Party A's wallet.
Then scaled again in depositAndAllocate() before passing it into AccountFacetImpl.allocate() to be allocated. As such, any token (e.g. USDC) with a decimal of less than 1e18 will be scaled up twice. This will cause the allocatedBalances[msg.sender] to be inflated. https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacet.sol#L46-L55
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
0xChinedu
high
Token Amount is scaled up twice in depositAndAllocate() causing the amount to be inflated
Summary
In AccountFacet.depositAndAllocate() the token amount to be allocated is scaled up twice which causes the amount to be inflated.
Vulnerability Detail
The depositAndAllocate() allows Party A to deposit and allocate the amount they wish to engage in trading. However, the said amount deposited is first scaled when depositAndAllocate() calls AccountFacetImpl.deposit() with the said amount (and msg.sender) and deposits it into Party A's wallet.
Then scaled again in depositAndAllocate() before passing it into AccountFacetImpl.allocate() to be allocated. As such, any token (e.g. USDC) with a decimal of less than 1e18 will be scaled up twice. This will cause the allocatedBalances[msg.sender] to be inflated.
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacet.sol#L46-L55
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacetImpl.sol#L19-L25
Impact
Accounting of funds allocated to Party A will be inflated as a result of multiple scaling.
Code Snippet
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacet.sol#L46-L55
https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacetImpl.sol#L19-L25
Tool used
Manual Review
Recommendation
Amount to be allocated by Party A should not be scaled again in depositAndAllocate() after it has already been scaled in AccountFacetImpl.deposit().
Duplicate of #222
The text was updated successfully, but these errors were encountered: