Summary
Crater Invoice through version 6.0.6 contains a path traversal vulnerability in its authenticated self-update API. A company owner who can submit a crafted ZIP archive may write files outside the intended extraction directory, potentially placing PHP code in a web-accessible location and achieving remote code execution.
Affected context
The issue occurs in Crater Invoice deployments that expose the self-update functionality and use the affected ZIP extraction flow. It becomes risky when an authenticated company owner can provide or influence an update archive and the application extracts archive entry names without constraining them to the intended destination directory. Impact also depends on the web server being able to serve or execute files written by the application.
Exploit preconditions
- Attack surface: Authenticated self-update API and ZIP archive extraction
- Required access: Authenticated company-owner privileges or equivalent access to the update function
- Trigger point: Processing of a supplied archive by the ZIP extraction routine
- Why exploitation is possible: Archive entry names containing parent-directory traversal sequences are accepted without sufficient canonicalization and containment checks
- Additional condition for code execution: The destination must be web-accessible and the server must interpret an uploaded or extracted PHP file as executable code
Why this happens
The underlying bug is improper handling of file paths extracted from an untrusted archive. ZIP entry names are passed to a generic extraction routine without reliably normalizing the resulting path and verifying that it remains within the approved extraction directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory. When the application permits attacker-controlled archive paths to escape the intended directory, arbitrary files may be overwritten or created.
Potential impact
- An attacker may write arbitrary files outside the intended update directory.
- Sensitive application files could be overwritten or corrupted.
- Malicious PHP files could be placed in a web-accessible directory.
- The attacker could achieve remote code execution under the web server's privileges.
- Application data, credentials, or connected services could be exposed or altered.
General mitigation guidance
Mitigation generally focuses on treating archive contents as untrusted and
enforcing destination containment before writing files.
Common defensive patterns include:
- Normalize each archive entry path and reject absolute paths, parent-directory traversal, and ambiguous path encodings.
- Verify that every resolved extraction path remains beneath a dedicated, non-public extraction directory.
- Prefer secure archive-extraction libraries or APIs that enforce path confinement by default.
- Keep update staging directories separate from the web root and prevent execution of uploaded or extracted scripts.
- Apply least-privilege permissions to the application and web server processes.
- Restrict self-update operations to trusted administrators and require integrity verification for update packages.
- Use a fixed allowlist of permitted archive paths and file types where practical.
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules identifying archive extraction calls that use attacker-controlled entry names without canonicalization.
- Code review checks for missing containment validation after path normalization.
- Tests using archive entries with parent-directory segments, absolute paths, alternate separators, and encoded traversal forms.
- Runtime monitoring for file creation outside approved update directories.
- Web server and application logs showing unusual self-update requests or newly created PHP files in public directories.
- Policy enforcement that blocks executable scripts in upload, cache, and update-staging locations.
Automated security review tools may help identify unsafe archive extraction patterns, but findings should be validated against the application's filesystem and deployment configuration.

