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

MixinGrantKeys:grantKeys possible DoS with (Unexpected) revert #62

Open
code423n4 opened this issue Nov 22, 2021 · 2 comments
Open

MixinGrantKeys:grantKeys possible DoS with (Unexpected) revert #62

code423n4 opened this issue Nov 22, 2021 · 2 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

GiveMeTestEther

Vulnerability details

Impact / POC

A user can share the minimum possible time of his key (and buy additional time by extending the key to have enough time to make the attack work) to a recipient of the "grantKeys()" such that for this recipient the "require(expirationTimestamp > toKey.expirationTimestamp, 'ALREADY_OWNS_KEY');" reverts. This will revert the whole transaction and no recipient will receive an airdropped key.

An attacker can optimize for which recipient & key expiration timestamp to maximize gas griefing.

This attack is also feasible, by buying a key for a recipient or transferring his "key" to the recipient (buys for himself and transfers to the recipient) if this allows the "require(expirationTimestamp > toKey.expirationTimestamp, 'ALREADY_OWNS_KEY');" to revert.

grantKeys(): https://github.com/code-423n4/2021-11-unlock/blob/ec41eada1dd116bcccc5603ce342257584bec783/smart-contracts/contracts/mixins/MixinGrantKeys.sol#L22

Tools Used

Manual Analysis

Recommended Mitigation Steps

  • skip the users that satisfy the require condition (change to an if statement) and don't emit an event for skipped users
  • or create a new event for key granting that differentiates by user that received an airdrop an by users that didn't
@code423n4 code423n4 added 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 labels Nov 22, 2021
code423n4 added a commit that referenced this issue Nov 22, 2021
@julien51 julien51 added disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons labels Jan 3, 2022
@0xleastwood
Copy link
Collaborator

This sounds like something that should be handled. As the protocol can be impacted by this issue, I'll keep this as medium for now.

@0xleastwood
Copy link
Collaborator

Actually, after thinking about this more, the onlyKeyGranterOrManager could simply not include the malicious user in the transaction. To maintain such an attack could also be costly as it requires the attacker to continuously purchase membership. Marking this as low.

@0xleastwood 0xleastwood added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jan 16, 2022
@0xleastwood 0xleastwood removed the disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants