SECURITY AUDIT

KUDAN AUDIT

Adversarial review of the KUDAN contracts — findings, fixes and coverage.

Scope: KudanVault, KudanStaking, OracleRouter, RegimeController, KudanToken, UniV3Twap (Solidity 0.8.24).

REVIEWINTERNAL SECURITY REVIEW · KUDAN TEAM
119
TESTS PASSING
0
HIGH / MEDIUM OPEN
2
FINDINGS FIXED
≥91%
VAULT COVERAGE
IMPORTANTThis is an internal, first-party security review by the KUDAN team — not an independent third-party audit. It is not a guarantee of safety. An external audit has not yet been commissioned; when one is, its report will be published here in full. Use experimental software at your own risk.

Summary

The review combined static analysis (Slither, zero unaddressed high/medium), an adversarial manual pass over every contract, and 119 unit / fuzz / invariant / lifecycle tests. Two Medium accounting issues were found and fixed, each now covered by a regression test. No Critical or High issue was substantiated, and no path to direct theft of user funds was found.

Infrastructure partners

KUDAN operates its off-chain and research infrastructure through two certified partner programs. Neither touches user funds or on-chain parameters — both are operational, not custodial.

ORACLE PARTNERNETWORK
OPN · LEVEL 2 PARTNER

Certified Oracle Cloud architecture and enterprise SLAs for the off-chain stack — indexers, liquidation keepers, monitoring and alerting. Distinct from the on-chain price oracles (Chainlink × Pyth).

NVIDIA PARTNER NETWORK
NPN · PARTNER

Partner resources and ecosystem tooling for the GPU-sector risk research and simulation workloads behind the risk engine. Does not issue or endorse xNVDA; changes nothing on-chain.

Findings

All confirmed findings, each reproduced with a test then fixed and re-verified.

MEDIUM

Staking fee cut leaked to LPs when no active stakers

KudanVault.harvestFees · KudanStaking.notifyFee

harvestFees debited the 25% staking allocation before notifyFee, which no-ops when there are no active stakers — the cut silently became LP yield. Fixed: notifyFee returns the accepted amount and the vault only streams (and debits) when active stakers exist, keeping the cut owed otherwise. CEI-clean.

FIXED · regression test
MEDIUM

Bad-debt write-off stranded by dust in a second market

KudanVault._absorbBadDebt

The socialization guard returned early if any market held nonzero collateral units, so 1 wei of dust in a second market could strand an insolvent position forever, leaving phantom debt in totalAssets. Fixed: the guard now triggers on residual collateral value below a dust threshold, not unit count.

FIXED · regression test
HARDENING

Non-18-decimal USDG would break valuation

KudanVault constructor

Collateral is valued in 1e18 USD and compared directly to USDG debt with no decimal normalization. The constructor now reverts (BadDecimals) unless USDG has 18 decimals, removing a deploy-time misconfiguration risk.

FIXED
HARDENING

Zero TWAP price could brick repay / write-off

KudanVault.repay · _absorbBadDebt

A degenerate zero return from the $KUDAN TWAP would revert with a division error. Both paths now revert explicitly (BadTwap) with a zero-price guard.

FIXED
NOTE

Insurance pool converts to buyback, not direct supplier make-whole

KudanVault._absorbBadDebt → KudanStaking.slash

On bad debt, slashed $KUDAN routes to the buyback accumulator rather than directly compensating USDG suppliers. This is by design (buyback pressure + first-loss capital) and documented here so the "insurance" framing is not overread as direct supplier reimbursement.

DOCUMENTED · by design

Methodology

  • Static analysis with Slither — zero unaddressed high/medium; intentional patterns triaged inline with justification.
  • Manual adversarial review of every contract: reentrancy/CEI, accounting drift, liquidation edge cases, oracle handling, ERC4626 share math, access control, griefing.
  • Property testing: fuzz (rate monotonicity, accrual, LTV cap, HF, liquidation soundness, ERC4626 round-trips) and invariants (collateral accounting, debt ≤ supply, share solvency).
  • Lifecycle integration test end to end: deposit → borrow → regime change → earnings → HF drop → liquidation → bad-debt slash.

What is sound

Pool-U compounding-index math and the 50/25/25 fee split are self-consistent; borrowed liquidity and the fee reserve cannot be withdrawn (maxWithdraw clamps to available cash). Interest cannot be bypassed by toggling payInKudan (gated on zero debt), and pending pool-K interest is synced on every position-touching path. Reentrancy is covered by nonReentrant + CEI throughout; the staking accumulator tracks pooled balance internally, defeating share-donation attacks. The dead-shares first-deposit guard, cooldown-aware slashing with an anti-brick dust floor, UniV3 negative-tick rounding, and the Pyth confidence/deviation checks all verified correct. The liquidation seize-cap with pro-rata repay down-scaling cannot over-seize or bypass the close factor. Access control is clean: timelock owner, guardian limited to pausing deposits and borrows only.