F-2024-0005·signature-replay

Potential Replay Attack Prevention Issue in Signature Verification Logic

Acknowledgedvaulthealthfipoints
TL;DR

The _permit function uses OR-joined checks across signature v/r/s tracking flags. Only one flag has to be unused for the signature to pass, weakening replay protection.

Severity
LOW
Impact
LOW
Likelihood
LOW
Method
MManual review
CAT.
Complexity
HIGH
Exploitability
LOW
02Section · Description

Description

Potential replay attack prevention issue in signature verification logic.

The _permit function in the RibbonVault contract utilizes the require(sig_v[v]==false || sig_r[r] == false || sig_s[s]==false,"sig used"); condition to prevent signature replay attacks. This logic checks if any one of the v, r, or s parameters of the signature has been used before. While this condition appears to prevent signature reuse, it is not the most robust approach as it only requires one of the conditions to be false for the signature to be accepted, which can potentially lead to unforeseen issues in certain edge cases.

03Section · Impact

Impact

Low impact:

  • The current implementation passes all standard tests and does not exhibit immediate vulnerabilities. However, the use of || instead of && in the replay prevention logic is not a best practice and might lead to potential risks in more complex scenarios or under specific conditions.
  • Potential future issues could arise if this logic is exploited in unforeseen ways, potentially allowing partial signature reuse under very specific circumstances.
04Section · Recommendation

Recommendation

To enhance the robustness of the signature replay prevention mechanism, it is recommended to use a stricter condition that ensures all parts of the signature (v, r, s) are unique before accepting the transaction. This can be achieved by modifying the condition to use && instead of ||:

solidity
require(sig_v[v]==false && sig_r[r] == false && sig_s[s]==false,"sig used");
F-2024-0005

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx