mizazhaider-ceh/agentarsenal/defi-threats

Claude Code and agent skill by mizazhaider-ceh/agentarsenal

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when assessing DeFi protocols for economic and technical

Install

npx vskill@latest install mizazhaider-ceh/agentarsenal/defi-threats

SKILL.md

The same SKILL.md was published earlier as mizazhaider-ceh/agentarsenal/defi-threats.

DeFi attackers do not break code, they break assumptions: that prices are fair, that liquidity is deep, that voters are honest. This skill covers authorized assessment of DeFi threat models: mapping the economic assumptions, testing them on forks, and reviewing the mitigations. Test on local mainnet forks, never against live protocols.

Quick Workflow

  1. Map the money flows: deposits, borrows, swaps, liquidations, and

fees, with the contracts involved.

  1. List every external dependency: oracles, DEX pools, and other

protocols it composes with.

  1. Identify the economic assumptions: price sources, liquidity depth,

and honest majority assumptions.

  1. Test flash loan attacks on a fork: borrow, manipulate, profit,

repay, all in one transaction.

  1. Test oracle manipulation: move the price source and see what the

protocol does.

  1. Review MEV exposure: can transactions be sandwiched or frontrun for

profit.

  1. Check governance: can an attacker buy votes and change the rules.
  2. Report each broken assumption with the fork test that broke it.

1. Fork based testing setup

bash
# Fork mainnet locally for safe testing (needs an RPC URL you control)
anvil --fork-url "$RPC_URL" --fork-block-number 21000000 &
echo "local fork on 127.0.0.1:8545; fund a test account and attack the fork"
bash
# Impersonate a whale account on the fork to get test capital
cast rpc anvil_impersonateAccount 0xWhaleAddress --rpc-url http://127.0.0.1:8545
# Never do this on mainnet; it only works on your local fork

2. Oracle manipulation test pattern

python
#!/usr/bin/env python3
"""Oracle manipulation test outline (run against your local fork)."""
print("attack pattern:")
print("1. read the protocol's price source (which pool, which oracle)")
print("2. on the fork, swap a large amount to move the pool price")
print("3. call the protocol function that reads the manipulated price")
print("4. measure the profit: borrow too much, liquidate unfairly, etc.")
print("5. check mitigations: TWAP window, Chainlink fallback, sanity bounds")
bash
# Inspect what the protocol actually reads for prices
grep -rn "getReserves\|latestRoundData\|consult\|quote" contracts/ | head -20
# Then on the fork: move the underlying pool and observe the effect

3. Flash loan attack surface checklist

bash
# Functions callable in one transaction that depend on manipulable state
grep -rn "flashLoan\|borrow\|liquidate" contracts/ --include="*.sol" | head -20
# For each: what stops an attacker from borrowing big, distorting a
# price, and extracting value before repaying in the same transaction

Edge cases

  • The fork drifts from mainnet state. Pin the block number and note

it; results are valid for that state.

  • Mitigations exist but have parameters (TWAP window, deviation

thresholds). Test the boundary values, not just the happy path.

  • The protocol is upgradeable. Economic review must cover the admin's

power too, not just the current logic.

  • Composability: the protocol is safe alone but dangerous combined

with another protocol's feature. Test the composition.

Escalation

  • Attack unprofitable on the fork due to gas or slippage: compute the

capital threshold where it becomes profitable and report that.

  • Logic too complex for manual review: use symbolic execution or

fuzzing (Foundry invariant tests) on the critical invariants.

  • Governance risk found: hand to dao-governance-risks for the deep

review.

Detection and defender view

DeFi defenders monitor mempools for attack transactions, oracles for deviations, and admin actions for surprises. They defend with TWAP oracles, borrow caps, pause mechanisms, and bug bounties sized to the TVL. The durable lesson from every major DeFi hack is that economic assumptions need the same rigor as code: document them, test them adversarially, and monitor them live.

Key references

  • SWC Registry: oracle and access weaknesses.
  • Major incident post mortems: oracle manipulation case studies.
  • Flash loan attack literature and mitigations.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mizazhaider-ceh/agentarsenal/defi-threats/badge)](https://verified-skill.com/skills/mizazhaider-ceh/agentarsenal/defi-threats)

Something wrong with this skill or its page? Tell us.