/

CVE-2022-50944

Severity:

HIGH RISK

(8.8)

Code Injection in Aero CMS Admin Post Creation

CVE-2022-50944

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution by authenticated users via malicious file upload

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Aero CMS 0.0.1 contains a PHP code injection flaw in the admin post creation workflow, where uploaded files provided via the image parameter can contain executable PHP code.

An authenticated attacker can upload a malicious PHP file through posts.php?source=add_post, which the server then executes, leading to full remote code execution under the web server's privileges.

Affected context

The vulnerability appears in the Aero CMS administrative interface when adding new posts via posts.php with source=add_post.

In affected setups, the application treats the image upload parameter as a trusted file and stores it in a web-accessible location without enforcing strict file type validation or ensuring non-executable storage.

The issue manifests when the environment executes uploaded files as PHP scripts (e.g., within the document root on a PHP-enabled web server), allowing the embedded code to run when the file is requested.

Exploit preconditions

  • Attack surface: Web-based admin interface, specifically admin/posts.php?source=add_post.
  • Required access: Valid authenticated account with permission to create or edit posts and upload images.
  • Trigger point: Submitting a post creation request that includes a file upload via the image parameter containing PHP code, followed by requesting the uploaded file through the web server.
  • Why exploitation is possible: The server accepts arbitrary file content as an "image," stores it in a location interpreted by PHP, and does not enforce robust content-type checks, file extension whitelisting, or execution barriers on uploaded files.

Why this happens

This vulnerability is rooted in CWE-94: Improper Control of Generation of Code, specifically allowing user-supplied content to become executable code on the server.

The application treats uploaded files as benign images but fails to:

  • Restrict allowed file types to non-executable formats,
  • Store uploads outside of executable web paths, or
  • Sanitize and validate file names and contents.

As a result, a user can upload a PHP file containing arbitrary code that is later executed by the PHP interpreter when accessed through the web server, effectively turning untrusted input into server-side code.

Potential impact

  • Execution of arbitrary PHP code under the web server account.
  • Full compromise of the Aero CMS instance, including reading or modifying database content through application context.
  • Deployment of web shells for persistent access and further lateral movement.
  • Exfiltration or tampering of user data and configuration.
  • Use of the compromised server as a pivot point for attacking internal infrastructure.

General mitigation guidance

Effective mitigation generally focuses on preventing uploaded content from becoming executable and tightening trust boundaries around file handling:

  • Enforce strict whitelisting of file extensions and MIME types for uploads (e.g., only JPEG/PNG), and reject any potentially executable formats.
  • Store uploaded files outside of the web root or in directories configured to disallow script execution (e.g., using web server configuration to disable php execution in upload paths).
  • Normalize and sanitize file names, and avoid using user-provided extensions directly.
  • Apply least-privilege to the web server user and the upload directories to limit damage if a file is misclassified.
  • Introduce centralized upload handling and validation routines rather than ad-hoc file handling in multiple endpoints.

How teams detect issues like this

Organizations can detect and monitor for this class of vulnerabilities using a combination of review and tooling:

  • Static analysis: Scan PHP code for direct calls to file upload handlers that save files in executable locations, or for scripts referencing upload directories under the document root without execution safeguards.
  • Code review: Flag patterns where:
  • $_FILES input is stored without extension/content checks,
  • Upload directories are inside the web root,
  • There is no server configuration to disable script execution in upload paths.
  • Runtime monitoring: Track access to newly created files in upload directories, particularly .php or other executable extensions, and alert on suspicious patterns.
  • Security testing: Use automated web scanners or manual penetration testing to probe file upload endpoints for handling of unexpected file types and extensions.

Sources

SourceLink
github.comgithub.com/MegaTKC/AeroCMS
exploit-db.comexploit-db.com/exploits/51085
vulncheck.comvulncheck.com/advisories/aero-cms-php-code-injection-via-posts-php

Frequently asked

questions

Yes, it is remotely exploitable via the web interface, but it requires a valid authenticated account with sufficient privileges to upload images through the admin post creation endpoint.

The attacker needs authenticated access to the Aero CMS admin area or any role that can create posts and upload images via posts.php?source=add_post. No direct server or shell access is required.

The most robust fix is to treat all uploads as untrusted data: enforce strict file type and extension whitelisting, store uploads in non-executable locations, and configure the web server to disable scripting in upload directories. Centralizing upload handling logic and applying consistent validation across all upload points further reduces risk.

Adopt secure file upload patterns by default: design upload directories as data-only, non-executable locations; use a well-reviewed upload abstraction that performs validation, renaming, and storage; and include checks for this pattern in code review and automated security testing. Combining these coding practices with defense-in-depth server configuration helps prevent code injection via uploads.

Find out what's already
exploitable in your codebase.