pwn-template

pwn-template is a command for Claude Code from allsmog/pwn-claude-plugin. It costs 17 tokens per session (541 once invoked), scanned A, original, MIT.

An interactive generator for pwntools Python templates used in binary exploitation, where code is crafted to take advantage of program vulnerabilities.

In plain words
What is it for?
Use it to create templates for techniques such as return-to-win, return-to-libc, ROP chains, format-string attacks, shellcode, heap exploitation, and others.
Why use it?
It avoids starting common exploit scripts from an empty file and gathers the values each technique needs.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the pwn-htb plugin — 7 skills, 16 commands, 3 agents, 2 hooks shipped together

Good fit Use it to create templates for techniques such as return-to-win, return-to-libc, ROP chains, format-string attacks, shellcode, heap exploitation, and others.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add allsmog/pwn-claude-plugin
Claude Code
/plugin install pwn-htb

Made for: Claude Code.

Or install pwn-htb, the plugin that ships this one along with the rest of its 7 skills, 16 commands, 3 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pwn-template

README.md
[![agentmods](https://agentmods.dev/badge/commands/allsmog/pwn-claude-plugin/pwn-template/github.svg)](https://agentmods.dev/commands/allsmog/pwn-claude-plugin/pwn-template)
Your own site
<a href="https://agentmods.dev/commands/allsmog/pwn-claude-plugin/pwn-template"><img src="https://agentmods.dev/badge/commands/allsmog/pwn-claude-plugin/pwn-template/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pwn-template

Your own site · 80×15
<a href="https://agentmods.dev/commands/allsmog/pwn-claude-plugin/pwn-template"><img src="https://agentmods.dev/badge/commands/allsmog/pwn-claude-plugin/pwn-template.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 541 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.00541
Opus 5 $0.00009 $0.00270
Sonnet 5 $0.00003 $0.00108
Haiku 4.5 $0.00002 $0.00054

Measured 9d ago against content hash fcb03ce65e86, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

pwn-template scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

pwn-htb/commands/pwn-template.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PWN Template - Exploit Template Generator

Generate a pwntools exploit template for a specific exploitation technique.

Execution Steps

Step 1: Select Template Type

If no type argument provided, ask user to select:

Available templates:

  1. ret2win - Simple return to win function
  2. ret2libc - Return to libc with leak
  3. rop - Generic ROP chain
  4. format-string - Format string exploitation
  5. shellcode - Shellcode injection
  6. got-overwrite - GOT overwrite via write primitive
  7. heap - Basic heap exploitation
  8. srop - Sigreturn-oriented programming

Step 2: Gather Required Information

Based on template type, ask for:

All templates:

  • Binary name/path
  • Offset to return address

ret2win:

  • Win function address

ret2libc:

  • Libc path (optional)
  • pop_rdi gadget address

format-string:

  • Format string offset
  • Target address to write

shellcode:

  • Buffer address (or leak method)

Step 3: Generate Template

Read template from ${CLAUDE_PLUGIN_ROOT}/templates/<type>.py and customize with provided values.

Step 4: Save Template

Save customized template to exploit.py in current directory.

Template Descriptions

ret2win

Simple overflow to call existing win/flag function. Best when PIE disabled and win function exists.

ret2libc

Two-stage attack: leak libc address, then call system("/bin/sh"). Requires gadgets and partial RELRO.

rop

Generic ROP chain construction. For complex scenarios requiring multiple gadgets.

format-string

Arbitrary read/write via printf vulnerability. Includes offset finder and payload generator.

shellcode

Direct shellcode execution. Requires executable stack (NX disabled).

got-overwrite

Overwrite GOT entry to redirect execution. Requires partial RELRO and write primitive.

heap

Basic tcache/fastbin exploitation. Template for common heap scenarios.

srop

Sigreturn-based exploitation. For minimal gadget scenarios.

Output

Generated template includes:

  • Full pwntools setup with context
  • Local/remote/GDB connection toggle
  • Commented explanation of each step
  • Placeholder values clearly marked with # TODO

Read the full file on GitHub · 91 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 91 lines · 17 tokens per session scan A fcb03ce65e86

Subscribe to this mod's changes

pwn-template is a command published in the GitHub repository allsmog/pwn-claude-plugin (2 stars, last pushed 6mo ago), licensed MIT. It adds 17 tokens to every session and 541 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.