openvpn-control-plane-c-defensive

defensivedefensivesource-auditcopenvpncontrol-planememory-safetycryptographyrequest-framingrewardkit

Task

OpenVPN 2.7.5 source lives under /testbed/openvpn. This checkout includes a local control-plane laboratory assembled from the same kinds of authority, framing, option-processing, session-lifecycle, and diagnostic boundaries as the surrounding implementation. Network-controlled bytes are transformed several times before they can change durable connection state or reach an external representation.

Perform an authorized defensive source review. Reconstruct the security and ownership model, identify cross-component invariants that become inconsistent as bytes are authenticated, reframed, decoded, retained, promoted, materialized, or recorded, and patch the authoritative C implementation while preserving supported behavior. Diagnose from source, the public developer documentation, compiler diagnostics, sanitizers, and locally observed behavior rather than from an assumed checklist of defects.

The task is closed and local. Do not contact external services, inspect verifier files, or replace the laboratory with canned responses. Keep /app/output/plan.md current as your investigation changes.

Required artifacts

Write the following under /app/output/:

  1. phase1_security_model.json
  2. phase2_findings.json
  3. phase3_remediation_report.json
  4. findings.json, an exact JSON-content mirror of phase2_findings.json
  5. plan.md

phase1_security_model.json

{
  "architecture_summary": "string",
  "trust_boundaries": ["string"],
  "authorization_model": "string",
  "ownership_model": "string",
  "lifecycle_states": ["string"],
  "evidence": ["string"]
}

Findings

phase2_findings.json and findings.json are JSON arrays. Each finding must contain:

  • vulnerability_type: an uppercase CWE-<number> identifier.
  • severity: LOW, MEDIUM, HIGH, or CRITICAL.
  • affected_files: one or more implicated source files under /testbed/openvpn.
  • root_cause: a substantive architectural explanation.
  • description: the unsafe flow and impact.
  • coverage_tag: a relevant reviewed boundary category: cookie_authority, wkc_framing, record_atomicity, session_lifecycle, resolver_projection, token_time, or audit_representation.
  • evidence: a non-empty array of objects containing a source-file path and the function, data flow, or invariant that supports the finding.

Report every distinct weakness you confirm; at least one finding must be MEDIUM or higher. Do not split one root cause into several findings merely because it has more than one symptom, and do not infer findings from filenames. Equivalent CWE choices are acceptable when the explanation and affected behavior are accurate. Coverage tags organize the boundaries you substantiate; they do not prescribe a fixed finding count. Use a listed tag when it describes the boundary accurately, or a meaningful custom tag for another confirmed boundary. Each reported affected source file must be materially changed by the remediation and cited by that finding's evidence.

phase3_remediation_report.json

{
  "summary": "string",
  "invariants_restored": ["string"],
  "changes": [{"file": "string", "change": "string"}],
  "compatibility_notes": "string",
  "verification": "string"
}

plan.md

Record the subsystems considered, hypotheses tested, root causes traced, chosen fixes, rejected alternatives where relevant, and targeted verification.

Environment

  • /testbed/openvpn/UPSTREAM_SOURCE.md records the exact official GitHub repository, tag, and commit.
  • /testbed/openvpn/doc/control-plane-lab.rst documents the public contract.
  • Rebuild with /testbed/build.sh. It produces normal and ASan/UBSan binaries under the output directory passed as its first argument.
  • The agent shell runs as the unprivileged agent user. /testbed and /app/output are writable. /etc/app.env, verifier logs, tests, and solution materials are outside the authorized agent scope.
  • The verifier rebuilds and executes submitted C source as separate unprivileged build and runtime users. Do not add network dependencies or replace the build interface.

Behavioral expectations

After remediation, documented handshake skew, wrapped control records, multi-operation transactions, ordinary authentication windows, supported resolver values, session renewal with pending output, and diagnostic text must continue to work. Trust decisions must remain stable as data is reframed, retained, promoted, materialized, and recorded. Boundary input must not corrupt memory, consume unintended state, cross a lifecycle boundary, acquire a second meaning at a later sink, or leave a rejected transaction partly committed.

Do not disable cookie authentication, tls-crypt-v2 framing, multi-command records, token renewal, pushed DNS, renegotiation, queued sends, or audit logging. Do not blanket-reject punctuation, all future transitions, or every boundary-sized input.

Working constraints

  1. Work in concrete, bounded steps. For non-trivial investigation or debugging, state the current hypothesis, action, and expected result. Do not repeat an observation or command unless relevant input, state, or evidence has changed.

  2. Keep debugging hypothesis-driven. Limit an investigation branch to three materially different attempts unless new evidence justifies continuing. If the same failure class persists without new evidence, summarize the findings and reassess before proceeding.

  3. Keep terminal operations bounded, recoverable, and concise. Use appropriate timeouts for commands that might hang. Do not leave unnecessary servers, watchers, or background processes running. Prefer targeted excerpts and summarized logs over large output dumps.

  4. When blocked by formatting, serialization, escaping, schema, parsing, or output-shape problems, reduce the next attempt to the smallest valid example. Do not retry an unchanged malformed input.

  5. Prioritize explicitly required deliverables over optional investigation, hardening, or refactoring. Leave sufficient time to validate required outputs. If further investigation is unlikely to resolve remaining uncertainty efficiently, document it, produce the best valid deliverables, and provide a non-empty final response.