Issue Between Comment and Code in Consortium
The comment in the Consortium contract's signature-checking function says it will revert on a bad signature, but the code actually uses continue. This mismatch could confuse developers and lead to incorrect assumptions about error handling.
Originally disclosed on Immunefi
- Disclosed after under an hour
#38370 [SC-Insight] Issue Between Comment and Code in Consortium
Submitted on Jan 1st 2025 at 17:41:21 UTC by @huntercheto for Audit Comp | Lombard
- Report ID: #38370
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/lombard-finance/evm-smart-contracts/blob/main/contracts/consortium/Consortium.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The comment in the Consortium contract code for handling signatures suggests that the program will revert. However, the actual implementation uses continue. This discrepancy between the comment and the code could lead to confusion, as it may mislead into assuming that a revert will occur when it doesn't. The misunderstanding could lead to improper assumptions about failure conditions and it could affect modifications and troubleshooting.
Vulnerability Details
In the function _checkProof, the comment states "revert if bad signature," but the code actually uses the continue statement. This inconsistency could result in potential confusion when the code is reviewed.
// revert if bad signature
// revert if bad signature
if (err != ECDSA.RecoverError.NoError) {
continue;
}
Impact Details
This is an INSIGHT, because this bug does not directly affect the security or operation of the system, but rather it is a comment issue and it can cause confusion as someone may misinterpret the error handling behavior.
This would be CRITICAL, if the code is meant to revert on a bad signature but mistakenly uses continue instead of revert, as it could allow invalid signatures to be processed without proper validation. This oversight is critical because it may enable attackers to bypass signature checks, compromising the security of the system and potentially allowing unauthorized access or manipulation of sensitive operations.
Proof of Concept
Proof of Code
This is straightforward and there is no need for additional proof of code, as the issue is evident through the current implementation and can be easily verified by reviewing the codebase.
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 comment was not updated when the code was changed to use continue instead of revert.
Impact
This is only a comment issue and does not directly affect security or operation, but it could cause confusion and lead to incorrect assumptions about failure conditions.
What the attacker needed
None
The fix
The comment should be updated to match the code, or the code changed to revert if that was intended.
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 is a program on a blockchain. A comment is a note for humans that the computer ignores. Here, the note says 'stop and undo everything' (revert) if a signature is bad, but the code actually just skips that signature and keeps going (continue). This can confuse someone reading the code into thinking the program will stop when it won't.