The PriorityPool::withdraw
function allows anyone to withdraw more asset tokens than they deposited.
The function PriorityPool::withdraw
lacks sufficient checks that allows a malicious actor to withdraw more tokens than deposited.
The steps to replicate the same are as follows:-
Malicious actor deposits tokens via the PriorityPool::deposit
function.
A legitimate user also deposits his token via the same function.
The malicious actor would now first withdraw by sending _shouldUnqueue
as false and next by sending _shouldUnqueue
as true by calling the PriorityPool::withdraw
function.
This sequence allows the attacker to withdraw more tokens than he ever deposited.
Even if the off-chain mechanism tries to prevent this by manually calling pause pauseForUpdate
, it can be easily by-passed by sandwiching victim's transaction.
The attacker just needs to ensure the his withdraw transaction goes through as soon as user deposits tokens.
The below test was added in priority-pool.test.ts
file.
As we can see the attacker is able to gain extra 99
tokens.
Malicious actor can steal funds
Manual review
Hardhat
Instead of relying on a manual pauseForUpdate
, it is recommended to pause the flow on-chain till further unpause.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.