Skip to content

Server-Side Template Injection

Critical
frankie567 published GHSA-hj8m-9fhf-v7jp Jun 23, 2023

Package

pip fief-server (pip)

Affected versions

>=0.19.0

Patched versions

0.25.3
docker ghcr.io/fief-dev/fief (Docker)
>=0.19.0
0.25.3

Description

Server-Side Template Injection

Overview of the Vulnerability

Server-Side Template Injection (SSTI) is a vulnerability within application templating engines where user input is improperly handled and is embedded into the template, possibly leading code being executed.

An attacker can use SSTI to execute code on the underlying system by manipulating values within the embedded template. When code is executed within the underlying system, it can allow an attacker to run permissioned commands under the exploited process, or exploit Cross-Site Scripting (XSS) to run code within the user's browser.

Business Impact

SSTI can lead to reputational damage for the business due to a loss in confidence and trust by users. If an attacker successfully executes code within the underlying system, it can result in data theft and indirect financial losses.

Steps to Reproduce

  1. Sign up and login to your account
  2. Use a browser to navigate to: email-templates {{URL}}
  3. put your payload in Edit Base template {{ cycler.__init__.__globals__.os.popen('id').read() }} and you will se it will execute.

Payload:
{{ cycler.__init__.__globals__.os.popen('id').read() }}

Proof of Concept (PoC)

The screenshot(s) below demonstrates the SSTI:

SSTI

Severity

Critical

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
Low
Privileges required
None
User interaction
None
Scope
Changed
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.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

CVE ID

No known CVE

Weaknesses

No CWEs

Credits