Skip to content
Business logic Audit finding Beginner

The RdpxV2Core contract allows anyone to call redeem tokens even if the contract is paused

The redeem function in the RdpxV2Core contract lacks a pause check, so users can still redeem matured bonds even when the contract is paused. An attacker could bypass the admin's emergency pause and continue redeeming tokens during a hack or maintenance.

LowK Follow with HHK, Tendency and 3 others

Originally disclosed on Code4rena

Submitted by LowK, also found by HHK, Tendency, ItsNio, ak1, and Inspecktor

When the admin pauses the contract RdpxV3core locks anyone to use this contract such as a bond, bondWithDelegate, and withdraw. But a function redeem is still available to use. Any situations that occur like a hack accident or system are under maintenance then anyway, your smart contract is running to continue to get unexpected.

Proof of Concept

The code below does not call a function whenNotPause() to check whether this contract is paused or not.

function redeem(
    uint256 id,
    address to
  ) external returns (uint256 receiptTokenAmount) {
    // Validate bond ID
    _validate(bonds[id].timestamp > 0, 6);
    // Validate if bond has matured
    _validate(block.timestamp > bonds[id].maturity, 7);

    _validate(
      msg.sender == RdpxV2Bond(addresses.receiptTokenBonds).ownerOf(id),
      9
    );

    // Burn the bond token
    // Note requires an approval of the bond token to this contract
    RdpxV2Bond(addresses.receiptTokenBonds).burn(id);

    // transfer receipt tokens to user
    receiptTokenAmount = bonds[id].amount;
    IERC20WithBurn(addresses.rdpxV2ReceiptToken).safeTransfer(
      to,
      receiptTokenAmount
    );

    emit LogRedeem(to, receiptTokenAmount);
  }

To reproduce this vulnerability, let’s modify a test called testRedeem() in a /test/rdpxV2-core/Unit.t.sol. After running the test, you will get everything passed. So it is proof of vulnerable

function testRedeem() public {
    rdpxV2Core.bond(1 * 1e18, 0, address(this));
    // ...
    rdpxV2Core.pause(); // <- add this line to test

    // test redeem after expiry
    rdpxV2Bond.approve(address(rdpxV2Core), 0);
    rdpxV2Core.redeem(0, address(1));
    assertEq(rdpxV2Bond.balanceOf(address(this)), 0);
    assertEq(rdpxV2ReceiptToken.balanceOf(address(1)), 25 * 1e16);
    // ...
}

Recommended Mitigation Steps

Adding the line _whenNotPaused(); into the function redeem().

psytama (Dopex) confirmed


The original report as published on Code4rena, by LowK. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The pause mechanism can be bypassed for redemptions, so during an emergency or maintenance the contract may still process redemptions unexpectedly.

What the attacker needed

A matured bond; bond owner approval to the core contract

The fix

Add a whenNotPaused check to the redeem function so it respects the contract's paused state.

How it was found

  1. Create a bond by calling the bond function.
  2. Pause the contract using the pause function.
  3. Approve the bond token to the core contract.
  4. Call redeem for the matured bond and observe that it succeeds despite the pause.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract can have a pause switch that the admin uses to stop all activity in an emergency. The redeem function lets a user swap a matured bond for receipt tokens, but it does not check that switch. So even when the contract is paused, someone can still redeem their bond.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Dopex

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.