Skip to content
Business logic Audit finding Intermediate

The assumption that operator == to (user) may not hold leading to failed timelock deposits

The timelockDepositTo function credits the operator's address instead of the user-specified 'to' address, so in meta-transactions where operator and user differ, deposits fail because the operator lacks sufficient timelock balance.

0xRajeev Follow

Originally disclosed on Code4rena

Submitted by 0xRajeev

The contract uses _msgSender() to denote an operator who is operating on behalf of the user. This is typically used for meta-transactions where the operator is an intermediary/relayer who may facilitate gas-less transactions on behalf of the user. They may be the same address but it is safer to assume that they may not be.

While the code handles this separation of role in most cases, it misses doing so in timelockDepositTo() function where it accounts the _timelockBalances to the operator address instead of the user specified to address. It assumes they are the same. The corresponding usage in _mintTimelock() which is called from withdrawWithTimelockFrom() uses the user specified ‘from’ address and not the _msgSender(). Therefore the corresponding usage in timelockDepositTo() should be the same.

In the scenario where the operator address != user specified from/to addresses, i.e. meta-transactions, the timelock deposits and withdrawals are made to/from different addresses and so the deposits of timelocked tokens will fail because the operator’s address does not have the required amount of _timelockBalances.

Recommend changing operator to from on L281 of timelockDepositTo() and specifying the scenarios where the role of the operator is applicable and document/implement those accordingly.

asselstine (PoolTogether) disputed:

In the function timelockDepositTo() the msg.sender is using their timelocked funds to re-enter the pool. They can only spend their own funds; they should not be able to spend other user’s funds.

The warden is saying the timelockDepositTo should be callable by anyone and allow them to transfer other user’s funds from the timelock back into tickets. This actually introduces an attack vector.

dmvt (judge) commented:

I think sponsor is misunderstanding warden’s concern here. The issue is not that msg.sender is being checked, but that _msgSender is being checked. Happy to discuss this more if sponsor still disagrees, but I think the concern raised is valid.

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

Likely the function uses _msgSender() (the operator) instead of the user-specified 'to' address when updating timelock balances.

Impact

In meta-transactions where operator and user differ, timelock deposits fail because the operator's address lacks the required timelock balance.

What the attacker needed

Meta-transaction where operator != user

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 some systems, a relayer (operator) sends transactions on behalf of a user. The code mistakenly uses the relayer's address as the user when recording a deposit, so the deposit fails because the relayer doesn't have the user's funds.

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 0xRajeev

View all

61 more disclosed reports, best first.

More from PoolTogether

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.