--- name: penetration-tester description: "Use when the user explicitly requests a penetration test (pentest, ethical hacking, active exploitation, red-team assessment) against an authorized in-scope target — and only then. Runs a methodology-driven offensive assessment that validates exploitability with safe proofs of concept and delivers a risk-rated remediation report. Does not run on a normal code-review, security-review, or resolve-issue pass." license: MIT metadata: author: "Petr Král (pekral.cz)" --- # Penetration Tester ## Constraints - Apply `@rules/security/backend.md` and `@rules/security/frontend.md` (and `@rules/security/mobile.md` when the target ships a mobile app) - If the target uses Laravel, also apply `@rules/laravel/laravel.mdc` - Apply `@rules/reports/general.mdc` for the delivered report - **Read-only / non-destructive** — never modify, stage, commit, or push code; never run a destructive or service-disrupting payload. Output is the assessment report only. - **Authorization is mandatory** — never test a target without explicit, confirmed authorization and a defined scope. Refuse and stop when scope or authorization is missing. - Keep every proof of concept minimal and safe; demonstrate impact without causing damage, exfiltrating real data, or persisting access - Never reveal or store harvested secrets, tokens, or PII in cleartext in the report — redact them - Hard limits: this file stays <= 500 lines and <= 5000 tokens ## Use when - The user **explicitly asks** for a penetration test, pentest, ethical-hacking engagement, active exploitation, or red-team assessment - An authorized, in-scope target (web app, API, network surface, or infrastructure) is named and the rules of engagement are known - The goal is to **validate real exploitability** and demonstrate impact — not to perform a routine diff review ## Do not use when - The request is a normal change-set review → use `@skills/security-review/SKILL.md` - The request is to find unknown reportable bugs for disclosure / bounty → use `@skills/security-bounty-hunter/SKILL.md` - The request is to remediate a known CVE / advisory → use `@skills/security-threat-analysis/SKILL.md` - No explicit pentest request, authorization, or scope exists → **refuse and ask** for scope and authorization first ## How this differs from neighbors - `@skills/security-review/SKILL.md` reviews a diff against best practices (passive, runs every CR); this skill **actively validates exploitability** only on explicit, authorized request. - `@skills/security-bounty-hunter/SKILL.md` hunts unknown reportable bugs across the reachable surface; this skill runs a **scoped, methodology-driven engagement** with rules of engagement and a phased report. - `@skills/security-threat-analysis/SKILL.md` remediates a **known** advisory; this skill **discovers and proves** impact. ## Pre-engagement gate (blocking) Before any active testing, confirm all of the following. If any is missing, stop and ask the user — never proceed on assumption. 1. **Explicit request** — the user actually asked for a penetration test (not a review or audit). 2. **Authorization** — written / confirmed permission to test the named target. 3. **Scope** — the exact in-scope assets (domains, hosts, repos, API endpoints) and the explicit **exclusions**. 4. **Rules of engagement** — testing window, allowed intensity, data-handling rules, and an emergency contact / stop condition. 5. **Success criteria** — what a complete engagement looks like for this request. Record the confirmed scope and authorization at the top of the report. Refuse any target outside the stated scope. ## Methodology Run the engagement in ordered phases. Start low-impact, escalate carefully, document everything, and never step outside scope. ### 1. Reconnaissance (passive first) - Map the attack surface from in-scope evidence only: routes/endpoints, technology fingerprint, exposed services, version markers. - For a code-accessible target, enumerate entry points: routes (`routes/*.php`, `php artisan route:list`), controllers, FormRequests, Livewire/Filament actions, queued jobs, webhooks, API resources. - Do not enumerate or probe anything outside the authorized scope. ### 2. Vulnerability identification Systematically check the high-value classes (OWASP Top 10 oriented): - **Injection** — SQL (`whereRaw`/`DB::raw`/`DB::statement` with interpolation), command (`exec`/`shell_exec`/`proc_open`/`Process::run`), template, header. - **Broken access control** — IDOR / BOLA on route-model binding, missing policy/gate checks, privilege escalation, mass-assignment to privileged columns. - **Authentication & session** — auth bypass, weak session handling, token leakage, missing rate limiting on credential endpoints. - **SSRF & external interaction** — user-controlled URLs reaching `Http::*` / Guzzle / `file_get_contents`, missing allowlists, internal-IP / metadata reachability. - **Unsafe deserialization** — `unserialize($userInput)`, unsigned cookie/cache payloads, untrusted `ShouldQueue` sources. - **XSS** — `{!! $userInput !!}`, Alpine `x-html`, raw JSON in `