Normal behavior: withdraw_shares() allows investors to redeem their shares.
It computes payout, deducts company_balance, zeroes the investor’s shares, and then performs a raw_call() to transfer ETH back to msg.sender.
Specific issue:
The call to raw_call() happens after modifying key state variables, but without using any non-reentrant guard or mutex.
While Vyper’s pragma nonreentrancy on offers a baseline guard, it does not protect cross-contract calls made from a function that sends value to an untrusted contract — especially when multiple external functions can be called indirectly (for example, via fallback or self-destruct re-entry).
If an attacker uses a contract as the “investor” and implements a fallback that re-invokes another state-changing function (like fund_investor()), it can break accounting consistency or corrupt share totals.
Likelihood
Possible whenever an attacker invests through a smart-contract wallet with a malicious fallback.
Real-world likelihood: Low → Medium, since most investors are EOAs, but a single malicious contract investor is enough to trigger it.
Impact
High: Reentrancy could allow nested state changes before withdraw_shares() finishes, causing share accounting mismatches or bypassing checks in other functions (e.g., calling fund_investor() again to inflate shares before company_balance is restored).
Could corrupt issued_shares totals or create phantom balances.
severe integrity and solvency risk.
Explanation:
The attacker invests, then calls withdraw_shares().
During the ETH transfer in raw_call(), the attacker’s fallback re-invokes fund_cyfrin(1), causing share issuance logic to run in an inconsistent state.
This demonstrates that without an explicit non-reentrant modifier or balance-transfer isolation, reentrancy is possible and dangerous.
Explanation (brief)
Adopt a checks-effects-interactions pattern and/or an explicit reentrancy lock.
Always complete state updates before making external calls, and ensure no re-entry can occur into state-changing functions.
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.