/

CVE-2026-33183

Severity:

CRITICAL RISK

(9.1)

Path Traversal in Saloon PHP API Integration Library

CVE-2026-33183

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Write

Severity:

CRITICAL RISK

(9.1)

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

Saloon's fixture handling previously used fixture names directly to construct file paths under a configured directory without validating or constraining those names.

If an attacker could influence the fixture name, they could traverse outside the fixture directory to read sensitive files or overwrite arbitrary files accessible to the PHP process.

Affected context

This vulnerability affects PHP applications that use Saloon's fixture functionality for mocking or recording HTTP responses, particularly in testing or development tooling.

The risk arises when fixture names are dynamically derived from external input such as request parameters, configuration values, or other data that may be influenced by an attacker.

In such setups, the fixture name is interpolated into a filesystem path without robust validation, allowing crafted names with directory traversal sequences to escape the intended fixture storage directory.

The application does not need to expose raw filesystem paths directly; using Saloon's fixture API with untrusted names is sufficient to create the vulnerable condition.

Exploit preconditions

  • Attack surface: Indirect filesystem access through Saloon's fixture API (e.g., mocking, recording, or replaying responses).
  • Required access: Ability to influence or control the fixture name, commonly through:
  • Request parameters or headers feeding into fixture naming
  • User-controlled configuration values
  • Any external input used to construct fixture identifiers
  • Trigger point: Any operation that reads or writes fixtures, such as:
  • Loading a stored fixture for a mocked response
  • Recording and persisting a new fixture file
  • Why exploitation is possible: The fixture name is concatenated with the base fixture directory path without sufficient validation or canonicalization. Directory traversal sequences (../, ..\\) and other path components are honored by the filesystem, allowing the resolved path to escape the intended base directory and target arbitrary locations accessible by the process.

Why this happens

The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Saloon's fixture layer assumed that fixture names would be safe and confined to a single directory, but it failed to enforce that assumption programmatically.

By allowing path separators (/, \), .. segments, and other unsafe characters within fixture names, the code treated attacker-influenceable strings as trusted filesystem path components.

Without validating the fixture name or confirming that the final resolved path remains under the configured fixture directory, the system violated the intended directory boundary.

This pattern is a classic directory traversal issue: untrusted input is used directly in file path construction, enabling access to files outside the intended sandbox.

Potential impact

  • An attacker could read sensitive files (e.g. application configuration, environment files, logs, or private keys) that are accessible to the PHP process.
  • An attacker could overwrite existing files within the application or hosting environment, potentially altering application behavior or configuration.
  • An attacker could poison fixture data to mislead tests, debugging, or integration workflows, potentially hiding defects or influencing application logic under test.
  • In some environments, overwriting critical files (e.g. autoloaded PHP scripts, configuration, or cache files) could enable remote code execution under the web server or worker process.
  • The integrity of recorded API responses and test artifacts could be compromised, impacting reliability and trust in the development pipeline.

General mitigation guidance

Effective mitigation focuses on strictly constraining how fixture names are mapped to filesystem paths and reducing trust in any external influence over those names.

Recommended defensive patterns include:

  • Input validation and canonicalization:
  • Enforce a safe character set for fixture names (e.g. alphanumerics, underscores, hyphens) and explicitly reject path separators (/, \), .., and null bytes.
  • Treat fixture names as logical identifiers rather than raw path fragments; map them to filenames through a controlled transformation.
  • Directory boundary enforcement:
  • After resolving the full path, normalize and canonicalize it, then verify that it remains under the configured fixture directory before any read or write.
  • Implement a single, centralized storage layer responsible for all filesystem interactions, consistently applying boundary checks.
  • Privilege and exposure reduction:
  • Run the application with the least necessary filesystem privileges, limiting access to sensitive system paths.
  • Store fixtures in dedicated directories with tightly scoped permissions to minimize blast radius if traversal is attempted.
  • Configuration discipline:
  • Avoid deriving fixture names directly from user input; instead, map external values to safe, vetted identifiers.
  • Document fixture naming conventions to discourage ad hoc uses that bypass the established constraints.

These patterns reduce reliance on caller behavior and make it harder for traversal issues to reappear in future changes.

How teams detect issues like this

Identifying this class of vulnerability typically involves both code-centric and behavior-centric approaches:

  • Static analysis and linting:
  • Search for file operations where paths are constructed from variables containing request data, configuration values, or other untrusted inputs.
  • Flag uses of concatenated path strings (e.g. $baseDir . '/' . $fixtureName) without preceding validation, particularly in the fixture or storage layers.
  • Use security-oriented static analysis rules or tools that specifically look for CWE-22 patterns in PHP filesystem APIs like file_get_contents, fopen, file_put_contents, and similar.
  • Targeted code review:
  • Examine the fixture subsystem and any code that computes fixture names, checking for:
  • Absence of whitelisting-based validation
  • Lack of canonicalization and directory-boundary checks
  • Reliance on caller discipline (e.g. "callers must provide safe names") instead of enforced constraints.
  • Review test helpers and mocking utilities, as these often handle fixture logic and are easy to overlook in security reviews.
  • Runtime and log analysis:
  • Instrument or log fixture paths being used at runtime, alerting on patterns that contain ../, ..\\, or unexpected directory levels.
  • Use application-level monitoring to detect unusual access to non-fixture directories originating from fixture-related code paths.
  • Security testing:
  • In controlled environments, fuzz fixture naming interfaces (where exposed) with traversal patterns to verify that the application prevents escaping the designated directory.

Automated code review tools and security scanners can help surface this pattern early, but should be complemented with manual review of path-handling logic.

Sources

SourceLink
docs.saloon.devdocs.saloon.dev/upgrade/upgrading-from-v3-to-v4
github.comgithub.com/saloonphp/saloon/security/advisories/GHSA-f7xc-5852-fj99

Frequently asked

questions

It can be, depending on how the application uses Saloon. If fixture names are influenced directly or indirectly by remote input (such as HTTP parameters or user-controlled configuration), a remote attacker may be able to exploit the traversal. If fixture names are entirely internal and never derived from untrusted data, practical exploitability is reduced.

The attacker needs a way to influence or control the fixture name used by Saloon's fixture subsystem. This access is often through application-level interfaces—such as APIs that derive fixture identifiers from user input—rather than direct filesystem access. The attack then leverages the application's own permissions on the filesystem.

The safest pattern is to treat fixture names as opaque identifiers, not raw path fragments. Apply strict input validation (rejecting path separators, .., and other unsafe characters), normalize and canonicalize the final path, and enforce that it remains under the intended fixture directory before any file operations. Centralizing these checks in the fixture/storage layer ensures consistent protection.

To prevent similar path traversal issues, adopt secure-by-default file handling patterns:

  • Design APIs so that consumers provide logical identifiers, not arbitrary paths.
  • Enforce whitelisting-based validation for any data that influences filesystem paths.
  • Implement canonicalization and directory-boundary checks in a shared utility or storage abstraction.
  • Include filesystem access patterns in regular security reviews and static analysis policies, especially in libraries and shared components.
Find out what's already
exploitable in your codebase.