Public investment flows through fund_cyfrin(1) → fund_investor(). The function computes a share price from the company’s net worth per outstanding share, and then mints new_shares = msg.value // share_price. If no shares exist, it falls back to INITIAL_SHARE_PRICE.
When some shares already exist (issued_shares > 0) but the company’s net worth is smaller than the outstanding share count (e.g., net_worth < issued_shares), the integer division
share_price = net_worth // issued_shares evaluates to 0. The next line
new_shares = msg.value // share_price then attempts division by zero, reverting every investment and creating a DoS for new investors until state changes (e.g., owner funding or debt reduction).
Likelihood: Medium
Occurs when net worth per issued share becomes < 1 wei, for example, after large issuance at high valuations followed by net worth shrinkage, or when debt nearly equals balance leaving a very small positive net_worth while issued_shares remains large.
Occurs when operational flows (holding-cost accrual, debt payments, revenue mismatches) drive net_worth // issued_shares == 0 while issued_shares > 0.
Impact: Medium
Investor DoS. All new investments revert due to division by zero, blocking recapitalization exactly when the company may need it most.
Economic instability. Prevents fresh capital inflow; can strand the company at the insolvency boundary, worsening other issues (e.g., rising holding debt, inability to produce).
Construct a state where net_worth = 1 wei and issued_shares is large, forcing share_price = 0, and show that calling fund_cyfrin(1) reverts.
Enforce a strictly positive share price whenever issued_shares > 0
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.