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

Emit incorrect error

Vulnerability Details

Error selector 0xbac65e5b‎ is the encode of error MulWadFailed(), not the MathMasters__MulWadFailed() in comment.

Tools Used

Manual.

Recommendations

bytes4 selector = MathMasters__MulWadFailed.selector;
assembly {
...
mstore(0x40, selector)
...
}

PoC

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "forge-std/Test.sol";
import {MathMasters} from "../src/MathMasters.sol";
contract IncorrectErrorSelector is Test {
// error for mulWad and mulWadUp
error MulWadFailed();
// success
function test_es_mulwad() external {
vm.expectRevert(MulWadFailed.selector);
MathMasters.mulWad(type(uint256).max, type(uint256).max);
}
}
Updates

Lead Judging Commences

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

Wrong error selector

Support

FAQs

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