sherlock-audit / 2024-04-titles-judging

1 stars 1 forks source link

ComposableSecurity - Message digest does not include the type of operation #417

Closed sherlock-admin4 closed 1 month ago

sherlock-admin4 commented 2 months ago

ComposableSecurity

medium

Message digest does not include the type of operation

Summary

Functions that are used to acknowledge and unacknowledge the edges in TitlesGraph contract use exactly the same digest when verifying the signature. That is because the digest does not include the value which states whether it is actually an acknowledge or unacknowledge.

The attacker can front-run the user and use their signature to execute the opposite operation.

Vulnerability Detail

The functions that accept signature parameter, which are: acknowledgeEdge(bytes32 edgeId_, bytes calldata data_, bytes calldata signature_) and unacknowledgeEdge(bytes32 edgeId_, bytes calldata data_, bytes calldata signature_), use the same parameters to generate the message digest (that is bytes32 digest = _hashTypedData(keccak256(abi.encode(ACK_TYPEHASH, edgeId, data)));).

The same signature can be used to acknowledge and unacknowledge the edge. The attacker could front-run the transaction with a correct signature and execute another transaction with changed value and the same signature, resulting in the opposite operation.

Impact

The attacker can front-run the user and use the signature to unacknowledge the edge which is being acknowledged (and the opposite way).

Code Snippet

https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/graph/TitlesGraph.sol#L40-L50

Tool used

Manual Review

Recommendation

Include the boolean value in the message digest (the structHash param of EIP712).

Duplicate of #273

ccashwell commented 2 months ago

Signature re-use is not possible due to its inclusion in _isUsed, and front-running isn't a concern for this as there's no value for an attacker to do so.

ComposableSecurityTeam commented 1 month ago

Escalate

This is a valid issue. The duplicate was accepted and is rewarded here: https://github.com/sherlock-audit/2024-04-titles-judging/issues/273

sherlock-admin3 commented 1 month ago

Escalate

This is a valid issue. The duplicate was accepted and is rewarded here: https://github.com/sherlock-audit/2024-04-titles-judging/issues/273

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

WangSecurity commented 1 month ago

Agree with the escalation, planning to accept and duplicate with #273

Evert0x commented 1 month ago

Result: Medium Duplicate of #273

sherlock-admin2 commented 1 month ago

Escalations have been resolved successfully!

Escalation status: