{"id":"GHSA-pxrr-hq57-q35p","summary":"dynaconf Affected by Remote Code Execution (RCE) via Insecure Template Evaluation in @jinja Resolver","details":"### 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```","aliases":["CVE-2026-33154","PYSEC-2026-2147"],"modified":"2026-07-17T21:09:14.859344146Z","published":"2026-03-18T20:08:06Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-03-18T20:08:06Z","nvd_published_at":"2026-03-20T21:17:15Z","cwe_ids":["CWE-1336","CWE-78","CWE-94"],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/dynaconf/dynaconf/security/advisories/GHSA-pxrr-hq57-q35p"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33154"},{"type":"WEB","url":"https://github.com/dynaconf/dynaconf/commit/2fbb45ee36b8c0caa5b924fe19f3c1a5e8603fa7"},{"type":"PACKAGE","url":"https://github.com/dynaconf/dynaconf"},{"type":"WEB","url":"https://github.com/dynaconf/dynaconf/releases/tag/3.2.13"}],"affected":[{"package":{"name":"dynaconf","ecosystem":"PyPI","purl":"pkg:pypi/dynaconf"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.2.13"}]}],"versions":["0.1.0","0.1.1","0.1.2","0.2.0","0.2.1","0.2.10","0.2.11","0.2.12","0.2.13","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.8","0.2.9","0.3.0","0.4.0","0.4.1","0.4.2","0.4.3","0.4.4","0.4.5","0.5.0","0.5.1","0.5.2","0.5.3","0.5.4","0.5.5","0.6.0","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.1.0","1.2.0","1.2.1","2.0.0","2.0.1","2.0.2","2.0.3","2.0.4","2.1.0","2.1.1","2.2.0","2.2.1","2.2.2","2.2.3","3.0.0","3.0.0rc1","3.0.0rc2","3.1.0","3.1.1","3.1.10","3.1.11","3.1.12","3.1.1rc1","3.1.1rc2","3.1.1rc3","3.1.1rc4","3.1.1rc5","3.1.1rc6","3.1.2","3.1.3","3.1.3rc1","3.1.4","3.1.5","3.1.7","3.1.8","3.1.9","3.2.0","3.2.1","3.2.10","3.2.11","3.2.12","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.2.7","3.2.8","3.2.9"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-pxrr-hq57-q35p/GHSA-pxrr-hq57-q35p.json","last_known_affected_version_range":"\u003c= 3.2.12"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}