Pool owners can prevent the payment of taxes
A pool owner can add a reward token that always reverts when transferred to the global beneficiary, causing the tax withdrawal function to fail. This prevents taxes from being paid without affecting other pool functionality.
Submitted by IllIllI
Pool owners can prevent taxes from being paid without impacting any other functionality
Proof of Concept
By adding a custom reward token that always reverts for transfers to globalBenericiary, the owner can prevent taxes from being paid:
File: contracts/PermissionlessBasicPoolFactory.sol #1
258 /// @notice Withdraw taxes from pool
259 /// @dev Anyone may call this, it just moves the taxes from this contract to the globalBeneficiary
260 /// @param poolId which pool are we talking about?
261 function withdrawTaxes(uint poolId) external {
262 Pool storage pool = pools[poolId];
263 require(pool.id == poolId, 'Uninitialized pool');
264
265 bool success = true;
266 for (uint i = 0; i < pool.rewardTokens.length; i++) {
267 uint tax = taxes[poolId][i];
268 taxes[poolId][i] = 0;
269 success = success && IERC20(pool.rewardTokens[i]).transfer(globalBeneficiary, tax);
270 }
271 require(success, 'Token transfer failed');
272 }
While the sponsor mentions that malicious tokens make the pool malicious, this particular issue has a simple fix outlined below in the mitigation section
Recommended Mitigation Steps
Force taxes to be paid during withdraw()
illuzen (FactoryDAO) confirmed, disagreed with severity and commented:
Valid, but adding another transfer to withdraw increases gas costs. And it’s possible pool creator and token creator are not same party, so it’s not clear the mitigation would be better.
I think it’s an acceptable risk. If someone wants to go to this level of trouble, they could just fork the contract and remove the fees.
illuzen (FactoryDAO) resolved:
Justin Goro (judge) commented:
Validating against tokens specifically written with if statements for this contract is not really something a developer can prevent. For instance, a token creator can cause their token to revert if the contract requesting transferFrom approval is a Uniswap router. This would prevent all trade of that token within Uniswap. But that’s certainly not the failing of the Uniswap developers.
However, for tokens in particular, it is recommended to not revert on bad implementations and so the issue will be treated as belonging to that camp of suggestions. For that reason, the risk status will remain 2.
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 tax withdrawal function transfers each reward token to the global beneficiary and requires all transfers to succeed, so a token that reverts on such transfers blocks the entire tax payment.
Impact
Taxes on that pool's reward tokens cannot be paid, but other pool functionality is unaffected; the sponsor considers this an acceptable risk.
What the attacker needed
Pool owner controls reward token; token reverts on transfer to beneficiary
The fix
The issue was fixed by forcing taxes to be paid during withdraw(), as indicated by the resolved pull request.
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 smart contract system, pool owners can create pools with reward tokens. The contract collects taxes on these tokens and later sends them to a global beneficiary. If a pool owner uses a token that refuses to be sent to that beneficiary, the tax payment always fails, so the taxes are never paid.
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.