Withdraw
function in Astaria Router takes approval for wrong amount leading to possibility of over approvals
#467
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-228
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/AstariaXYZ/astaria-gpl/blob/4b49fe993d9b807fe68b3421ee7f2fe91267c9ef/src/ERC4626RouterBase.sol#L48
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/AstariaRouter.sol#L168
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L131
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L163
Vulnerability details
Impact
withdraw()
function in Line 168 of AstariaRouter.sol allowsvault
token owners to withdraw underlying asset from vault. Note that implementation calls thewithdraw()
function of its parent contract ERC4626RouterBase.sol, refer line 48.Note that approval is taken for
amount
instead ofmaxSharesOut
- amount here refers to the actual underlying asset that was deposited in the vault (eg. WETH) and not the shares held by owner.This function then calls
withdraw
function in Line 131 of PublicVault.sol. This function reduces allowance of shares that are supposed to be burnt - since the approval was given foramount
of underlying asset & notmaxShares
, this could lead to either over allowance/under allowance situation. Under allowance leads to denial-of-service, over allowance leads to open approvals that were never supposed to be open.Since this can potentially lead to loss of vault tokens of LPs, I've marked it as
HIGH
riskProof of Concept
withdraw
function of Astaria RouterTools Used
Manual
Recommended Mitigation Steps
Change line 48 in
ERCRouterBase.sol
fromto
The text was updated successfully, but these errors were encountered: