Closed code423n4 closed 2 years ago
https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L739-L758
Any user can borrow any amount of Asset without transfer any Collateral Token to the Pair
borrow
Asset
Collateral Token
Pair
By invoking borrowAsset() and passe collateralAmount = 0 you will be able to borrow all the liquidity in the Pair
borrowAsset()
collateralAmount = 0
As we can see they just check for if (_collateralAmount > 0) to invoke _addCollateral() and get the collateral Token to transfer to Pair
if (_collateralAmount > 0)
_addCollateral()
Add more checks for _collateralAmount param
_collateralAmount
Invalid, same as #204
isSolvent modifier prevents this
Lines of code
https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L739-L758
Vulnerability details
Impact
Any user can
borrow
any amount ofAsset
without transfer anyCollateral Token
to thePair
Proof of Concept
By invoking
borrowAsset()
and passecollateralAmount = 0
you will be able toborrow
all the liquidity in thePair
As we can see they just check for
if (_collateralAmount > 0)
to invoke_addCollateral()
and get the collateral Token to transfer to PairRecommended Mitigation Steps
Add more checks for
_collateralAmount
param