Chuyển đến nội dung
tinAI
Quay lại

Anthropic mở mã reference harness tự tìm và vá lỗ hổng bảo mật bằng Claude

Bản dịch tiếng Việt của tinAI · Từ anthropics/defending-code-reference-harness (github.com) · Ngày gốc: · Dịch ngày:

Bài gốc: anthropics/defending-code-reference-harness (github.com)

Tác giả: Anthropic

Ngày đăng: Dịch ngày:

TL;DR

Reference implementation cho pipeline recon → find → verify → report → patch bằng Claude — bộ Claude Code skills + autonomous harness, mặc định cấu hình tìm memory bug C/C++ với Docker + ASAN trong gVisor sandbox. Repo không nhận contribution, là template để bạn customize cho codebase và vuln class riêng.

Ước tính đọc: 5 phút

Giới thiệu

Đây là reference implementation cho việc tự tìm và vá lỗ hổng bảo mật bằng Claude — đúc kết từ kinh nghiệm Anthropic làm việc với security team ở nhiều tổ chức kể từ khi launch Claude Mythos Preview. Repo không nhận contribution và không được maintain — nó là reference cho bạn tự customize chứ không phải product dùng ngay.

Anthropic cũng có managed option tên Claude Security: scan repo, multi-stage verification pipeline để giảm false positive, lifecycle management cho findings.

Tính năng chính

Claude Code skills

Bộ skill tương tác: /quickstart, /threat-model, /vuln-scan, /triage, /patch, /customize. Mở repo trong Claude Code và chạy /quickstart để bắt đầu.

Autonomous reference pipeline (harness/)

Luồng recon → find → verify → report → patch, mặc định cấu hình tìm memory bug C/C++ với Docker + ASAN. Pipeline là reference, không phải product — shape, prompt và sandbox có thể reuse, nhưng harness sẽ không chạy được trên mọi codebase out-of-the-box. Dùng /customize để port sang ngôn ngữ / detector / vuln class khác.

Sandbox

Cách sử dụng

Quick start

git clone https://github.com/anthropics/defending-code-reference-harness
cd defending-code-reference-harness
claude

Trong Claude Code:

> /quickstart
> /quickstart how do I port the pipeline to Java?
> /quickstart how do I triage all these bugs?

Ramp up theo lộ trình đề xuất

BướcThời gianViệc
1Ngày 1Build threat model + chạy static scan + triage đầu tiên
2Ngày 2Chạy reference pipeline trên thư viện C/C++
3Ngày 3-5Customize pipeline cho target của bạn
4Tuần 2Bắt đầu autonomous scanning, triage, patching

Day 1 — toàn bộ loop qua interactive skill

export CLAUDE_CODE_SUBAGENT_MODEL=<model-id>
claude
> /quickstart
> /threat-model bootstrap targets/canary
> /vuln-scan targets/canary
> /triage targets/canary/VULN-FINDINGS.json
> /patch ./TRIAGE.json --repo targets/canary

Output: THREAT_MODEL.md, VULN-FINDINGS.{json,md}, TRIAGE.{json,md}, PATCHES/.

Lưu ý: bug candidate Day 1 đến từ Claude review tĩnh source code → false positive cao trên target không phải canary. Bug verify bằng execution sẽ có ở Day 2.

Day 2 — chạy pipeline tự động

python3 -m venv .venv && .venv/bin/pip install -e .
./scripts/setup_sandbox.sh   # cài gVisor, build agent image, verify isolation; yêu cầu Docker
export ANTHROPIC_API_KEY=sk-ant-...

bin/vp-sandboxed run drlibs --model <model-id> --runs 3 --parallel --stream --auto-focus
bin/vp-sandboxed patch results/drlibs/<timestamp>/ --model <model-id>

Hoặc nhờ Claude Code launch pipeline và watch kết quả real-time.

