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

Dangerous delegatecall for a malicous initcode #483

Closed
code423n4 opened this issue Oct 25, 2022 · 3 comments
Closed

Dangerous delegatecall for a malicous initcode #483

code423n4 opened this issue Oct 25, 2022 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 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/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/Holographer.sol#L164

Vulnerability details

Impact

Detailed description of the impact of this finding.
In line 164 of contract Holographer, it uses a delegatecall to allow another contract B (HolographRegistryInterface(HolographInterface(holograph).getRegistry())
.getReservedContractTypeAddress(contractType)) to modify the storage slots of Holographer since in delegatecall, the callee will use the same storage slots as its caller. As a result, a malicous callee will be able to use it init() function to revise all the parameters set by Holographer.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
https://github.com/code-423n4/2022-10-holograph/blob/f8c2eae866280a1acfdc8a8352401ed031be1373/contracts/enforcer/Holographer.sol#L164

Tools Used

Remix

Recommended Mitigation Steps

Avoid using delegatecall unless they are part of the Holograph package, an external contract can be malicous and might compromise the whole Holograph ecosystem, use call instead.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Oct 25, 2022
code423n4 added a commit that referenced this issue Oct 25, 2022
@gzeoneth gzeoneth added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Oct 31, 2022
@gzeoneth
Copy link
Member

Duplicate of #494

@gzeoneth gzeoneth marked this as a duplicate of #494 Oct 31, 2022
@gzeoneth gzeoneth added duplicate This issue or pull request already exists and removed sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue labels Oct 31, 2022
@ACC01ADE
Copy link

ACC01ADE commented Nov 9, 2022

Delegate calls are only made to internal protocol created and managed contracts.

@ACC01ADE ACC01ADE added sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue responded The Holograph team has reviewed and responded labels Nov 9, 2022
@gzeoneth gzeoneth added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Nov 21, 2022
@gzeoneth
Copy link
Member

Consider with #247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 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

3 participants