/

CVE-2026-120203

Severity:

HIGH RISK

(8.8)

Code Injection (CWE-94) in ShowDoc Mock Templates

CVE-2026-120203

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Shell Command Execution

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

ShowDoc's Mock feature can evaluate stored mockjs templates as code, allowing an authenticated user to execute shell commands when a template is triggered. The risk is greatest when users who can create or manage mock templates are not fully trusted, and the official Docker image may run the resulting commands as root.

ShowDoc's Mock feature can evaluate stored mockjs templates as code, allowing an authenticated user to execute shell commands when a template is triggered. The risk is greatest when users who can create or manage mock templates are not fully trusted, and the official Docker image may run the resulting commands as root.

Affected context

The vulnerability is in ShowDoc's Mock feature, where templates are stored through the mock-management flow and evaluated when requested. It affects versions 2.8.14 through releases before 3.9.6 when an authenticated user can store a template that reaches an unsafe evaluation path. In the official Docker image, command execution may occur with root privileges.

The vulnerability is in ShowDoc's Mock feature, where templates are stored through the mock-management flow and evaluated when requested. It affects versions 2.8.14 through releases before 3.9.6 when an authenticated user can store a template that reaches an unsafe evaluation path. In the official Docker image, command execution may occur with root privileges.

Exploit preconditions

  • Attack surface: The Mock feature's template creation and retrieval functionality
  • Required access: Authentication and permission to add or manage mock templates
  • Trigger point: A stored template is evaluated when the corresponding mock information is requested
  • Why exploitation is possible: Template content reaches an evaluation mechanism that can interpret attacker-controlled content as executable code
  • Attack surface: The Mock feature's template creation and retrieval functionality
  • Required access: Authentication and permission to add or manage mock templates
  • Trigger point: A stored template is evaluated when the corresponding mock information is requested
  • Why exploitation is possible: Template content reaches an evaluation mechanism that can interpret attacker-controlled content as executable code

Why this happens

The underlying issue is code injection, mapped to CWE-94: Improper Control of Generation of Code. The Mock feature evaluates template content as code rather than treating it strictly as data. When users can influence content that reaches this evaluation path, the application may execute unintended commands.

The underlying issue is code injection, mapped to CWE-94: Improper Control of Generation of Code. The Mock feature evaluates template content as code rather than treating it strictly as data. When users can influence content that reaches this evaluation path, the application may execute unintended commands.

Potential impact

  • An authenticated user could execute shell commands in the ShowDoc runtime
  • The application environment could be compromised
  • In the official Docker image, commands may run with root privileges
  • An attacker could potentially access or alter data available to the compromised runtime
  • An authenticated user could execute shell commands in the ShowDoc runtime
  • The application environment could be compromised
  • In the official Docker image, commands may run with root privileges
  • An attacker could potentially access or alter data available to the compromised runtime

General mitigation guidance

Defensive patterns focus on keeping user-controlled template content out of executable evaluation paths.

  • Prefer a data-only template engine or a restricted expression language over general-purpose evaluation.
  • Treat templates as untrusted input and apply strict allowlisting and validation before storage and use.
  • Separate template authorship from the ability to trigger or publish templates where practical.
  • Run application containers and services with least privilege, avoiding root where possible.
  • Use isolation and resource limits to reduce the consequences of a compromised runtime.

Defensive patterns focus on keeping user-controlled template content out of executable evaluation paths.

  • Prefer a data-only template engine or a restricted expression language over general-purpose evaluation.
  • Treat templates as untrusted input and apply strict allowlisting and validation before storage and use.
  • Separate template authorship from the ability to trigger or publish templates where practical.
  • Run application containers and services with least privilege, avoiding root where possible.
  • Use isolation and resource limits to reduce the consequences of a compromised runtime.

How teams detect issues like this

  • Use static analysis to identify dynamic evaluation functions and flows from user-controlled template fields.
  • Review Mock template creation, storage, and retrieval paths for unsafe interpretation of stored content.
  • Apply code review checks that flag user input passed to evaluators, interpreters, or shell execution APIs.
  • Enforce policies that prohibit general-purpose evaluation of user-controlled content and monitor for unexpected child processes.
  • Automated code review tools may help identify risky data flows for further assessment.
  • Use static analysis to identify dynamic evaluation functions and flows from user-controlled template fields.
  • Review Mock template creation, storage, and retrieval paths for unsafe interpretation of stored content.
  • Apply code review checks that flag user input passed to evaluators, interpreters, or shell execution APIs.
  • Enforce policies that prohibit general-purpose evaluation of user-controlled content and monitor for unexpected child processes.
  • Automated code review tools may help identify risky data flows for further assessment.

Sources

SourceLink
gist.github.comgist.github.com/LioTree/028af150fd991cf9924dd2c7d5912e54
github.comgithub.com/star7th/showdoc
github.comgithub.com/star7th/showdoc/blob/v3.9.5/mock/index.js#L42
github.comgithub.com/star7th/showdoc/commit/5a2087a3f408f5266f61e9e2fb98845ef4788288
vulncheck.comvulncheck.com/advisories/showdoc-2.8.14-before-3.9.6-code-injection-via-mock-templates

Frequently asked

questions

It can be triggered through ShowDoc's Mock functionality, but the described attack requires an authenticated user with permission to add or manage templates.

An attacker needs access to the relevant Mock operations. The exact access level depends on how authentication and permissions are configured in a deployment.

Avoid evaluating user-controlled templates as code. Use a data-only or restricted template mechanism with strict validation.

Review data flows into dynamic evaluators, limit who can create and trigger templates, and run the application with least privilege.

It can be triggered through ShowDoc's Mock functionality, but the described attack requires an authenticated user with permission to add or manage templates.

An attacker needs access to the relevant Mock operations. The exact access level depends on how authentication and permissions are configured in a deployment.

Avoid evaluating user-controlled templates as code. Use a data-only or restricted template mechanism with strict validation.

Review data flows into dynamic evaluators, limit who can create and trigger templates, and run the application with least privilege.

Find out what's already
exploitable in your codebase.