sherlock-2025-07-mellow-h01

[H-01] Consensus.checkSignatures doesn’t check duplication of signers

보고서

Summary

Consensus.checkSignatures 에서 서명을 확인할 때 중복 서명이 있는 지 확인하지 않는다. 공격자가 서명을 하나만 확보하면 조작된 가격으로 주문을 할 수 있다.

Keyword

price oracle, oracle manipulation, signature, lack of input validation, crypto theft

Vulnerability

Consensus.checkSignatures 에서 서명을 확인할 때 중복 서명이 있는 지 확인하지 않는다. 따라서 중복 서명을 이용하면 단 하나의 서명으로 threshold를 우회하고 SignatureDepositQueue.depositSignatureRedeemQueue.redeem 을 할 수 있다. 즉 공격자가 서명을 하나만 확보하면 조작된 가격으로 주문을 할 수 있다.

function checkSignatures(bytes32 orderHash, Signature[] calldata signatures) public view returns (bool) {
    ConsensusStorage storage $ = _consensusStorage();
    if (signatures.length == 0 || signatures.length < $.threshold) {
        return false;
    }
    for (uint256 i = 0; i < signatures.length; i++) {
        address signer = signatures[i].signer;
@>      (bool exists, uint256 signatureTypeValue) = $.signers.tryGet(signer);
        if (!exists) {
            return false;
        }
        SignatureType signatureType = SignatureType(signatureTypeValue);
        if (signatureType == SignatureType.EIP712) {
@>          address recoveredSigner = ECDSA.recover(orderHash, signatures[i].signature);
            if (recoveredSigner == address(0) || recoveredSigner != signer) {
                return false;
            }
        } else if (signatureType == SignatureType.EIP1271) {
@>          bytes4 magicValue = IERC1271(signer).isValidSignature(orderHash, signatures[i].signature);
            if (magicValue != IERC1271.isValidSignature.selector) {
                return false;
            }
        } else {
            return false;
        }
    }
    return true;
}

Impact

단 하나의 서명만으로 Consensus의 threshold를 우회, 조작된 가격으로 deposit 또는 redeem을 할 수 있다. 입출금을 반복하여 컨트랙트에 예치된 토큰을 탈취할 수 있다.

Mitigation

Consensus.checkSignatures 에서 중복 서명이 있는 지 확인한다.


tags: bughunting, mellow, smart contract, solidity, severity high, defi, price oracle, oracle manipulation, signature, lack-of-input-validation-vul, crypto theft, consensus