Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-35163

CVE-2026-35163: OctoPrint XSS Vulnerability

CVE-2026-35163 is a cross-site scripting flaw in OctoPrint that allows attackers to inject HTML and JavaScript through crafted print files. This post explains its impact, affected versions, and mitigation steps.

Published:

CVE-2026-35163 Overview

CVE-2026-35163 is a stored cross-site scripting (XSS) vulnerability in OctoPrint, a web interface for controlling consumer 3D printers. The flaw exists in the Suppressed Command notification handling within src/octoprint/static/js/app/viewmodels/terminal.js. Printer-controlled payload.command and payload.message values render through PNotify without HTML escaping. An attacker who convinces a victim to print a crafted file can inject HTML and JavaScript into the notification popup. Successful exploitation allows the attacker to disrupt prints, read information available to the victim, exfiltrate sensitive settings when permitted, or perform actions in the victim's OctoPrint session. The issue is fixed in versions 1.11.8 and 2.0.0rc3.

Critical Impact

Attackers can execute arbitrary JavaScript in an authenticated OctoPrint user's browser session by delivering a crafted print file, enabling session-scoped actions and disclosure of sensitive settings.

Affected Products

  • OctoPrint versions prior to 1.11.8
  • OctoPrint 2.0.0 release candidates prior to 2.0.0rc3
  • OctoPrint web interface component terminal.js

Discovery Timeline

  • 2026-08-21 - CVE-2026-35163 published to NVD
  • 2026-08-21 - Last updated in NVD database

Technical Details for CVE-2026-35163

Vulnerability Analysis

The vulnerability is a stored XSS classified under [CWE-80]: Improper Neutralization of Script-Related HTML Tags in a Web Page. OctoPrint's terminal view model consumes notification payloads emitted from printer command processing. The Suppressed Command notification calls _.sprintf(text, payload) and passes the resulting string into PNotify's text field. PNotify renders that field as HTML by default. Because payload.command and payload.message are not sanitized, any attacker-controlled substring survives into the DOM as live markup.

Exploitation is user-interaction dependent. A victim must load or print a crafted file that causes OctoPrint to emit a suppressed-command event with attacker-controlled content. Once triggered, injected script runs with the privileges of the current OctoPrint session, which may include reading settings, altering prints, or issuing API calls on the user's behalf.

Root Cause

The root cause is missing output encoding on printer-supplied values before they enter an HTML rendering sink. The terminal.js view model treats printer telemetry as trusted string data and forwards it to PNotify, a library that interprets HTML in its text option. No escaping layer exists between the payload source and the DOM.

Attack Vector

The attack vector is local per the CVSS metric, requiring an authenticated OctoPrint user to interact with a crafted G-code file or a file that generates malicious command-suppression events. The attacker does not need direct network access to the OctoPrint instance. Delivery vehicles include shared model repositories, USB media, or social engineering that induces the victim to print an attacker-supplied file.

javascript
// Security patch in src/octoprint/static/js/app/viewmodels/terminal.js
// fix(coreui): XSS in Suppressed Command Notifications

            new PNotify({
                title: gettext("Suppressed command"),
-               text: _.sprintf(text, payload),
+               text: _.sprintf(text, {
+                   command: _.escape(payload.command),
+                   message: _.escape(payload.message)
+               }),
                type: severity,
                hide: false
            });

Source: OctoPrint commit 42e0f98

The patch wraps both payload.command and payload.message in _.escape() from Lodash, converting HTML metacharacters into entity references before they reach PNotify.

Detection Methods for CVE-2026-35163

Indicators of Compromise

  • Unexpected HTML tags, <script> fragments, or event-handler attributes appearing in OctoPrint terminal logs and notification history.
  • G-code files containing anomalous strings in comments, filenames, or command fields that resemble HTML or JavaScript syntax.
  • Outbound HTTP requests from browsers with authenticated OctoPrint sessions to unfamiliar hosts shortly after a print job begins.

Detection Strategies

  • Inspect stored print files and upload logs for HTML metacharacters (<, >, ", ', &) inside G-code comments or M-code arguments.
  • Compare deployed OctoPrint versions against 1.11.8 and 2.0.0rc3 across fleets of Raspberry Pi and workstation hosts running the service.
  • Monitor browser DOM changes on the OctoPrint terminal page for injected nodes that did not originate from the application's own templates.

Monitoring Recommendations

  • Enable OctoPrint access logging and forward it to centralized log storage for retrospective review of file uploads and API calls.
  • Alert on new outbound connections from workstations that regularly access OctoPrint web interfaces.
  • Track file provenance for G-code uploads, especially files sourced from public model-sharing sites.

How to Mitigate CVE-2026-35163

Immediate Actions Required

  • Upgrade OctoPrint to version 1.11.8 or 2.0.0rc3 on all print servers, including containerized and OctoPi deployments.
  • Restrict OctoPrint access to trusted networks and require authentication, avoiding public exposure of the web interface.
  • Reject or manually review G-code files from untrusted sources before printing.

Patch Information

OctoPrint maintainers released fixes in OctoPrint 1.11.8 and OctoPrint 2.0.0rc3. The corrective code changes are documented in commit 42e0f98 and commit 6e3db90. Full advisory details are in GHSA-p6qx-ghxm-389h.

Workarounds

  • Avoid printing files from untrusted sources until the patch is applied.
  • Limit user account permissions so that low-trust accounts cannot access sensitive settings if a session is hijacked.
  • Log out of the OctoPrint web interface when not actively monitoring prints to reduce the window for session-scoped attacks.
bash
# Upgrade OctoPrint using pip inside the OctoPrint virtualenv
source ~/oprint/bin/activate
pip install --upgrade OctoPrint==1.11.8
sudo systemctl restart octoprint

# Verify installed version
octoprint --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.