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

Signature bypass #20

Open
code423n4 opened this issue May 4, 2022 · 1 comment
Open

Signature bypass #20

code423n4 opened this issue May 4, 2022 · 1 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

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L185
https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L238-L240

Vulnerability details

Impact

It's possible to bypass verifySig and checkValidatorSignatures methods using empty signers.

Proof of Concept

The method ecrecover returns address(0) when the signature is wrong, so if a user use address(0) as a validator or _signer the return will be true.

_signer == ecrecover(messageDigest, _v, _r, _s);

Also, the method checkValidatorSignatures never check that the validator is repeated inside the array, so if someone it's able to specify the validators, and it's able to sign with one valid key, if he repeat the same signature multiple times, it will be computed as a different one.

Recommended Mitigation Steps

check that _signer is not empty.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels May 4, 2022
code423n4 added a commit that referenced this issue May 4, 2022
@maptuhec maptuhec added the duplicate This issue or pull request already exists label May 11, 2022
@maptuhec
Copy link
Collaborator

Duplicate of #127

@maptuhec maptuhec marked this as a duplicate of #127 May 11, 2022
@albertchon albertchon added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels May 20, 2022
@JeeberC4 JeeberC4 added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed duplicate This issue or pull request already exists 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jun 13, 2022
@JeeberC4 JeeberC4 reopened this Jun 13, 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
Projects
None yet
Development

No branches or pull requests

4 participants