{"id":"CVE-2026-33154","aliases":["GHSA-pxrr-hq57-q35p","PYSEC-2026-2147"],"title":"dynaconf Affected by Remote Code Execution (RCE) via Insecure Template Evaluation in @jinja Resolver","summary":"dynaconf Affected by Remote Code Execution (RCE) via Insecure Template Evaluation in @jinja Resolver","severity":"high","cvss":7.5,"cvssVector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","vendor":"dynaconf","product":"dynaconf","ecosystem":"pip","affected":["dynaconf < 3.2.13"],"patched":["dynaconf 3.2.13"],"published":"2026-03-18","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:40.609033441Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-pxrr-hq57-q35p","references":[{"url":"https://github.com/dynaconf/dynaconf/security/advisories/GHSA-pxrr-hq57-q35p"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33154"},{"url":"https://github.com/dynaconf/dynaconf/commit/2fbb45ee36b8c0caa5b924fe19f3c1a5e8603fa7"},{"url":"https://github.com/dynaconf/dynaconf"},{"url":"https://github.com/dynaconf/dynaconf/releases/tag/3.2.13"}],"tags":["osv","pip","exploit-available"],"epss":0.00526,"epssPercentile":0.43373,"exploits":{"github":1,"githubRepos":["https://github.com/redyank/CVE-2026-33154"],"checkedAt":"2026-09-21T15:28:41.801Z"},"exploitAvailable":true,"ingestedAt":"2026-07-13T18:58:01.733Z","slug":"CVE-2026-33154","body":"## Overview\n\n### Summary\nDynaconf is vulnerable to Server-Side Template Injection (SSTI) due to unsafe template evaluation in the @jinja resolver.\nWhen the jinja2 package is installed, Dynaconf evaluates template expressions embedded in configuration values without a sandboxed environment.\n\nIf an attacker can influence configuration sources such as:\nenvironment variables\n.env files\ncontainer environment configuration\nCI/CD secrets\nthey can execute arbitrary OS commands on the host system.\nIn addition, the @format resolver allows object graph traversal, which may expose sensitive runtime objects and environment variables.\n\n### Details\nThe vulnerability arises because Dynaconf's string resolvers lack proper security boundaries.\n\n1. @jinja Resolver\nThe @jinja resolver renders templates using full Jinja2 evaluation.\nHowever, the rendering context is not sandboxed, which allows attackers to access Python's internal attributes.\nUsing objects such as cycler, attackers can reach Python's __globals__ and import the os module.\n\nExample attack path\ncycler\n → __init__\n → __globals__\n → os\n → popen()\nThis leads to arbitrary command execution.\n\n2. @format Resolver\nThe @format resolver performs Python string formatting using internal objects.\nThis allows attackers to traverse Python's object graph and access sensitive runtime objects.\nExample traversal:\n{this.__class__.__init__.__globals__[os].environ}\nThis can expose\n- API keys\n- database credentials\n- internal service tokens\n- environment secrets\n\n### PoC\n```\nimport os\nfrom dynaconf import Dynaconf\n# Malicious configuration injection\nos.environ[\"DYNACONF_RCE\"] = \"@jinja {{ cycler.__init__.__globals__.os.popen('id').read() }}\"\nsettings = Dynaconf()\nprint(\"[!] Command Execution Result:\")\nprint(settings.RCE)\n```\n### Impact\nSuccessful exploitation allows attackers to:\n- Execute arbitrary OS commands on the host system\n- Access sensitive environment variables\n- Compromise application secrets\n- Fully compromise the running application process\nBecause configuration values may originate from CI/CD pipelines, container orchestration systems, or environment injection, this vulnerability can become remotely exploitable in real-world deployments.\n\n\n### Remediation / Mitigation (Examples)\n\n1. Use Jinja2 sandbox for template rendering\n```\nfrom jinja2.sandbox import SandboxedEnvironment\nenv = SandboxedEnvironment()\ntemplate = env.from_string(\"{{ config_value }}\")\nsafe_value = template.render(config_value=user_input)```\n```\n2. Restrict @format usage to trusted values\n```\nsafe_value = \"{name}\".format(name=trusted_name)\n```\n\n## Affected packages\n\n- `dynaconf < 3.2.13`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `dynaconf 3.2.13`","depth":"midnight","depthScore":53,"depthScoreParts":{"impact":41.3,"likelihood":0.1,"exploitation":12,"ransomware":0},"changes":[{"seq":5102,"id":"CVE-2026-33154","ts":1788887248427,"field":"exploit_available","old":"false","new":"true"},{"seq":3985,"id":"CVE-2026-33154","ts":1788886364097,"field":"exploit_available","old":"true","new":"false"},{"seq":2800,"id":"CVE-2026-33154","ts":1788883030798,"field":"exploit_available","old":"false","new":"true"},{"seq":1829,"id":"CVE-2026-33154","ts":1788882433728,"field":"exploit_available","old":"true","new":"false"},{"seq":927,"id":"CVE-2026-33154","ts":1788881867454,"field":"exploit_available","old":"false","new":"true"}]}