28849 - [SC - Low] Using batchRedemption even if the TCR becomes s...

Submitted on Feb 28th 2024 at 21:07:22 UTC by @cryptoticky for Boost | eBTC

Report ID: #28849

Report type: Smart Contract

Report severity: Low

Target: https://github.com/ebtc-protocol/ebtc/blob/release-0.7/packages/contracts/contracts/CdpManager.sol

Impacts:

  • Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)

  • Protocol insolvency

Description

Brief/Intro

When the TCR is smaller than the MCR, the TCR continues to be smaller if redeemer redeem debt token, and to suppress this, eBTC protocol does not allow redeem debt token when the TCR is smaller than the MCR.

Vulnerability Details

https://docs.ebtc.finance/ebtc/protocol-mechanics/redemptions img.png

As you can see on the redemption description page, Redemptions are disabled whenever the Total Collateral Ratio (TCR) goes below the Minimum Collateral Ratio (MCR) of 110%.

  • CdpManager.sol:line 354

The problem is that an attacker can bypass this require and continue to redeem it even when the TCR is smaller than the MCR.

Attack Scenario

Let's look at the case where TCR is very close to MCR and larger than the MCR, but now TCR becomes smaller than the MCR with full redemption to the first ICR that is larger than the MCR. When this redemption is made, TCR becomes smaller than MCR, so the redemption cannot proceed until TCR becomes larger than MCR again.

However, if an attacker redeems multiple CDPs, not just CDP(the first ICR), multiple redemptions can proceed despite the fact that the TCR is smaller than the MCR with the repayment of the first CDP.

Attached below is the PoC test code explaining these scenarios.

You can create PoC_CDPManager.redemptions.t.sol file in foundry_test folder.

And run this in terminal.

forge test -vvv --match-contract PoC_CDPManagerRedemptionsTest.

The result:

Impact Details

An attacker can exploit this vulnerability to send the TCR quickly down the MCR and launch an attack whenever the TCR rises above the MCR to prevent the protocol from returning to normal. There is no direct benefit to the attacker, but it interferes with the normal operation of the protocol, which continues to be present in recovery mode. This prevents the borrowers from disposing of their CDP, resulting in the destruction of community. If this continues, the protocol will go bankrupt.

References

To solve this vulnerability, we can simply check the TCR whenever the function proceeds with a CDP.

We can modify CdpManager.sol:393-395 lines like

Proof of Concept

Attack Scenario

Let's look at the case where TCR is very close to MCR and larger than the MCR, but now TCR becomes smaller than the MCR with full redemption to the first ICR that is larger than the MCR. When this redemption is made, TCR becomes smaller than MCR, so the redemption cannot proceed until TCR becomes larger than MCR again.

However, if an attacker redeems multiple CDPs, not just CDP(the first ICR), multiple redemptions can proceed despite the fact that the TCR is smaller than the MCR with the repayment of the first CDP.

Attached below is the PoC test code explaining these scenarios.

You can create PoC_CDPManager.redemptions.t.sol file in foundry_test folder.

And run this in terminal.

forge test -vvv --match-contract PoC_CDPManagerRedemptionsTest.

The result:

Last updated

Was this helpful?