Skip to content

Privilege re-escalation in Studio after staff access removed

High
ormsbee published GHSA-99vw-2wrq-xh9x May 17, 2024

Package

No package listed

Affected versions

< redwood

Patched versions

master, >= redwood

Description

Impact

The JWT authentication used by MFEs to make REST requests has code that trusts the JWT and updates the user record in the database to match it. This code will even automatically create the user in that service, if it doesn't already exist. I believe the idea was to be able to allow users to use other services like ecommerce without having to worry about syncing user updates between the LMS and those services–the LMS would just issue the token, and then those services would update themselves based on the token being presented by the user.

In order to make sure that the LMS itself does not update its fields from a possibly outdated JWT, it has configuration to set the EDX_DRF_EXTENSIONS['JWT_PAYLOAD_USER_ATTRIBUTE_MAPPING'] setting be an empty dictionary. Unfortunately, this was not being set for Studio.

The vulnerability is this:

  1. User rusty has is_staff=True for his auth_user entry, making them global staff.
  2. User rusty is currently logged in and has a valid JWT token in their edx-jwt-cookie-header-payload cookie.
  3. An administrator sets is_staff=False for user rusty as part of the off-boarding process, but does not change their username. At this point, rusty cannot access the Django admin, even if their session was still active.
  4. While user rusty still has a valid JWT token (up to 1 hour), they reload an MFE page that makes API calls, such as course authoring (e.g. https://apps.next-release.openedx.org/course-authoring/home).
  5. The code in our JwtAuthentication class will see that the token is marked with is_staff=True, while the database shows is_staff=False, and will update the database to match the token, making rusty global staff again.

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
High
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
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:H/UI:N/S:C/C:H/I:H/A:N

CVE ID

No known CVE

Weaknesses

No CWEs