Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brave Plum Shetland - Yul Block Contains return Function Call Causing Premature Execution Halt in Unitroller.sol #231

Open
sherlock-admin4 opened this issue Dec 31, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

Brave Plum Shetland

High

Yul Block Contains return Function Call Causing Premature Execution Halt in Unitroller.sol

Summary

https://github.com/sherlock-audit/2024-12-numa-audit/blob/main/Numa/contracts/lending/Unitroller.sol#L179
The presence of a return function call within a Yul assembly block can prematurely halt execution, preventing subsequent code from being executed. This behavior can lead to unexpected results or potential vulnerabilities if critical logic is skipped.

Vulnerability Details

In the identified Yul assembly block, the use of the return opcode causes the execution to stop entirely. This can be problematic if there is code following the assembly block that must execute to maintain the integrity of the protocol or complete the intended logic.

Issue

The return function call terminates the execution abruptly, skipping any instructions after the assembly block.

Affected Code

// contracts/lending/Unitroller.sol Line: 179
return(free_mem_ptr, returndatasize())

Impact

Premature execution halt might result in skipped essential operations, leading to unintended behaviors.
If critical logic for state updates or validations resides after the assembly block, it will be ignored, potentially causing system inconsistencies or vulnerabilities.

Severity Assessment

Severity: Medium

Likelihood: Moderate

Impact: The skipped logic could lead to state inconsistencies or a failure to execute essential operations.

Proof of Concept (PoC)

Deploy the Unitroller contract with the current code.
Call a function that invokes the Yul block containing return.
Observe that any logic following the Yul block is not executed.

Recommendations

Replace the return opcode with structured Solidity code or ensure that it is used only when appropriate, i.e., at the end of execution paths where no further logic is required.
If assembly is necessary, explicitly manage control flow to avoid unintentional halts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant