Method fund() can be called by anyone #133
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
duplicate
This issue or pull request already exists
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2022-05-aura/blob/main/contracts/AuraVestedEscrow.sol#L96-L110
Vulnerability details
Method fund() can be called by anyone
In the contract
AuraVestedEscrow.sol
anyone can call the methodfund()
, and it can only be called once.Impact
The method
fund()
can only be called once due to the state variableinitialised
. There is no check whether the amount is 0 or if the array of recipients is empty.The method is also the only method setting the values for
totalLocked[_recipient]
, which is used throughout the rest of the contract.This combined with the method being
external
and callable by anyone, can create a DoS for that method, and indirectly for the rest of the contract, since all other methods in the contract assumestotalLocked[_recipient]
holds some positive value.Proof of concept
The code can be found at L96-L110:
Consider the scenario:
AuraVestedEscrow.sol
fund()
method with_recipient
being an empty array and/or_amount
being 0.initialised
is now set totrue
andfund()
will from now on revert if called.cancel()
will revert since it requirestotalLocked[_recipient] > 0
available()
andvested()
will always return0
.claim()
will not really do anything as it makes use ofavaialble()
to calculate the amount to lock/transfer which always returns0
.Recommended mitigation
Do some checking on the input parameters
_recipient
and_amount
. Ideally set some restriction on the method for who can call the method, since it is basically a form of initialization, since it is only callable once.The text was updated successfully, but these errors were encountered: