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

Signatures can be reused across forks #430

Closed
Tracked by #88
code423n4 opened this issue Oct 25, 2022 · 4 comments
Closed
Tracked by #88

Signatures can be reused across forks #430

code423n4 opened this issue Oct 25, 2022 · 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 disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) invalid This doesn't seem right responded The Holograph team has reviewed and responded sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/HolographERC20.sol#L244
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/abstract/EIP712.sol#L83-L89

Vulnerability details

Impact

In the case of a hard fork, the same signature can be considerd valid on both chains due to the lack on block.chainid computation in HolographERC20.permit().

Proof of Concept

The block.chainid will be used during initialization for HolographERC20.init() and EIP712_domainSeparatorV4().

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/HolographERC20.sol#L244

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/abstract/EIP712.sol#L83-L89

In the event of a hard fork, approvals via permit on one chain will be considered valid on the other chain.

Recommended Mitigation Steps

Include the chainid on HolographERC20.permit() hash schema to prevent double spending and replay attacks in the case of a chainsplit/hard fork.

@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 Oct 25, 2022
code423n4 added a commit that referenced this issue Oct 25, 2022
@gzeoneth
Copy link
Member

gzeoneth commented Oct 28, 2022

nice to have hark fork replay protection but ./abstract is out-of-scope; will downgrade to qa

@gzeoneth gzeoneth added the disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label Oct 28, 2022
@gzeoneth gzeoneth reopened this Oct 28, 2022
@alexanderattar alexanderattar added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Nov 8, 2022
@alexanderattar
Copy link

Good find. Chain id should be included to prevent replays if there is a chain fork.

@alexanderattar alexanderattar added the responded The Holograph team has reviewed and responded label Nov 8, 2022
@ACC01ADE ACC01ADE added sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue and removed sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels Nov 18, 2022
@ACC01ADE
Copy link

ACC01ADE commented Nov 18, 2022

Further review of the code makes this an invalid issue since block.chainid is clearly used and checked in the EIP712.sol contract.
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/abstract/EIP712.sol#L88

@ACC01ADE
Copy link

Additionally, the cached data in EIP712 is updated if there is a change in blockchain chain id for some reason.
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/abstract/EIP712.sol#L76

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 disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) invalid This doesn't seem right responded The Holograph team has reviewed and responded sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants