The share price calculation relies on the company's net_worth (company_balance - holding_debt) divided by the issued_shares. The owner has control over both the company_balance (via fund_cyfrin(0)) and the issued_shares (via increase_share_cap()).
A malicious owner can exploit this to perform a "rug pull" on investors by inflating the share price, attracting investment, and then deflating the share price to zero before the investor can withdraw.
Attack Steps:
Inflate: Owner funds the company with a massive amount of ETH (e.g., 10,000 ETH) using fund_cyfrin(0) when issued_shares is low. This instantly and artificially inflates the share price.
Attract: Investor buys shares at the inflated price.
Deflate: Owner calls pay_holding_debt() with a large msg.value. If msg.value exceeds the debt, the excess is added to company_balance. The owner can then call produce() repeatedly, draining the company_balance and setting the share price to near zero.
Result: The investor's shares are now worthless, and the owner has control of the withdrawn funds.
Likelihood: High
The owner has direct, immediate control over the two variables (company_balance and issued_shares) that determine the share price. The attack is a single-transaction exploit for the inflation phase and a simple sequence of calls for the deflation phase.
Impact: High
The vulnerability allows the owner to steal all investor funds by manipulating the share price to zero, resulting in a complete loss of capital for all non-owner investors. This is a direct financial loss and a protocol failure.
Owner inflates share price by funding company with 1000 ETH via fund_cyfrin(0).
Investor buys shares at inflated price (100 ETH investment).
Owner deflates share price by calling produce(50000), draining 500 ETH from balance.
Investor's share value drops by >30%, demonstrating the manipulation.
Supporting Code:
The owner should not be able to increase the company_balance without a corresponding increase in issued_shares.
Alternatively, the share price calculation should exclude owner-funded ETH from the net_worth calculation.
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.