The ApprovalFacet.sol contract in the Beanstalk project has a potential front-running vulnerability in the increaseDepositAllowance and decreaseDepositAllowance functions. This vulnerability could be exploited to manipulate the contract's state before a transaction is executed, leading to unintended consequences.
The increaseDepositAllowance and decreaseDepositAllowance functions in ApprovalFacet.sol perform two separate steps:
Check current allowance: Verify if the current allowance is sufficient to increase/decrease by the desired amount.
Update allowance: If sufficient, the function increases/decreases the allowance accordingly.
However, the separation of these two steps creates a small window of time between checking and updating the allowance. An attacker could exploit this time gap to execute another transaction before the allowance is updated.
Example:
In increaseDepositAllowance: An attacker could send a transaction to transfer a large amount of deposit before the allowance is increased.
In decreaseDepositAllowance: An attacker could send a transaction to transfer a large amount of deposit before the allowance is decreased.
Users could lose their deposits because the attacker transferred them before the allowance was updated.
Manual
Add the functions _increaseDepositAllowance and _decreaseDepositAllowance in LibSiloPermit.
Use these functions in LibSiloPermit to increase/decrease allowance more securely.
Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
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.