Under normal conditions, withdraw_shares() allows investors to redeem their shares for ETH based on the company’s current net worth per share. The function ensures fairness by applying penalties and payout caps, and then transfers the appropriate value to the investor.
The issue occurs when the company is bankrupt (company_balance < holding_debt). In this case, the calculated share price becomes zero, resulting in a payout of zero. The function still resets the investor’s shares and decreases issued_shares, permanently erasing investor holdings without any compensation. This occurs silently without reverting, leading to a total and irreversible loss of investor funds.
Likelihood:
This occurs whenever the company becomes insolvent (its debt exceeds its liquid balance).
Investors attempting to redeem shares during this period automatically trigger the condition since get_share_price() returns zero.
Impact:
Investors permanently lose all of their shares without receiving any compensation.
The company’s share registry and total supply are altered, enabling potential manipulation of future equity or recovery events.
Explanation of PoC:
The owner funds the company to provide initial liquidity.
The investor purchases shares via fund_cyfrin(1).
We artificially inflate holding_debt to exceed company_balance to simulate bankruptcy.
The investor calls withdraw_shares().
Because the company is insolvent:
get_share_price() returns 0
payout = shares * share_price = 0
Investor shares are reset to 0 anyway
Result: The investor permanently loses their shares and receives no ETH, demonstrating the vulnerability.
Add a solvency check before allowing share withdrawals to prevent irreversible loss.
Description: Insolvency is not permanent; owner can always restore solvency via capital injection or debt repayment. Investor loss at zero net worth is normal investment risk, not a bug.
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.