performing-binary-exploitation-analysis
하는 일
이 도구는 공격자가 명령을 실행할 수 있는 컴퓨터 프로그램(ELF 파일)의 보안 결함을 찾는 데 도움을 줍니다. 버퍼 오버플로 취약점을 찾고, 문제를 보여 주기 위해 작은 프로그램(익스플로잇)을 만듭니다.
사용하는 경우
- ✓허가를 받고 프로그램의 보안을 테스트할 때.
- ✓보안 경진대회(CTF)에 참여할 때.
- ✓프로그램의 공격 방어 장치가 작동하는지 확인할 때.
스킬 링크
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-binary-exploitation-analysis/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 프로그램을 분석해 보안 결함을 찾고, 이를 악용하는 예시를 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 도구는 프로그램의 보호 기능을 확인하는 checksec과 공격 코드를 만드는 pwntools 같은 유틸리티를 사용합니다. 프로그램이 어디서 실패하는지 찾고, 그 결함을 이용해 명령을 실행하는 코드를 만듭니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Performing Binary Exploitation Analysis
For authorized security testing and CTF challenges only.
Analyze ELF binaries for exploitation vectors using checksec, ROPgadget, and pwntools for buffer overflow and ROP chain development.
When to Use
- Analyzing ELF binaries during authorized penetration tests to identify memory corruption vulnerabilities
- Solving binary exploitation challenges in CTF competitions
- Evaluating the effectiveness of compiler mitigations (NX, ASLR, stack canaries, PIE, RELRO) on target binaries
- Developing proof-of-concept exploits for vulnerability reports to demonstrate impact
- Training security engineers in exploit development techniques for defensive awareness
- Validating that security patches for buffer overflow vulnerabilities are effective
Do not use against systems without explicit written authorization. Binary exploitation techniques can cause system instability and must only be applied in controlled environments (lab VMs, CTF platforms, authorized pentests with scope documents).
Prerequisites
- Linux system (Ubuntu/Debian recommended) for exploit development
- Python 3.8+ with
pwntools(pip install pwntools) - GDB with
pwndbgorGEFplugin for enhanced debugging ROPgadgetfor ROP chain gadget discovery (pip install ROPgadget)checksec(included with pwntools or standalone viaapt install checksec)- Target vulnerable binary compiled for testing (e.g., from pwnable.kr, ROP Emporium, or custom test binaries)
- Basic understanding of x86/x86_64 calling conventions and stack layout
Workflow
Step 1: Install the Exploitation Toolkit
# Install pwntools and dependencies
pip install pwntools ROPgadget
# Install GDB with pwndbg plugin
git clone https://github.com/pwndbg/pwndbg
cd pwndbg && ./setup.sh
# Alternatively, install GEF (GDB Enhanced Features)
# bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
# Install supporting tools
sudo apt install -y gdb nasm gcc-multilib libc6-dbg
# Verify installation
python3 -c "from pwn import *; print('pwntools version:', version)"
checksec --version
ROPgadget --version
Step 2: Analyze Binary Protections with checksec
Before writing any exploit, enumerate the security mitigations compiled into the binary:
from pwn import *
# Load the target binary
binary_path = "./vulnerable_server"
elf = ELF(binary_path)
# checksec output explains what mitigations are in place
print(f"Architecture: {elf.arch}")
print(f"Bits: {elf.bits}")
print(f"Endianness: {elf.endian}")
print()
# Key security properties
# RELRO: Full = GOT is read-only, Partial = GOT header read-only, No = writable GOT
# Stack Canary: Detects stack buffer overflows via random canary value
# NX (No-eXecute): Prevents executing code on the stack (DEP)
# PIE: Position Independent Executable, randomizes base address
# ASLR: OS-level address randomization (check /proc/sys/kernel/randomize_va_space)
# Also available via command line:
# checksec --file=./vulnerable_server
# Command-line checksec output example:
checksec --file=./vulnerable_server
# RELRO STACK CANARY NX PIE
# Partial RELRO No canary found NX disabled No PIE
# Check ASLR status on the system
cat /proc/sys/kernel/randomize_va_space
# 0 = disabled, 1 = conservative, 2 = full randomization
Step 3: Find the Buffer Overflow Offset
Determine exactly how many bytes are needed to overwrite the return address:
from pwn import *
context.binary = ELF("./vulnerable_server")
context.log_level = "info"
# Method 1: Use cyclic pattern to find exact offset
# Generate a unique cyclic pattern
pattern_length = 200
pattern = cyclic(pattern_length)
print(f"Generated cyclic pattern of length {pattern_length}")
# Send the pattern to the binary
p = process("./vulnerable_server")
p.sendline(pattern)
p.wait()
# After the crash, read the value in RIP/EIP from core dump or GDB
# Then find the offset:
# For 64-bit: crashed_value = p.corefile.fault_addr
# Or manually from GDB: "info registers rip" after crash
crashed_rip = 0x6161616c # Example value from crash
offset = cyclic_find(crashed_rip)
print(f"Offset to return address: {offset} bytes")
# Method 2: Use GDB with pwndbg to find offset interactively
# In GDB:
# pwndbg> cyclic 200
# pwndbg> run < <(python3 -c "from pwn import *; print(cyclic(200).decode())")
# pwndbg> cyclic -l $rsp (or cyclic -l <value in RIP>)
…
자주 묻는 질문
ELF 파일이란 무엇인가요?
Linux와 Unix 시스템의 일반적인 실행 파일 형식입니다. 컴퓨터에서 실행하는 프로그램과 같은 종류입니다.
'버퍼 오버플로'란 무엇인가요?
프로그램이 메모리 영역이 담을 수 있는 것보다 더 많은 데이터를 쓰려고 할 때 발생하는 결함입니다. 중요한 정보를 덮어쓸 수 있으며, 악의적인 코드 실행을 허용할 수 있습니다.
ROP(Return-Oriented Programming)란 무엇인가요?
프로그램이 코드를 직접 실행하지 못하도록 막는 보호 장치가 있을 때 사용하는 고급 기법입니다. 공격자는 프로그램 안에 이미 있는 작은 코드 조각을 연결해 원하는 동작을 수행합니다.
상세 정보
작성자의 원본 설명
Analyze ELF binaries for memory-corruption vulnerabilities and build proof-of-concept exploits using pwntools, checksec, and ROPgadget for buffer overflows and ROP chains. Use when a penetration test or CTF challenge requires evaluating compiler mitigations (NX, ASLR, stack canaries, PIE, RELRO) or developing a working exploit to demonstrate impact. '
인기도
- GitHub 스타
- 35k
- 순위
- #8193
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 8. 31.
댓글
- …
이 저장소의 다른 스킬
abusing-dpapi-for-credential-access
35kAI 에이전트에게 특정 작업을 위한 준비된 지침을 제공해, 더 잘하고 더 빠르게 처리하도록 합니다.
abusing-shadow-credentials-for-privesc
35kAI 에이전트가 명확하고 잘 구성된 텍스트를 쓰도록 가르칩니다.
achieving-cmmc-level-2-compliance
35kCMMC Level 2 규정 준수를 위한 환경을 준비하도록 돕습니다. 보안 요구 사항을 구현하고 필요한 문서를 관리합니다.
acquiring-disk-image-with-dd-and-dcfldd
35k에이전트가 하드 드라이브의 정확한 복사본을 만들도록 돕습니다. 조사 중 정보가 손실되거나 변경되지 않도록 하는 데 유용합니다.