Skip to content
Business logic Audit finding Intermediate

Pool owners can prevent withdrawals of specific receipts

A pool owner can prevent a specific receipt holder from withdrawing by configuring a reward token that reverts for that address, causing the entire withdrawal transaction to fail. The attacker can monitor receipt creation and target the owner's address.

IllIllI Follow

Originally disclosed on Code4rena

Submitted by IllIllI

Pool owners can prevent withdrawals of specific receipts without impacting any other functionality

Proof of Concept

Reciepts are non-transferrable, so a malicious owner can monitor the blockchain for receipt creations, and inspect which account holds the receiptId. Next, by changing settings in a custom reward token that reverts for specific addresses, the owner can prevent that specific receipt owner from withdrawing:

File: contracts/PermissionlessBasicPoolFactory.sol   #1

230               success = success && IERC20(pool.rewardTokens[i]).transfer(receipt.owner, transferAmount);
231           }
232
233           success = success && IERC20(pool.depositToken).transfer(receipt.owner, receipt.amountDepositedWei);
234           require(success, 'Token transfer failed');

https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/PermissionlessBasicPoolFactory.sol#L230-L234

While the sponsor mentions that malicious tokens make the pool malicious, this particular issue has a straight forward fix outlined below in the mitigation section

Recommended Mitigation Steps

Rather than reverting the whole withdrawal if only one transfer fails, return a boolean of whether all withdrawals were successful, and allow withdraw() to be called multiple times, keeping track of what has been transferred and what hasn’t

illuzen (FactoryDAO) confirmed, disagreed with severity and commented:

Valid, similar to #124 mitigation seems risky, could provide emergencyWithdrawal function instead…

illuzen (FactoryDAO) resolved:

https://github.com/code-423n4/2022-05-factorydao/pull/2

Justin Goro (judge) commented:

While the example provided is not in scope for the developer to fix, the catch all provided by the sponsor is a good way to act as a last resort protection against loop griefing attacks.


The original report as published on Code4rena, by IllIllI. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

The withdrawal function requires all token transfers to succeed, so a single failing transfer (due to a malicious token) reverts the entire withdrawal.

Impact

A pool owner could block withdrawals for specific receipt holders, but only if they use a malicious reward token; the text notes this is not in scope for the developer to fix.

What the attacker needed

Pool owner controls reward token; owner can monitor blockchain

The fix

The withdrawal function should not revert entirely if one transfer fails; instead, it should return a boolean and allow multiple withdrawals, tracking what has been transferred.

How it was found

  1. The pool owner deploys a custom reward token that reverts for a specific address.
  2. The owner monitors the blockchain for receipt creations and identifies the receipt owner.
  3. The owner configures the pool to use the malicious token.
  4. When the targeted receipt owner calls withdraw, the token transfer reverts and the withdrawal fails.

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.

A pool is a smart contract where people deposit tokens and get receipts. The pool owner can set a custom reward token that refuses to send tokens to a particular address. When that person tries to withdraw, the whole transaction fails, so they cannot get their deposit back.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by IllIllI

View all

119 more disclosed reports, best first.

More from FactoryDAO contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.