Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

_validateSignature is not pure

Summary

The _validateSignature function in the provided smart contract code is incorrectly marked as pure. This misclassification is due to the function's interaction with the Ethereum Virtual Machine (EVM) through the ECDSA.recover function, which inherently involves reading from and writing to the blockchain's state, contrary to the pure function's definition.

Vulnerability Details

The pure keyword in Solidity indicates that a function does not modify or read from the contract's state. However, the _validateSignature function does not adhere to this principle for several reasons:

Interaction with External State: The function uses the ECDSA.recover function, which is part of the EVM and interacts with the blockchain's state to recover the signer's address from the signature. This interaction with external state contradicts the pure function's definition.
Implicit State Dependency: Even though the function does not explicitly read from or write to the contract's state variables, its operation depends on the blockchain's state (specifically, the validity of the signature and the resulting recovered address). This dependency on external state makes the function not pure.

Impact

Marking the _validateSignature function as pure when it interacts with the blockchain's state can lead to misunderstandings about the function's behavior. Developers and auditors might assume that the function is safe to call without side effects, which is not the case. This misinterpretation could potentially lead to security vulnerabilities if the function is used in contexts where its side effects are not considered.

Tools Used

Hardhat

Recommendations

Correct Function Declaration: Remove the pure keyword from the function declaration to accurately reflect the function's behavior.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.