Skip to content

Commit b2c3b1a

Browse files
Alan-JowettCopilot
andcommitted
feat: add exhaustive-path-tracing to security audit template
Add the exhaustive-path-tracing protocol to the investigate-security template for systematic deep analysis of parser and decoder functions that process untrusted structured input. Changes: - Add exhaustive-path-tracing to template protocol list (optional, applied selectively to parser/decoder functions) - Add instruction 7 with criteria for identifying functions that warrant deep path tracing (multi-field decode, inter-value arithmetic, iteration over decoded elements) - Add specific attention items: inter-value arithmetic validation, loop-carried invariant gaps, truncation after bounds check - Expand investigation plan from 5 to 7 steps, adding parser identification (step 3) and deep-dive (step 5) - Add coverage ledger requirement to quality checklist - Update manifest.yaml protocol list and description - Add investigate-security to exhaustive-path-tracing applicable_to Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2672c17 commit b2c3b1a

3 files changed

Lines changed: 58 additions & 5 deletions

File tree

manifest.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,11 @@ templates:
13491349
path: templates/investigate-security.md
13501350
description: >
13511351
Security audit of code or a system component. Systematic
1352-
vulnerability analysis with severity classification.
1352+
vulnerability analysis with severity classification. Applies
1353+
exhaustive path tracing selectively to parser/decoder functions
1354+
that handle untrusted structured input.
13531355
persona: security-auditor
1354-
protocols: [anti-hallucination, self-verification, operational-constraints, security-vulnerability]
1356+
protocols: [anti-hallucination, self-verification, operational-constraints, adversarial-falsification, security-vulnerability, exhaustive-path-tracing]
13551357
taxonomies: [stack-lifetime-hazards]
13561358
format: investigation-report
13571359

protocols/reasoning/exhaustive-path-tracing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ description: >
1111
applicable_to:
1212
- review-code
1313
- investigate-bug
14+
- investigate-security
1415
- exhaustive-bug-hunt
1516
---
1617

templates/investigate-security.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ protocols:
1212
- guardrails/anti-hallucination
1313
- guardrails/self-verification
1414
- guardrails/operational-constraints
15+
- guardrails/adversarial-falsification
1516
- analysis/security-vulnerability
17+
- reasoning/exhaustive-path-tracing # optional — apply selectively to parser/decoder functions
1618
taxonomies:
1719
- stack-lifetime-hazards
1820
format: investigation-report
@@ -88,6 +90,42 @@ code or system component.
8890
- Prefer deterministic methods (targeted search, structured enumeration)
8991
- Document your search strategy for reproducibility
9092

93+
7. **Apply the exhaustive-path-tracing protocol selectively** to
94+
**parser and decoder functions** that process untrusted structured input.
95+
This protocol is not applied to every function — only to functions
96+
identified during Phase 2 (attack surface enumeration) that meet
97+
ALL of the following criteria:
98+
99+
- The function **decodes multiple fields** from a wire format, file
100+
format, or serialized structure controlled by an untrusted source
101+
- The function **performs arithmetic** (subtraction, addition,
102+
multiplication, shift) on two or more decoded values, or between
103+
a decoded value and a running accumulator
104+
- The function contains **loops** that iterate over a variable number
105+
of decoded elements, where each iteration updates shared state
106+
(offsets, remaining lengths, accumulators)
107+
108+
For each such function, apply the full exhaustive-path-tracing
109+
protocol with particular attention to:
110+
111+
- **Inter-value arithmetic validation**: After decoding a new field
112+
value, verify that every subsequent arithmetic operation using that
113+
value against a running accumulator (e.g., `Largest -= Count`) is
114+
guarded against underflow or overflow — not just at the decode site,
115+
but at every use site within the function, including the *current*
116+
loop iteration (not just the next iteration's entry check).
117+
- **Loop-carried invariant gaps**: When a loop body decodes a fresh
118+
value and uses it immediately, but the bounds check for that value
119+
only runs at the *next* iteration's entry, the current iteration's
120+
use is unguarded. Explicitly verify that each decoded value is
121+
validated before its first arithmetic use within the same iteration.
122+
- **Truncation after bounds check**: When a decoded uint64_t value
123+
passes a bounds check against a uint16_t buffer length and is then
124+
cast to uint16_t, the cast is safe. But when a decoded value is
125+
used in arithmetic *without* a prior bounds check against the
126+
current accumulator, the arithmetic may underflow even though the
127+
decode itself succeeded.
128+
91129
## Non-Goals
92130

93131
Explicitly define what is OUT OF SCOPE for this security audit.
@@ -110,10 +148,19 @@ Before beginning analysis, produce a concrete step-by-step plan:
110148
data enters the system.
111149
2. **Enumerate attack surface**: List every input handling path,
112150
authentication point, and privilege transition.
113-
3. **Classify**: Apply the security-vulnerability protocol systematically
151+
3. **Identify parser/decoder functions for deep analysis**: From the
152+
attack surface enumeration, identify functions that decode multiple
153+
fields from untrusted structured input and perform inter-value
154+
arithmetic (see instruction 7). List these functions explicitly —
155+
they will receive exhaustive path tracing.
156+
4. **Classify**: Apply the security-vulnerability protocol systematically
114157
to each attack surface element.
115-
4. **Rank**: Order findings by exploitability and impact.
116-
5. **Report**: Produce the output according to the specified format.
158+
5. **Deep-dive**: Apply the exhaustive-path-tracing protocol to each
159+
function identified in step 3. For each, trace every arithmetic
160+
operation on decoded values through every loop iteration and
161+
verify underflow/overflow guards exist at every use site.
162+
6. **Rank**: Order findings by exploitability and impact.
163+
7. **Report**: Produce the output according to the specified format.
117164

118165
## Quality Checklist
119166

@@ -127,3 +174,6 @@ Before finalizing, verify:
127174
- [ ] At least 3 findings have been re-verified against the source
128175
- [ ] Coverage statement documents what was and was not examined
129176
- [ ] No fabricated vulnerabilities — unknowns marked with [UNKNOWN]
177+
- [ ] All parser/decoder functions identified in step 3 have coverage
178+
ledgers from exhaustive-path-tracing (or explicit justification
179+
for skipping)

0 commit comments

Comments
 (0)