Unfair Liquidation Auditor
When to Use
- Auditing liquidation fairness, L2 deployments, pause mechanisms
- User mentions: L2 sequencer, grace period, pause, interest accumulation, LTV gap, auction, slippage protection, collateral priority
- Analyzing liquidation timing, state synchronization, user protections
- Reviewing pause/unpause logic, sequencer checks, health score calculations
Audit Workflow
IMPORTANT: Announce skill usage at the start of analysis
Begin with: "I'm using the audit-unfair-liquidation skill to analyze this contract for unfair liquidation vulnerabilities..."
Scan for liquidation fairness issues
- Search:
sequencer, paused, accrue, LTV, auction, healthFactor, slippage, collateralPriority, borrower
- Focus: sequencer checks, pause states, interest accrual, health calculations, auction mechanics
Check against vulnerability patterns
- Reference
reference.md for complete checklist
- Compare code against
example.md
Validate exploitability
- Check access control first - grep for
onlyOwner|onlyAdmin|onlyGovernance modifiers
- Can non-privileged actors exploit unfair liquidation mechanisms?
- Can users be liquidated during sequencer downtime without grace period?
- Does interest accumulate while repayments paused?
- Can liquidators cherry-pick stable collateral?
- Is there an LTV gap between borrow and liquidation?
- Verify no compensating protections exist
- Downgrade severity if admin-only unless direct borrower harm
Generate report
- Use deliverable template below
- Include timing analysis and PoC
- Rank by severity
Core Vulnerability Patterns
See reference.md for full checklist. Key patterns:
- Missing L2 sequencer grace period → users liquidated immediately when sequencer restarts
- Interest accumulates while paused → users liquidated for interest accrued during downtime
- Repayment paused, liquidation active → users prevented from avoiding liquidation
- Late interest/fee updates → isLiquidatable uses stale values
- Lost positive PNL/yield → profitable positions lose gains during liquidation
- Unhealthier post-liquidation → liquidator cherry-picks stable collateral
- Corrupted collateral priority → liquidation order doesn't match risk
- Borrower replacement misattribution → original borrower repays new owner's debt
- No LTV gap → users liquidatable immediately after borrowing
- Interest during auction → borrowers accrue interest while being auctioned
- No liquidation slippage protection → liquidators can't specify minimum rewards
Code examples: See example.md
Severity Criteria
Critical: Missing sequencer grace period on L2, repayment paused while liquidation active, immediate liquidation after borrow (no LTV gap), MUST be exploitable by non-privileged actors
High: Interest accumulation during pause, late fee updates, cherry-picking collateral leaving unhealthier state, MUST be exploitable by non-privileged actors
Medium: Lost PNL/yield during liquidation, interest accrual during auctions, no liquidator slippage protection, admin-only liquidation timing configuration issues with cascading borrower impact
Low: Suboptimal collateral priority without security impact, admin-only parameter issues without immediate borrower impact
IMPORTANT: Admin-only liquidation timing functions (onlyOwner, onlyAdmin, onlyGovernance) are MEDIUM or LOW severity unless:
- Admin can trigger liquidations during sequencer downtime without grace period
- Pause mechanism controlled by admin creates asymmetry (repayment paused, liquidation active)
- LTV configuration by admin allows immediate liquidation after borrowing
False Positives - Do NOT Flag
- L1-only deployments (no sequencer concerns)
- Protocols with explicit admin-only liquidation during pause
- Systems where pause simultaneously halts interest and liquidation
- Documented grace periods after unpause events
- Single-collateral systems (no cherry-picking possible)
- Admin-only pause functions (onlyOwner, onlyAdmin) where pause halts both repayment and liquidation symmetrically
- Governance-controlled LTV parameters with documented gap between borrow and liquidation thresholds
- Admin functions for grace period configuration with reasonable defaults
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, timing/fairness analysis, PoC, remediation.
Key Principles
- Fairness - users must have opportunity to avoid liquidation
- Synchronization - pause states must be consistent (repay ↔ liquidate)
- Grace periods - time for users to respond after downtime
- Health improvement - liquidation must improve borrower health
- Predictability - liquidators need slippage protection
Output Guidelines
DO:
- Reference specific lines and functions
- Provide timing analysis (sequencer downtime windows)
- Show PoCs demonstrating unfair liquidation scenarios
- Analyze pause state interactions
- Calculate LTV gaps and health score changes
DON'T:
- Report intentional pause-based liquidation designs
- Flag missing features with alternative mechanisms
- Use vague terms ("might be unfair")
- Ignore documented grace period configurations
1---2name: audit-unfair-liquidation3description: Audits Solidity liquidation mechanisms for unfair liquidation vulnerabilities including missing L2 sequencer grace periods, interest accumulation while paused, repayment paused while liquidation active, late interest/fee updates, lost positive PNL/yield during liquidation, unhealthier post-liquidation state from cherry-picking, corrupted collateral priority, borrower replacement misattribution, no LTV gap allowing immediate liquidation, interest during auctions, and no liquidation slippage protection (project)4license: MIT5---67# Unfair Liquidation Auditor89## When to Use10- Auditing liquidation fairness, L2 deployments, pause mechanisms11- User mentions: L2 sequencer, grace period, pause, interest accumulation, LTV gap, auction, slippage protection, collateral priority12- Analyzing liquidation timing, state synchronization, user protections13- Reviewing pause/unpause logic, sequencer checks, health score calculations1415## Audit Workflow1617**IMPORTANT: Announce skill usage at the start of analysis**1819Begin with: "I'm using the **audit-unfair-liquidation** skill to analyze this contract for unfair liquidation vulnerabilities..."20211. **Scan for liquidation fairness issues**22 - Search: `sequencer`, `paused`, `accrue`, `LTV`, `auction`, `healthFactor`, `slippage`, `collateralPriority`, `borrower`23 - Focus: sequencer checks, pause states, interest accrual, health calculations, auction mechanics24252. **Check against vulnerability patterns**26 - Reference `reference.md` for complete checklist27 - Compare code against `example.md`28293. **Validate exploitability**30 - **Check access control first** - grep for `onlyOwner|onlyAdmin|onlyGovernance` modifiers31 - Can non-privileged actors exploit unfair liquidation mechanisms?32 - Can users be liquidated during sequencer downtime without grace period?33 - Does interest accumulate while repayments paused?34 - Can liquidators cherry-pick stable collateral?35 - Is there an LTV gap between borrow and liquidation?36 - Verify no compensating protections exist37 - Downgrade severity if admin-only unless direct borrower harm38394. **Generate report**40 - Use deliverable template below41 - Include timing analysis and PoC42 - Rank by severity4344## Core Vulnerability Patterns4546See `reference.md` for full checklist. Key patterns:47481. Missing L2 sequencer grace period → users liquidated immediately when sequencer restarts492. Interest accumulates while paused → users liquidated for interest accrued during downtime503. Repayment paused, liquidation active → users prevented from avoiding liquidation514. Late interest/fee updates → isLiquidatable uses stale values525. Lost positive PNL/yield → profitable positions lose gains during liquidation536. Unhealthier post-liquidation → liquidator cherry-picks stable collateral547. Corrupted collateral priority → liquidation order doesn't match risk558. Borrower replacement misattribution → original borrower repays new owner's debt569. No LTV gap → users liquidatable immediately after borrowing5710. Interest during auction → borrowers accrue interest while being auctioned5811. No liquidation slippage protection → liquidators can't specify minimum rewards5960**Code examples:** See `example.md`6162## Severity Criteria6364**Critical:** Missing sequencer grace period on L2, repayment paused while liquidation active, immediate liquidation after borrow (no LTV gap), **MUST be exploitable by non-privileged actors**65**High:** Interest accumulation during pause, late fee updates, cherry-picking collateral leaving unhealthier state, **MUST be exploitable by non-privileged actors**66**Medium:** Lost PNL/yield during liquidation, interest accrual during auctions, no liquidator slippage protection, **admin-only liquidation timing configuration issues with cascading borrower impact**67**Low:** Suboptimal collateral priority without security impact, **admin-only parameter issues without immediate borrower impact**6869**IMPORTANT:** Admin-only liquidation timing functions (onlyOwner, onlyAdmin, onlyGovernance) are **MEDIUM or LOW severity** unless:70- Admin can trigger liquidations during sequencer downtime without grace period71- Pause mechanism controlled by admin creates asymmetry (repayment paused, liquidation active)72- LTV configuration by admin allows immediate liquidation after borrowing7374## False Positives - Do NOT Flag7576- L1-only deployments (no sequencer concerns)77- Protocols with explicit admin-only liquidation during pause78- Systems where pause simultaneously halts interest and liquidation79- Documented grace periods after unpause events80- Single-collateral systems (no cherry-picking possible)81- **Admin-only pause functions** (onlyOwner, onlyAdmin) where pause halts both repayment and liquidation symmetrically82- Governance-controlled LTV parameters with documented gap between borrow and liquidation thresholds83- Admin functions for grace period configuration with reasonable defaults8485## 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, timing/fairness analysis, PoC, remediation.9293## Key Principles9495- **Fairness** - users must have opportunity to avoid liquidation96- **Synchronization** - pause states must be consistent (repay ↔ liquidate)97- **Grace periods** - time for users to respond after downtime98- **Health improvement** - liquidation must improve borrower health99- **Predictability** - liquidators need slippage protection100101## Output Guidelines102103**DO:**104- Reference specific lines and functions105- Provide timing analysis (sequencer downtime windows)106- Show PoCs demonstrating unfair liquidation scenarios107- Analyze pause state interactions108- Calculate LTV gaps and health score changes109110**DON'T:**111- Report intentional pause-based liquidation designs112- Flag missing features with alternative mechanisms113- Use vague terms ("might be unfair")114- Ignore documented grace period configurations