DYAD - kartik_giri_47538'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: 174/183

Findings: 1

Award: $0.02

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Description: The deposit function in the VaultManagerV2 allowing anyone to make deposit because of its modifier isValidDNft(id) it only check that nft is owned by someone. By exploiting this an attacker can make 0 deposit and front-run the user withdraw tx and revert that tx cause the withdraw function have the check which checks that user can't withdraw there funds in same block as of deposit tx.

Proof of Concept:

  1. The user calls the withdraw function.
  2. But attacker is monitoring the txs.
  3. Now the attacker can front-run the user withdraw tx by giving higher gas fee and make the 0 amount of deposit in user position.
  4. Which will make the user withdraw tx revert cause of check in withdraw function.

Withdraw fubction check which will cause an DOS attack:-

  function withdraw(uint256 id, address vault, uint256 amount, address to) public isDNftOwner(id) {
       
@>      if (idToBlockOfLastDeposit[id] == block.number) revert DepositedInSameBlock();
        
        uint256 dyadMinted = dyad.mintedDyad(address(this), id); 
        
        Vault _vault = Vault(vault); 
        
       
        uint256 value = amount * _vault.assetPrice() * 1e18 / 10 ** _vault.oracle().decimals() / 10 ** _vault.asset().decimals();
       
        if (getNonKeroseneValue(id) - value < dyadMinted) revert NotEnoughExoCollat();
        _vault.withdraw(id, to, amount); 
        if (collatRatio(id) < MIN_COLLATERIZATION_RATIO) revert CrTooLow();
    }

Impact: I think high cause the attacker can DOS the user every they tries to withdraw the funds.

Recommended Mitigation: The recommended mitigation is to use isDNftOwner() modifier in deposit function which allows only owner of nft to deposit.

Assessed type

DoS

#0 - c4-pre-sort

2024-04-27T11:34:57Z

JustDravee marked the issue as duplicate of #1103

#1 - c4-pre-sort

2024-04-27T11:45:57Z

JustDravee marked the issue as duplicate of #489

#2 - c4-pre-sort

2024-04-29T09:32:55Z

JustDravee marked the issue as sufficient quality report

#3 - c4-judge

2024-05-05T20:38:08Z

koolexcrypto marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2024-05-05T21:12:22Z

koolexcrypto marked the issue as nullified

#5 - c4-judge

2024-05-05T21:12:30Z

koolexcrypto marked the issue as not nullified

#6 - c4-judge

2024-05-08T15:29:26Z

koolexcrypto marked the issue as duplicate of #1001

#7 - c4-judge

2024-05-11T19:44:45Z

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