-
Notifications
You must be signed in to change notification settings - Fork 7
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
Arbitrary transactions possible due to insufficient signature validation #300
Comments
raymondfam marked the issue as sufficient quality report |
raymondfam marked the issue as duplicate of #23 |
raymondfam marked the issue as not a duplicate |
raymondfam marked the issue as duplicate of #46 |
alex-ppg marked the issue as not a duplicate |
alex-ppg marked the issue as primary issue |
This exhibit is incorrect as the Warden specifies that a This statement is incorrect as the second-to-last statement of the As such, this exhibit is invalid. |
alex-ppg marked the issue as unsatisfactory: |
alex-ppg marked the issue as unsatisfactory: |
Hello @alex-ppg
the line require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "GS026"); just checks that the address is not a zero address, but when } else if (v == 1) {
// If v is 1 then it is an approved hash
// When handling approved hashes the address of the approver is encoded into r
currentOwner = address(uint160(uint256(r)));
// Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction
require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "GS025"); meaning an attacker can simply create a multi-sig contract of his own and bypass the signature validation. since when A similar issue was found in here in biconomy contest |
Hey @shealtielanz, thanks for bringing this to my attention! I believe you are misinterpreting the referenced check as well as what the original Biconomy contest issue was about. I will preface this by saying that the code is out-of-scope as it is Gnosis Safe code. In the Biconomy contest, the relevant
This assumption does not stand in the Brahma contest. The line you have referenced: require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "GS026"); Does not simply check that the As such, the Please let me know if the above address your concerns! |
Lines of code
https://github.com/code-423n4/2023-10-brahma/blob/dd0b41031b199a0aa214e50758943712f9f574a0/contracts/src/core/ConsoleFallbackHandler.sol?plain=1#L39-L54
Vulnerability details
Impact
An attacker can create arbitrary transaction by evading signature validation.
Proof of Concept
The protocol supports contract signed transactions
(EIP-1271)
. The support is implemented as we can see in theisValidSignature
callThe
isValidSignature
function does a thorough check in order to be certain a signature is valid but in this case there is a bug in thecheckSignatures
which is called by theisValidSignature
function.https://github.com/code-423n4/2023-10-brahma/blob/dd0b41031b199a0aa214e50758943712f9f574a0/contracts/src/core/ConsoleFallbackHandler.sol#L52C1-L53C10
The
checkSignatures
function inside the Safe contracts, does not check whether the signer is actually the contract owner in a acase wherev=0
. One might argue that thecheckSignatures
function is presently out of scope but this is still a valid bug as theisValidSignature
in theConsoleFallbackHandler
calls thecheckSignatures
function in order to verify if a signature is truly valid.https://github.com/code-423n4/2023-10-brahma/blob/dd0b41031b199a0aa214e50758943712f9f574a0/contracts/lib/safe-contracts/contracts/GnosisSafe.sol#L240C5-L240C31
A hacker can craft a signature that bypasses the signature requirements and sets a hacker controlled signer that will always return
EIP1271_MAGIC_VALUE
from theisValidSignature.
If exploited, theisValidSignature
will end up allowing a forged signature from a fake signer. Any Contract that make calls to theisValidSignature
function will be affected as well becausecheckSignatures
does not validate that the signer is the caller or owner of the contract.This impacts the
execTransaction
function in theGnosisSafe
contracts most especially.Tools Used
Manual Review
Recommended Mitigation Steps
Properly validate that the
signer
is theowner
in thecheckSignatures
function in order to keep theisValidSignature
function in theConsoleFallbackHandler
safe.Assessed type
Other
The text was updated successfully, but these errors were encountered: