sherlock-audit / 2024-05-elfi-protocol-judging

0 stars 0 forks source link

0xPwnd - Unrestricted Access to batchUpdateAccountToken Allows Unauthorized Token Balance Modification #278

Closed sherlock-admin3 closed 1 week ago

sherlock-admin3 commented 2 weeks ago

0xPwnd

High

Unrestricted Access to batchUpdateAccountToken Allows Unauthorized Token Balance Modification

Summary

The vulnerability lies in the batchUpdateAccountToken function. This function lacks proper access control, allowing any user to call it and potentially manipulate their own or other users' token balances. This issue can lead to draining the protocol's funds or causing a griefing attack by modifying other users' balances.

Vulnerability Detail

Here is a simple scenario

Another Scenario

Impact

Loss of funds for both users and protocol

Code Snippet

https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/facets/AccountFacet.sol#L68-L71

https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/AssetsProcess.sol#L179-L193

Tool used

Manual Review

Recommendation

Implement checks on the batchUpdateAccountToken

Duplicate of #28