/

CVE-2026-61738

Severity:

CRITICAL RISK

(10.0)

Path Traversal (CWE-22) in SOCFortress CoPilot Reports

CVE-2026-61738

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-73, CWE-434

Impact:

Unauthorized Host-File Overwrite

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in SOCFortress CoPilot allows an authorized administrator or analyst to influence the destination of a generated GCP ScoutSuite report through a multipart filename. Under affected configurations, this may write accepted JSON content outside the intended report directory and overwrite host files, potentially disrupting application operation.

A path traversal vulnerability in SOCFortress CoPilot allows an authorized administrator or analyst to influence the destination of a generated GCP ScoutSuite report through a multipart filename. Under affected configurations, this may write accepted JSON content outside the intended report directory and overwrite host files, potentially disrupting application operation.

Affected context

The issue occurs in the ScoutSuite GCP report-generation route when the backend passes a caller-controlled multipart filename to a file-writing service. The service combines that filename with the intended report directory without sanitizing traversal components or verifying that the resolved destination remains within the permitted directory. Exploitation depends on the route being reachable and the submitted content satisfying the endpoint's GCPScoutSuiteJSON validation.

The issue occurs in the ScoutSuite GCP report-generation route when the backend passes a caller-controlled multipart filename to a file-writing service. The service combines that filename with the intended report directory without sanitizing traversal components or verifying that the resolved destination remains within the permitted directory. Exploitation depends on the route being reachable and the submitted content satisfying the endpoint's GCPScoutSuiteJSON validation.

Exploit preconditions

  • Attack surface: POST /api/scoutsuite/generate-gcp-report
  • Required access: An authenticated account with administrator or analyst privileges
  • Trigger point: Processing and saving the uploaded report through the ScoutSuite integration
  • Required input: A crafted multipart filename and JSON content accepted as GCPScoutSuiteJSON
  • Why exploitation is possible: The filename influences the filesystem destination, while the writer lacks canonical-path containment validation
  • Environmental dependency: The resulting permissions and impact depend on the backend account, filesystem protections, and writable application paths
  • Attack surface: POST /api/scoutsuite/generate-gcp-report
  • Required access: An authenticated account with administrator or analyst privileges
  • Trigger point: Processing and saving the uploaded report through the ScoutSuite integration
  • Required input: A crafted multipart filename and JSON content accepted as GCPScoutSuiteJSON
  • Why exploitation is possible: The filename influences the filesystem destination, while the writer lacks canonical-path containment validation
  • Environmental dependency: The resulting permissions and impact depend on the backend account, filesystem protections, and writable application paths

Why this happens

The underlying bug is a failure to treat multipart filenames as untrusted path data. Combining a caller-controlled filename with a trusted directory using os.path.join does not prevent traversal when the filename contains path components or causes the resolved path to escape the intended location. Without filename normalization, destination allowlisting, and resolved-path containment checks, an attacker can influence where validated content is written. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related concerns involving external control of file names and unrestricted file upload handling.

The underlying bug is a failure to treat multipart filenames as untrusted path data. Combining a caller-controlled filename with a trusted directory using os.path.join does not prevent traversal when the filename contains path components or causes the resolved path to escape the intended location. Without filename normalization, destination allowlisting, and resolved-path containment checks, an attacker can influence where validated content is written. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related concerns involving external control of file names and unrestricted file upload handling.

Potential impact

  • Host files may be overwritten with content accepted by the report-validation logic
  • The application may become unavailable or malfunction because source or configuration files are altered
  • Root-owned files may be modified when the backend runs with excessive privileges
  • Application integrity and deployment reliability could be affected
  • Broader compromise may be possible in environments where overwritten files are later executed or trusted, but this is not established by the demonstrated primitive alone
  • Host files may be overwritten with content accepted by the report-validation logic
  • The application may become unavailable or malfunction because source or configuration files are altered
  • Root-owned files may be modified when the backend runs with excessive privileges
  • Application integrity and deployment reliability could be affected
  • Broader compromise may be possible in environments where overwritten files are later executed or trusted, but this is not established by the demonstrated primitive alone

General mitigation guidance

Mitigation generally focuses on removing caller control over filesystem destinations and reducing the privileges available to the service.

