GHSA-c34r-238x-f7qx: Remote Code Execution Vulnerability via SSTI in Fides Webserver Jinja Email Templating Engine
SummaryThe 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.DetailsThe 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.It 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.Admin UI users assigned the following default roles are permitted to modify email templates and are therefore able to exploit this vulnerability:OwnerContributorOAuth 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.ImpactThis 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.PatchesThe 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.WorkaroundsThere are no workarounds.PoCThe following payload, when injected into the email template, enables the execution of a command on the underlying system, revealing the content of environment variables:The following HTTP request to the Fides Webserver API can be used to update a privacy request denial email template:As 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.
CVSS v4.0: 8.6
CVSS v3.1: 9.1