docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
---
|
||||
id: wiki-2026-0508-fuzzing
|
||||
title: Fuzzing
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Fuzz Testing, Coverage-Guided Fuzzing]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [security, testing, dast]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: C/Rust/Go
|
||||
framework: AFL++/libFuzzer/cargo-fuzz
|
||||
---
|
||||
|
||||
# Fuzzing
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 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.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 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.
|
||||
|
||||
### 매 sanitizers
|
||||
- ASan (heap/stack OOB, UAF), UBSan (UB), MSan (uninit read), TSan (data race), LSan (leak).
|
||||
- 매 fuzzing 의 corpus 는 sanitizer 와 함께 build 의 mandatory.
|
||||
|
||||
### 매 응용
|
||||
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).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### libFuzzer (C++)
|
||||
```cpp
|
||||
// fuzz_target.cc — clang -fsanitize=fuzzer,address fuzz_target.cc parser.cc
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "parser.h"
|
||||
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||
### cargo-fuzz (Rust)
|
||||
```rust
|
||||
// fuzz/fuzz_targets/parse.rs
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
### 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 @@
|
||||
```
|
||||
|
||||
### Structure-aware (libprotobuf-mutator)
|
||||
```cpp
|
||||
DEFINE_PROTO_FUZZER(const my::Message& msg) {
|
||||
HandleMessage(msg); // valid proto guaranteed → deeper coverage
|
||||
}
|
||||
```
|
||||
|
||||
### 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: [[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