Lucene search

K
code423n4Code4renaCODE423N4:2022-06-CANTO-V2-FINDINGS-ISSUES-92
HistoryJul 01, 2022 - 12:00 a.m.

A cap is needed on the amount of Note than can be borrowed

2022-07-0100:00:00
Code4rena
github.com
6

Lines of code
<https://github.com/Plex-Engineer/lending-market-v2/blob/ea5840de72eab58bec837bb51986ac73712fcfde/contracts/Note.sol#L14&gt;

Vulnerability details

Impact

The fact that there is no cap on the amount of Note that can be borrowed makes the Oracle Extractable Value unlimited. But as you intend to rely on TWAP, you need to make sure the cost of oracle manipulation is lower than the Oracle Extractable Value.

Proof of Concept

By manipulating the TWAPs of the designated proxy used for Note (USDC ?) and its relative price to a given collateral(which would be highly costly), an attacker could borrow Note without limit, and empty all pools related to Note and all Note-related value, instantly killing the stablecoin.

The value extractable by Oracle Manipulations is usually easily computable as it is the size of the lending market, but here, it’s more difficult to evaluate as it could potentially be any value linked to Note. This makes risk management harder and increase significantly the risk of attack.

Therefore a cap on how many Notes can be borrowed needs to be added to mitigate this risk.

The attack would be:

  • Manipulate the USDC / Collateral TWAP to be able to borrow Note with less than 1$ of collateral, which would be costly.
  • Extract all the value possible linked to Note, for example:
    - by buying all the tokens from pools Note / token at a discount
    - by supplying Notes to the lending platform and borrow collaterals for which the Note price is still at 1$
    - etc

Essentially as you have no cap on the amount of Note that could be borrowed in such a scenario, you cannot be sure that the potential attack profits are lower than the attack cost.

Recommended Mitigation Steps

The governance needs to set a limit on how much Note can be borrowed to mitigate risks, or add for example an β€œhourly” borrowing limit.

Easiest way to do this would be able to mint / burn from the accountant


The text was updated successfully, but these errors were encountered:

All reactions