Skip to content
Business logic Audit finding Intermediate

Signature replay

The redeem method in PoolTemplate verifies insurance data using a Merkle proof that only includes the target and insured addresses, not the incident timestamp. An attacker could reuse a valid proof to call insure with high amounts if the owner creates an incident with a future timestamp.

0x1f8b Follow

Originally disclosed on Code4rena

Submitted by 0x1f8b

Signature replay in PoolTemplate.

Proof of Concept

The redeem method of PoolTemplate verifies the data stored in incident, and the verification logic of this process is performed as following:

require(
    MerkleProof.verify(
        _merkleProof,
        _targets,
        keccak256(
            abi.encodePacked(_insurance.target, _insurance.insured)
        )
    ) ||
        MerkleProof.verify(
            _merkleProof,
            _targets,
            keccak256(abi.encodePacked(_insurance.target, address(0)))
        ),
    "ERROR: INSURANCE_EXEMPTED"
);

As can be seen, the only data related to the _insurance aretarget and insured, so as the incident has no relation with theInsurance, apparently nothing prevents a user to call insure with high amounts, after receive the incident, the only thing that prevents this from being reused is that the owner creates the incident with an _incidentTimestamp from the past.

So if an owner create a incident from the future it’s possible to create a new insure that could be reused by the same affected address.

Another lack of input verification that could facilitate this attack is the _span=0 in the insure method.

Recommended Mitigation Steps

It is mandatory to add a check in applyCover that_incidentTimestamp is less than the current date and the span argument is greater than 0 in theinsure method.

oishun1112 (Insure) confirmed and resolved, but disagreed with severity:

agree on the _incidentTimestamp check. disagree on span check since there already is

require(
            parameters.getMinDate(msg.sender) <= _span,
            "ERROR: INSURE_SPAN_BELOW_MIN"
        );

we are going to set default value of 1week for everyone

oishun1112 (Insure) commented:

we assume ownership control works fine. this can lose money in-proper way, but not at risk since onlyOwner modifier applied.

0xean (judge) commented:

going to leave this as 2

2 — Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.

The external requirement here would be an incorrect timestamp from the owner which would cause assets to be at risk from the replay.

oishun1112 (Insure) commented:

there is

_span >= getMinDate()

so we don’t implement _span > 0

The original report as published on Code4rena, by 0x1f8b. 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

Root cause

Likely the Merkle proof verification omits the incident timestamp, allowing replay if the timestamp is in the future.

Impact

Could allow an attacker to reuse a valid proof to insure high amounts and potentially drain funds, but only if the owner creates an incident with a future timestamp.

What the attacker needed

Owner creates incident with future timestamp; attacker has a valid Merkle proof

The fix

The contract should be fixed by adding a check that the incident timestamp is in the past and that the span is greater than zero.

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 checks a proof to confirm an insurance claim, but the proof does not include when the incident happened. If the contract owner sets a future date for an incident, someone could reuse the same proof to file another claim and get more money than intended.

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 by 0x1f8b

View all

21 more disclosed reports, best first.

More from InsureDAO contest

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.