Summary
A critical directory traversal vulnerability in Reportico Web can allow a remote attacker to create or overwrite files outside the intended template location. The risk arises when the run.php endpoint processes a user-controlled saveTemplate filename together with execute_mode=PREPARE, subject to the permissions of the web server account.
Affected context
The vulnerability occurs in Reportico Web deployments where the run.php endpoint is reachable and accepts template-saving requests. It becomes risky when the saveTemplate parameter is used to construct a filesystem path without reliably constraining the destination to an approved directory, and when the web process has write access to sensitive locations.
Exploit preconditions
- Attack surface: The remotely accessible
run.phpweb endpoint - Required access: Network access to the endpoint; authentication requirements depend on deployment configuration
- Trigger point: A request that combines
saveTemplatewithexecute_mode=PREPARE - Why exploitation is possible: A filename supplied by the requester can influence the filesystem destination, allowing path traversal beyond the intended template directory
- Permission boundary: Files can only be created or overwritten where the web server account has write permission
Why this happens
The underlying bug is insufficient validation and canonicalization of a user-controlled filename before it is used in a filesystem write operation. When path components are accepted without enforcing a fixed base directory, an attacker may cause the application to resolve a path outside its intended storage area. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- Sensitive files may be overwritten or corrupted
- Application availability could be disrupted through destructive file changes
- Configuration, code, or data integrity may be compromised
- Server-side code execution may be possible if a writable location is interpreted as executable content
- The web application or host could be used as a foothold for further compromise
General mitigation guidance
Mitigation generally focuses on removing filename-derived filesystem paths from security-sensitive write operations and enforcing a narrow storage boundary.
Common defensive patterns include:
- Accepting opaque server-generated identifiers instead of client-controlled paths
- Canonicalizing candidate paths and verifying that they remain beneath an approved directory
- Rejecting traversal components, absolute paths, unexpected separators, and symbolic-link escapes
- Applying strict allowlists for template names and permitted file types
- Separating writable template storage from executable code, configuration, and sensitive data
- Running the web process with the minimum filesystem privileges required
- Enforcing authorization and request protections around template creation and modification
- Using filesystem and operating-system controls to limit write access and contain damage
How teams detect issues like this
Detection can combine application testing, source review, and runtime monitoring:
- Use static analysis to identify user-controlled values passed to file creation, rename, or write APIs
- Review code for path concatenation without canonicalization and base-directory enforcement
- Test endpoint authorization and filename validation with traversal-pattern variations in controlled environments
- Monitor web-server processes for unexpected writes outside designated application directories
- Alert on modifications to executable files, configuration files, and sensitive system locations
- Enforce repository and CI policies that require approved path-handling utilities for file operations
- Automated application-security and code-review tools may help identify related path traversal patterns

