Skip to content

dynaconf Affected by Remote Code Execution (RCE) via Insecure Template Evaluation in @jinja Resolver

High severity GitHub Reviewed Published Mar 18, 2026 in dynaconf/dynaconf • Updated Mar 18, 2026

Package

pip dynaconf (pip)

Affected versions

<= 3.2.12

Patched versions

3.2.13

Description

Summary

Dynaconf is vulnerable to Server-Side Template Injection (SSTI) due to unsafe template evaluation in the @Jinja resolver.
When the jinja2 package is installed, Dynaconf evaluates template expressions embedded in configuration values without a sandboxed environment.

If an attacker can influence configuration sources such as:
environment variables
.env files
container environment configuration
CI/CD secrets
they can execute arbitrary OS commands on the host system.
In addition, the @Format resolver allows object graph traversal, which may expose sensitive runtime objects and environment variables.

Details

The vulnerability arises because Dynaconf's string resolvers lack proper security boundaries.

  1. @Jinja Resolver
    The @Jinja resolver renders templates using full Jinja2 evaluation.
    However, the rendering context is not sandboxed, which allows attackers to access Python's internal attributes.
    Using objects such as cycler, attackers can reach Python's globals and import the os module.

Example attack path
cycler
init
globals
→ os
→ popen()
This leads to arbitrary command execution.

  1. @Format Resolver
    The @Format resolver performs Python string formatting using internal objects.
    This allows attackers to traverse Python's object graph and access sensitive runtime objects.
    Example traversal:
    {this.class.init.globals[os].environ}
    This can expose
  • API keys
  • database credentials
  • internal service tokens
  • environment secrets

PoC

import os
from dynaconf import Dynaconf
# Malicious configuration injection
os.environ["DYNACONF_RCE"] = "@jinja {{ cycler.__init__.__globals__.os.popen('id').read() }}"
settings = Dynaconf()
print("[!] Command Execution Result:")
print(settings.RCE)

Impact

Successful exploitation allows attackers to:

  • Execute arbitrary OS commands on the host system
  • Access sensitive environment variables
  • Compromise application secrets
  • Fully compromise the running application process
    Because configuration values may originate from CI/CD pipelines, container orchestration systems, or environment injection, this vulnerability can become remotely exploitable in real-world deployments.

Remediation / Mitigation (Examples)

  1. Use Jinja2 sandbox for template rendering
from jinja2.sandbox import SandboxedEnvironment
env = SandboxedEnvironment()
template = env.from_string("{{ config_value }}")
safe_value = template.render(config_value=user_input)```
  1. Restrict @Format usage to trusted values
safe_value = "{name}".format(name=trusted_name)

References

@pedro-psb pedro-psb published to dynaconf/dynaconf Mar 18, 2026
Published to the GitHub Advisory Database Mar 18, 2026
Reviewed Mar 18, 2026
Last updated Mar 18, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

EPSS score

Weaknesses

Improper Control of Generation of Code ('Code Injection')

The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Learn more on MITRE.

Improper Neutralization of Special Elements Used in a Template Engine

The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. Learn more on MITRE.

CVE ID

CVE-2026-33154

GHSA ID

GHSA-pxrr-hq57-q35p

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.