Common defensive patterns include:

  • Generate server-side report names rather than using client-supplied filenames
  • Treat multipart filenames as display metadata only, not as filesystem paths
  • Resolve candidate paths and enforce strict containment within an approved directory
  • Reject path separators, traversal components, absolute paths, and unexpected filename formats
  • Use dedicated writable directories that are isolated from application source and configuration paths
  • Apply least-privilege service identities and avoid running the backend as root
  • Keep report validation and file storage policies independent of client-controlled path data
  • Consider atomic writes and controlled file permissions to limit overwrite effects

Mitigation generally focuses on removing caller control over filesystem destinations and reducing the privileges available to the service.

Common defensive patterns include:

  • Generate server-side report names rather than using client-supplied filenames
  • Treat multipart filenames as display metadata only, not as filesystem paths
  • Resolve candidate paths and enforce strict containment within an approved directory
  • Reject path separators, traversal components, absolute paths, and unexpected filename formats
  • Use dedicated writable directories that are isolated from application source and configuration paths
  • Apply least-privilege service identities and avoid running the backend as root
  • Keep report validation and file storage policies independent of client-controlled path data
  • Consider atomic writes and controlled file permissions to limit overwrite effects

How teams detect issues like this

Detection can combine source analysis, runtime monitoring, and policy enforcement:

  • Search for filesystem APIs that concatenate or join user-controlled filenames with trusted directories
  • Flag uses of multipart filename values that reach open, write, rename, copy, or save operations without canonicalization
  • Review whether resolved paths are checked against an approved directory boundary
  • Add code-review checks for server-generated filenames and isolated upload/report directories
  • Monitor file writes outside expected report locations, especially writes to application source or configuration directories
  • Enforce static-analysis and secure-upload policies in CI pipelines
  • Log authenticated route usage, destination paths, and write failures without exposing sensitive content

Detection can combine source analysis, runtime monitoring, and policy enforcement:

  • Search for filesystem APIs that concatenate or join user-controlled filenames with trusted directories
  • Flag uses of multipart filename values that reach open, write, rename, copy, or save operations without canonicalization
  • Review whether resolved paths are checked against an approved directory boundary
  • Add code-review checks for server-generated filenames and isolated upload/report directories
  • Monitor file writes outside expected report locations, especially writes to application source or configuration directories
  • Enforce static-analysis and secure-upload policies in CI pipelines
  • Log authenticated route usage, destination paths, and write failures without exposing sensitive content

Sources

SourceLink
github.comgithub.com/socfortress/CoPilot/commit/1881ef8d28bc7f45ffa88d7ba4fcca7302355508
github.comgithub.com/socfortress/CoPilot/commit/bfa630b65d554670c7462a32ce6fd4e3cbd0254c
github.comgithub.com/socfortress/CoPilot/pull/940
github.comgithub.com/socfortress/CoPilot/pull/941
github.comgithub.com/socfortress/CoPilot/security/advisories/GHSA-q3g8-3cf7-744f
github.comgithub.com/socfortress/CoPilot/tree/v0.1.77

Frequently asked

questions

It can be reached through the report-generation API when that endpoint is exposed to an attacker who has the required authenticated administrator or analyst privileges. It is not an unauthenticated arbitrary file-write issue based on the described behavior.

The attacker needs access to the affected route and must submit content that passes the endpoint's GCPScoutSuiteJSON validation. The practical impact also depends on backend filesystem permissions.

Do not use client-supplied filenames as filesystem destinations. Generate names on the server and enforce resolved-path containment within a dedicated, least-privilege directory.

Treat all upload metadata as untrusted, isolate writable directories from application code, run services with minimal permissions, and use static analysis and code review rules that track user-controlled path data into filesystem operations.

It can be reached through the report-generation API when that endpoint is exposed to an attacker who has the required authenticated administrator or analyst privileges. It is not an unauthenticated arbitrary file-write issue based on the described behavior.

The attacker needs access to the affected route and must submit content that passes the endpoint's GCPScoutSuiteJSON validation. The practical impact also depends on backend filesystem permissions.

Do not use client-supplied filenames as filesystem destinations. Generate names on the server and enforce resolved-path containment within a dedicated, least-privilege directory.

Treat all upload metadata as untrusted, isolate writable directories from application code, run services with minimal permissions, and use static analysis and code review rules that track user-controlled path data into filesystem operations.

Find out what's already
exploitable in your codebase.