Skip to content

Security: frekramp/forgemind

Security

SECURITY.md

ForgeMind — Smart Contract Security Report

Contracts: ForgeVault.sol, MockYieldStrategy.sol, ForgeActionLog.sol, ForgeProfile.sol, interfaces/IYieldStrategy.sol Network: LiteForge (LitVM) testnet · chain 4441 · Solidity 0.8.24 (Foundry) Review type: Internal security review + threat model of the fund-handling paths Status: ✅ No critical vulnerabilities in the fund paths · 75/75 tests passing Last updated: 2026-06-11


Summary

ForgeMind's vault is built defensively for a money-handling contract and is solvent by construction: user principal is custodied 1:1 as native zkLTC, and simulated yield payouts are capped by a pre-funded reward pool, so a yield shortfall can never block a principal withdrawal. Every fund-moving entrypoint is reentrancy-guarded and follows checks-effects-interactions. The autonomous agent and keeper are non-custodial: they never hold keys and can only ever move a user's own funds, never extract them.

Result: no critical vulnerabilities were found in the deposit / withdraw / mode-switch / yield paths. The full suite of 75 tests passes across core, adversarial, reentrancy, edge-case, and aggregate suites.


Test coverage — 75 / 75 passing

$ forge test
Ran 7 test suites: 75 tests passed, 0 failed, 0 skipped (75 total tests)
Suite Focus
ForgeVault deposit / withdraw / withdrawAll, Stack/Grow, goals, projection
ForgeVaultEdge boundary + adversarial edge cases
ForgeVaultAggregates TVL + user-registry accounting
ForgeReentrancy malicious-recipient reentrancy on the fund paths
ForgeAgent keeper authorization, expiry, revocation, scope
ForgeActionLog decision ledger + attested-signer verification
ForgeProfile missions / XP / registry

Threat model — fund paths

Attack vector Mitigation Status
Reentrancy on deposit / withdraw / claim nonReentrant on every fund-moving entrypoint; external native sends happen last (checks-effects-interactions) ✅ Mitigated
Yield shortfall starves a principal withdrawal Principal held 1:1; payouts capped at rewardPool so the strategy never sends more than it holds; TVL tracks principal only ✅ Solvent by construction
Integer overflow / underflow Solidity 0.8.24 built-in checks; TVL deliberately excludes unrealized yield to avoid underflow ✅ Mitigated
Keeper draining user funds Keeper grant is opt-in, expiry-gated, instantly revocable, with separate compound/rebalance permissions; it can only act on the user's own position and can never withdraw to itself or touch another user ✅ Non-custodial
Agent holding user keys The agent only prepares transactions; the user signs every one in their own wallet ✅ Non-custodial
Strategy swapped out from under users setStrategy is guarded to zero outstanding principal, so it can't orphan or strand Grow funds ✅ Guarded
Unbounded on-chain loops / gas griefing Paginated user registry; no unbounded iteration ✅ Mitigated
Forged agent decisions in the ledger logAttested verifies a trusted-signer ECDSA signature on-chain before recording a decision ✅ Verified on-chain

Non-custodial guarantees

  • The agent never holds private keys. It calls propose* tools that return prepared transactions; the user signs each one.
  • The keeper grant (authorizeAgent) is capped by an expiry, instantly revocable (revokeAgent), split into separate compound / rebalance permissions, and can only ever move the user's own funds. It cannot withdraw, transfer out, or touch another user's position.

Scoped by design for the testnet hackathon (disclosed, not defects)

  • Simulated yield. Grow-mode's ~5% APY is paid from a pre-funded testnet reward pool, not real protocol revenue. Principal is always returnable 1:1. The IYieldStrategy interface lets a real yield source drop in on mainnet without changing the vault.
  • Single-owner admin. The deployer key holds setStrategy / setAgent, used only to wire the contracts at deploy. It is a throwaway testnet key and cannot touch user principal (it can't withdraw funds; setStrategy is zero-principal-guarded; a keeper it sets can still only act on opted-in users' own funds).

Mainnet hardening roadmap

These are forward-looking productionization steps, not current risks to testnet users:

  • Move ownership behind a timelock + multisig, and make it rotatable.
  • Use a pull-payment on the Grow→Stack rebalance so a contract recipient with a reverting receive() can't block its own rebalance.
  • Swap MockYieldStrategy for a real yield source (e.g. liquid staking) through the existing IYieldStrategy interface.

Conclusion

For its scope — a non-custodial testnet vault with clearly-labelled simulated yield — ForgeMind's contracts are sound. The money paths are reentrancy-safe and solvent by construction, the agent and keeper are non-custodial and tightly scoped, and all 75 tests pass. No critical vulnerabilities were found in the fund-handling logic. The roadmap items above are standard mainnet-hardening steps, not present-day risks.

Reproduce: cd contracts && forge test

There aren't any published security advisories