Skip to content

XSS in directives and rules URL parameters

High
amousset published GHSA-fc5g-p464-qpp9 Oct 2, 2024

Package

rudder-server (rudder)

Affected versions

< 7.3.16
>= 8.0.0, < 8.0.10
>= 8.1.0, < 8.1.5

Patched versions

7.3.16
8.0.10
8.1.5
rudder-webapp (rudder)
*
None

Description

Impact

Clicking on a malicious link pointing to the rules or directives pages while connected to the web interface of a Rudder server can lead to arbitrary script execution (a case of DOM based XSS). The injected script can then access all internal APIs with the user's privileges, including policies configuration, API accounts management (if the connected account has admin permissions), etc. It could hence allow compromising the Rudder server and all its managed nodes.

This vulnerability also allows some stored XSS (in directive ID), but exploiting it requires an account with write access to the configuration policies.

Details

The rules and directives pages use a JSON URL parameter to get the ID of the rule or directive to load (source). It has the following behavior (here in the directives page):

  • The page loads with a JSON parameter: /rudder/secure/configurationManager/directiveManagement#{"directiveId":"bef08dbb-d33c-49d9-8021-ecd7b828d779"}

  • Some JavaScript code in the page fetches the URL parameter:

var directiveId = decodeURI(window.location.hash.substring(1)) ;
  • It sends it to the server with an Ajax call:
${SHtml.ajaxCall(JsVar("directiveId"), displayDetails _)._2.toJsCmd};
  • The backend parses the JSON and builds a JavaScript file that loads the given directive in the page:
      json.parseOpt(jsonId).flatMap(_.extractOpt[JsonDirectiveRId]) match {
        case Some(id) =>
          updateDirectiveForm(Right(DirectiveId(DirectiveUid(id.directiveId), ParseRev(id.rev))), None)
  def updateDirectiveForm(
      // ...
  ) {
      JsRaw("""sessionStorage.removeItem('tags-${directiveId.uid.value}');""")
  }
  • The script is returned to the browser which evaluates it, leading to executing a script containing:
sessionStorage.removeItem('tags-bef08dbb-d33c-49d9-8021-ecd7b828d779');

Injection

The injection happens in the URL parameter:

/rudder/secure/configurationManager/directiveManagement#{"directiveId":"');alert(1);//"}

which leads to executing the following line:

sessionStorage.removeItem('tags-');alert(1);//');

This evaluates arbitrary JavaScript code which bypasses all mitigation for simpler XSS or CSRF (SameSite cookie attribute, etc.).

Patches

The fix consists in applying proper JavaScript escaping on the untrusted strings.

Workarounds

None on the server side.

On the client side, avoid clicking on untrusted links pointing to your Rudder server while connected to its Web interface. You can use different browsers, browser profile, etc. to prevent it.

References

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
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
Low

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:R/S:C/C:H/I:H/A:L

CVE ID

No known CVE

Weaknesses

No CWEs