Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-64187

CVE-2025-64187: OctoPrint XSS Vulnerability

CVE-2025-64187 is a cross-site scripting flaw in OctoPrint that allows attackers to inject malicious code through printer notifications. This article covers the technical details, affected versions, and mitigation.

Published:

CVE-2025-64187 Overview

OctoPrint is a web interface for controlling consumer 3D printers. CVE-2025-64187 is a Cross-Site Scripting (XSS) vulnerability [CWE-80] affecting OctoPrint versions 1.11.3 and below. The flaw allows injection of arbitrary HTML and JavaScript into Action Command notifications and prompt popups generated by the printer. An attacker who convinces a victim to print a specially crafted file can disrupt ongoing prints, extract sensitive configuration data, or perform actions on behalf of the targeted user within the OctoPrint instance. OctoPrint version 1.11.4 remediates the issue.

Critical Impact

Successful exploitation enables arbitrary script execution in the OctoPrint web interface, potentially exposing sensitive configuration and enabling unauthorized actions under the victim's session.

Affected Products

  • OctoPrint versions 1.11.3 and below
  • action_command_notification plugin
  • action_command_prompt plugin

Discovery Timeline

  • 2025-11-07 - CVE-2025-64187 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-64187

Vulnerability Analysis

The vulnerability resides in two OctoPrint plugins that render printer-originated messages in the web UI: action_command_notification and action_command_prompt. Both plugins pass printer-supplied text directly into PNotify popups without HTML escaping. When an attacker-controlled G-code file contains action commands with crafted message payloads, the injected HTML and JavaScript execute in the context of the authenticated OctoPrint user's browser session.

Because the injected script runs in-session, it inherits the victim's permissions. A user with administrative rights exposes API keys, printer profiles, and stored credentials. The attack vector is local since the payload must reach OctoPrint through a printed file, but no authentication is required on the attacker side and only minimal user interaction (initiating the print) is needed.

Root Cause

The root cause is missing output encoding on untrusted input rendered into the DOM. The data.message field in action_command_notification.js and the text and buttons fields in action_command_prompt.js were passed unchanged to PNotify, which renders HTML by default.

Attack Vector

An attacker crafts a G-code or print file containing action command sequences with embedded HTML or JavaScript. When the victim prints the file, OctoPrint parses the action commands and renders the payload in a notification or prompt popup, executing the injected script.

javascript
// Patch: src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js
             ) {
                 new PNotify({
                     title: gettext("Printer Notification"),
-                    text: data.message,
+                    text: _.escape(data.message),
                     hide: false,
                     icon: "fa fa-bell-o",
                     buttons: {

// Patch: src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js
             var opts = {
                 title: gettext("Message from your printer"),
-                message: text,
-                selections: buttons,
+                message: _.escape(text),
+                selections: buttons.map(function (btn) {
+                    return _.escape(btn);
+                }),
                 maycancel: true, // see #3171
                 onselect: function (index) {
                     if (index > -1) {
// Source: https://github.com/OctoPrint/OctoPrint/commit/9112e07b1085f4c1ee9eefc67985809251057a44

The fix wraps all printer-supplied strings with _.escape() (Lodash HTML escaping) before rendering, neutralizing script and HTML tags.

Detection Methods for CVE-2025-64187

Indicators of Compromise

  • G-code or print files containing action command sequences with <script>, <img onerror=, or other HTML tag patterns embedded in message strings
  • OctoPrint logs showing action command notifications or prompts with unusual character sequences such as angle brackets or JavaScript event handlers
  • Unexpected outbound HTTP requests from the OctoPrint web UI following a print job

Detection Strategies

  • Inspect uploaded print files for M118, //action:, or notification action commands containing HTML markup or JavaScript keywords
  • Enable browser Content Security Policy (CSP) reporting to capture inline script execution attempts in the OctoPrint UI
  • Monitor OctoPrint's octoprint.log for anomalous action command activity correlated with user session events

Monitoring Recommendations

  • Track OctoPrint version strings across managed instances to identify hosts running 1.11.3 or earlier
  • Alert on new file uploads from untrusted sources that trigger action command handlers
  • Review web proxy logs for suspicious requests originating from workstations accessing the OctoPrint interface

How to Mitigate CVE-2025-64187

Immediate Actions Required

  • Upgrade OctoPrint to version 1.11.4 or later on all deployments
  • Audit uploaded G-code and print files from external sources before printing
  • Restrict OctoPrint web interface access to trusted networks using firewall rules or a reverse proxy with authentication

Patch Information

The fix is available in OctoPrint 1.11.4. See the GitHub Security Advisory GHSA-crvm-xjhm-9h29 and the remediation commit for technical details. The patch adds _.escape() calls around all printer-supplied message and button strings before they are rendered in PNotify popups.

Workarounds

  • Disable the action_command_notification and action_command_prompt plugins until the upgrade can be applied
  • Only print files from trusted, verified sources and avoid running community-shared G-code without inspection
  • Limit OctoPrint user permissions so lower-privilege accounts cannot access sensitive configuration endpoints
bash
# Upgrade OctoPrint using pip within the OctoPrint virtualenv
source ~/oprint/bin/activate
pip install --upgrade "OctoPrint>=1.11.4"
sudo service octoprint restart

# 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.