본문으로 건너뛰기
Skillpedia
테스트6.5k · #14167

fuzzing

하는 일

이 스킬은 메모리 오류와 버그를 찾기 위해 컴파일된 프로그램과 라이브러리를 퍼징 테스트하는 방법을 설명합니다. 자신의 코드를 테스트하는 개발자와 보안 엔지니어를 위한 스킬입니다.

사용하는 경우

  • ✓개발자가 출시 전에 파일 파서의 충돌 버그를 찾으려는 경우.
  • ✓보안 엔지니어가 신뢰할 수 없는 입력을 읽는 라이브러리를 테스트해야 할 때.
  • ✓팀이 퍼징 실행으로 발견한 충돌을 줄이고 정리하려는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/fuzzing/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/fuzzing/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분.

작동 방식

이 스킬은 AI에게 퍼징 도구를 고르고, 작은 테스트 하네스를 작성하고, 입력을 모으고, 찾은 충돌을 줄이고 정렬하도록 안내합니다.

기술 내용 (원본 SKILL.md)

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

Coverage-Guided Fuzzing Playbook

Find memory-corruption and logic bugs by systematically mutating inputs while tracking code coverage. Works on parsers, network protocol handlers, file format readers, crypto implementations.

1. Target Scoping

Before writing a harness, answer:

  • What is the attack surface? (file parser / network socket / library API)
  • What input format does the target consume? (binary struct / text / TLV)
  • Is source available? (instrumented build) or binary-only? (QEMU/Frida mode)
# Quick API surface for a library
nm -D /workspace/target.so | grep ' T ' | awk '{print $3}' | sort > /workspace/exports.txt
# or via radare2
r2 -q -e bin.demangle=true -c "aaa; afl~pub" /workspace/target.so 2>/dev/null | head -40

2. Fuzzer Selection

Scenario Fuzzer Rationale
Source available, C/C++ AFL++ Best coverage feedback, mutator ecosystem
Source available, any lang libFuzzer In-process, lower overhead, LLVM native
Binary-only AFL++ QEMU mode AFL_USE_QEMU=1
Binary-only (faster) AFL++ Frida mode Lighter than QEMU on some targets
Multi-CPU farm AFL++ + honggfuzz honggfuzz for socket fuzzing
Go / Rust native go-fuzz / cargo fuzz Language-native instrumentation
Network protocol daemon AFL++ persistent + preeny Desock the accept() loop

3. Instrumented Build (source-available)

# AFL++
CC=afl-clang-fast CXX=afl-clang-fast++ \
  cmake -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_C_FLAGS="-fsanitize=address,undefined -g -O1" \
        -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -g -O1" \
        -S /workspace/src -B /workspace/build-afl
cmake --build /workspace/build-afl -j$(nproc)

# libFuzzer (alternative)
CC=clang CXX=clang++ \
  cmake -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_C_FLAGS="-fsanitize=fuzzer,address,undefined -g" \
        -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer,address,undefined -g" \
        -S /workspace/src -B /workspace/build-lf
cmake --build /workspace/build-lf -j$(nproc)

Minimum sanitizer flags: -fsanitize=address,undefined. Add -fsanitize=memory (MSan) on a separate build for uninit reads. Do NOT combine MSan with ASan — they conflict.

4. Harness Skeleton

AFL++ persistent-mode harness (C)

/* harness.c — compile with afl-clang-fast */
#include <stdint.h>
#include <string.h>

/* Include target headers */
#include "target_api.h"

/* AFL++ persistent mode — loops inside the same process (~20x faster) */
__AFL_FUZZ_INIT();

int main(void) {
    __AFL_INIT();
    const uint8_t *buf = __AFL_FUZZ_TESTCASE_BUF;
    while (__AFL_LOOP(10000)) {
        size_t len = __AFL_FUZZ_TESTCASE_LEN;
        /* Call the target function directly */
        target_parse(buf, len);   /* replace with actual API */
    }
    return 0;
}

libFuzzer target (C)

/* fuzz_target.cc */
#include <stdint.h>
#include <stddef.h>
#include "target_api.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    /* Wrap any setup in thread_local or static init if needed */
    target_parse(data, size);
    return 0;  /* non-zero aborts fuzzer */
}

Key harness rules:

  • Allocate nothing that leaks between iterations (use arena or reset)
  • Do not call exit() or abort() inside the harness — let ASan terminate
  • Minimize initialization overhead outside the fuzz loop
  • If target needs a null-terminated string: strndup((char*)data, size)

5. Seed Corpus Curation

# Create corpus dir
mkdir -p /workspace/corpus/initial

# If target is a file parser, seed with real samples
find /usr/share -name "*.png" 2>/dev/null | head -10 | \
  xargs -I{} cp {} /workspace/corpus/initial/

# For binary protocols, create minimal valid inputs by hand
# For text protocols, minimal valid requests:
printf 'GET / HTTP/1.0\r\n\r\n' > /workspace/corpus/initial/http_get.bin

# AFL++ minimize corpus to remove redundant seeds
afl-cmin -i /workspace/corpus/initial \
         -o /workspace/corpus/minimized \
         -- /workspace/build-afl/harness @@

Good seed = valid, minimal, diverse. 5–50 seeds beats 5000 random bytes.

6. Run AFL++

mkdir -p /workspace/findings/afl

# Single-core
AFL_SKIP_CPUFREQ=1 \
AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 \
afl-fuzz \
  -i /workspace/corpus/minimized \
  -o /workspace/findings/afl \
  -t 1000 \           # timeout per testcase (ms)
  -- /workspace/build-afl/harness @@

# Multi-core (1 main + N-1 secondary)
자주 묻는 질문

퍼징이란 무엇인가요?

프로그램에 수정된 입력을 많이 보내고 충돌이나 오류를 살피는 것입니다.

어떤 도구를 언급하나요?

AFL++, libFuzzer, Honggfuzz와 소스 및 바이너리 대상을 위한 방법을 언급합니다.

버그도 고치나요?

아닙니다. 개발자가 고칠 수 있도록 충돌을 찾고 정리하는 것을 돕습니다.

상세 정보

작성자의 원본 설명

Coverage-guided fuzzing methodology for compiled binaries and libraries: target scoping, fuzzer selection (AFL++/libFuzzer/Honggfuzz), harness skeleton, ASan+UBSan flags, corpus curation, crash triage and minimization (afl-tmin/minimize_corpus), exploitability rubric. Outputs corpora and crashes to /workspace/. Triggers on: 'fuzz', 'fuzzing', 'AFL', 'libFuzzer', 'harness', 'crash triage', 'coverage-guided', 'afl-tmin', 'sanitizer', 'corpus'.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14167
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