Withdrawal delay can be circumvented
The withdrawal delay in the Collateral contract can be bypassed because tokens can still be transferred after initiating a withdrawal. An attacker can use multiple accounts to always have one account in a valid withdrawal window, allowing them to withdraw funds at any time, even immediately after purchase.
Submitted by cmichel, also found by IllIllI and leastwood
After initiating a withdrawal with initiateWithdrawal, it’s still possible to transfer the collateral tokens. This can be used to create a second account, transfer the accounts to them and initiate withdrawals at a different time frame such that one of the accounts is always in a valid withdrawal window, no matter what time it is. If the token owner now wants to withdraw they just transfer the funds to the account that is currently in a valid withdrawal window.
Also, note that each account can withdraw the specified amount. Creating several accounts and circling & initiating withdrawals with all of them allows withdrawing larger amounts even at the same block as they are purchased in the future.
I consider this high severity because it breaks core functionality of the Collateral token.
Proof of Concept
For example, assume the _delayedWithdrawalExpiry = 20 blocks. Account A owns 1000 collateral tokens, they create a second account B.
- At
block=0, A callsinitiateWithdrawal(1000). They send their balance to account B. - At
block=10, B callsinitiateWithdrawal(1000). They send their balance to account A. - They repeat these steps, alternating the withdrawal initiation every 10 blocks.
- One of the accounts is always in a valid withdrawal window (
initiationBlock < block && block <= initiationBlock + 20). They can withdraw their funds at any time.
Recommended Mitigation Steps
If there’s a withdrawal request for the token owner (_accountToWithdrawalRequest[owner].blockNumber > 0), disable their transfers for the time.
// pseudo-code not tested
beforeTransfer(from, to, amount) {
super();
uint256 withdrawalStart = _accountToWithdrawalRequest[from].blockNumber;
if(withdrawalStart > 0 && withdrawalStart + _delayedWithdrawalExpiry < block.number) {
revert(); // still in withdrawal window
}
}
ramenforbreakfast (prePO) commented:
This is a valid claim.
Agree with sponsor.
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
Impact
This breaks the core functionality of the Collateral token by allowing withdrawals to bypass the intended delay, potentially enabling larger withdrawals than intended.
What the attacker needed
A collateral token balance; ability to create multiple accounts
The fix
The contract should disable transfers for an account that has an active withdrawal request until the withdrawal window has passed.
How it was found
- Account A initiates a withdrawal for its entire balance.
- Account A transfers its balance to account B.
- Account B initiates a withdrawal for its entire balance.
- Account B transfers its balance back to account A.
- Repeat the alternating initiation and transfer every half of the delay period.
- One account is always in a valid withdrawal window, so funds can be withdrawn at any time.
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 withdrawal delay is meant to stop people from taking their money out too quickly. But the contract lets you move your tokens to another account even after you start a withdrawal. By moving tokens between two accounts, you can always have one account that is allowed to withdraw, so you can get your money out whenever you want.
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.