/

CVE-2026-52891

Severity:

CRITICAL RISK

(9.9)

OS Command Injection (CWE-78) in Wekan Avatar Upload

CVE-2026-52891

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78, CWE-88

Impact:

Remote Code Execution on Server

Severity:

CRITICAL RISK

(9.9)

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

Wekan's avatar upload feature previously passed user-controlled filenames into a shell command used for MIME-type detection, without safely handling shell metacharacters.

An attacker who could upload an avatar with a crafted filename containing shell syntax could execute arbitrary commands on the Wekan server process.

Affected context

The vulnerability occurs in Wekan instances that allow users to upload avatar images, where the application builds shell commands using user-supplied filenames.

Specifically, the logic in models/avatars.js and models/fileValidation.js used child_process.exec() with a command string that directly embeds the avatar filename.

Environments where file uploads are broadly available or where filename validation is minimal are most exposed, especially when the Wekan process runs with elevated privileges.

Exploit preconditions

  • Attack surface: HTTP(S) endpoint(s) handling avatar image uploads.
  • Required access: Ability to authenticate (if required by the instance) and upload or influence avatar filenames.
  • Trigger point: Server-side MIME-type detection that executes a shell command including the user-controlled filename.
  • Why exploitation is possible: The filename is interpolated into a shell command executed via child_process.exec() without proper escaping or argument separation, allowing shell metacharacters like backticks and $() to be interpreted as commands.

Why this happens

The core bug stems from constructing shell command strings by concatenating user-controlled input and then executing them via child_process.exec().

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because shell metacharacters in filenames are not neutralized, enabling command injection.

Additionally, it aligns with CWE-88: Argument Injection or Modification, as untrusted content is embedded into command arguments instead of using safe APIs that separate executable paths from parameters.

At an abstract level, the pattern is "dynamic shell command construction with untrusted input" instead of using parameterized or non-shell-based APIs for MIME detection.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the Wekan server process.
  • Reading, modifying, or deleting application and system files accessible to the Wekan runtime.
  • Exfiltration or corruption of Wekan board data and configuration.
  • Pivoting to other services or hosts reachable from the compromised server.
  • Installation of backdoors, cryptominers, or other persistent malware.

General mitigation guidance

Effective mitigation generally focuses on eliminating shell-based command construction paths and strictly constraining how external utilities are invoked.

Recommended defensive patterns include:

  • Replacing child_process.exec() with safer alternatives that accept argument arrays (for example, spawn-style APIs) and avoid going through the shell.
  • Using in-process MIME-type detection libraries instead of external shell commands where feasible.
  • Treating filenames as opaque data: never interpolating them into shell commands or scripts; if external tools are unavoidable, pass filenames as separate arguments, not as part of a command string.
  • Applying strict server-side validation and normalization of filenames, rejecting characters and patterns that are not needed for legitimate use (such as backticks, $(), and other metacharacters).
  • Running the Wekan service with least-privilege OS accounts and restricted filesystem and network permissions to reduce impact if exploitation occurs.

How teams detect issues like this

Detection typically involves examining both source code and runtime behavior for dangerous command construction patterns.

Useful approaches include:

  • Static analysis rules that flag uses of child_process.exec() or similar shell-invoking APIs when any part of the command string is derived from request data, filenames, or other user inputs.
  • Code review checklists that require reviewers to verify that all external command executions use parameterized argument arrays and that no user-controlled data is concatenated into shell commands.
  • Application-level logging that records unusual or malformed filenames supplied during avatar uploads, coupled with monitoring for suspicious command executions on the host.
  • Host-based intrusion detection or endpoint monitoring configured to alert on unexpected shell invocations or processes spawned by the Wekan service account.

Sources

SourceLink
github.comgithub.com/wekan/wekan/commit/a4c74a5980e9f778eb444fd346f32aa3d16786a9
github.comgithub.com/wekan/wekan/releases/tag/v9.07
github.comgithub.com/wekan/wekan/security/advisories/GHSA-35j7-h385-2q9g

Frequently asked

questions

Yes. An attacker who can reach the Wekan avatar upload functionality over HTTP(S) and supply filenames with shell metacharacters can attempt to exploit this issue remotely, subject to any authentication requirements.

The attacker needs the ability to upload or control the filename of an avatar image. In many deployments this requires a valid Wekan account, but in more open instances or integrations, registration or upload might be less restricted.

The most robust fix is to remove all shell-based command composition that incorporates user input. Use APIs that take argument arrays or pure library calls for MIME detection and avoid exec-style functions altogether, ensuring filenames never pass through a shell.

Adopt coding standards that prohibit constructing shell commands from untrusted data, mandate the use of safe process-spawning APIs, and enforce these standards through static analysis and code review. Combine this with conservative filename validation and least-privilege execution of services to minimize both likelihood and impact of command injection flaws.

Find out what's already
exploitable in your codebase.