bittersecurity/vigilo/economic-attack
Claude Code and agent skill by bittersecurity/vigilo
- community
Checking that the SKILL.md file is still in the repository.
Auto-loaded by flashloan-auditor and defi-auditor agents during Phase 2. Provides detection patterns for: spot price manipulation, oracle staleness, short TWAP, donation attacks, slippage, flash loan governance. Core artifact: Price Flow Map.
Install
npx vskill@latest install bittersecurity/vigilo/economic-attackSKILL.md
The same SKILL.md was published earlier as bittersecurity/vigilo/economic-attack.
Economic Attack Vulnerability Analysis
OWASP SC02/SC07:2025 - Oracle Manipulation (#2) and Flash Loan Attacks (#7) in OWASP SC Top 10 (2025). Flash loans enable 60%+ of DeFi exploits, with 2024-2025 major attacks including Cetus ($223M), Euler ($197M), KiloEx ($117M). Price manipulation accounts for 34%+ of market manipulation exploits.
Attacker Mindset: Infinite Capital
CRITICAL: With flash loans, attackers have INFINITE CAPITAL for one transaction.
Key insight: If ANY step fails, entire transaction reverts. Attacker loses only gas (~$50). This means attackers can try complex attacks with zero risk.
Why Economic Attacks Happen (Root Causes)
Root Cause 1: Single Source Price Dependency
Protocol trusts ONE price source that attacker can manipulate.
Attacker's view: "I can move this price with enough capital. Flash loan gives me that capital."
Root Cause 2: Spot Price Trust
Using current-moment values instead of time-averaged values.
Detection: Any getReserves(), slot0(), balanceOf() used for pricing is suspect.
Root Cause 3: Staleness Blindness
Oracle price could be hours or days old, but protocol uses it anyway.
Detection: latestRoundData() without checking updatedAt timestamp.
Root Cause 4: Composability Trust
Protocol blindly trusts external protocol's reported values.
Attacker's view: "I can donate to that vault and inflate pricePerShare, then borrow against it."
The Price Flow Map (Core Artifact)
Trace how prices flow through the system:
Document each price dependency:
| Function | Price Source | Manipulable? | Impact if Manipulated | |
|---|---|---|---|---|
| liquidate() | Chainlink ETH/USD | Staleness only | Unfair liquidations | |
| borrow() | Uniswap reserves | Flash loan | Undercollateralized borrow | |
| mint() | vault.totalAssets() | Donation | Steal other users' deposits |
Detection Patterns
Pattern 1: Spot Price Dependency (Most Critical)
Root Cause: Single Source + Spot Price Trust
Attack Flow:
- Flash loan large amount of token0
- Swap to drain token0 from pool → price spikes
- Call victim function that reads this price
- Profit at inflated price
- Swap back, repay flash loan
Search Queries:
Verification Questions:
- Is this price used for critical decisions?
- Can flash loan move this price significantly?
- Is there enough liquidity to resist manipulation?
Pattern 2: Oracle Staleness
Root Cause: Staleness Blindness
Search Queries:
Verification Questions:
- Is
updatedAtchecked against a max staleness? - What's the heartbeat of this oracle?
- What happens during oracle downtime?
Pattern 3: Short TWAP Window
Root Cause: Insufficient time averaging
Attacker's view: "I can maintain manipulated price for 60 seconds across multiple blocks if I'm a validator, or use multiple flash loans."
Safe TWAP windows:
- Minimum: 30 minutes (1800 seconds)
- Recommended: 1-4 hours for high-value decisions
Search Queries:
Pattern 4: Donation Attack / Share Inflation
Root Cause: Composability Trust + Spot Value
Attack Flow:
- Deposit 1 wei → get 1 share (first depositor)
- Donate 1M tokens directly to vault (not via deposit)
- pricePerShare = 1M / 1 = 1M per share
- Victim deposits 999K → gets 0 shares (rounds down)
- Attacker redeems 1 share → gets everything
Search Queries:
Pattern 5: Missing Slippage Protection
Root Cause: No minimum output enforcement
Attack Flow (Sandwich):
- See victim's pending swap in mempool
- Front-run: buy token, raise price
- Victim's swap executes at worse price
- Back-run: sell token at higher price
- Profit from victim's slippage
Search Queries:
Pattern 6: Flash Loan Governance
Root Cause: Snapshot at call time
Search Queries:
Flash Loan Exploitability Checklist
For each value used in critical decisions:
- [ ] Can this value be changed within one transaction?
- [ ] Does flash loan provide enough capital to move it significantly?
- [ ] Is the value read and used in the same transaction?
- [ ] Is there a time delay between read and use?
- [ ] Are there circuit breakers for extreme values?
Price Source Risk Matrix
| Source Type | Manipulation Risk | Attack Vector | |
|---|---|---|---|
| DEX Spot (getReserves) | CRITICAL | Flash loan swap | |
| Uniswap V3 slot0 | CRITICAL | Flash loan swap | |
| TWAP < 10 min | HIGH | Multi-block or validator | |
| TWAP 10-30 min | MEDIUM | Validator collusion | |
| TWAP > 30 min | LOW | Expensive sustained attack | |
| Chainlink (no staleness) | HIGH | Wait for stale price | |
| Chainlink (with staleness) | LOW | Limited window | |
| balanceOf(this) | HIGH | Direct donation |
Search Query Reference
Rationalization Table (Reject These Excuses)
| Excuse | Attacker's Reality | |
|---|---|---|
| "Flash loans are expensive" | 0.09% fee on $100M = $90K. Profit can be millions. | |
| "Pool has high liquidity" | Higher liquidity = need bigger flash loan. Still doable. | |
| "TWAP protects us" | Short TWAP < 10min is still manipulable. Check the window. | |
| "No one would do this" | MEV bots automate attacks 24/7. They're already looking. | |
| "Chainlink is always accurate" | Chainlink can be stale. Always check updatedAt. | |
| "This is theoretical" | Cetus ($223M), Euler ($197M), Mango ($114M), KiloEx ($117M) | |
| "Attack would cost too much" | Flash loan cost is near zero. Only gas at risk. |
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
- SKILL.md in the repositoryCheckingpackages/opencode/skills/economic-attack/SKILL.md
Popularity
- Repository stars
- 67
- Repository forks
- 19
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (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
[](https://verified-skill.com/skills/bittersecurity/vigilo/economic-attack)