-
Notifications
You must be signed in to change notification settings - Fork 3
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
attacker can make a gnosis safe multisig creation fail #257
Comments
alex-ppg marked the issue as duplicate of #354 |
alex-ppg marked the issue as insufficient quality report |
dmvt marked the issue as unsatisfactory: |
hi judge @dmvt, i will like to point out reasons why i believe the primary issue this issue has been grouped with is of lower quality and not accurate. I believe this issue of mine here has been unfairly marked OOS.
I will like to suggest a review of this issue and hope the judge finds it valid as a medium severity because it does impact the availability of a function in the protocol and root cause of the issue is in an in-scope contract. |
dmvt marked the issue as unsatisfactory: |
While I think you are splitting hairs here and that the issues are effectively the same, since you have avoided pointing to ServiceRegistry, I have adjusted my ruling to reflect the difference. I still consider this to be unsatisfactory due to the simple lack of motivation problem. While true that an attacker can grief the creation, they gain nothing by doing so. They also incur a higher gas fee than they inflict, making this extremely unlikely. |
Based on this issue, I have proposed an org rule to be taken up by the next Supreme Court session: code-423n4/org#143 |
Hi @dmvt The gain is preventing use of the function. The function is to be used for creating multisigs used in the protocol. Preventing the creation will simply stall genuine protocol processes for the period the attack is on for.
While it is true an attacker will pay higher gas fee to front run, they may derive satisfaction from simply DOSing. I think Assets do not have to be at risk or should there be a value leak. This attack can be done over and over again to affect the availability of the create() function |
You have not provided any additional information in your comment above. My ruling in this case is final. Please continue any conversation you have around issues of this type in the org issue linked above. |
Lines of code
https://github.com/code-423n4/2023-12-autonolas/blob/2a095eb1f8359be349d23af67089795fb0be4ed1/registries/contracts/multisigs/GnosisSafeMultisig.sol#L91
Vulnerability details
Impact
There is a potential vulnerability in the
create()
function ofGnosisSafeMultisig.sol
due to the way the nonce is handled. The create() function uses thecreateProxyWithNonce()
function fromgnosisSafeProxyFactory
, and the nonce is supplied as part of thedata
parameter to the create() function. However, this approach allows an attacker to front-run the transaction by submitting their own create request with the same parameters. If attacker's tx gets executed before the legitimate tx, the attacker gets the address for the multisig and the legitimate tx will fail.The issue arises because the attacker can create the exact address that is expected to be generated by the
CREATE2
call inIGnosisSafeProxyFactory(gnosisSafeProxyFactory).createProxyWithNonce()
when the legitimate transaction is made. Since the parameters and, consequently, the final salt and initializer will be the same, the attacker's transaction may get executed first. When the legitimate transaction is eventually executed, the address will already be occupied, and the Ethereum Virtual Machine (EVM) will reject its creation.Attacker can decide to do this as many times as possible just to grief the caller of the create() function. This can essentially prevent/block the create functionality from being used by the protocol at a certain time.
Proof of Concept
data
parameter of create() function.https://github.com/code-423n4/2023-12-autonolas/blob/2a095eb1f8359be349d23af67089795fb0be4ed1/registries/contracts/multisigs/GnosisSafeMultisig.sol#L91C1-L99C69
https://github.com/code-423n4/2023-12-autonolas/blob/2a095eb1f8359be349d23af67089795fb0be4ed1/registries/contracts/multisigs/GnosisSafeMultisig.sol#L106
Because the nonce is gotten from the parameter which is supplied by the caller, it can be watched and front run to cause a legitimate tx to fail.
Below is a POC i made to demonstrate this scenario:
registries/test
.registries
folder and run test withnpx hardhat test ./test/<your test file name>.js
Tools Used
manual review, hardhat
Recommended Mitigation Steps
To address this vulnerability and enhance clarity, consider modifying the create() function to use a nonce that is generated and managed within the function itself. Make sure the nonce is self incrementing and unique to each call. This would prevent attackers from supplying their own nonce via parameters and front-running the transaction. For example something like this can be implemented:
Assessed type
Other
The text was updated successfully, but these errors were encountered: