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

Intended configuration of recoveryDelay < timelockDelay allows for malicious takeover by recovery spells #15

Closed
howlbot-integration bot opened this issue Oct 27, 2024 · 4 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working nullified Issue is high quality, but not accepted primary issue Highest quality submission among a set of duplicates 🤖_38_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue sufficient quality report This report is of sufficient quality

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/code-423n4/2024-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/RecoverySpell.sol#L95-L127

Vulnerability details

Vulnerability Details

Impact

RecoverySpell.sol states that it is of CRITICAL importance for the deployer to have recovery spells with the delay for the recoverySpell to become executable (hereafter referred to as recoveryDelay) shorter than the delay for a scheduled proposal to become executable in Timelock.sol (hereafter referred to as timelockDelay)

Even though it is only a comment, it says that the condition should be met by default and is basically a rule that should be followed, but that it is not possible to enforce that in the smart contracts.

This will make deployers to follow the comment's instructions. However, if the recovery spell is malicious, they will lose their safe.

Proof of Concept

  1. The attacker creates a recovery spell with recoveryDelay = 10 days.

  2. The deployer creates a new system instance with the malicious recovery spell and a timelockDelay of 20 days. He chooses this delay because of the comment that says it is of critical importance for the following to be true: recoveryDelay < timelockDelay.

  3. The recoveryDelay runs out and the malicious recovery spell gets executed.

Recommended Mitigation Steps

The timing constraints recommended to be used by the protocol are unsafe and the protocol needs to assess which timing constraints are not exploitable, if such timing constraints exist.

It should also be assessed whether it is possible to enforce the timing constraints in the smart contracts.

Assessed type

Timing

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_38_group AI based duplicate group recommendation bug Something isn't working primary issue Highest quality submission among a set of duplicates sufficient quality report This report is of sufficient quality labels Oct 27, 2024
howlbot-integration bot added a commit that referenced this issue Oct 27, 2024
@ElliotFriedman
Copy link

This is a known issue, already covered in the docs, see guardian scenarios https://github.com/code-423n4/2024-10-kleidi/blob/main/docs/EDGECASES.md#guardian

@ElliotFriedman
Copy link

all of these parameters will be enforced from the frontend as there is no way to enforce them onchain without revealing the recovery spells

@ElliotFriedman ElliotFriedman added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Oct 29, 2024
@GalloDaSballo
Copy link

I don't believe this is valid

There is no one intended configuration, the EDGECASES and Readme make it clear that it "depends on who you trust"

This seems like a known feature of the system

@c4-judge c4-judge added the nullified Issue is high quality, but not accepted label Oct 30, 2024
@c4-judge
Copy link

GalloDaSballo marked the issue as nullified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working nullified Issue is high quality, but not accepted primary issue Highest quality submission among a set of duplicates 🤖_38_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

3 participants