Autonomous web penetration testing skill with threat modeling, JavaScript analysis, and multi-role verification
triggers
["run pentest-lyan security test","start web penetration test with lyan","analyze web application security using pentest-lyan","perform black box testing with lyan","test web app for vulnerabilities using pentest-lyan","conduct authorized security assessment with lyan","scan web application with pentest-lyan","resume pentest-lyan security test"]
Pentest-Lyan is an autonomous web penetration testing framework that performs self-directed threat modeling across 12 dimensions, complete JavaScript analysis, and cross-role verification. It validates business impact (not just HTTP 200 responses), maintains state across sessions, and generates both technical Markdown and delivery-ready Word reports.
What It Does
Autonomous Threat Modeling: Identifies threats based on 12 thinking dimensions rather than fixed vulnerability checklists
Deep JavaScript Analysis: Reads and understands business logic, signing mechanisms, and frontend parameters before testing APIs
Business Impact Validation: Verifies database-layer changes, data access, and state transitions actually occur
Stateful Testing: Supports resume (--resume), multi-project isolation, and session pooling
Dual Report Formats: Markdown for technical details, Word for delivery; separates critical findings from configuration issues
Installation
Prerequisites
Python 3.8+ with the project dependencies
Playwright MCP Server (recommended for browser automation and session pooling)
Setup Steps
# Clone the repository
git clone https://github.com/HeaSec/Pentest-Lyan.git
cd Pentest-Lyan
# Install Python dependencies (if requirements.txt exists)
pip install -r requirements.txt
# Install as a Claude Code skill# Copy the entire pentest-lyan/ directory to your Claude Code skills path# Default locations:# - macOS/Linux: ~/.config/claude-code/skills/# - Windows: %APPDATA%\claude-code\skills\cp -r . ~/.config/claude-code/skills/pentest-lyan/
Playwright MCP Setup (Optional but Recommended)
# Install Playwright MCP for browser automation
npm install -g @playwright/mcp-server
# Or add to your MCP configuration# The skill will use curl if Playwright is unavailable
Project Structure
pentest-lyan/
├── SKILL.md # Main orchestrator (3 phases, 9 exit conditions)
├── gates.md # HARD GATE definitions (G1-G7)
├── schema.md # Data schema index
├── references/ # Process documentation (read by agent as needed)
│ ├── discovery-guide.md
│ ├── attack-guide.md
│ ├── threat-modeling.md
│ ├── validation-guide.md
│ ├── cross-role-testing.md
│ ├── audit-guide.md
│ ├── report-template.md
│ ├── docx-template.md
│ └── post-delivery.md
├── schema/ # Field specification schemas (*.schema.json)
├── scripts/ # Utility scripts
│ └── render_docx.py
└── templates/ # Word document templates
Important: No need to declare authorization scope/timeframe — issuing the command implies authorization.
Multi-Project Management
# List all projects
/pentest-lyan --list
# Resume an existing project
/pentest-lyan --resume <project-id>
# Start with custom project ID
/pentest-lyan https://target.example.com --project custom-id
Default project-id is extracted from the hostname's first segment.
Testing Phases
Pentest-Lyan executes in three sequential phases:
Phase 1: Discovery
Deep JavaScript analysis (business logic, signing, parameters)
Complete API endpoint discovery
Session pool creation
Permission matrix generation
Phase 2: Attack
Feature-level testing pipeline
Dynamic sub-module discovery
Cross-role privilege verification
Business impact validation
Phase 3: Audit
Schema validation
Completeness auditing
System-level checks
Report generation (Markdown + Word)
Account Requirements (G1 Gate)
The G1 gate checks account availability but does not block testing:
≥2 accounts: Normal flow, full cross-role testing
0-1 accounts: Degraded mode, limited privilege testing; if registration page found, report prompts user to register additional accounts
role_level must be explicitly declared by the user (not inferred from username):
high_privilege: Admin, superuser, manager
standard: Regular user
limited: Guest, read-only
Working with State Files
Pentest-Lyan maintains state in pentest-data/<project-id>/:
pentest-data/
└── <project-id>/
├── state.json # Main state (phase, coverage, findings)
├── index.json # Project metadata
├── pages/ # Discovered pages/APIs
├── sessions/ # Session data (contains credentials)
├── modules/ # Feature module state
└── coverage/ # Coverage tracking