Summary
ImpressCMS 1.4.4 contains an unrestricted file upload vulnerability where weak extension sanitization allows attackers to upload executable PHP code using alternative extensions.
By bypassing file type restrictions with extensions such as .php2, .php6, .php7, .phps, or .pht, an attacker can achieve remote code execution on the server when the uploaded payload is executed by PHP.
Affected context
This vulnerability occurs in ImpressCMS 1.4.4 wherever user-supplied files are accepted and stored on a web-accessible path, and upload validation relies mainly on checking filename extensions.
It is particularly relevant in contexts such as media managers, profile image uploads, or content attachments where:
- Uploaded files end up in directories processed by the PHP interpreter
- Extension checks do not properly account for alternative or compound PHP extensions
- Server configuration treats multiple extensions or certain suffixes as PHP scripts
Exploit preconditions
- Attack surface: HTTP file upload endpoints exposed by ImpressCMS (e.g., media upload, content/file managers).
- Required access: Ability to authenticate or otherwise reach an upload feature (depending on site configuration; often low-privileged user or, in some cases, even anonymous access).
- Trigger point: Uploading a crafted file containing PHP code using a bypass extension (e.g.,
.php2.php6.php7.phps.pht), then accessing it via the web to trigger server-side execution. - Why exploitation is possible: The upload logic relies on naïve extension filtering that only blocks standard
.phpor a limited set of extensions, while the underlying web server/PHP configuration still treats alternative or compound extensions as executable PHP.
Why this happens
The root cause aligns with CWE-434: Unrestricted Upload of File with Dangerous Type.
The upload mechanism attempts to enforce safety using filename-based filtering but:
- Assumes a small, fixed list of "dangerous" extensions (e.g.,
.php) rather than considering all extensions interpreted as code by the server. - Does not robustly normalize or parse multi-part and chained extensions, allowing combinations like
.php2.php6.php7.phps.pht. - Stores uploaded files in locations reachable by the web server without enforcing that they are treated as non-executable content.
This creates an insecure pattern where user-controlled files can be interpreted as active code by the runtime environment.
Potential impact
- Remote execution of arbitrary PHP code on the server.
- Full compromise of the ImpressCMS instance, including modification of content and configuration.
- Theft or manipulation of data stored in the application database.
- Installation of web shells or backdoors for persistent access.
- Lateral movement to other systems reachable from the compromised server.
- Use of the compromised site for phishing, malware distribution, or spam campaigns.
General mitigation guidance
Effective mitigation focuses on hardening both upload handling and server execution behavior rather than relying on ad hoc extension filters.
Recommended defensive patterns include:
- Deny-by-default upload policy: Maintain an explicit allowlist of safe, non-executable file types (e.g., specific image and document MIME types) and reject everything else.
- Content-type and content inspection: Validate MIME type using server-side libraries and, where feasible, perform basic content inspection to ensure files match their claimed type (e.g., real image formats).
- Safe storage locations: Store uploaded files outside of web-accessible directories or in paths where the web server is configured not to treat files as executable code.
- Non-executable file handling: Configure the web server/PHP to disable script execution in upload directories, including for lesser-known or chained PHP-related extensions.
- Robust filename normalization: Normalize and sanitize filenames server-side, stripping or rejecting multiple extensions, control characters, and unusual suffixes.
- Least privilege runtime: Run the web server and PHP with minimal filesystem and system privileges to limit damage if a bypass occurs.
How teams detect issues like this
Detection can combine code-focused and operational approaches:
- Static analysis and code review:
- Look for upload handlers relying on string-based extension checks or blacklist-style validation.
- Flag any logic that accepts arbitrary file types or fails to enforce an explicit allowlist.
- Verify that upload paths and generated URLs do not map to script-executable directories.
- Configuration review:
- Inspect web server and PHP-FPM configurations for directories where script execution is enabled and ensure upload paths are excluded.
- Review mappings for non-standard PHP extensions (.php2, .php3, .php4, .php5, .php6, .php7, .phps, .pht, .phtml, etc.).
- Runtime monitoring:
- Monitor logs for suspicious uploads, especially files with multiple or unusual extensions.
- Track execution of scripts from known upload directories or media paths.
- Automated tools:
- Use web application scanners configured to test upload endpoints with varied extensions and payload types.
- Integrate secure coding checks into CI that flag dangerous upload patterns and misconfigurations.

