본문으로 건너뛰기
Skillpedia
데이터베이스48k · #5540

pwn-chain

하는 일

이 도구는 알려진 취약점을 익스플로잇 프로그램으로 바꾸는 데 도움을 줍니다. 메모리 오버플로나 리눅스 시스템의 오류처럼 소프트웨어 버그를 이용하는 '익스플로잇'(보안 결함을 악용하는 프로그램)을 만듭니다.

사용하는 경우

  • ✓프로그램에 결함이 있다는 것을 이미 알고 있고, 이를 이용하는 코드를 만들려고 할 때.
  • ✓테스트 환경(CTF)에서 쓰던 익스플로잇을 허가된 실제 시스템에 맞게 조정할 때.
  • ✓리눅스 운영체제 구성 요소(커널)의 결함을 이용해 관리자 권한을 얻으려 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pwn-chain/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pwn-chain/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제가 리눅스 프로그램에서 발견한 버퍼 오버플로 취약점에 대한 익스플로잇을 만들고 싶습니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

'pwntools' 같은 라이브러리를 사용해 익스플로잇 코드를 작성합니다. 먼저 취약점의 유형과 시스템 보호 기능을 분석합니다. 그다음 익스플로잇 전략을 고르고, '가젯'이라 불리는 기존 코드 조각을 찾아 익스플로잇을 조립합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

⚠️ AUTHORIZED USE ONLY This skill is for educational purposes or authorized security assessments only. You must have explicit, written permission from the system owner before using this tool. Misuse of this tool is illegal and strictly prohibited.

Mandatory confirmation gate Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:

  1. Ask the user to state the exact target URL, IP, account, or resource.
  2. Ask the user to confirm written authorization and the permitted scope.
  3. Show the exact command(s) and explain their expected effect.
  4. Wait for explicit confirmation in the current conversation.

Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.

When to Use

  • A binary vulnerability is understood and needs a reliable exploit.
  • Porting a CTF-style exploit to an authorized real-world target.

适用范围

当任务属于以下场景时使用本 skill:

  1. 拿到二进制 + 已知漏洞点 — 静态/审计/fuzz 已经找到溢出/UAF/double free,需要从触发到拿 shell
  2. CTF 题已经本地通了,远程打不通 — 远端环境差异导致脚本失效,需要稳定化
  3. 真实目标的二进制利用 — SRC / 红队场景下,已经识别到内存损坏漏洞,需要构造 RCE
  4. Linux 内核驱动的 ioctl bug — 用户态触发,目标是提权到 root

前提:你已经知道"哪里炸了"。本 skill 不负责发现漏洞(那是 fuzzing / 审计),只负责"从漏洞点写出 exploit"。

与其他 skill 的分工

场景 用什么
识别 custom VM / anti-debug / 复杂 obfuscation reverse-engineering/
从零打开二进制做静态分析 ida-reverse/ 或 radare2/
有漏洞点,写 exploit 打通远程 本 skill
把 pwn 拿到的 shell 整合进完整攻击链 attack-chain/(下游)

reverse-engineering/ 关注"理解程序在干什么"(模式识别、协议还原、解 CTF 题里的奇怪机制);本 skill 关注"把已经看懂的漏洞变成可执行的攻击"。两者经常配套使用,但分工清晰。

核心工作流

Step 1: 确认漏洞类型 + 保护机制
   ├─ checksec ./vuln(NX / Canary / PIE / RELRO / Fortify)
   ├─ file ./vuln  + readelf -d ./vuln
   ├─ 漏洞分类:栈溢出 / 格式化字符串 / 堆 (UAF/DF/OF) / 整数 / 竞态 / 内核
   └─ → 决定走哪个 references/

Step 2: 选择利用策略
   ├─ NX 关 + 无 ASLR → 直接 shellcode
   ├─ NX 开 + 给 libc → ret2libc / one_gadget
   ├─ NX 开 + 不给 libc → leak 后 libc-database 反查
   ├─ 堆 → 按 glibc 版本对应技术 (tcache/fastbin/unsorted/large)
   └─ 内核 → commit_creds / modprobe_path / core_pattern

Step 3: 准备 libc + gadget
   ├─ libc-database:./find puts 0x6f0
   ├─ ROPgadget --binary ./libc.so.6 --only "pop|ret"
   ├─ one_gadget ./libc.so.6
   └─ 计算 base:leak_addr - libc.sym['puts']

