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

Re-org attack in factory #466

Open
c4-submissions opened this issue Nov 17, 2023 · 4 comments
Open

Re-org attack in factory #466

c4-submissions opened this issue Nov 17, 2023 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-313 grade-b Q-05 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-11-canto/blob/335930cd53cf9a137504a57f1215be52c6d67cb3/asD/src/asDFactory.sol#L34

Vulnerability details

Description

NOTE --> For a better understanding, see this as a reference.

In asDFactory, function create does deploy a new asD token using the new keyword (so CREATE underhood). That means the address derivation of the new token depends only on the asDFactory nonce and due to the nature of blockchain networks, which do not maintain a single chain but multiple child ones with a primary one (see here), it is possible to suffer from block re-orgs, opening the door for the next attack scenario:

Attack scenario

Imagine that Alice deploys a new asD token, and links it against a certain market. Bob sees that the network block re-org is gonna happen and calls asDFactory, function create and deploys an asD token at the same address of Alice's one, but on the "re-orged blockchain branch". By doing that, Bob becomes the owner of such a token instead of Alice, being able to withdraw all the interest accrued by such a token, leading to a theft of interest.

Recommended Mitigation Steps

Deploy the asD token via CREATE2 with a salt given as a function argument.

Assessed type

Other

@c4-submissions c4-submissions 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 17, 2023
c4-submissions added a commit that referenced this issue Nov 17, 2023
@c4-pre-sort
Copy link

minhquanym marked the issue as duplicate of #313

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Nov 29, 2023
@c4-judge
Copy link

MarioPoneder changed the severity to QA (Quality Assurance)

@c4-judge
Copy link

MarioPoneder marked the issue as grade-c

@c4-judge c4-judge added grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards grade-b and removed grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Nov 29, 2023
@c4-judge
Copy link

c4-judge commented Dec 4, 2023

MarioPoneder marked the issue as grade-b

@C4-Staff C4-Staff reopened this Dec 4, 2023
@C4-Staff C4-Staff added the Q-05 label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-313 grade-b Q-05 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

4 participants