DYAD - 0xlucky'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: 148/183

Findings: 1

Award: $3.82

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

3.8221 USDC - $3.82

Labels

bug
3 (High Risk)
satisfactory
sufficient quality report
:robot:_52_group
duplicate-308

External Links

Lines of code

https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/Vault.kerosine.unbounded.sol#L56-L67

Vulnerability details

Impact

As mentioned in docs migration is going to happen from vaultManager to vaultManagerv2 , So during migration as mentioned in Deploy.V2.s.sol new WETH vault and new wSTETH vault will be deployed. And in that deploy script dyad is not deployed again. So considering that it can cause underflow in assetPrice and it will revert the function as in that numerator is calculated using above two values.

Also in observation 6.4 is mentioned that while calulating tvl, kerosene
vaults should not be consider. so only weth steth are remained.

Proof of Concept

"uint numerator = tvl - dyad.totalSupply();

here tvl will be totalvalue locked of vaults ( WETH and wSTETH ) which is calculated by balanceOf(address(vault)) , which will be very less when new vaults will be deployed of above 2 vaults.

But dyad contract address will be old only, dyad.totalSupply() would be very large.

And new deployed vaults would not be able to cope up with dyad totalsupply, so it will be less and underflow will occur and function will always revert, so we will not be to get assetprice from vault.kerosine.unbounded.sol .

Tools Used

Manual Review

So instead of getting value of number of token from balanceOf(addres(vault)) , it should be mantained via state variable (internal accounting), so that value can be maintained while migrating too.

Assessed type

Under/Overflow

#0 - c4-pre-sort

2024-04-27T18:17:29Z

JustDravee marked the issue as duplicate of #958

#1 - c4-pre-sort

2024-04-29T08:39:36Z

JustDravee marked the issue as sufficient quality report

#2 - c4-judge

2024-05-05T13:48:49Z

koolexcrypto marked the issue as duplicate of #308

#3 - c4-judge

2024-05-11T20:10:13Z

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