CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-33183
8.0

CVE-2026-33183: Path Traversal in Saloon PHP Fixture Management

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 26, 2026·6 min read·2 visits

PoC Available

Executive Summary (TL;DR)

A path traversal vulnerability in Saloon < 4.0.0 allows attackers to read or write arbitrary files via improperly validated fixture names.

The Saloon PHP library (versions prior to 4.0.0) is vulnerable to a path traversal flaw in its MockResponse fixture system. Applications that allow user-controlled input to influence fixture names can be coerced into reading or writing files outside the intended base directory, leading to arbitrary file disclosure or file overwrite.

Vulnerability Overview

The Saloon PHP library provides a robust framework for building API integrations and SDKs. Within this ecosystem, the MockResponse fixture system enables developers to record and replay API responses for testing and development purposes. This system relies on the filesystem to store and retrieve recorded responses, using a designated base directory for organizational boundaries.

Versions of Saloon prior to 4.0.0 suffer from an Improper Limitation of a Pathname to a Restricted Directory vulnerability (CWE-22). The vulnerability manifests within the fixture management implementation, specifically in how the library processes fixture names to generate file paths. The system fails to sanitize input for directory traversal sequences before initiating filesystem operations.

Exploitation requires that an application utilizing Saloon permits external or untrusted input to define or influence the name of a requested fixture. When an application passes dynamic input to the MockResponse::fixture() method without preceding validation, an attacker can manipulate the resolution path. The severity of the impact depends on whether the application is configured to read existing fixtures or record new ones.

Root Cause Analysis

The fundamental flaw exists in the interaction between the Saloon\Http\Faking\Fixture and Saloon\Helpers\Storage classes. The Fixture class accepts a string parameter representing the name of the desired mock response. This string acts as the primary identifier for the corresponding JSON file on the disk.

Prior to the 4.0.0 patch, the Fixture::getFixturePath() method assumed the provided name was structurally safe. It directly concatenated the input string with a .json file extension. The method lacked any mechanism to detect or strip directory traversal sequences, such as ../ or ..\, allowing these characters to persist into the subsequent storage resolution phase.

The Storage class is responsible for managing the physical filesystem interactions. Its buildPath() method utilized simple string concatenation to join the configured base fixture directory with the relative path supplied by the Fixture class. The implementation did not employ path canonicalization techniques, nor did it verify that the final absolute path resolved to a location within the designated base directory.

Consequently, the operating system natively resolved the traversal sequences embedded in the concatenated string. If an attacker supplied a payload containing multiple parent directory sequences, the resolution process escaped the intended storage root, allowing direct read or write access to arbitrary locations on the host filesystem subject to the permissions of the PHP process.

Code Analysis and Patch Review

In vulnerable versions, the application accepted fixture names directly into the path construction logic. The absence of a robust validation layer meant that input strings like ../../../../etc/passwd were blindly processed as valid file identifiers. This directly violated secure coding principles regarding filesystem boundary enforcement.

The 4.0.0 release resolves this vulnerability by implementing a multi-layered defense strategy. The primary mitigation introduces strict input validation within the src/Http/Faking/Fixture.php file. The developers implemented a regular expression whitelist and specific character checks to reject traversal sequences outright.

if (str_contains($name, "\0") || str_contains($name, '..') || str_contains($name, '~')
    || ! preg_match('/^[a-zA-Z0-9\/_\-\\]+$/', $name)) {
    throw new FixtureException('The fixture name must not contain directory traversal components or invalid characters.');
}

As a defense-in-depth measure, the maintainers modified the src/Helpers/Storage.php file to establish a filesystem jail. They introduced the normalizePath method to manually resolve structural segments without accessing the filesystem, and the ensurePathUnderBase method. This latter method uses the realpath() function on the base directory and strictly compares it against the requested target, throwing an exception if the target resides outside the designated boundary. This combination completely neutralizes the traversal vector.

Exploitation Methodology

Exploiting this vulnerability in a read context (Local File Disclosure) requires identifying an application endpoint that incorporates user input into the mock fixture selection process. For example, a developer might expose a debug parameter via an HTTP GET request to dynamically load specific mock states during staging.

The attacker crafts an HTTP request containing a traversal payload in the vulnerable parameter. By supplying a string such as ../../../../etc/passwd, the application passes the payload to Saloon's fixture handler. Saloon attempts to load [BASE]/../../../../etc/passwd.json. If the application host possesses a file matching the exact string with the .json extension appended, or if the system ignores the extension under specific conditions, the contents are returned as the mocked API response.

The vulnerability also presents a write-based attack vector if the application operates in "record" mode. In this state, Saloon captures live API responses and saves them to the disk for future use. If the attacker can influence the fixture name during a recording event, they gain the ability to dictate the destination file path.

By supplying a payload like ../public/payload.php, the attacker forces Saloon to write the recorded JSON response outside the temporary fixture directory. If the attacker can predict or manipulate the contents of the recorded API response to include executable code (e.g., PHP tags), and if the application's web server executes .json files or the attacker bypasses the extension appending, this flaw escalates to remote code execution.

Remediation and Mitigation

The definitive remediation for this vulnerability is to upgrade the saloonphp/saloon dependency to version 4.0.0 or later. This version contains the comprehensive structural fixes, including the regex whitelisting and the realpath-based filesystem jail, which eliminate the root cause of the path traversal.

Developers must audit their application codebases to identify any instances where user-supplied data interacts with the MockResponse::fixture() method or the Fixture class constructor. Applications should never pass unvalidated external input directly into file path construction mechanisms. Implement strict allowlisting for any dynamic fixture selection logic.

Administrators should enforce the principle of least privilege at the operating system level. The PHP process executing the application must operate with the minimum filesystem permissions necessary. Restricting write access to only designated temporary or upload directories prevents attackers from overwriting critical application code or configuration files, mitigating the impact of the write-based exploitation scenario.

Organizations should deploy Web Application Firewall (WAF) rules to detect and block incoming HTTP requests containing common directory traversal patterns. Signatures targeting ../, ..\, and URL-encoded variants (%2e%2e%2f) provide a secondary layer of defense against exploitation attempts while systems undergo the patching process.

Fix Analysis (2)

Technical Appendix

CVSS Score
8.0/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:U

Affected Systems

saloonphp/saloon (PHP)

Affected Versions Detail

Product
Affected Versions
Fixed Version
saloon
saloonphp
< 4.0.04.0.0
AttributeDetail
CWE IDCWE-22
Attack VectorNetwork
CVSS v4.0 Score8.0
ImpactFile Disclosure / File Overwrite
Exploit StatusPoC Available
Affected ComponentMockResponse Fixtures

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Known Exploits & Detection

GitHub Security AdvisoryFunctional PoC test case available within the library's security test suite demonstrating the write capability outside the base directory.

Vulnerability Timeline

Initial fix commits for path traversal in v4 branch.
2026-03-10
Additional security improvements for SSRF and credential leakage added.
2026-03-17
CVE-2026-33183 published and GitHub Advisory released.
2026-03-26

References & Sources

  • [1]GitHub Advisory (GHSA-f7xc-5852-fj99)
  • [2]Saloon v3 to v4 Upgrade Guide

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.