Malicious user can drain PeUSDMainnetStableVision via executeFlashloan() #280
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-769
edited-by-warden
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/code-423n4/2023-06-lybra/blob/main/contracts/lybra/token/PeUSDMainnetStableVision.sol#L129
https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/token/PeUSDMainnetStableVision.sol#L132
Vulnerability details
Impact
Maliciuos user can use
executeFlashloan()
and steal all available EUSD tokens.Proof of Concept
Here is a vulnerable function:
It allows to pass an arbitrary
bytes calldata data
as one of the arguments. Later it callsreceiver
, that can bePeUSDMainnetStableVision
contract itself, with a maliciousdata
.So malicious user can pass next arguments:
Step by step:
data
;Right after that hacker will be approved and be able to transfer all EUSD tokens from the contract.
Sorry for no tests included. I was little bit confused with setting up all params.
P.S. The same issue was in Damn Vulnerably DeFi Challenges (Truster).
Tools Used
Manual review.
Recommended Mitigation Steps
You can provide an additional checks to prohibit calls for approve functions or receiver should not be the same as
PeUSDMainnetStableVision
contract.Assessed type
Other
The text was updated successfully, but these errors were encountered: