GHSA-pcc4-rvhr-2pr8: Path Traversal

Published Oct 19, 2026
·
Updated

Summary

The Fortran extractor's C-preprocessor step (graphify/extractors/fortran.py, cpppreprocess) applies an incomplete #include hardening. The -nostdinc -I /dev/null flags it relies on (comment "Security (F-007)") do not stop a capital-F Fortran source file from including absolute paths (#include "/etc/passwd") or from path-traversing out of the corpus (#include "../../../../home/victim/.ssh/idrsa"). cpp always searches the directory of the file being preprocessed for quoted includes and always honours absolute include paths, regardless of -nostdinc/-I. As a result, indexing an untrusted repository that contains a .F/.F90/.F95/.F03/.F08 file reads arbitrary local files off the host and inlines their contents into the knowledge graph, which is then shipped to the LLM/agent and written to the on-disk, shareable output (graph.json, GRAPHREPORT.md, the Obsidian wiki, HTML/SVG exports).

This is the exact "corpus-side file-exfiltration vector" the F-007 comment says it is defending against; the mitigation is bypassable.

Severity

High. Arbitrary local-file read on the host, triggered by graphify's core action (indexing an untrusted folder — "turn any folder of code ... into a queryable knowledge graph"), defeating a documented security control. It runs on the default, offline, no-API-key AST path (graphify update . / graphify extract) — no credentials, network, or LLM call required. CWE-73 (external control of file name/path) / CWE-22 (path traversal) / CWE-200 (information exposure).

Where

graphify/extractors/fortran.py, cpppreprocess():

result = subprocess.run( ["cpp", "-w", "-P", "-nostdinc", "-I", "/dev/null", str(path.resolve())], captureoutput=True, timeout=30, )

Reached from extractfortran() (same file) for any suffix in FORTRANCPPEXTS = {".F", ".F90", ".F95", ".F03", ".F08"}, which are collected by default (detect.CODEEXTENSIONS) and dispatched by extract.DISPATCH.

Why the mitigation does not work

-nostdinc only removes the standard system include directories, and -I /dev/null only sets the additional search path. Neither affects:

1. Absolute includes — #include "/etc/passwd" is opened directly by cpp. 2. Quoted includes relative to the current file — cpp always searches the directory containing the file being preprocessed for #include "...", so #include "../../../../etc/shadow" traverses out of the corpus.

Proof of concept (verified)

Reproduced against the shipped code with the exact command cpppreprocess builds (cpp -w -P -nostdinc -I /dev/null <file>), and against extractfortran() directly.

Secret on disk (/tmp/secret.txt): TOPSECRET...

(a) Absolute include — evilabs.F90:

program evil #include "/absolute/path/to/secret.txt" end program evil

(b) Relative traversal — evilrel.F90:

program evil #include "../secret.txt" end program evil

Both produce preprocessed output containing the full secret file contents ("SECRET IN OUTPUT: True" for both).

Surfacing into the graph — leak.F90 places the include in an identifier position via a free-form continuation so the leaked value becomes a node/edge:

module m contains subroutine s use & #include "/path/to/token.secret" end subroutine s end module m

extractfortran() on this file emits a node whose label is the entire single-line contents of token.secret and an imports edge to it. That node is written to graph.json / GRAPHREPORT.md / the wiki and returned by the MCP querygraph / getnode / getneighbors tools — i.e. exfiltrated into the agent's context and into persisted, shareable artifacts.

Fidelity note: Fortran is case-insensitive, so captured identifiers are lower-cased. Case-insensitive secrets (file paths, hostnames, usernames, hex tokens, connection-string fragments, and the mere existence/partial content of a readable file) leak cleanly; high-entropy case-sensitive blobs (base64/JWT) are partially corrupted by the lower-casing but still confirm readability and structure. Single-token-per-line secret files (API-key files, single-line credential/token files) leak that token in full (lower-cased). Requires cpp/gcc on PATH (near-ubiquitous on the dev/CI hosts graphify targets); it cleanly falls back to raw bytes when absent.

Suggested fix

Mirror the containment approach already used elsewhere in the codebase (projectxmlissafe, security.validategraphpath): before invoking cpp, scan the source for #include directives and refuse or neutralise any include whose target is absolute or resolves outside the corpus/repo root. Concretely, in cpppreprocess:

- Parse #include "..." / #include <...> directives. - Resolve each target against the file's directory; if it is absolute, or its .resolve() escapes the scan root, strip that line (or fall back to path.readbytes() with no preprocessing). - Only allow includes that resolve to a path inside the corpus root.

A blunter but safe alternative is to strip all #include lines before preprocessing (macros still expand; cross-file includes lose fidelity but no host files can be read). Running cpp inside a filesystem sandbox (bwrap/unshare with only the corpus mounted) would also close it but is heavier.

Detected by

Aeon vuln-scanner. Semgrep flagged the Fortran subprocess path; manual review of the F-007 mitigation plus an empirical cpp repro confirmed the bypass.

Affected Software

1 affected componentFixes available
pip/graphifyy>=0.7.2<0.9.70
0.9.70

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/graphifyy to a version that resolves this vulnerability.

    Fixed in 0.9.70
  2. Compensating control

    In graphify's Fortran extractor (`_cpp_preprocess`), parse `#include "..."` and `#include <...>` directives before invoking `cpp`; resolve each target against the source file's directory and refuse or strip any include that is absolute or whose resolved path escapes the corpus/repository root. For rejected includes, either strip the line or fall back to `path.read_bytes()` without preprocessing.

Event History

Oct 19, 2026
Advisory Published
via GitHub·04:51 PM
Data Sourced
via GitHub·04:51 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which environments are exposed?

Hosts that index an untrusted repository containing a capital-F Fortran source file, such as .F, .F90, .F95, .F03, or .F08, are exposed. Files readable by the indexing host may be included and incorporated into generated artifacts.

2

What does an attacker need to trigger the issue?

An attacker needs to place a quoted #include directive in one of the affected Fortran source files and have that repository indexed. The include can name an absolute path or traverse outside the indexed corpus.

3

Where can exposed file contents end up?

Included contents can be added to the knowledge graph and sent to the LLM or agent. They can also be written to graph.json, GRAPH_REPORT.md, Obsidian wiki output, and HTML or SVG exports.

4

What is a safe temporary mitigation if patching cannot be performed immediately?

Do not index untrusted repositories that contain affected capital-F Fortran source files. Treat generated graph and report artifacts from previously indexed untrusted repositories as potentially containing host-local file contents.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203