Skip to content
Access control Audit finding Intermediate

Suspended PartyBs can bypass the withdrawal restriction by exploiting `fillCloseRequest`

A suspended PartyB can bypass the withdrawal restriction by using a separate PartyA account to create a deliberately losing position, then filling the close request to move funds out. This allows the attacker to transfer ill-gotten gains out of the protocol, causing losses to the protocol and its users.

0xcrunch Follow with 0xmuxyz, Juntao and 11 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-06-symmetrical-judging/issues/229

Found by

0xcrunch, 0xmuxyz, Juntao, PokemonAuditSimulator, Viktor_Cortess, ast3ros, bin2chen, circlelooper, josephdara, mrpathfindr, mstpr-brainbot, panprog, rvierdiiev, xiaoming90

Summary

Suspended PartyBs can bypass the withdrawal restriction by exploiting fillCloseRequest function. Thus, an attacker can transfer the ill-gotten gains out of the protocol, leading to a loss of assets for the protocol and its users.

Vulnerability Detail

https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacet.sol#L26

Solidity
File: AccountFacet.sol
26:     function withdraw(uint256 amount) external whenNotAccountingPaused notSuspended(msg.sender) {
27:         AccountFacetImpl.withdraw(msg.sender, amount);
28:         emit Withdraw(msg.sender, msg.sender, amount);
29:     }
30: 
31:     function withdrawTo(
32:         address user,
33:         uint256 amount
34:     ) external whenNotAccountingPaused notSuspended(msg.sender) {
35:         AccountFacetImpl.withdraw(user, amount);
36:         emit Withdraw(msg.sender, user, amount);
37:     }

When a user is suspended, they are not allowed to call any of the withdraw functions (withdraw and withdrawTo) to withdraw funds from their account. These withdrawal functions are guarded by the notSuspended modifier that will revert if the user's address is suspended.

https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/utils/Accessibility.sol#L73

Solidity
File: Accessibility.sol
73:     modifier notSuspended(address user) {
74:         require(
75:             !AccountStorage.layout().suspendedAddresses[user],
76:             "Accessibility: Sender is Suspended"
77:         );
78:         _;
79:     }

However, suspected PartyBs can bypass this restriction by exploiting the fillCloseRequest function to transfer the assets out of the protocol. Following describe the proof-of-concept:

  1. Anyone can be a PartyA within the protocol. Suspended PartyBs use one of their wallet addresses to operate as a PartyA.
  2. Use the PartyA to create a new position with an unfavorable price that will immediately result in a significant loss for any PartyB who takes on the position. The partyBsWhiteList of the new position is set to PartyB address only to prevent some other PartyB from taking on this position.
  3. Once PartyB takes on the position, PartyB will immediately incur a significant loss, while PartyA will enjoy a significant gain due to the zero-sum nature of this game.
  4. PartyA requested to close its position to lock the profits and PartyB will fill the close request.
  5. PartyA calls the deallocate and withdraw functions to move the assets/gains out of the protocol.

Impact

In the event of an attack, the protocol will suspend the malicious account and prevent it from transferring ill-gotten gains out of the protocol. However, since this restriction can be bypassed, the attacker can transfer the ill-gotten gains out of the protocol, leading to a loss of assets for the protocol and its users.

Code Snippet

https://github.com/sherlock-audit/2023-06-symmetrical/blob/main/symmio-core/contracts/facets/Account/AccountFacet.sol#L98

Tool used

Manual Review

Recommendation

Add the notSuspended modifier to the openPosition and fillCloseRequest functions to block the above-described attack path.

Diff
function fillCloseRequest(
    uint256 quoteId,
    uint256 filledAmount,
    uint256 closedPrice,
    PairUpnlAndPriceSig memory upnlSig
- ) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId) {
+ ) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId) notSuspended(msg.sender) {
	..SNIP..
}
Diff
function openPosition(
    uint256 quoteId,
    uint256 filledAmount,
    uint256 openedPrice,
    PairUpnlAndPriceSig memory upnlSig
- ) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId) {
+ ) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId) notSuspended(msg.sender) {
    ..SNIP..
}

Discussion

MoonKnightDev

We disagree with the severity of this issue because, in the current system, Party B is permissioned. Therefore, it is highly unlikely that Party B will be suspended.

Navid-Fkh

The mentioned PartyA will also be suspended by our bots; thus, they won't be able to withdraw any funds. Therefore, we won't have any problems

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

How it worked

Root cause

Likely the `fillCloseRequest` and `openPosition` functions lack the `notSuspended` modifier, allowing suspended PartyBs to perform actions that indirectly transfer funds.

Impact

The attacker can transfer ill-gotten gains out of the protocol, leading to a loss of assets for the protocol and its users.

What the attacker needed

Suspended PartyB account; Attacker controls a PartyA wallet; PartyB is permissioned (per developer)

How it was found

  1. Suspended PartyB uses one of their wallet addresses to operate as a PartyA.
  2. Use the PartyA to create a new position with an unfavorable price that will immediately result in a significant loss for any PartyB who takes on the position, and set the partyBsWhiteList to PartyB address only.
  3. Once PartyB takes on the position, PartyB will immediately incur a significant loss, while PartyA will enjoy a significant gain.
  4. PartyA requested to close its position to lock the profits and PartyB will fill the close request.
  5. PartyA calls the deallocate and withdraw functions to move the assets/gains out of the protocol.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

In this system, users can be 'suspended' to stop them from taking money out. The report shows that a suspended user can still move money by creating a second account and making a trade that intentionally loses money to the suspended account, then closing the trade to get the funds out. This defeats the suspension and lets the attacker keep the money.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0xcrunch

View all

5 more disclosed reports, best first.

More from Symmetrical Update

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.