Zum Inhalt springen
Skillpedia
Sicherheit35k · #8193

performing-binary-exploitation-analysis

Was er macht

Dieses Tool hilft dir, Sicherheitslücken in Programmen (ELF-Dateien) zu finden, mit denen ein Angreifer Befehle ausführen könnte. Es sucht nach Buffer-Overflow-Schwachstellen und baut kleine Programme (Exploits), die das Problem zeigen.

Wann du ihn nutzt

  • ✓Wenn du mit Genehmigung die Sicherheit eines Programms testest.
  • ✓Wenn du an Sicherheitswettbewerben (CTFs) teilnimmst.
  • ✓Wenn du prüfst, ob die Schutzmechanismen eines Programms gegen Angriffe funktionieren.

Link zum Skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-binary-exploitation-analysis/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-binary-exploitation-analysis/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Analysiere dieses Programm auf Sicherheitslücken und erstelle ein Beispiel, wie man sie ausnutzen kann.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool nutzt Hilfsprogramme wie `checksec`, um die Schutzmechanismen des Programms zu prüfen, und `pwntools`, um Angriffe zu bauen. Es findet heraus, wo das Programm versagt, und erstellt Code, der diese Schwachstelle ausnutzt, um Befehle auszuführen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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 pwndbg or GEF plugin for enhanced debugging
  • ROPgadget for ROP chain gadget discovery (pip install ROPgadget)
  • checksec (included with pwntools or standalone via apt 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>)

…

Häufige Fragen

Was ist eine ELF-Datei?

Das ist ein gängiger Typ ausführbarer Dateien unter Linux und Unix, etwa Programme, die du auf deinem Computer startest.

Was ist ein „Buffer Overflow“?

Das ist eine Schwachstelle, bei der ein Programm mehr Daten in einen Speicherbereich schreibt, als dieser fassen kann. Dabei können wichtige Informationen überschrieben werden, sodass sich schädlicher Code ausführen lässt.

Was ist ROP (Return-Oriented Programming)?

Das ist eine fortgeschrittene Technik, wenn ein Programm Schutzmechanismen hat, die direkte Codeausführung verhindern. Stattdessen werden kleine, bereits vorhandene Codeteile im Programm zu einer Kette verbunden, um das gewünschte Ergebnis zu erreichen.

Details

Originalbeschreibung des Autors

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. '

repo: mukul975/Anthropic-Cybersecurity-Skills

Beliebtheit

GitHub-Sterne
35k
Platz im Ranking
#8193
Lizenz
Apache-2.0
Aktualisiert
31.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills