The share price calculation uses integer division (//), which leads to precision loss. While this is acceptable for small numbers, the loss becomes significant and exploitable when the company scales to high values of net_worth and issued_shares.
The share price is calculated as:
share_price: uint256 = net_worth // max(self.issued_shares, 1)
Because Vyper does not use fixed-point math by default, any remainder from the division is discarded. This discarded value represents value lost from the company's net worth, which is effectively a form of dilution for existing shareholders.
An attacker can exploit this by making a large investment that results in a significant remainder, then immediately withdrawing their shares, capturing the value of the discarded remainder.
Likelihood: Medium
The exploit requires the company to reach a high valuation and a specific ratio of net_worth to issued_shares that maximizes the remainder. This is a specific condition, but one that is guaranteed to occur as the protocol scales.
Impact: Medium
The impact is a gradual, but persistent, dilution of existing shareholders' equity. While not a direct fund drain, it creates an unfair economic model where a portion of the company's value is lost on every share purchase and withdrawal, making the protocol less trustworthy for large investors.
Create high-valuation scenario: Owner funds company with 10,000 ETH.
Two investors invest identical amounts (1 ETH each).
Floor division in share price calculation discards remainder, causing precision loss.
The test demonstrates that remainder > 0, confirming value loss due to integer division.
Supporting Code:
The contract should use a fixed-point math library to ensure high precision in all financial calculations.
When msg.value is slightly below share_price, fund_investor() issues zero shares but still accepts the full ETH payment. This allows a single transaction to burn a substantial amount (e.g., >100 ETH) with no equity granted.
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.