Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Unprotected function dispatch in `MAIN` Macro

Summary

The MAIN macro in the HorseStore.huff contract lacks a revert instruction in case none of the specified function signatures match the provided calldata. This absence of a revert mechanism may lead to unintended consequences, such as calling the wrong function, potentially causing security vulnerabilities or unintended state changes.

Vulnerability Details

The MAIN macro is designed to identify and execute the appropriate function based on the provided calldata. However, it does not include a revert instruction at the end to handle the scenario where none of the specified function signatures match the input. As a result, if a caller provides calldata with an unrecognized signature, the contract will proceed to execute the first function specified in the MAIN macro (GET_TOTAL_SUPPLY in this case).

Impact

The absence of a revert mechanism in the MAIN macro could potentially lead to the execution of unintended functions. In a scenario where sensitive functions or state-changing operations are defined later in the macro, this could result in unexpected behavior or security vulnerabilities. It may allow malicious actors to trigger undesired actions within the contract.

Tools Used

Manual review.

Recommendations

It is recommended to add a revert instruction in theMAIN macro to handle the case where none of the specified function signatures match the provided calldata. This will ensure that the contract reverts in case of unrecognized function signatures, preventing unintended execution and enhancing the overall security of the contract.

0x00 0x00 revert
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

MAIN() macro is not properly implemented

Any call data sent to the contract that doesn't contain a function selector will randomly mint a horse.

Support

FAQs

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