7 stage của pipeline

  1. Build: compile target thành Docker image với ASAN.
  2. Recon: agent đọc source và đề xuất phân vùng (input-parsing subsystem nào nên attack riêng), để các find agent parallel không trùng nhau.
  3. Find: N agent parallel, mỗi agent trong container isolated riêng. Mỗi agent đọc source, tạo malformed input, chạy ASAN binary cho đến khi một input crash 3/3 lần.
  4. Verify: grader agent reproduce mỗi crash trong container fresh. Chỉ proof-of-concept input chuyển từ find agent sang grader.
  5. Dedupe: judge agent so sánh crash đã verify với bug đã report, quyết định là bug mới, ví dụ tốt hơn của bug cũ, hay duplicate.
  6. Report: report agent viết structured exploitability analysis — primitive class, reachability, escalation path, severity.
  7. Patch (lệnh riêng): patch agent viết proposed fix. Grader agent confirm: code mới build được, proof-of-concept gốc không còn crash, test suite vẫn pass, fresh find agent không bypass được fix.

Day 3-5 — customize cho stack của bạn

Pipeline reference designed cho memory bug trong C/C++, nhưng shape generic. Port sang ngôn ngữ / vuln class mới chỉ cần trả lời:

Câu hỏiC/C++ referenceStack của bạn (ví dụ)
Cái gì signal một finding?ASAN crash signatureexception / canary file / DNS callback
Proof-of-concept trông thế nào?crashing input fileHTTP request sequence / tx list / test harness
Target build và run thế nào?Dockerfile (clang + ASAN)build theo ngôn ngữ của bạn trong container

Quy trình:

> /quickstart how do I customize this for ~/code/my-service?
> /threat-model bootstrap-then-interview ~/code/my-service
> /vuln-scan ~/code/my-service
> /triage ~/code/my-service/VULN-FINDINGS.json --repo ~/code/my-service
> /customize use ~/code/my-service/{THREAT_MODEL.md,VULN-FINDINGS.json} and ./TRIAGE.md

Sau khi /customize xong, sẽ có targets/my-service/ setup sẵn. Validate bằng smoke run:

bin/vp-sandboxed run my-service --model <model-id> --runs 1

Tuần 2 — outer loop

Khi pipeline đã customize, thêm outer loop: chạy nhiều pipeline scan, triage findings cross-run, patch theo prioritization, lặp lại.

bin/vp-sandboxed run my-service --model <model-id> --runs 5 --parallel --stream --auto-focus
> /triage results/my-service/ --repo ~/code/my-service --auto --votes 5
> /patch results/my-service/<timestamp>/ --model <model-id>

/triage cross-run: collapse duplicate, recalibrate severity theo threat model, route mỗi finding tới component owner. Khi bug được fix, model không re-find nữa và sẽ surface bug mới (sâu hơn). Càng nhiều wave, số bug giảm nhưng độ phức tạp tăng.

Lưu ý quan trọng: autonomous triage và patching vẫn là open issue. /patch có verification strategy giúp raise the bar, nhưng severity/prioritization là judgment về môi trường cụ thể của bạn — verified patch không phải lúc nào cũng upstreamable. Hầu hết partner báo cáo đây là bottleneck hiện tại, nên dành real engineering time cho hai bước này.

Định hướng tiếp theo

Anthropic ghi nhận team thành công nhất thường đầu tư vào:

  1. Review toàn bộ internal repo + open-source dependencies quan trọng, rank theo exposure / lịch sử CVE / business-criticality, scan theo priority.
  2. Bespoke infrastructure cho scan (di chuyển khỏi laptop / one-off VM). Team thành công không lao đầu vào “perfect scanning platform” trước khi scale.
  3. Tích hợp scan vào SDLC: recurring scan (hàng ngày / hàng tuần) hoặc CI pipeline.
  4. Thử nghiệm model để tìm cái phù hợp nhất với team mình.

Bài gốc: README của anthropics/defending-code-reference-harness.


Đường dẫn nguồn

tinAI dịch bài này sang tiếng Việt từ anthropics/defending-code-reference-harness (github.com) · Loại nguồn: GitHub và giữ bối cảnh từ bản tin tinAI đã giới thiệu bài này .

Bản tin này có 3 bài dịch liên quan từ cùng bản tin.