Skip to content
Business logic Audit finding Intermediate

Strategist nonce is not checked

The commitment validation in the vault router never checks the strategist's nonce, even though the nonce is part of the signed commitment. A strategist therefore cannot cancel a signed commitment, and a borrower could reuse it to borrow several times.

cryptphi Follow with rvierdiiev, HonorLt and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/59

Found by

cryptphi, rvierdiiev, HonorLt, ctf_sec

Summary

Strategist nonce is not checked while checking commitment. This makes impossible for strategist to cancel signed commitment.

Vulnerability Detail

VaultImplementation.commitToLien is created to give the ability to borrow from the vault. The conditions of loan are discussed off chain and owner or delegate of the vault then creates and signes deal details. Later borrower can provide it as IAstariaRouter.Commitment calldata params param to VaultImplementation.commitToLien.

After the checking of signer of commitment VaultImplementation._validateCommitment function calls AstariaRouter.validateCommitment.

Solidity
  function validateCommitment(IAstariaRouter.Commitment calldata commitment)
    public
    returns (bool valid, IAstariaRouter.LienDetails memory ld)
  {
    require(
      commitment.lienRequest.strategy.deadline >= block.timestamp,
      "deadline passed"
    );


    require(
      strategyValidators[commitment.lienRequest.nlrType] != address(0),
      "invalid strategy type"
    );


    bytes32 leaf;
    (leaf, ld) = IStrategyValidator(
      strategyValidators[commitment.lienRequest.nlrType]
    ).validateAndParse(
        commitment.lienRequest,
        COLLATERAL_TOKEN.ownerOf(
          commitment.tokenContract.computeId(commitment.tokenId)
        ),
        commitment.tokenContract,
        commitment.tokenId
      );


    return (
      MerkleProof.verifyCalldata(
        commitment.lienRequest.merkle.proof,
        commitment.lienRequest.merkle.root,
        leaf
      ),
      ld
    );
  }

This function check additional params, one of which is commitment.lienRequest.strategy.deadline. But it doesn't check for the nonce of strategist here. But this nonce is used while signing.

Also AstariaRouter gives ability to increment nonce for strategist, but it is never called. That means that currently strategist use always same nonce and can't cancel his commitment.

Impact

Strategist can't cancel his commitment. User can use this commitment to borrow up to 5 times.

Code Snippet

Provided above

Tool used

Manual Review

Recommendation

Give ability to strategist to call increaseNonce function.

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

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 strategist cannot cancel a commitment, and a user could reuse it to borrow up to five times.

What the attacker needed

A signed commitment from the strategist; borrower submits the commitment

The fix

The strategist should be able to call the nonce-increment function so that previously signed commitments become invalid.

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 strategist signs an off-chain message that lets someone borrow against a vault. A nonce is a counter meant to make each signed message usable only once, so raising it cancels old signatures. Here the contract never compares the nonce, so the same signed message stays valid and can be used again.

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 cryptphi

View all

7 more disclosed reports, best first.

More from Astaria

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.