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

QA Report #123

Open
code423n4 opened this issue Aug 5, 2022 · 0 comments
Open

QA Report #123

code423n4 opened this issue Aug 5, 2022 · 0 comments
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax valid

Comments

@code423n4
Copy link
Contributor

QA report

Low Risk

[L-01] The recoverKey function don't out of it's bound

In SignatureDecoder.sol, recoverKey function if call this function with a high pos, this overflow the messageSignatures, this would contain bytes (0) or maybe dirty bytes

Check if the position does not overflow the array:

function recoverKey(
    bytes32 messageHash,
    bytes memory messageSignatures,
    uint256 pos
) internal pure returns (address) {
    uint256 messageSignaturesLength = messageSignatures.length;
    if (messageSignaturesLength % 65 != 0) {
        return (address(0));
    }
    if (pos < messageSignaturesLength / 65) {
        return (address(0));
    }

    uint8 v;
    bytes32 r;
    bytes32 s;
    (v, r, s) = signatureSplit(messageSignatures, pos);

    // If the version is correct return the signer address
    if (v != 27 && v != 28) {
        return (address(0));
    } else {
        // solium-disable-next-line arg-overflow
        return ecrecover(toEthSignedMessageHash(messageHash), v, r, s);
    }
}
@code423n4 code423n4 added bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Aug 5, 2022
code423n4 added a commit that referenced this issue Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax valid
Projects
None yet
Development

No branches or pull requests

2 participants