Skip to content

Stored XSS through Client Side Template Injection

High
NGPixel published GHSA-xjcj-p2qv-q3rf May 19, 2024

Package

No package listed

Affected versions

<=2.5.302

Patched versions

2.5.303

Description

Summary

Client side template injection was discovered, that could allow an attacker to inject malicious JavaScript into the content section of pages that would execute once a victim loads the page that contains the payload. This was possible through the injection of a invalid HTML tag with a template injection payload on the next line.

Details

The root cause of the vulnerability is due to the mustache expressions escaping to be done before the dom-purify module, at which point the invalid tags are removed. The mustache expressions are then no longer escaped.

PoC

Payload was executable by having an invalid HTML tag with the template payload in the next line.

<INVALID TAG>
{{ TEMPLATE CODE }}

Example:

<xyzabcd>
{{constructor.constructor('alert(1)')()}}

Impact

Due to the JWT and other possible authentication cookies having to be modified or interacted with through JavaScript as a result of the single page architecture, the HTTPOnly flag not being set to true could leave any authentication cookies vulnerable to compromise which would lead to the compromise of normal user and possibly privileged user accounts.

It should be noted that this can allow a threat actor to execute any JavaScript a developer would be able to in the context of a victims browser and is not limited to the compromise of user authentication cookies.

Severity

High

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
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None

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.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N

CVE ID

CVE-2024-34710

Weaknesses

Credits