# Valid redemption proposals can be disputed when bad debt occurs by applying it to a SR outside of the proposal

Bad debt applied to a short record via proposeRedemption doesn't update updatedAt, letting an attacker dispute a valid redemption proposal and collect the penalty fee.

- Payout: Audit contest
- Severity: medium
- Program: DittoETH
- Found by: Cosine
- Disclosed: 2024-06-25
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-03-dittoeth-findings/issues/33
- Library page: https://bugbountylibrary.com/r/c4%3A2024-03-dittoeth%3AM-09
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic

**Target:** DittoETH RedemptionFacet.proposeRedemption / LibSRUtil.updateErcDebt
**Root cause:** updateErcDebt increases a short's ercDebt (lowering CR) without updating the short's updatedAt timestamp, so proposeRedemption can silently apply bad debt to an SR outside the proposal and make an in-proposal SR appear below the CR threshold.
**Steps:**
1. Create a valid redemption proposal covering short records.
2. Wait for bad debt to occur so ercDebtRate increases.
3. Call `proposeRedemption` with inputs referencing a short record outside the proposal to trigger `updateErcDebt` on it, lowering its CR without updating `updatedAt`.
4. Now an SR in the original proposal falls below the CR threshold relative to the manipulated SR.
5. Call `disputeRedemption` on the original proposal to collect the penalty fee.
**How found:** Noticed that updateErcDebt mutates ercDebt (and thus CR) but leaves updatedAt unchanged, then observed proposeRedemption is a public path that invokes updateErcDebt on arbitrary SRs, enabling CR manipulation outside the proposal scope.
**Exploitation:** Attacker uses proposeRedemption as a lever to apply socialized bad debt to a chosen short record (not in the proposal), dropping its CR without touching updatedAt. This makes a previously valid redemption proposal appear disputable, so the attacker disputes it and receives the penalty fee at the proposer's expense.
**Insight:** When a debt/interest accrual function mutates a health metric (CR) but not the staleness timestamp, look for any public entrypoint that calls it on records outside the caller's intended scope — that gap lets you shift another record's CR to invalidate proposals or liquidations.

## Proof of concept (copied exactly from the original report)

**Test proving proposeRedemption does not update updatedAt**

```
function test_proposeRedemption_does_update_updatedAt() public {
    // setup
    uint88 _redemptionAmounts = DEFAULT_AMOUNT * 2;
    makeShorts({singleShorter: true});

    skip(1 hours);
    _setETH(1000 ether);

    // propose a redemption
    MTypes.ProposalInput[] memory proposalInputs =
        makeProposalInputsForDispute({shortId1: C.SHORT_STARTING_ID, shortId2: C.SHORT_STARTING_ID + 1});

    uint32 updatedAtBefore = getShortRecord(sender, C.SHORT_STARTING_ID).updatedAt;

    vm.prank(receiver);
    diamond.proposeRedemption(asset, proposalInputs, _redemptionAmounts, MAX_REDEMPTION_FEE);

    uint32 updatedAtAfter = getShortRecord(sender, C.SHORT_STARTING_ID).updatedAt;

    // updatedAt param was not updated
    assertEq(updatedAtBefore, updatedAtAfter);
}
```

