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

VaultFactory is suspicious of the reorg attack #238

Closed
code423n4 opened this issue Jul 14, 2023 · 2 comments
Closed

VaultFactory is suspicious of the reorg attack #238

code423n4 opened this issue Jul 14, 2023 · 2 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 duplicate-416 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/VaultFactory.sol#L67

Vulnerability details

Impact

Exploits involving Stealing of funds.

Proof of Concept

The deployVault function deploys a new vault contract using the create, where the address derivation depends only on the arguments passed.

At the same time, some of the chains (Polygon, Optimism, Arbitrum) to which the VaultFactory will be deployed are suspicious of the reorg attack.

File: VaultFactory.sol

67:      Vault _vault = new Vault(  

Link to Code

Even more, the reorg can be couple of minutes long. So, it is quite enough to create the position and transfer funds to that address, especially when someone uses a script, and not doing it by hand.

Optimistic rollups (Optimism/Arbitrum) are also suspect to reorgs since if someone finds a fraud the blocks will be reverted, even though the user receives a confirmation and already created a position.

If Alice creates a new vault, and then sends funds to it. Bob sees that the network block reorg happens and calls deployVault. Thus, it creates vault with an address to which Alice sends funds. Then Alices' transactions are executed and Alice transfers funds to Bob's controlled vault.

Tools Used

VS Code

Recommended Mitigation Steps

Deploy the Vault contract via create2 with salt.

Assessed type

Other

@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 Jul 14, 2023
code423n4 added a commit that referenced this issue Jul 14, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #416

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Aug 6, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Aug 6, 2023

Picodes marked the issue as satisfactory

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 duplicate-416 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants