agentleFS
silonxxsilonxx/hackbot/skills/hunt-rce/SKILL.md

hunt-rce

Skill0 starsChanged 3 months agoMITView on GitHub

RCE and remote code execution hunting methodology. TRIGGER: user is testing for RCE, command injection, code execution, or mentions headless browser exploitation, file write primitives, or protocol-level attacks.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 16 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Instead, RCE comes from chaining primitives: a file write becomes RCE via DLL hijack, an SSRF becomes RCE via cloud metadata → instance …

    line 17
  2. Distinctive:

    When you find HTML-to-PDF or screenshot rendering:

    line 24
  3. Distinctive:

    Use Chrome DevTools Protocol over WebSocket to read local files

    line 28
  4. Distinctive:

    Use K8s service account token to access cluster API

    line 30
  5. Distinctive:

    When target uses Perforce for version control:

    line 33
  6. Very specific:

    Use client-WriteFile to write malicious DLL to application directory

    line 39
  7. Distinctive:

    Document converters (LibreOffice, Pandoc)

    line 61
  8. Distinctive:

    Import/export features using external tools

    line 63
  9. Distinctive:

    Check CVE databases for that version

    line 70
  10. Distinctive:

    Look at the User-Agent of server-side HTTP clients

    line 71
  11. Very specific:

    Check navigator.userAgent in headless browsers via injected JS

    line 72
  12. Distinctive:

    Look for these primitives that chain to RCE:

    line 75
  13. Distinctive:

    Always check if you're in a container (Docker/K8s) — K8s secrets are at known paths

    line 103
  14. Distinctive:

    Check for service mesh/sidecar proxies that might give access to other services

    line 104
  15. Distinctive:

    Look for IAM roles/service accounts attached to the compute instance

    line 105
  16. Distinctive:

    Document the full chain clearly — reviewers need to understand each step

    line 106
  17. Very specific:

    No social engineering and no active network attacks (mDNS/ARP/DNS poisoning) unless the program's policy explicitly authorizes them.

    line 115
  18. Distinctive:

    Do not use extracted cloud credentials to access the account or real data beyond the minimal proof they are valid.

    line 118
  19. Distinctive:

    Run the finding through triage-finding before writing it up.

    line 122

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

hunt-rce — Remote Code Execution Hunting

You are assisting an authorized bug bounty hunter doing ethical testing under a program's published policy, whose RCE reports include headless Chrome exploitation chains, Perforce protocol abuse for arbitrary file write, and vulnerable component exploitation. Their RCE findings are typically chains: SSRF → LFI → RCE, or file write → DLL hijack → RCE.

Core Philosophy

RCE is the holy grail. In bug bounty, you rarely get direct eval(user_input). Instead, RCE comes from chaining primitives: a file write becomes RCE via DLL hijack, an SSRF becomes RCE via cloud metadata → instance credentials → deploy pipeline. Think in chains.

RCE Chains (from real reports)

Chain 1: Headless Chrome → Debug Protocol → File Read → K8s Secrets

When you find HTML-to-PDF or screenshot rendering:

  1. Confirm JavaScript execution in the renderer
  2. Port scan localhost for Chrome DevTools port (30000-50000 range)
  3. Access '/json' endpoint on debug port to get WebSocket URL
  4. Use Chrome DevTools Protocol over WebSocket to read local files
  5. Read /var/run/secrets/kubernetes.io/serviceaccount/token
  6. Use K8s service account token to access cluster API

Chain 2: Perforce Client → Arbitrary File Write → DLL Hijack

When target uses Perforce for version control:

  1. Set up malicious Perforce server
  2. Coerce connection via an IN-SCOPE vector only (do NOT use social engineering or network poisoning unless the program's policy explicitly authorizes it — both are out of scope on nearly every program; if no in-scope vector exists, report the file-write primitive and explain the chain instead)
  3. Use client-WriteFile to write malicious DLL to application directory
  4. Application loads DLL on next startup → RCE Key: Check if P4CLIENTPATH is set. If not, the Perforce server can write ANYWHERE.

Chain 3: Vulnerable Component → Known CVE

Identify component versions and check for known RCE CVEs:

  • HeadlessChrome/77.0.3844.0 → multiple RCE CVEs
  • pdf.js 1.10.97 → CVE-2018-5158 (XSS that enables further chains)
  • Old libcurl → protocol smuggling
  • OpenSearch with vulnerable Chrome → RCE via reporting plugin

Chain 4: SSRF → Cloud Metadata → Deploy Key → Code Push

  1. SSRF to '169.254.169.254/latest/meta-data/iam/security-credentials/'
  2. Extract AWS credentials
  3. List accessible services (S3, CodeCommit, ECR)
  4. Push malicious code or container → RCE in deployment

Discovery Methodology

Step 1: Identify Code Execution Surfaces

  • PDF generators (wkhtmltopdf, headless Chrome, Puppeteer)
  • Image processors (ImageMagick, GraphicsMagick)
  • Document converters (LibreOffice, Pandoc)
  • Template engines (Jinja2, ERB, Handlebars)
  • Import/export features using external tools
  • Version control integrations (Git, SVN, Perforce)
  • CI/CD pipelines accessible via API

Step 2: Version Fingerprinting

For every component you identify:

  • Extract exact version from headers, error messages, or behavior
  • Check CVE databases for that version
  • Look at the User-Agent of server-side HTTP clients
  • Check navigator.userAgent in headless browsers via injected JS

Step 3: Primitive Hunting

Look for these primitives that chain to RCE:

  • File write: upload features, Perforce, import tools
  • File read: SSRF, LFI, directory traversal
  • JS execution (headless): XSS in headless browser context, template injection
  • Command injection: user input in system calls, filename handling
  • Deserialization: Java/PHP/Python/Ruby object deserialization

Step 4: Chain the Primitives

Map your primitives to known escalation paths: File Write + DLL hijack, webshell, cron job, authorized_keys File Read + secrets, tokens, source code → auth bypass → more access JS Execution (headless) + Chrome debug protocol → file read → K8s secrets SSRF + cloud metadata → credentials → lateral movement Template Injection → code execution in server-side template engine

Impact Demonstration

For RCE, demonstrate:

  1. Command execution proof: id, whoami, hostname output
  2. Or file read proof: sensitive file contents (tokens, configs)
  3. Environment context: are you in a container? What services are accessible?
  4. Blast radius: one pod? The whole cluster? All customer data?

For file-write-to-RCE chains, you may need to explain the chain rather than actually execute malicious code. Show the write primitive works, explain the RCE path.

Key Considerations

  • Always check if you're in a container (Docker/K8s) — K8s secrets are at known paths
  • Check for service mesh/sidecar proxies that might give access to other services
  • Look for IAM roles/service accounts attached to the compute instance
  • Document the full chain clearly — reviewers need to understand each step

Scope & Ethics Guardrails (beginner — do not skip)

  • Prove execution with a HARMLESS command (id, whoami, hostname) or a single benign file read. Never run destructive, persistent, or state-changing payloads on live infrastructure (no data deletion, no shells left behind, no crypto/DoS).
  • Once you have proof of execution, STOP. Do not pivot deeper, move laterally into the internal network, access customer data, or push code to real pipelines to "prove" blast radius — describe it instead.
  • No social engineering and no active network attacks (mDNS/ARP/DNS poisoning) unless the program's policy explicitly authorizes them. They are out of scope almost everywhere.
  • Do not use extracted cloud credentials to access the account or real data beyond the minimal proof they are valid.
  • Confirm the asset is in scope before testing. RCE is high-stakes — if any step could cause damage or leave scope, stop and ask the user first.
  • Run the finding through triage-finding before writing it up.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.