This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
xiaoming90 - Return data from the external call not verified during deposit and redemption #181
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
xiaoming90
medium
Return data from the external call not verified during deposit and redemption
Summary
The deposit and redemption functions did not verify the return data from the external call, which might cause the contract to wrongly assume that the deposit/redemption went well although the action has actually failed in the background.
Vulnerability Detail
https://github.com/sherlock-audit/2023-03-notional/blob/main/contracts-v2/contracts/internal/balances/protocols/GenericToken.sol#L63
When the external call within the
GenericToken.executeLowLevelCall
function reverts, thestatus
returned from the.call
will befalse
. In this case, Line 69 above will revert.https://github.com/sherlock-audit/2023-03-notional/blob/main/contracts-v2/contracts/internal/balances/TokenHandler.sol#L375
For deposit and redeem, Notional assumes that all money markets will revert if the deposit/mint and redeem/burn has an error. Thus, it does not verify the return data from the external call. Refer to the comment in Line 317 above.
However, this is not always true due to the following reasons:
false (0)
. In this case, the current codebase will wrongly assume that the deposit/redemption went well although the action has failed.Impact
The gist of prime cash is to integrate with multiple markets. Thus, the codebase should be written in a manner that can handle multiple markets. Otherwise, the contract will wrongly assume that the deposit/redemption went well although the action has actually failed in the background, which might potentially lead to some edge cases where assets are sent to the users even though the redemption fails.
Code Snippet
https://github.com/sherlock-audit/2023-03-notional/blob/main/contracts-v2/contracts/internal/balances/TokenHandler.sol#L375
https://github.com/sherlock-audit/2023-03-notional/blob/main/contracts-v2/contracts/external/actions/TreasuryAction.sol#L318
Tool used
Manual Review
Recommendation
Consider checking the
returnData
to ensure that the external money market returns a successful response after deposit and redemption.Note that the successful response returned from various money markets might be different. Some protocols return
1
on a successful action, while Compound return zero (NO_ERROR
).The text was updated successfully, but these errors were encountered: