Skip to content

fix: sandbox served course assets to prevent stored XSS - #481

Merged
vgulati-apphelix merged 1 commit into
release-ulmofrom
fix/LP-asset-csp-sandbox
Sep 21, 2026
Merged

vgulati-apphelix merged 1 commit into
release-ulmofrom
fix/LP-asset-csp-sandbox

Conversation

@naincy128

@naincy128 naincy128 commented Sep 21, 2026

Copy link
Copy Markdown

Description

This PR backports the upstream security fix for GHSA-c6xg-fh3c-vvhh / CWE-434 / CWE-79 to downstream.

Cherry-picked from upstream commit: 2efdce0760561db2bcd3a2895c93480d01f0a308.

Vulnerability Summary

Course assets uploaded in Studio (CMS) were served inline by contentserver using attacker-controlled MIME types without restricted headers or a sandboxing CSP. This allowed malicious course staff to upload .html or .svg files containing JavaScript, resulting in Stored Cross-Site Scripting (XSS) and privilege escalation when viewed by administrators or instructors.

Fix

Adds Content-Security-Policy: sandbox header to asset server responses in openedx/core/djangoapps/contentserver/views.py. This forces the browser to treat rendered assets as an isolated, opaque origin with script execution and session access disabled.


Ticket

LP-1255

Studio course assets are served by the contentserver with the uploader-supplied
Content-Type and no neutralizing headers, on a route mounted on the Studio (CMS)
origin. An author with file-upload permission can upload an HTML or SVG file
containing script; when another user opens the asset URL it runs same-origin
with the Studio session, enabling privilege escalation (self-granting
course-admin, or Django superuser via same-origin /admin/ when a global-staff
user views it).

Send `Content-Security-Policy: sandbox` on every course-asset response so the
asset loads in an opaque origin and cannot script against the Studio/LMS
session. A per-course escape-hatch flag, course_assets.allow_unsafe_asset_rendering,
lets operators temporarily disable sandboxing for a course whose content must be
migrated first.

Closes GHSA-c6xg-fh3c-vvhh.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 2efdce0)
@vgulati-apphelix
vgulati-apphelix merged commit 723014f into release-ulmo Sep 21, 2026
64 checks passed
@vgulati-apphelix
vgulati-apphelix deleted the fix/LP-asset-csp-sandbox branch September 21, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants