VYPR
Unrated severityNVD Advisory· Published Jun 17, 2026

e107: Command Injection via shell expansion in ImageMagick resize destination path

CVE-2026-48997

Description

e107 is a content management system (CMS). Versions 2.3.5 and earlier contain a command injection vulnerability in the ImageMagick resize destination path. In resize_image(), the source path is escaped with escapeshellarg(), but the destination path is inserted inside raw double quotes in the convert command; in the submit-news upload flow, that destination filename includes the first six characters of user-controlled news title input. Because the title filter removes literal spaces but not tab characters, and shell expansions such as $(...) and backticks can survive into the quoted destination argument, /bin/sh -c may evaluate attacker-controlled input. Exploitation is possible only when all of the following non-default settings are enabled: resize_method=ImageMagick, subnews_attach=1, upload_enabled=1, subnews_resize is numeric between 30 and 5000, and the attacker is a non-admin in classes permitted by both subnews_class and upload_class. This issue has been fixed in version 2.3.6.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Patches

Vulnerability mechanics

Root cause

"The destination filename in the ImageMagick convert command is wrapped in double quotes instead of being shell-escaped, and the news title filter does not remove tab characters or shell metacharacters, allowing command substitution to be evaluated by /bin/sh -c."

Attack vector

An authenticated non-admin user submits a news item whose title contains a shell command substitution payload (e.g., `$(cmd)` or backticks) with a tab character in place of a space. The title filter strips literal spaces but leaves tabs intact, and the first six characters of the title become part of the destination filename in the ImageMagick `convert` command. Because the destination path is only double-quoted (not shell-escaped), `/bin/sh -c` evaluates the embedded command substitution. The attack requires four non-default settings: `resize_method=ImageMagick`, `subnews_attach=1`, `upload_enabled=1`, and `subnews_resize` set to a numeric value between 30 and 5000, plus the attacker must belong to a member class permitted by both `subnews_class` and `upload_class` [ref_id=2].

Affected code

The vulnerability resides in `resize_handler.php` where the ImageMagick `convert` command is built: the source path is escaped with `escapeshellarg()` but the destination path is inserted inside raw double quotes (`"..."`), allowing shell command substitution. In `submitnews.php`, the destination filename includes the first six characters of the user-controlled news title, which is filtered only by `str_replace(" ", "_", ...)` — tab characters (0x09) survive and act as shell IFS separators, enabling injection of `$(...)` or backtick payloads.

What the fix does

The patch applies `escapeshellarg()` to the destination filename in `resize_handler.php`, preventing shell metacharacters from being interpreted by `/bin/sh -c`. Additionally, `submitnews.php` now confines the title slug to `[A-Za-z0-9_]` before it reaches `resize_image()`, so shell metacharacters are stripped even if a future caller relaxes the quoting. The integer geometry and quality arguments are also cast to integers [ref_id=1].

Preconditions

  • configresize_method must be set to 'ImageMagick' (default is 'gd2')
  • configsubnews_attach and upload_enabled must both be enabled (both default off)
  • configsubnews_resize must be a numeric value between 30 and 5000 (default empty)
  • authAttacker must be a non-admin member whose class passes both subnews_class and upload_class checks
  • inputAttacker must submit a news title containing shell metacharacters ($(...) or backticks) with a tab character (0x09) as IFS separator

Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.