ํ๊ตญ์ด ยท English
C/C++ protocolยทplatform ์ฝ๋์ ์ทจ์ฝ์ finding์ ์ฌํ ๊ฐ๋ฅํ ์ฆ๊ฑฐ๋ก ์ ๊ทํํ๊ณ ,
ํ๋ณด ํจ์น๋ฅผ ๊ฒฉ๋ฆฌ๋ ๋ณต์ฌ๋ณธ์์ ๊ฒ์ฆํ๋ MVP๋ค. ์ ์ฅ์ ์ด๋ฆ์ code-shield์ด๊ณ ,
๊ณต๊ฐ Python package์ CLI๋ ์ด๋ฆ ์ถฉ๋์ ํผํ๊ธฐ ์ํด ์ค๋ฆฝ์ ์ธ ๋ด๋ถ ์ด๋ฆ
protocol-remediator๋ฅผ ์ฌ์ฉํ๋ค.
# Python core (๋ฐํ์ dependency ์์)
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m unittest discover -s tests -v
# React console
cd frontend
npm install
npm run dev # http://127.0.0.1:5173์ฝ์์ ์ ์ฅ์์ ํฌํจ๋ fixture matrixยทgenerated corpusยทcase study ๊ฒฐ๊ณผ๋ฅผ ์ ์ ๋ฐ์ดํฐ๋ก ๋ณด์ฌ์ค๋ค.
ํ์ฌ ๊ตฌํ์ ์ค์ฌ์ ํจ์น ์์ฑ ๋ชจ๋ธ์ด ์๋๋ผ ๋ค์ ๊ฒ์ฆ ํ๋ฃจํ๋ค.
sanitizer ๋๋ SARIF
-> Finding + EvidenceBundle
-> source context
-> manual/external-agent patch
-> ์๋ณธ ์ฌํ
-> build
-> patched reproducer
-> tests
-> static rescan
-> bounded refuzz
-> protocol oracle
-> verified report
- versioned
Finding,EvidenceBundle,PatchProposal,VerificationReportJSON ๋ชจ๋ธ detected โ reproducible โ contextualized โ proposed โ plausible โ verified์ํ ์ ์ด- AddressSanitizer, MemorySanitizer, UndefinedBehaviorSanitizer ๋ณด๊ณ ์ ์์ง
- SARIF 2.1 finding ์์ง
- normalized finding์ SARIF 2.1 ๋ด๋ณด๋ด๊ธฐ
- source location ์ฃผ๋ณ์ ๊ฐ์ฌ ๊ฐ๋ฅํ context JSON ์์ฑ
- TOML ๊ธฐ๋ฐ target/build/gate ์ค์
- network-off, capability-drop, resource-limit๊ฐ ์ ์ฉ๋ Docker ์คํ๊ธฐ
- ๋ช ์์ opt-in์ด ํ์ํ local ์คํ๊ธฐ
- ์๋ณธ target ๋ณต์ฌ๋ณธ์์ finding ์ฌํ ํ ๋ณ๋ ๋ณต์ฌ๋ณธ์์ patch ๊ฒ์ฆ
- patch checksum, reproducer checksum, ๊ฒฝ๋ก ํ์ถ, symlink, ํ์ผยท๋ผ์ธ ์ ํ ๊ฒ์ฌ
- test/fuzz harness/reproducer ๊ฐ์ ๋ณดํธ ๊ฒฝ๋ก์ patch ๊ฑฐ๋ถ
- ์ธ๋ถ patch agent command ์ด๋ํฐ
- ๊ฐ command์ exit code, stdout/stderr, ์๊ฐ๊ณผ gate ๊ฒฐ๊ณผ ๋ณด์กด
- Python 3.11 ์ด์
- patch ๊ฒ์ฆ์ ์ํ Git
- ๊ธฐ๋ณธ ๊ฒฉ๋ฆฌ ์คํ์๋ Docker
- ์์ ์คํ์๋ Clang
๋ฐํ์ Python dependency๋ ์๋ค.
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m unittest discover -s tests -v์ค์นํ์ง ์๊ณ ์คํํ๋ ค๋ฉด:
PYTHONPATH=src python3 -m protocol_remediator --help
PYTHONPATH=src python3 -m unittest discover -s tests -v๋์ end-to-end suite๋ examples์ C/C++ fixture matrix๋ค.
Clang ASan/UBSan์ผ๋ก CWE-121, CWE-190, CWE-416, CWE-787, CWE-476์ ์ค์
์ฌํํ ๋ค์, ๊ฐ invariant๋ฅผ ๋ณต๊ตฌํ๋ patch์ ๋ํด ์ฌ์ฏ gate๋ฅผ ๋ชจ๋ ์คํํ๋ค.
fixture๋ณ ์
๋ ฅ๊ณผ ๊ฒ์ฆ ๋ฒ์๋
examples/README.md์ ์ ๋ฆฌ๋์ด ์๋ค.
unit-test framework ์์ด ์ค์ matrix๋ง ์คํํ๋ ค๋ฉด:
PYTHONPATH=src python3 examples/run_fixture_matrix.py๋ ๋ง์ C/C++ ๋ณํ ์์ ๋ฅผ ์๋ ์์ฑํด ์คํํ๋ ค๋ฉด:
PYTHONPATH=src python3 examples/run_generated_corpus.py --count 50์ด runner๋ unittest๋ฅผ ์ฌ์ฉํ์ง ์๊ณ , ์์ฑํ ๊ฐ ํ๋ก์ ํธ๋ฅผ ๋์ผํ
VerificationPipeline์ ํต๊ณผ์ํจ๋ค. ๊ฒฐ๊ณผ summary๋ ๊ธฐ๋ณธ์ ์ผ๋ก
artifacts/generated-corpus-summary.json์ ๋จ๋๋ค.
ํ์ฌ ๊ตฌํ ์ํ๋ฅผ ์ด์ํ ๋์๋ณด๋๋ก ํ์ธํ ์ ์๋ Vite + React + TypeScript
ํ๋ก ํธ์๋๋ frontend์ ์๋ค. ์ด ์ฝ์์ fixture matrix, generated
corpus, Hermes API server ์ฐ๊ฒฐ๋ฉด, ๊ฒ์ฆ gate, evidence safety invariant๋ฅผ ํ ํ๋ฉด์
์ ๋ฆฌํ๋ค.
cd frontend
npm install
npm run dev๊ธฐ๋ณธ ๊ฐ๋ฐ ์๋ฒ๋ http://127.0.0.1:5173์ด๋ค. production build๋ ๋ค์์ผ๋ก ํ์ธํ๋ค.
cd frontend
npm run buildprotocol-remediator ingest-sanitizer \
--log asan.log \
--reproducer crash.input \
--target-name parser \
--revision 0123456789abcdef \
--variant asan-x86_64 \
--output intake/parser-crash์ถ๋ ฅ:
intake/parser-crash/finding.json
intake/parser-crash/evidence.json
protocol-remediator ingest-sarif \
--sarif results.sarif \
--output intake/sarifprotocol-remediator export-sarif \
--finding intake/parser-crash/finding.json \
--finding intake/another/finding.json \
--output artifacts/findings.sarifprotocol-remediator context \
--finding intake/parser-crash/finding.json \
--evidence intake/parser-crash/evidence.json \
--target-root /path/to/target \
--output intake/parser-crash/context.jsonprotocol-remediator verify \
--config /path/to/target/target.toml \
--finding intake/parser-crash/finding.json \
--evidence intake/parser-crash/evidence.json \
--patch candidate.patch \
--artifacts artifacts์ข
๋ฃ ์ฝ๋๋ verified์ด๋ฉด 0, ๊ฒ์ฆ ์คํจ์ด๋ฉด 1, ์ค์ ยท์
๋ ฅ ์ค๋ฅ์ด๋ฉด 2๋ค.
Hermes API server๋ฅผ ๋์ฐ๋ฉด remediate๊ฐ ๋ก์ปฌ command ๋์ HTTP API๋ก patch๋ฅผ
์์ฒญํ ์ ์๋ค. ๊ธฐ๋ณธ endpoint๋ POST /v1/patches์ด๋ฉฐ, finding/evidence/context์
target workspace archive๋ฅผ ๋ฐ์ unified diff๋ฅผ ๋ฐํํ๋ค.
์์ ์๋ฒ ์คํ:
PYTHONPATH=src python3 -m protocol_remediator.hermes_server \
--host 127.0.0.1 \
--port 8765์ค์น ํ์๋ console script๋ ์ฌ์ฉํ ์ ์๋ค.
hermes-agent-server --host 127.0.0.1 --port 8765์ด์ backend command๋ฅผ ๋ถ์ผ ๋๋ argument ๋จ์๋ก --backend-command๋ฅผ
๋ฐ๋ณตํ๋ค. {context}, {workspace}, {patch_output} placeholder๋ฅผ ์ง์ํ๋ค.
hermes-agent-server \
--backend-command my-patch-agent \
--backend-command --context \
--backend-command {context} \
--backend-command --workspace \
--backend-command {workspace} \
--backend-command --output \
--backend-command {patch_output}target.toml์์๋ ๋ค์์ฒ๋ผ Hermes mode๋ฅผ ์ง์ ํ๋ค.
[agent]
mode = "hermes"
url = "http://127.0.0.1:8765"
timeout_seconds = 30๊ทธ๋ค์ ๊ธฐ์กด remediate ๋ช
๋ น์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ค.
protocol-remediator remediate \
--config examples/length-prefixed-parser/target.hermes.toml \
--finding artifacts/hermes-cli-input/finding.json \
--evidence artifacts/hermes-cli-input/evidence.json \
--artifacts artifacts/hermes-cli๊ฐ๋ฐ์ฉ end-to-end ํ์ธ์ ๋ค์ runner๋ก ์คํํ๋ค. ์ด runner๋ ์์ Hermes server๋ฅผ ๋์ฐ๊ณ , API client๋ก patch๋ฅผ ๋ฐ์ ๋ค์ ๊ฒ์ฆ ํ๋ฃจํ๋ฅผ ๋๊น์ง ์คํํ๋ค.
PYTHONPATH=src python3 examples/run_hermes_demo.pyHermes๋ฅผ ์ฐ์ง ์๊ณ ๋ก์ปฌ command๋ฅผ ์ง์ ํธ์ถํ๋ ค๋ฉด target.toml์ agent command๋ฅผ
๋ฌธ์์ด ๋ฐฐ์ด๋ก ์ง์ ํ๋ค.
[agent]
mode = "command"
command = [
"my-patch-agent",
"--context",
"{context}",
"--workspace",
"{workspace}",
"--output",
"{patch_output}",
]
timeout_seconds = 900๊ทธ๋ค์ ๋ค์ ๋ช ๋ น์ ์คํํ๋ค.
protocol-remediator remediate \
--config /path/to/target/target.toml \
--finding intake/parser-crash/finding.json \
--evidence intake/parser-crash/evidence.json \
--artifacts artifactscore๋ ํน์ LLM API๋ฅผ ์ง์ ํธ์ถํ์ง ์๋๋ค. Hermes backend๋ ์ธ๋ถ command๊ฐ context๋ฅผ ์ฝ๊ณ unified diff๋ฅผ ์์ฑํ๋ ๊ณ์ฝ์ด๋ค. agent ์์ ์ ์๋ณธ target์ด ์๋ ์์ ๋ณต์ฌ๋ณธ์์ ์คํ๋๋ค.
์ ์ฒด ์์๋
target.toml์ ์๋ค.
[project]
name = "my-protocol"
language = "c++"
root = "."
[executor]
mode = "docker"
image = "my-frozen-toolchain@sha256:..."
timeout_seconds = 300
network = false
[reproduction]
failure_regex = "AddressSanitizer|heap-buffer-overflow"
[verification]
required_gates = [
"build",
"reproducer",
"tests",
"rescan",
"refuzz",
"protocol",
]
[gates]
build = [["cmake", "-S", ".", "-B", "build"], ["cmake", "--build", "build"]]
reproducer = [["./build/fuzz_target", "{reproducer}"]]
tests = [["ctest", "--test-dir", "build", "--output-on-failure"]]
rescan = [["./tools/run-sast", "--fail-on-new"]]
refuzz = [["./tools/refuzz", "--seconds", "60"]]
protocol = [["./tools/protocol-oracle"]]๊ฐ command๋ shell ๋ฌธ์์ด์ด ์๋๋ผ argument ๋ฐฐ์ด์ด๋ค. ์ง์ placeholder:
{workspace}: executor์์ ๋ณด์ด๋ ์์ target ๊ฒฝ๋ก{reproducer}: checksum ๊ฒ์ฆ ํ ์์ target์ ๋ณต์ฌํ reproducer ๊ฒฝ๋ก
build์ reproducer๋ ํญ์ ํ์ํ๋ค. ๊ธฐ๋ณธ ์ ์ฑ
์์๋ ์ฌ์ฏ gate๊ฐ ๋ชจ๋
ํ์๋ค. ๋์ ํน์ฑ์ ์ฌ์ฉํ ์ ์๋ gate๊ฐ ์๋ค๋ฉด required_gates์์ ๋ช
์์ ์ผ๋ก
์กฐ์ ํด์ผ ํ๋ฉฐ, ๋ณด๊ณ ์์ ๊ทธ๋๋ก ๋จ๋๋ค.
๊ฐ ๊ฒ์ฆ run์ ๋ค์์ ๋ณด์กดํ๋ค.
artifacts/run_<id>/
candidate.patch
context.json
evidence.input.json
finding.input.json
finding.final.json
patch-proposal.json
patch-stats.json
verification-report.json
verification-report.json์๋ baseline๊ณผ patched command์ ์ถ๋ ฅ์ด ํฌํจ๋๋ค.
PoC๋ ๋ก๊ทธ์ ๋น๋ฐ์ด ํฌํจ๋ ์ ์์ผ๋ฏ๋ก artifact ์ ์ฅ์์๋ ๋ณ๋ ์ ๊ทผยท๋ณด์กด ์ ์ฑ
์
์ ์ฉํด์ผ ํ๋ค.
- ๊ธฐ๋ณธ ๊ถ์ฅ์ pinned Docker image์
network=false๋ค. - local executor๋
allow_local=true๋ฅผ ์ง์ ์ ์ธํด์ผ ํ๋ฉฐ ์ ๋ขฐํ ์ ์๋ target์๋ ์ฌ์ฉํ๋ฉด ์ ๋๋ค. - ์ธ๋ถ๋ก ๋๊ฐ๋ LLM command์ ๋ฐ์ดํฐ ์ ์ฑ ์ ์ด์์๊ฐ ๊ฒฐ์ ํ๋ค. core๋ ์๋ ์ ๋ก๋ํ์ง ์๋๋ค.
plausible์ build์ ์ reproducer๋ง ํต๊ณผํ ์ํ๋ค.verified๋ program equivalence์ ์ฆ๋ช ์ ์๋๋ฉฐ ์ฌ๋ ์น์ธ์ ๋์ฒดํ์ง ์๋๋ค.- ์๋ merge๋ ๊ตฌํํ์ง ์์๋ค.
- ์ค์ ProFuzzBench/AFLNet target adapter
- protocol message sequence์ state trace collector
- CodeQL ์ ํ adapter ๋ฐ C/C++ source/sink model emitter
- ASan/UBSan/MSan๊ณผ architecture matrix ์คํ
- ์ ์ corpus ๊ธฐ๋ฐ differential protocol oracle
- AutoPatchBench runner์ ์ ๋ benchmark report
์กฐ์ฌ ๊ทผ๊ฑฐ์ ์ค๊ณ ๊ฒฐ์ ์ docs/research์ ์ ๋ฆฌ๋์ด ์๋ค (Korean).



