Summary
A path traversal flaw in Shopizer's /content/images/add endpoint allows crafted file upload requests to write files outside the intended directory.
When an attacker can control the upload path or filename, they may place arbitrary files in any writable location on the server, potentially enabling full application compromise.
Affected context
This vulnerability exists in Shopizer v3.2.5 within the image upload functionality exposed at the /content/images/add endpoint.
It manifests when user-controlled input is used to construct filesystem paths for uploaded files without enforcing strict canonicalization, directory whitelisting, and filename validation.
Any deployment that allows external users or integrated systems to upload images through this endpoint and runs the application with permissions to write beyond the intended upload directory is potentially exposed.
Exploit preconditions
- Attack surface: HTTP interface, specifically the /content/images/add POST endpoint.
- Required access: Ability to send authenticated or unauthenticated POST requests to the image upload endpoint, depending on how the instance is configured.
- Trigger point: The server-side file write operation that saves uploaded images based on a user-supplied path or filename parameter.
- Why exploitation is possible: The application constructs filesystem paths directly from user input without robust normalization, traversal-sequence filtering, or enforcement that the resolved path stays within a designated upload directory, allowing directory traversal sequences to break out of the intended folder.
Why this happens
The root cause is improper restriction of pathnames when building file system locations from user input, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal").
Instead of treating the upload destination as untrusted and constraining it to a fixed, validated directory, the implementation relies on raw client-provided segments (such as filenames or subdirectories) when calling filesystem APIs.
Without canonicalization and strict checks on the final resolved path, attackers can use traversal tokens (for example, parent directory references) or crafted path segments to escape the intended upload directory and target arbitrary writable paths.
Potential impact
- Arbitrary file creation or overwrite in any directory where the application process has write permissions.
- Placement of executable or interpretable files (e.g., scripts, templates) that could be invoked to achieve remote code execution, depending on server configuration.
- Overwriting configuration files or application assets, which can disrupt service or alter security controls.
- Planting web shells or backdoors that enable persistent access to the server.
- Assisting in data exfiltration or privilege escalation when combined with other weaknesses.
General mitigation guidance
Mitigation generally focuses on strictly constraining file upload destinations and treating upload paths as untrusted data.
Recommended defensive patterns include:
- Constructing upload paths from server-side configuration only, ignoring any directory components supplied by the client.
- Applying canonicalization and enforcing that the resolved path remains within a predefined, whitelisted base directory, rejecting requests that resolve outside it.
- Using fixed, server-generated filenames (for example, UUIDs) and separating logical identifiers from physical paths.
- Implementing strict allowlists for file extensions and content-type checks, and ensuring that uploaded files are stored in non-executable directories.
- Running the application under an account with minimal filesystem privileges so that even if traversal is attempted, the process cannot write to sensitive locations.
How teams detect issues like this
Detection efforts can focus on both code-level and operational signals:
- Static analysis and code review:
- Search for file upload handlers that concatenate user input directly into filesystem paths.
- Flag uses of APIs like
File,Paths.get, or equivalent where path segments are derived from HTTP parameters without normalization and boundary checks. - Check for missing checks that confirm the resolved path begins with an expected base directory.
- Runtime and logging:
- Log upload destinations and monitor for suspicious patterns, such as unexpected directory levels or attempts to write outside the normal upload tree.
- Use file integrity monitoring to detect new or modified files in sensitive directories that should not receive uploads.
- Policy enforcement:
- Enforce secure coding guidelines around file uploads and path handling via CI/CD checks.
- Integrate automated code review tools or SAST solutions configured with rules for path traversal and arbitrary file write patterns.

