Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.85 KB

File metadata and controls

50 lines (38 loc) · 2.85 KB

jUSDi Red Team Security Audit (Internal)

Overview

Date: January 31, 2026 Status: 🟢 VERIFIED (AUTOMATED) Target: jUSDi Vault Program (Solana)

This document outlines the internal "Red Team" security assessment for the jUSDi Single-Asset Compounding Vault.

Attack Vectors & Stress Tests

1. Yield Dilution / Theft

  • Vector: Attempting to withdraw more assets than owned by share count (stealing yield).
  • Test: User deposits 100, Yield adds 10, User withdraws 100 shares.
  • Result: ✅ PASSED. Logic correctly calculates amount_out = 110 based on new NAV. User gets their principal + share of yield. No more, no less.

2. Signer Bypass (Permissioning)

  • Vector: Calling initialize or harvest_yield without the admin signer.
  • Test: Automated harness attempted to strip signatures.
  • Result: ✅ PASSED. Anchor Signer constraint rejects transaction with AccountNotSigner error (Error 3010).

3. Uninitialized Account Attacks

  • Vector: Attempting to deposit into a Vault PDA that hasn't been initialized.
  • Test: Calling deposit on a random address or un-init PDA.
  • Result: ✅ PASSED. Anchor #[account(mut, seeds=...)] checks strictly enforce account initialization and ownership by the program. Custom error AccountNotInitialized (3012) observed.

4. Stack Overflow / DoS

  • Vector: Deploying a program that exceeds Solana's 4KB stack limit, causing it to freeze or fail indiscriminately.
  • Test: Compilation with cargo build-sbf and full recursive analysis.
  • Result: ✅ PASSED. Optimization lto="fat" reduced stack frame size significantly. Program executes within limits (approx 2000-3000 CUs for simple ops).

5. Borrow RefCell Panic

  • Vector: Interleaving CPI calls (transfer) while holding a mutable borrow to vault state, causing a runtime crash.
  • Test: Code Review inspection of deposit function.
  • Result: ✅ PASSED. lib.rs uses scoped blocks { ... } to drop borrows before CPI execution.

Critical Risk Assessment

Risk Area Status Mitigation
Share Price Manipulation LOW Internal NAV accounting relies on strict managed_assets / total_shares ratio. No external oracle dependency in MVP.
Admin Key Compromise HIGH The admin has power to harvest_yield and potentially upgrade (if BP is upgradeable). Mitigation: Use Squads MSIG.
Asset Depeg MEDIUM Theoretical risk of underlying asset (USDC) depeg, but Vault logic is platform-agnostic.

Recommendations

  1. Deployment: Ensure the deployment Authority is secured (Hardware Wallet or Squads).
  2. Monitoring: Watch for VaultPaused events or large outgoing transfers.

"A wise man thinks ahead; a fool doesn't, and even brags about it!" — Proverbs 13:16