Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (104 loc) · 5 KB
/
Copy pathMakefile
File metadata and controls
126 lines (104 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# CVE-2026-114938 "Java4Shell" local reproduction driver.
# The native model compiles and runs on the host (ARM or x86-64) under
# AddressSanitizer; the negative control runs an affected JDK in Docker.
REPRO := repro
.PHONY: all crash fixed vuln show show-fixed detect-demo detect-test detect-semgrep detect-yara detect-validate proof verify-proof verify-pdf verify-all verify-ci verify-ci-steps smoke qemu-control clean
all: crash
## crash: the full lab — fixed control (survives) then vuln (ASan catches OOB).
crash:
@$(MAKE) -C $(REPRO) run
## show: the animated color memory-map demo of the overflow.
show:
@$(MAKE) -C $(REPRO) show
## show-fixed: the same demo with the shipped guard — no overflow.
show-fixed:
@$(MAKE) -C $(REPRO) show-fixed
## detect-demo: run the crash/exception hunts against synthetic fixtures.
detect-demo:
@$(MAKE) -C $(REPRO) detect-demo
## detect-test: replay a synthetic pcap through the Suricata rules and score
## true/false positives (SKIPs cleanly if suricata is not installed).
detect-test:
@$(MAKE) -C $(REPRO) detect-test
## detect-semgrep: scan the annotated Java fixture with the source-review rules
## and score fires/non-fires (SKIPs cleanly if semgrep is not installed).
detect-semgrep:
@$(MAKE) -C $(REPRO) detect-semgrep
## detect-yara: scan fixtures with the YARA rules and assert each fires/stays
## quiet as expected (SKIPs cleanly if yara is not installed).
detect-yara:
@$(MAKE) -C $(REPRO) detect-yara
## detect-validate: parse every shipped detection artifact with its native tool
## (or a structural YAML/conf parser) so a broken rule can't look green.
detect-validate:
@$(MAKE) -C $(REPRO) detect-validate
## fixed: shipped guard applied -> no overflow, exit 0.
fixed:
@$(MAKE) -C $(REPRO) run-fixed
## vuln: the defect -> AddressSanitizer heap-buffer-overflow, abort.
vuln:
@$(MAKE) -C $(REPRO) run-vuln
## proof: regenerate repro/CRASH_PROOF.txt (committed crash transcript).
proof:
@sh $(REPRO)/make_proof.sh
## smoke: non-TTY CI check — fixed must exit 0, vuln must OOB-abort, hunts fire.
smoke:
@$(MAKE) -C $(REPRO) model >/dev/null
@cd $(REPRO) && ./model fixed >/dev/null \
&& echo "smoke: fixed PASS (exit 0)" \
|| { echo "smoke: fixed FAILED (expected exit 0)"; exit 1; }
@cd $(REPRO) && ASAN_OPTIONS=abort_on_error=0:detect_leaks=0 ./model vuln 2>&1 \
| grep -q 'heap-buffer-overflow' \
&& echo "smoke: vuln PASS (OOB detected)" \
|| { echo "smoke: vuln FAILED (expected heap-buffer-overflow)"; exit 1; }
@$(MAKE) detect-demo >/dev/null 2>&1 \
&& echo "smoke: detect-demo PASS" \
|| { echo "smoke: detect-demo FAILED"; exit 1; }
@# AUD-011: the model must REJECT a bad mode / out-of-range arg (rc 2), not
@# silently run the vuln path on a typo.
@cd $(REPRO) && { ./model vlun >/dev/null 2>&1; [ $$? -eq 2 ]; } \
&& { ./model vuln 999 1 >/dev/null 2>&1; [ $$? -eq 2 ]; } \
&& { ./model vuln 1 7 >/dev/null 2>&1; [ $$? -eq 2 ]; } \
&& { ./model vuln abc >/dev/null 2>&1; [ $$? -eq 2 ]; } \
&& echo "smoke: arg-validation PASS (bad mode/range rejected)" \
|| { echo "smoke: arg-validation FAILED (model accepted invalid input)"; exit 1; }
@echo "smoke: ALL PASS"
## verify-proof: assert the committed transcript still matches a fresh run,
## WITHOUT overwriting it. Compares normalized output (addresses/PID/date vary),
## leaving repro/CRASH_PROOF.txt untouched. Use `make proof` to regenerate.
verify-proof:
@sh $(REPRO)/verify_proof.sh
## verify-pdf: assert each published alert PDF has the page count its HTML
## declares (guards against broken-pagination prints). SKIPs without pdfinfo.
verify-pdf:
@sh docs/verify_pdf_pages.sh
## verify-all: the full LOCAL gate -- the ASan proof (smoke), proof-transcript
## drift, detection scoring + validation + YARA, and PDF page counts. Optional
## engines SKIP cleanly; the core (compiler/model) is required. Includes
## verify-proof, which only holds against the platform the transcript was
## captured on -- see verify-ci for the cross-platform subset.
verify-all: verify-ci-steps
@$(MAKE) verify-proof
@echo "verify-all: ALL GATES PASSED"
## verify-ci: the subset CI runs. Identical to verify-all MINUS verify-proof:
## the committed CRASH_PROOF.txt is an exact ASan transcript captured on the
## author's macOS/arm64, and ASan's banner format, libc/dyld frames and
## shadow-byte layout differ on a Linux/x86-64 runner, so an exact match is not
## a cross-platform invariant. The thing it proves -- the model aborts with a
## heap-buffer-overflow -- is already gated here by `smoke` (vuln PASS). Run
## `make verify-proof` locally (or `make proof` to regenerate) to guard drift.
verify-ci: verify-ci-steps
@echo "verify-ci: ALL GATES PASSED"
## verify-ci-steps: the shared platform-independent gate body.
verify-ci-steps:
@$(MAKE) smoke
@$(MAKE) detect-validate
@$(MAKE) detect-test
@$(MAKE) detect-yara
@$(MAKE) detect-semgrep
@$(MAKE) verify-pdf
## qemu-control: affected x86-64 JDK under Docker QEMU -> scalar path, no crash.
qemu-control:
@$(MAKE) -C $(REPRO) qemu-control
clean:
@$(MAKE) -C $(REPRO) clean