/

CVE-2026-35171

Severity:

CRITICAL RISK

(9.8)

Code Injection / Unsafe Dynamic Execution in Kedro

CVE-2026-35171

Analyzed

Vulnerability type

Category:

Code Injection / Unsafe Dynamic Execution

CWE:

CWE-94, CWE-502

Impact:

Remote Code Execution during Application Startup

Severity:

CRITICAL RISK

(9.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

Kedro allowed the logging configuration file path to be controlled via the KEDRO_LOGGING_CONFIG environment variable and loaded it without validation.

Because Python's logging.config.dictConfig() supports the special () key for arbitrary callable instantiation, a crafted logging config could execute system commands during application startup, resulting in remote code execution.

Affected context

This vulnerability affects Kedro-based applications that:

  • Read the logging configuration from a file whose path is set via the KEDRO_LOGGING_CONFIG environment variable, and
  • Pass that configuration directly into logging.config.dictConfig() without validation or restriction.

It becomes relevant in environments where attackers can influence the environment variables or the logging configuration file itself, such as compromised CI/CD runners, misconfigured container environments, shared servers, or multi-tenant deployments where environment configuration is loosely controlled.

Exploit preconditions

  • Attack surface: Application startup path in Kedro-based projects.
  • Required access: Ability to:
  • Set or modify the KEDRO_LOGGING_CONFIG environment variable to point to an attacker-controlled configuration file, or
  • Directly modify the file already referenced by KEDRO_LOGGING_CONFIG.
  • Trigger point: Application initialization when Kedro loads the logging configuration and calls logging.config.dictConfig().
  • Why exploitation is possible: The logging configuration is treated as trusted input and passed directly into dictConfig(), which honors the () key, enabling instantiation of arbitrary callables specified by untrusted configuration data.

Why this happens

The root cause lies in treating a fully dynamic, user-controlled logging configuration as trusted code-like input.

Python's logging.config.dictConfig() supports a () key that specifies a callable to construct loggers, handlers, or formatters.

When untrusted configuration is passed to dictConfig() without validation or restriction, attackers can reference arbitrary importable callables or wrappers that execute system commands during object creation.

This behavior maps primarily to CWE-94: Improper Control of Generation of Code, because configuration data is effectively allowed to define executable behavior during startup, and secondarily to CWE-502: Unsafe Deserialization, in that structured data is interpreted in a way that results in object construction and execution of attacker-controlled logic.

Potential impact

  • Execution of arbitrary system commands with the privileges of the Kedro application process.
  • Complete compromise of the host running the data pipeline or application.
  • Credential theft (e.g., cloud API keys, database passwords, tokens) accessible to the process.
  • Data exfiltration or destruction of datasets and models processed by Kedro pipelines.
  • Lateral movement within the environment, such as pivoting to other services or nodes.
  • Tampering with pipeline runs, experiment artifacts, and model training outputs.

General mitigation guidance

Effective mitigation focuses on constraining who controls logging configuration and how it is interpreted:

  • Remove or strictly limit user control over logging config paths:
  • Avoid reading configuration paths for critical subsystems directly from environment variables that may be influenced by external parties.
  • Prefer fixed, application-owned configuration locations with locked-down permissions.
  • Treat logging configuration as untrusted input:
  • Introduce validation layers that:
  • Reject unexpected keys (such as () or other dynamic-construction fields).
  • Enforce an allowlist of handlers, formatters, and filters permitted in the configuration.
  • Consider using a reduced logging configuration schema that does not rely on dynamic callables.
  • Use secure-by-default configuration patterns:
  • Ship with a minimal, static default logging configuration baked into the code or package.
  • Allow only high-level toggles (e.g., log level, enabled handlers) through environment variables, not full logging structures.
  • Constrain execution environment privileges:
  • Run Kedro processes with least-privilege OS accounts and minimal file-system and network access.
  • Use container or sandbox isolation where feasible to reduce the impact of possible code execution.
  • Harden configuration management:
  • Treat logging configuration files as sensitive assets, managed via configuration management systems with tight access control and auditing.
  • Avoid letting untrusted users edit runtime configuration in shared environments.

How teams detect issues like this

Detection can rely on both code-level and configuration-level analysis:

  • Static analysis and code review:
  • Search for uses of logging.config.dictConfig() where the input:
  • Comes from environment variables, command-line arguments, or user-supplied files.
  • Is not validated, sanitized, or restricted prior to being passed into dictConfig().
  • Flag any pattern where generic configuration blobs are directly forwarded to logging configuration APIs.
  • Configuration scanning:
  • Scan logging configuration files for the presence of the () key and other dynamic-construction mechanisms.
  • Enforce policy rules that disallow references to non-approved callables or modules.
  • Runtime and deployment checks:
  • Monitor for unexpected values of KEDRO_LOGGING_CONFIG and other critical environment variables in production.
  • Implement deployment-time validation steps (e.g., CI checks) that parse configuration and assert compliance with a safe schema.
  • Automated tooling:
  • Integrate static code analyzers or custom linters that specifically flag unsafe use of dictConfig() with untrusted input sources.
  • Use policy-as-code frameworks (e.g., in CI/CD pipelines) to enforce restrictions on configuration patterns and environment variable usage.

Sources

SourceLink
github.comgithub.com/kedro-org/kedro/security/advisories/GHSA-9cqf-439c-j96r

Frequently asked

questions

It can be, depending on how the environment is exposed. If an attacker can remotely influence the environment variables (such as through a deployment service, job scheduler, or configuration API) or write the logging configuration file, they can trigger code execution when the Kedro application starts.

An attacker needs the ability to control either:

  • The KEDRO_LOGGING_CONFIG environment variable (to point to a malicious configuration file), or
  • The contents of the logging configuration file referenced by that variable.

This may be achievable via compromised automation, misconfigured CI/CD pipelines, insufficiently isolated multi-tenant environments, or other configuration channels.

The safest pattern is to avoid feeding unvalidated, mutable configuration into logging.config.dictConfig(). Replace environment-driven, arbitrary logging configuration with a fixed, code-defined schema; validate any external configuration strictly against an allowlist, and disallow dynamic callable construction (including the () key) in untrusted configs.

Treat configuration that can influence execution behavior as potentially hostile. Apply strict schemas, validation, and allowlists for any configuration used to construct objects or callables; minimize reliance on dynamic execution features; review use of powerful standard-library APIs (like dictConfig(), eval, exec, and dynamic import mechanisms) to ensure they are never used directly with user-controlled or environment-derived data.

Find out what's already
exploitable in your codebase.