/

CVE-2026-25153

Severity:

HIGH RISK

(7.7)

Code Injection / Arbitrary Code Execution in Backstage

CVE-2026-25153

Modified

Vulnerability type

Category:

Code Injection / Arbitrary Code Execution

CWE:

CWE-94

Impact:

Remote Code Execution on TechDocs build infrastructure

Severity:

HIGH RISK

(7.7)

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

When Backstage TechDocs is configured with runIn: local, a malicious contributor who can modify a repository's mkdocs.yml file may configure MkDocs hooks that execute arbitrary Python code on the TechDocs build server.

This becomes risky in environments where untrusted or partially trusted users can influence mkdocs.yml for projects processed by TechDocs.

Affected context

The vulnerability appears in Backstage deployments using the @backstage/plugin-techdocs-node package with TechDocs configured to run builds locally (runIn: local), rather than inside a fully isolated environment.

It is relevant when:

  • TechDocs automatically processes documentation from source repositories, and
  • Contributors are able to submit or change mkdocs.yml files that TechDocs consumes.

The risk is most pronounced in multi-tenant or large engineering organizations where documentation repositories may be writable by many users or external contributors.

Exploit preconditions

  • Attack surface: TechDocs build process on the Backstage backend or associated build server.
  • Required access: Ability to submit, push, or modify a repository's mkdocs.yml file that TechDocs will process.
  • Trigger point: A TechDocs build gets initiated for the affected repository (e.g., via scheduled build, manual trigger, or on-demand preview).
  • Why exploitation is possible: The TechDocs Node plugin passes user-controlled mkdocs.yml configuration, including the hooks section, directly to MkDocs, which executes configured Python hooks during the build lifecycle. This effectively allows user-controlled configuration to introduce and run arbitrary Python code.

Why this happens

The root cause is the lack of strict validation and filtering of MkDocs configuration data originating from repository-controlled mkdocs.yml files.

In affected versions, the TechDocs Node plugin treated the configuration file as trusted and forwarded all keys, including hooks, to MkDocs. MkDocs hooks are effectively executable code entry points, enabling arbitrary Python statements to run when they are loaded and invoked.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because data from a non-trusted configuration file influences what code executes on the server (through hooks), without appropriate restriction or allowlisting of safe configuration keys.

Potential impact

  • Execution of arbitrary Python code on the TechDocs build server.
  • Access to environment variables, credentials, or tokens available to the TechDocs process.
  • Lateral movement from the documentation build environment to other internal services, depending on network and credential exposure.
  • Tampering with generated documentation artifacts, including inserting malicious content or misleading technical information.
  • Use of the TechDocs infrastructure as a foothold for further attacks (e.g., establishing persistence, exfiltrating data, or staging supply-chain compromises).

General mitigation guidance

Mitigation generally focuses on treating documentation configuration as untrusted input and constraining what the build pipeline is allowed to execute.

Recommended defensive patterns include:

  • Configuration allowlisting: Only pass a known-safe subset of mkdocs.yml keys into the build toolchain; strip or reject unsupported or high-risk fields such as hooks before execution.
  • Execution isolation: Prefer running documentation builds in strongly isolated environments (e.g., containers or sandboxed workers with limited privileges, restricted file system access, and tightly scoped network policies).
  • Principle of least privilege: Ensure the TechDocs build process runs under a minimally privileged account with no unnecessary access to secrets, internal services, or host resources.
  • Repository governance: Treat mkdocs.yml as security-sensitive; apply strict access controls and review processes for changes to documentation configuration.
  • Secure defaults: Configure the documentation system so that risky features are disabled by default, requiring explicit opt-in under controlled conditions.

How teams detect issues like this

Effective detection strategies focus on both code-level patterns and repository-level configuration scanning.

Potential approaches:

  • Static analysis / configuration linting: Scan mkdocs.yml files for disallowed or risky keys (such as hooks) and flag them during CI before TechDocs processes the repository.
  • Code review checks: In Backstage and TechDocs-related code, look for paths where external configuration is forwarded to build tools without validation; specifically, watch for direct use of full configuration objects passed into MkDocs without filtering.
  • Policy enforcement: Use repository management or CI policies to require review and approval for modifications to mkdocs.yml and other build-related configuration files.
  • Runtime monitoring: Log TechDocs build invocations and anomalous build behavior (e.g., unexpected network calls or filesystem access during documentation generation) and feed logs into centralized monitoring for alerting.

Sources

SourceLink
github.comgithub.com/backstage/backstage/security/advisories/GHSA-6jr7-99pf-8vgf
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6174
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6802
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-25153
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2435576
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25153.json

Frequently asked

questions

Yes, in environments where users can push changes to repositories that TechDocs processes, an attacker can exploit the issue by modifying mkdocs.yml and waiting for the build system to run. The attack path is indirect (via source control and documentation builds), but it can originate from remote contributors.

The attacker must be able to create or alter mkdocs.yml in a repository that TechDocs builds. This typically means write access to the documentation repository or the relevant branch in source control.

Implement a strict allowlist of safe MkDocs configuration keys and drop or reject any unsupported fields before invoking MkDocs. Combine this with isolation of the build environment and reduction of TechDocs process privileges.

Treat all build and documentation configuration as untrusted input, validate it against a constrained schema, run build tools in sandboxed environments, and enforce review workflows for configuration changes. Integrating automated checks in CI to detect high-risk configuration options helps catch issues before they reach production.

Find out what's already
exploitable in your codebase.