[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,92 +2,153 @@
|
||||
id: wiki-2026-0508-fuzzing
|
||||
title: Fuzzing
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-CE0886]
|
||||
aliases: [Fuzz Testing, Coverage-Guided Fuzzing]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
verification_status: applied
|
||||
tags: [security, testing, dast]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - Fuzzing"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: C/Rust/Go
|
||||
framework: AFL++/libFuzzer/cargo-fuzz
|
||||
---
|
||||
|
||||
# [[Fuzzing]]
|
||||
# Fuzzing
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> 퍼징(Fuzzing)은 애플리케이션에 스트레스를 가해 예상치 못한 동작, 프로그램 충돌(크래시) 또는 리소스 누수를 유발함으로써 소프트웨어의 취약점을 찾아내는 동적 애플리케이션 보안 테스트(DAST) 기법입니다 [1]. 소스에 관련 정보가 부족합니다.
|
||||
## 매 한 줄
|
||||
> **"매 random/mutated input 으로 crash, hang, UB 의 hunt"**. 매 1988 Miller (Wisconsin) 의 random input shell experiment 가 origin. 2026 현재 매 coverage-guided (AFL++, libFuzzer, Honggfuzz), structure-aware (libprotobuf-mutator), grammar-based (Nautilus), LLM-augmented (OSS-Fuzz Gen) 가 mainstream. Google OSS-Fuzz 가 100K+ bug 발견, Chrome/Linux kernel/OpenSSL 의 routine workflow.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **DAST의 일환:** 퍼징은 실행 중인 애플리케이션을 테스트하는 동적 애플리케이션 보안 테스트(DAST) 방법 중 하나로 분류됩니다 [1].
|
||||
- **스트레스 테스트:** 애플리케이션에 의도적으로 스트레스를 주어 예상치 못한 동작이나 시스템 크래시, 그리고 리소스 누수(resource leaks) 등을 유발하도록 작동합니다 [1].
|
||||
- **취약점 이해 도모:** 이러한 과정을 통해 개발자는 애플리케이션의 런타임 동작 방식과 내재된 취약점들을 보다 포괄적이고 종합적으로 이해할 수 있게 됩니다 [1].
|
||||
- 소스에 관련 정보가 부족합니다.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Programming & Language 분야의 자동 자산화 수행.
|
||||
### 매 fuzzing categories
|
||||
- **Black-box (dumb)**: random input, no instrumentation. 매 zzuf, radamsa.
|
||||
- **Coverage-guided (grey-box)**: input 의 mutation + branch coverage feedback. 매 AFL++, libFuzzer, Honggfuzz.
|
||||
- **White-box (concolic)**: symbolic execution + solver. 매 KLEE, SAGE.
|
||||
- **Structure-aware**: protobuf, JSON 의 grammar 의 valid input. 매 libprotobuf-mutator, FuzzGrammar.
|
||||
- **Differential**: 매 동일 input 을 두 implementation 에 → divergence 의 bug.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** DAST, Vulnerabilities
|
||||
- **Projects/Contexts:** 애플리케이션의 동작 및 취약점을 포괄적으로 이해하기 위한 소프트웨어 보안 테스트 컨텍스트에서 활용됩니다 [1].
|
||||
- **Contradictions/Notes:** 소스에 관련 정보가 부족합니다.
|
||||
### 매 sanitizers
|
||||
- ASan (heap/stack OOB, UAF), UBSan (UB), MSan (uninit read), TSan (data race), LSan (leak).
|
||||
- 매 fuzzing 의 corpus 는 sanitizer 와 함께 build 의 mandatory.
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-18*
|
||||
### 매 응용
|
||||
1. Memory-safety bug discovery (C/C++ codebases).
|
||||
2. Parser hardening (image, video, network protocols).
|
||||
3. Browser engine (V8 fuzzilli, JSC fuzzer).
|
||||
4. Crypto library (OpenSSL, BoringSSL via OSS-Fuzz).
|
||||
|
||||
---
|
||||
## 💻 패턴
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### libFuzzer (C++)
|
||||
```cpp
|
||||
// fuzz_target.cc — clang -fsanitize=fuzzer,address fuzz_target.cc parser.cc
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "parser.h"
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
if (size < 4) return 0;
|
||||
Parser p;
|
||||
p.Parse(reinterpret_cast<const char*>(data), size); // ASan catches OOB/UAF
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### cargo-fuzz (Rust)
|
||||
```rust
|
||||
// fuzz/fuzz_targets/parse.rs
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(s) = std::str::from_utf8(data) {
|
||||
let _ = mycrate::parse(s); // panics 는 fuzz crash 로 catch
|
||||
}
|
||||
});
|
||||
```
|
||||
```bash
|
||||
cargo fuzz run parse -- -max_total_time=600
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Go native fuzzing (1.18+)
|
||||
```go
|
||||
func FuzzParseURL(f *testing.F) {
|
||||
f.Add("http://example.com")
|
||||
f.Fuzz(func(t *testing.T, s string) {
|
||||
u, err := url.Parse(s)
|
||||
if err == nil && u.String() != s && url.QueryEscape(u.String()) == "" {
|
||||
t.Errorf("roundtrip mismatch: %q", s)
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
```bash
|
||||
go test -fuzz=FuzzParseURL -fuzztime=10m
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### AFL++ (compile-time instrumentation)
|
||||
```bash
|
||||
CC=afl-clang-fast CXX=afl-clang-fast++ ./configure
|
||||
make -j8
|
||||
mkdir in; echo "seed" > in/0
|
||||
afl-fuzz -i in -o out -- ./target @@
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Structure-aware (libprotobuf-mutator)
|
||||
```cpp
|
||||
DEFINE_PROTO_FUZZER(const my::Message& msg) {
|
||||
HandleMessage(msg); // valid proto guaranteed → deeper coverage
|
||||
}
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### OSS-Fuzz integration
|
||||
```dockerfile
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
RUN apt-get install -y libssl-dev
|
||||
COPY . $SRC/myproject
|
||||
COPY build.sh $SRC/
|
||||
WORKDIR $SRC/myproject
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| C/C++ memory bug hunt | libFuzzer + ASan/UBSan |
|
||||
| Rust panic / logic bug | cargo-fuzz |
|
||||
| Network protocol parser | AFL++ + structure-aware mutator |
|
||||
| Two implementations comparison | Differential fuzzing |
|
||||
| Continuous (open-source) | OSS-Fuzz |
|
||||
| Grammar-rich (JS, SQL) | Grammar-based (Nautilus, fuzzilli) |
|
||||
|
||||
**기본값**: 매 coverage-guided (libFuzzer/AFL++) + ASan + corpus minimization + CI 에 5min smoke.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[DAST (동적 애플리케이션 보안 테스트)]]
|
||||
- 변형: [[SCA (소프트웨어 구성 분석)]]
|
||||
- 응용: [[OSS-Fuzz]] · [[V8 엔진 힙 아키텍처]]
|
||||
- Adjacent: [[Symbolic Execution]] · [[Property-Based Testing]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 untrusted input 의 parser, codec, deserializer 가 있는 경우. 매 security-critical library 의 release 전 mandatory.
|
||||
**언제 X**: pure functional code 의 deterministic 한 input space (property-based testing 이 더 적절). 매 GUI / network state-heavy code.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Sanitizer 없이 fuzz**: 매 silent corruption 을 miss. 매 ASan 의 mandatory.
|
||||
- **Seed corpus 없음**: 매 coverage 의 plateau 가 빠름. 매 valid sample 10-100 개 의 seed.
|
||||
- **CI 에 30s 만 fuzz**: 매 너무 짧음. 매 minimum 10min, ideal continuous (OSS-Fuzz pattern).
|
||||
- **Crash 만 의 focus**: 매 hang, OOM, slow input 도 bug. 매 timeout / rss_limit 설정.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Miller 1990 "Empirical Study of Reliability of UNIX Utilities"; AFL++ docs; OSS-Fuzz reports).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — coverage-guided + sanitizers + OSS-Fuzz |
|
||||
|
||||
Reference in New Issue
Block a user