Summary
MarkUs contained a cross-site scripting (XSS) issue where student-submitted file contents were rendered as HTML without sanitization in the courses/<course_id>/assignments/<assignment_id>/submissions/html_content route.
When an attacker can control the submitted file content, they may be able to inject arbitrary JavaScript into the browser of any user who views that submission, potentially compromising accounts and session data.
Affected context
This vulnerability affects MarkUs deployments that allow students or other users to upload or submit files which can then be viewed via the submissions/html_content route.
The issue arises when the application:
- Reads the raw file contents from the submission,
- Treats those contents as HTML,
- And returns them to the browser without HTML sanitization or output encoding.
It is most relevant where instructors, TAs, or other privileged users regularly view student submissions through the web UI.
Exploit preconditions
- Attack surface: Web UI endpoint at
courses/<course_id>/assignments/<assignment_id>/submissions/html_content. - Required access: Ability to submit or upload a file for an assignment in a course (typically an authenticated student role or any role that can submit content).
- Trigger point: A victim (e.g., instructor, TA, or another user) viewing the submission via the vulnerable route in a browser.
- Why exploitation is possible: The server reads file contents and renders them directly as HTML without sanitization or context-appropriate output encoding, allowing attacker-controlled markup and scripts to execute in the victim's browser.
Why this happens
The root cause is improper neutralization of user-controlled content before it is included in an HTML response, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
MarkUs reads the contents of a student-submitted file and returns it as HTML without sanitizing dangerous elements (such as script tags, event handlers, or JavaScript URLs) or applying context-aware escaping.
This insecure pattern treats untrusted submission data as trusted HTML, allowing it to break out of any intended display context and inject active content into the page.
Potential impact
- Execution of arbitrary JavaScript in the context of the MarkUs application for the affected course.
- Theft or misuse of session cookies or other web storage data, depending on cookie and browser security settings.
- Unauthorized actions performed on behalf of the victim (e.g., grading changes, feedback modifications, or viewing other sensitive content) via cross-site request forgery-style actions within the authenticated session.
- Phishing or UI redressing attacks against instructors, TAs, or students by modifying the visible page content.
- Potential pivoting to further application weaknesses if sensitive tokens or CSRF protections can be bypassed via injected scripts.
General mitigation guidance
Effective mitigation focuses on treating all submission content as untrusted and neutralizing it before rendering:
- Apply robust HTML sanitization to any user-submitted content that must be rendered as HTML, using a well-maintained allowlist-based sanitizer that strips scripts, event handlers, and dangerous attributes.
- Prefer context-appropriate output encoding (e.g., HTML-escaping) when the content does not need to be interpreted as HTML, rendering it as plain text instead.
- Clearly separate trusted templates from untrusted data, ensuring templates contain markup and data is only ever inserted via encoded placeholders.
- Use Content Security Policy (CSP) to reduce the impact of any remaining XSS issues (e.g., disallow inline scripts and restrict script sources).
- Follow a secure-by-default design where new routes and views escape user content unless explicitly and safely opted into rich HTML rendering.
How teams detect issues like this
Organizations can detect similar XSS risks via:
- Static code analysis rules that flag direct insertion of request parameters, file contents, or other untrusted data into HTML responses without sanitization or encoding.
- Code review checklists that explicitly ask whether any rendered content originates from user submissions and if it is sanitized or escaped.
- Dynamic application security testing (DAST) that submits files containing benign XSS test payloads and inspects rendered output for execution.
- Automated security gates in CI/CD that scan templates and controllers for patterns like raw output helpers or direct rendering of user-controlled content.
- Logging and monitoring for anomalous script execution or suspicious parameters in URLs related to submission viewing endpoints.

