You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
have their shares/asset hard coded zero. while one of the input of either the borrowed asset/shares shout be zero, it is more flexible to allow a uint256 variable as a place holder and a require statement to ensure zero being passed
Root Cause
No response
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
-where the user passes in a non zero borrowed asset, the function would run but fail, leading to unexpected behaviour from the codes because the revert is not well handled.
-user may not understand reason for failed transaction
-gas is also spent on a transaction that fails.
PoC
No response
Mitigation
-since borrowed assets input by user has to be zero, require statements at the beginning of the function to validate that one of these values is indeed zero before further logic, along with a clear revert message.
proper documentation on the open source code as well as the user interface
The text was updated successfully, but these errors were encountered:
sherlock-admin2
changed the title
Sparkly Fleece Mammoth - Magic numbers in the morpho.sol contract hardcoded to zero
momo - Magic numbers in the morpho.sol contract hardcoded to zero
Oct 28, 2024
momo
Medium
Magic numbers in the morpho.sol contract hardcoded to zero
Summary
return values of
function getSupplyCollateralCalldata, function invokeSupplyCollateral,function getBorrowCalldata function invokeBorrow, function getWithdrawCollateralCalldata, function invokeWithdrawCollateral function invokeRepay
,https://github.com/sherlock-audit/2024-10-morpho-x-index/blob/main/index-protocol/contracts/protocol/integration/lib/Morpho.sol#L54
https://github.com/sherlock-audit/2024-10-morpho-x-index/blob/main/index-protocol/contracts/protocol/integration/lib/Morpho.sol#L98
https://github.com/sherlock-audit/2024-10-morpho-x-index/blob/main/index-protocol/contracts/protocol/integration/lib/Morpho.sol#L118
have their shares/asset hard coded zero. while one of the input of either the borrowed asset/shares shout be zero, it is more flexible to allow a uint256 variable as a place holder and a require statement to ensure zero being passed
Root Cause
No response
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
-where the user passes in a non zero borrowed asset, the function would run but fail, leading to unexpected behaviour from the codes because the revert is not well handled.
-user may not understand reason for failed transaction
-gas is also spent on a transaction that fails.
PoC
No response
Mitigation
-since borrowed assets input by user has to be zero, require statements at the beginning of the function to validate that one of these values is indeed zero before further logic, along with a clear revert message.
The text was updated successfully, but these errors were encountered: