Astaria contest - Bjorn_bug's results

On a mission is to build a highly liquid NFT lending market.

General Information

Platform: Code4rena

Start Date: 05/01/2023

Pot Size: $90,500 USDC

Total HM: 55

Participants: 103

Period: 14 days

Judge: Picodes

Total Solo HM: 18

Id: 202

League: ETH

Astaria

Findings Distribution

Researcher Performance

Rank: 103/103

Findings: 1

Award: $25.33

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: ladboy233

Also found by: Bjorn_bug, Jujic, KIntern_NA, RaymondFam, fs0c, joestakey, kaden, obront, unforgiven

Labels

bug
2 (Med Risk)
satisfactory
duplicate-51

Awards

25.3332 USDC - $25.33

External Links

Lines of code

https://github.com/AstariaXYZ/astaria-gpl/blob/4b49fe993d9b807fe68b3421ee7f2fe91267c9ef/src/ERC4626-Cloned.sol#L19

Vulnerability details

Impact

As arbitrary ERC20 tokens can be deposited in the liquidity pool to earn yield and mint VaultTokens to acquire shares, and since there is no indication in the documentation that the protocol will not support fee-on-transfer tokens or rebasing/deflationary/inflationary tokens in the future. Therefore, the "assets" parameter should be calculated each time to make sure that the amount of "assets" received is excluding any fees. This will prevent any potential abuse in minting more shares than intended.

Proof of Concept

function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) { // Check for rounding error since we round down in previewDeposit. require((shares = previewDeposit(assets)) != 0, "ZERO_SHARES"); require(shares > minDepositAmount(), "VALUE_TOO_SMALL"); // Need to transfer before minting or ERC777s could reenter. ERC20(asset()).safeTransferFrom(msg.sender, address(this), assets); _mint(receiver, shares); emit Deposit(msg.sender, receiver, assets, shares); afterDeposit(assets, shares); }

Tools Used

Inspection

Consider Using the balance before and after the transfer to calculate the received amount of assets instead of assuming that it would be equal to the amount passed as a parameter.

#0 - c4-judge

2023-01-26T16:57:21Z

Picodes marked the issue as duplicate of #51

#1 - c4-judge

2023-02-23T11:50:58Z

Picodes 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