-
Notifications
You must be signed in to change notification settings - Fork 0
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
Wrench attack resistance does not provide the advertised security guarantees #137
Comments
This finding didn't make it into the findings repo. With regards to wrench attack resistance, the documentation on the contest page (https://code4rena.com/audits/2024-10-kleidi) states that:
In particular the last sentence:
We show that, while using an intended system configuration, it is enough to use the wrench attack on two different days rather than to kidnap someone for the whole pause time and remain undetected In a different scenario, an attacker could just scare a user into using a recovery spell by social engineering and then execute one $5 wrench attack. I agree we're constructing a scenario here that is not straightforward and hence is not High severity. But given the rules of Medium severity on the one hand:
and that the main selling point is the $5 wrench attack resistance on the other hand, I believe Medium severity is appropriate. |
This finding should be a dupe with my submission 6 from the findings repo. I submitted it as a low but it looks like a valid medium severity concern, since the protocol will be unprotected for some duration. |
When keys are compromised, multiple parties can execute transactions, since all transactions are behind a timelock, all transactions will be cancelled, making it so that no transaction will be executable Meaning that Recovery Spell 2 will not be disrupted and instead will be able to work given a scenario of 2 consecutive attacks |
Okay, agree with you on this. This finding requires a key compromise in the sense of stealing a key such that the original owner of them loses access (for example I go to your house and take your seeds). |
This can hindered. The Safe implementation accepts a nonce as a part of the transaction hash which is then checked against the signature, meaning malicios actor can frontrun honest txs to increase the nonce and make them revert. Thus the honest user won't be able to cancel the malicios transactions. |
Lines of code
https://github.com/code-423n4/2024-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/Timelock.sol#L687-L700
https://github.com/code-423n4/2024-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/Timelock.sol#L815-L820
Vulnerability details
Vulnerability Details
Impact
The documentation states that when the cold signers of a safe are compromised, the pause guardian can pause the contract to cancel all malicious proposals, preventing them from being executed. After that, the recovery spell can be triggered to rotate the signing keys.
However, when the pause guardian calls
pause()
, a new pause guardian must be set by callingsetGuardian()
.This can only be done by the Timelock, meaning the proposal to set a new guardian has to wait
x days
until it can be executed.The waiting period is determined by the
delay
(hereafter referred to astimelockDelay
) of the Timelock, which has a maximum of30 days
.Furthermore a proposal can only be scheduled after the
pauseDuration
has ended.As a result, the contract may remain unprotected for at least
timelockDelay
if the pause guardian needs to pause the contract.If the cold signers are compromised again during this time, there will be no way to stop them from executing malicious proposals, which will cause a user to lose his funds.
Proof of Concept
The following values are chosen for the important variables:
It is important to note that the
delay
of the recovery spells does not have the same purpose as thetimelockDelay
.The cold signers are compromised.
RecoverySpellA is created to rotate the signing keys.
The pause guardian calls
pause()
to cancel all proposals, including the malicious ones, and gets deleted.After the
10 days
,executeRecoverySpell()
gets called to rotate the signing keys.The Safe schedules a new proposal to set a new guardian, which can be executed after the
5 days
.The cold signers of the safe get compromised again before the
timelockDelay
is over and callcancel()
to cancel the proposal to set a new guardian. They also schedule malicious proposals.RecoverySpellB is created to rotate the signing keys.
As there is no guardian to pause the contract, the malicious proposals will be executed before the
delay
of RecoverySpellB runs out.Recommended Mitigation Steps
Consider allowing a user to set multiple guardians.
It is important to make sure that this is compatible with the whole protocol.
Furthermore, it is insufficient to provide security measures that only work under the assumption of one compromise attempt.
While these are sufficient to protect against one $5 wrench attack, they simply raise the cost to a two times $5 wrench attack.
In particular it is not necessary to kidnap a user for
30 days
. It is sufficient to hit him with a $5 wrench on two different days.Assessed type
MEV
The text was updated successfully, but these errors were encountered: