defi-attack-patterns

Analyzes DeFi protocols for flash loan, oracle manipulation, MEV, and governance attack vectors.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/lNwNl/Praxis --skill defi-attack-patterns-lnwnl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: defi-attack-patterns
Source: https://github.com/lNwNl/Praxis/tree/main/skills/_disabled/defi-attack-patterns
Command: npx skills add https://github.com/lNwNl/Praxis --skill defi-attack-patterns-lnwnl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Auditing decentralized finance protocols requires deep knowledge of economic attack vectors that go beyond standard Solidity bugs, and this Skill provides a structured playbook of DeFi-specific exploitation patterns so analysts do not miss critical vulnerabilities like flash loan oracle manipulation or vault inflation attacks. ## Core Features & Use Cases - Flash Loan & Oracle Analysis: Step-by-step flows for spot price manipulation, TWAP comparison, Chainlink staleness checks, and L2 sequencer risks. - MEV & Precision Attack Coverage: Sandwich attacks, JIT liquidity, liquidation MEV, first-depositor vault inflation, and rounding truncation exploits. - Governance, Bridge & Token Edge Cases: Flash loan governance, timelock bypasses, bridge verification failures, ERC-777 reentrancy hooks, and fee-on-transfer accounting bugs, plus a decision tree for triaging any protocol. - Use Case: When reviewing a lending protocol that reads AMM reserves as its price oracle, use this Skill to walk through the flash loan manipulation flow and confirm whether a single-transaction attack can inflate collateral value. ## Quick Start Analyze this lending protocol's use of Uniswap spot reserves as a price oracle and determine whether it is vulnerable to a flash loan manipulation attack.

Frequently Asked Questions about defi-attack-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does a flash loan price oracle manipulation attack work?▼

An attacker borrows a large amount via flash loan, swaps it on an AMM to skew the spot price, then exploits a protocol that reads that spot price as its oracle, all within one transaction. Protocols using getReserves() directly are vulnerable; TWAP or Chainlink oracles mitigate this.

What is the first depositor vault inflation attack?▼

An attacker deposits 1 wei for 1 share, then donates a large amount directly to the vault, inflating the share price. A victim's subsequent deposit rounds down to zero shares due to integer division, letting the attacker claim the entire vault balance.

How do I check if a Chainlink oracle integration is safe?▼

Verify the code checks that price is positive, updatedAt is nonzero, the heartbeat interval has not elapsed, and answeredInRound matches roundId. On L2s like Arbitrum or Optimism, also check sequencer uptime, since frozen prices during sequencer downtime enable stale-price arbitrage.

Can flash loans be used to attack governance systems?▼

Yes, if a protocol counts live token balances for voting without snapshots. An attacker borrows governance tokens, meets quorum, passes a malicious proposal, and returns the tokens in one transaction. Snapshot-based voting and timelocks prevent this.

What token standard edge cases break DeFi protocol accounting?▼

Fee-on-transfer tokens cause protocols to overcredit deposits if they assume received equals sent amount. ERC-777 tokens introduce reentrancy via tokensReceived hooks, and rebasing tokens break cached balance accounting. Measure actual balance deltas instead of trusting parameters.