Step 4: 写 pwntools 模板(本地 process)
   ├─ context.binary = ELF('./vuln')
   ├─ p = process('./vuln')  /  p = gdb.debug('./vuln','b *main+xx')
   ├─ payload = cyclic(N) + p64(ret) + ...
   └─ p.interactive()

Step 5: 本地通
   ├─ 反复 attach + 看寄存器 + 调 offset
   ├─ 用 pwndbg/GEF 的 vmmap / heap / bins / telescope
   └─ 跑通后切 remote()

Step 6: 远程稳定化
   ├─ libc 偏移:用 leak 反查 libc-database,不要拍脑袋
   ├─ 栈对齐:16-byte 不对齐 → movaps 崩 → 加一个 ret gadget
   ├─ 远程网络延迟 → recvuntil 精确锚字符串,禁用模糊 sleep
   ├─ 远程缓冲:sendlineafter 比 sendline 更稳
   ├─ 堆喷成功率:放大 spray 数量 + 留 padding chunk 防合并
   └─ 多次跑:写 while True 验证成功率 ≥ 95%

典型场景

场景 1:远程 64 位二进制 (NX+PIE+canary, 给了 libc)

已有:./vuln(64-bit ELF, NX, PIE, canary)+ ./libc.so.6 + nc host port
漏洞:read(buf, 0x200) 但 buf 只有 0x40 字节 → 栈溢出
保护:canary 拦住,PIE 让 .text 随机化

策略:
1. 先 leak canary(栈/格式化字符串/部分读)
2. 再 leak 一个 libc 函数地址(puts@got)
3. 用 libc.address = leaked - libc.sym['puts'] 算 libc base
4. one_gadget ./libc.so.6 选一个约束能满足的 magic gadget
5. payload = padding + canary + saved_rbp + (pop_rdi + bin_sh + system) 或直接 one_gadget
6. 加一个 ret gadget 修栈对齐(关键!)

完整模板参见 references/stack-pwn.md。

场景 2:Linux 内核驱动 ioctl 越界写 → 拿 root

已有:vmlinux + bzImage + initramfs.cpio.gz + 自定义 vuln.ko
漏洞:ioctl(0x1337, ptr) 里 copy_from_user 长度可控 → kernel heap overflow (kmalloc-64 slab)
保护:SMEP, SMAP, KASLR, KPTI

策略:
1. 改 init 脚本拿到 root shell(CTF)或先 leak KASLR base 再继续(真实)
2. 通过 /proc/kallsyms(可能限权)或未初始化堆喷 leak 内核基址
3. 在 kmalloc-64 slab 里喷 tty_struct / msg_msg / pipe_buffer
4. 覆盖 vtable 指针指向用户态 → 不行(SMEP),改走 stack pivot + 内核 ROP
5. ROP 链:prepare_kernel_cred(0) → commit_creds → swapgs+iretq → 用户态 execve("/bin/sh")
6. 或更省事:覆盖 modprobe_path 为 "/tmp/x",写一个 /tmp/x,然后触发 modprobe

完整模板参见 references/kernel-pwn.md。

按需自举 (On-Demand Bootstrap)

工具依赖

工具 用途 安装方式
pwntools exploit 编写框架 pip install pwntools
GEF gdb 增强(推荐内核 + 用户态) git clone https://github.com/bata24/gef (fork 维护活跃)
pwndbg gdb 增强(堆调试体验最好) git clone https://github.com/pwndbg/pwndbg && ./setup.sh
ROPgadget gadget 搜索 pip install ropgadget

…

자주 묻는 질문

'pwn'은 무엇인가요?

정보 보안 커뮤니티에서 '당하다' 또는 '장악하다'라는 뜻으로 쓰는 속어입니다. 이 맥락에서는 프로그램의 취약점을 찾아 악용하는 기술을 가리킵니다.

'가젯'은 무엇인가요?

대상 프로그램이나 라이브러리 안에 이미 존재하는 작은 코드 조각입니다. 새 코드를 주입하지 않고도 특정 동작을 수행하는 익스플로잇을 만드는 데 쓰입니다.

이 도구를 쓰려면 허가가 필요한가요?

네, 반드시 필요합니다. 명시적이고 서면으로 된 허가를 받은 시스템에서만 사용해야 합니다. 허가 없는 시스템에서 사용하면 불법입니다.

상세 정보

작성자의 원본 설명

Go from reverse engineering to a working exploit: stack/heap/kernel pwn workflows with pwntools, libc-database, ROP, and stabilization from CTF to authorized remote targets.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5540
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