Slippage Protection Auditor
When to Use
- Auditing DEX integrations, AMM interactions, swap operations
- User mentions: slippage, MEV, sandwich attack, front-running, deadline, minAmountOut, swap, Uniswap, Curve, Balancer
- Reviewing token exchange functions, liquidity operations, router integrations
- Analyzing price impact protection in DeFi protocols
Audit Workflow
IMPORTANT: Announce skill usage at the start of analysis
Begin with: "I'm using the audit-slippage skill to analyze this contract for slippage protection and MEV vulnerabilities..."
Identify swap/liquidity operations
- Search:
swap, addLiquidity, removeLiquidity, IUniswapV2Router, ISwapRouter
- Focus: minAmountOut parameters, deadline parameters, quoter usage
Check against vulnerability patterns
- Reference
reference.md for complete checklist
- Compare code against
example.md
Validate MEV exploitability
- Check access control first - grep for
onlyOwner|onlyAdmin|onlyGovernance modifiers
- Can non-privileged actors exploit via MEV?
- Can MEV bot sandwich attack?
- Calculate extractable value (% of trade)
- Check if protection exists elsewhere in call stack
- Downgrade severity if admin-only unless users affected by MEV
Generate report
- Use deliverable template below
- Include sandwich attack PoC
- Quantify MEV extraction potential
Core Vulnerability Patterns
See reference.md for full checklist. Key patterns:
- No slippage parameter (minAmountOut = 0) → 99%+ value extractable
- No expiration deadline (type(uint256).max) → delayed execution risk
- block.timestamp as deadline → zero protection
- Incorrect slippage calculation → wrong reference value
- Mismatched slippage precision → decimal scaling errors
- Hard-coded slippage → withdrawal failures during volatility
- MinTokensOut for intermediate amount → multi-hop unprotected
- On-chain slippage calculation → flash loan manipulation
- Fixed fee tier assumption → routing through wrong pool
- Slippage on token amount not USD value → market crash risk
- No slippage on liquidity ops → LP value extraction
- Flash swap repayment without slippage → overpayment risk
- Approval race on router upgrade → MEV via old router
Code examples: See example.md
Severity Criteria
Critical: Zero slippage on user-facing swaps, missing deadline, on-chain quoter-based minOut, MUST be exploitable by non-privileged actors
High: Hard-coded slippage preventing withdrawals, intermediate-hop-only protection, wrong fee tier (80%+ liquidity elsewhere), MUST be exploitable by non-privileged actors
Medium: Wrong decimal precision (user can retry), suboptimal routing, missing LP operation slippage, admin-only swap functions with cascading user MEV exposure
Low: Suboptimal slippage (token vs USD) in stable pairs, documentation issues, admin-only swap parameter issues without immediate user impact
IMPORTANT: Admin-only swap functions (onlyOwner, onlyAdmin, onlyGovernance) are MEDIUM or LOW severity unless:
- Admin swaps use user funds directly (e.g., fee collection selling user-deposited tokens)
- Missing slippage enables admin to extract value from protocol treasury holding user funds
- Admin swap parameters affect user swap routing or slippage calculations
False Positives - Do NOT Flag
- Zero slippage on internal protocol-to-protocol swaps (both sides controlled)
- block.timestamp deadline in keeper/bot functions with off-chain slippage enforcement
- Hard-coded slippage in emergency-only functions with explicit warnings
- On-chain quoter in view functions (display/estimation only)
- Fixed fee tier with documented single-pool targeting
- Admin-only swap functions (onlyOwner, onlyAdmin) swapping protocol-owned assets not derived from user funds
- Governance-controlled swaps with timelock allowing users to exit before execution
- Treasury management swaps where admin has no access to user deposits
Deliverable Format
MANDATORY: Before deliverable, verify each checklist.md item against codebase. Flag violations as findings.
Use template: templates/report-template.md
Each finding includes: severity, pattern #, file/lines, description, vulnerable code, impact (MEV extraction %), PoC with sandwich attack simulation, remediation, gas impact.
Key Principles
- User control - users specify slippage and deadline per tx
- Off-chain calculation - minAmountOut from off-chain or TWAP, never current block
- Final output protection - multi-hop must protect final amount, not intermediate
- Decimal awareness - account for token decimal differences
Output Guidelines
DO:
- Reference specific lines/functions
- Provide sandwich attack PoCs
- Quantify MEV extraction ($ or %)
- Include real-world exploit examples
DON'T:
- Flag view/pure functions (no state change)
- Report intentional designs without exploit path
- Use vague terms
- Ignore liquidity depth context
1---2name: audit-slippage3description: Audits Solidity DEX integrations and smart contracts for slippage vulnerabilities enabling sandwich attacks including zero/missing minAmountOut parameters, block.timestamp or missing deadlines, on-chain slippage calculation via manipulable quoters, multi-hop swaps without final output protection, decimal precision mismatches between token pairs, hard-coded slippage preventing withdrawals during volatility, and fixed fee tier assumptions breaking when liquidity migrates4license: MIT5---67# Slippage Protection Auditor89## When to Use10- Auditing DEX integrations, AMM interactions, swap operations11- User mentions: slippage, MEV, sandwich attack, front-running, deadline, minAmountOut, swap, Uniswap, Curve, Balancer12- Reviewing token exchange functions, liquidity operations, router integrations13- Analyzing price impact protection in DeFi protocols1415## Audit Workflow1617**IMPORTANT: Announce skill usage at the start of analysis**1819Begin with: "I'm using the **audit-slippage** skill to analyze this contract for slippage protection and MEV vulnerabilities..."20211. **Identify swap/liquidity operations**22 - Search: `swap`, `addLiquidity`, `removeLiquidity`, `IUniswapV2Router`, `ISwapRouter`23 - Focus: minAmountOut parameters, deadline parameters, quoter usage24252. **Check against vulnerability patterns**26 - Reference `reference.md` for complete checklist27 - Compare code against `example.md`28293. **Validate MEV exploitability**30 - **Check access control first** - grep for `onlyOwner|onlyAdmin|onlyGovernance` modifiers31 - Can non-privileged actors exploit via MEV?32 - Can MEV bot sandwich attack?33 - Calculate extractable value (% of trade)34 - Check if protection exists elsewhere in call stack35 - Downgrade severity if admin-only unless users affected by MEV36374. **Generate report**38 - Use deliverable template below39 - Include sandwich attack PoC40 - Quantify MEV extraction potential4142## Core Vulnerability Patterns4344See `reference.md` for full checklist. Key patterns:45461. No slippage parameter (minAmountOut = 0) → 99%+ value extractable472. No expiration deadline (type(uint256).max) → delayed execution risk483. block.timestamp as deadline → zero protection494. Incorrect slippage calculation → wrong reference value505. Mismatched slippage precision → decimal scaling errors516. Hard-coded slippage → withdrawal failures during volatility527. MinTokensOut for intermediate amount → multi-hop unprotected538. On-chain slippage calculation → flash loan manipulation549. Fixed fee tier assumption → routing through wrong pool5510. Slippage on token amount not USD value → market crash risk5611. No slippage on liquidity ops → LP value extraction5712. Flash swap repayment without slippage → overpayment risk5813. Approval race on router upgrade → MEV via old router5960**Code examples:** See `example.md`6162## Severity Criteria6364**Critical:** Zero slippage on user-facing swaps, missing deadline, on-chain quoter-based minOut, **MUST be exploitable by non-privileged actors**65**High:** Hard-coded slippage preventing withdrawals, intermediate-hop-only protection, wrong fee tier (80%+ liquidity elsewhere), **MUST be exploitable by non-privileged actors**66**Medium:** Wrong decimal precision (user can retry), suboptimal routing, missing LP operation slippage, **admin-only swap functions with cascading user MEV exposure**67**Low:** Suboptimal slippage (token vs USD) in stable pairs, documentation issues, **admin-only swap parameter issues without immediate user impact**6869**IMPORTANT:** Admin-only swap functions (onlyOwner, onlyAdmin, onlyGovernance) are **MEDIUM or LOW severity** unless:70- Admin swaps use user funds directly (e.g., fee collection selling user-deposited tokens)71- Missing slippage enables admin to extract value from protocol treasury holding user funds72- Admin swap parameters affect user swap routing or slippage calculations7374## False Positives - Do NOT Flag7576- Zero slippage on internal protocol-to-protocol swaps (both sides controlled)77- block.timestamp deadline in keeper/bot functions with off-chain slippage enforcement78- Hard-coded slippage in emergency-only functions with explicit warnings79- On-chain quoter in view functions (display/estimation only)80- Fixed fee tier with documented single-pool targeting81- **Admin-only swap functions** (onlyOwner, onlyAdmin) swapping protocol-owned assets not derived from user funds82- Governance-controlled swaps with timelock allowing users to exit before execution83- Treasury management swaps where admin has no access to user deposits8485## Deliverable Format8687**MANDATORY:** Before deliverable, verify each `checklist.md` item against codebase. Flag violations as findings.8889Use template: `templates/report-template.md`9091Each finding includes: severity, pattern #, file/lines, description, vulnerable code, impact (MEV extraction %), PoC with sandwich attack simulation, remediation, gas impact.9293## Key Principles9495- **User control** - users specify slippage and deadline per tx96- **Off-chain calculation** - minAmountOut from off-chain or TWAP, never current block97- **Final output protection** - multi-hop must protect final amount, not intermediate98- **Decimal awareness** - account for token decimal differences99100## Output Guidelines101102**DO:**103- Reference specific lines/functions104- Provide sandwich attack PoCs105- Quantify MEV extraction ($ or %)106- Include real-world exploit examples107108**DON'T:**109- Flag view/pure functions (no state change)110- Report intentional designs without exploit path111- Use vague terms112- Ignore liquidity depth context