Skip to content

fix(console): message formatting XSS vulnerability#2247

Open
jwueller wants to merge 1 commit intomainsail-crew:developfrom
jwueller:fix-console-xss
Open

fix(console): message formatting XSS vulnerability#2247
jwueller wants to merge 1 commit intomainsail-crew:developfrom
jwueller:fix-console-xss

Conversation

@jwueller
Copy link
Copy Markdown

@jwueller jwueller commented Aug 17, 2025

Description

Having HTML characters like < in a message will currently break it's rendering. An example would be a standard Python object __repr__, like it might show up in an error message:

<klippy.extras.gcode_macro.GetStatusWrapperPython object at 0x7f67eb2cd0>

This is an XSS vulnerability. Making Klippy echo a message containing HTML could run arbitrary code in the browser of everyone currently monitoring the console.

But even if you consider this an unlikely attack vector, this will still fix quirky visual behavior in current message rendering, though.

Related Tickets & Documents

None as far as I can tell, but I can create one for this vulnerability, if required.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 17, 2025
Having HTML characters like `<` in a message will currently break it's
rendering. An example would be a standard Python object `__repr__`,
like it might show up in an error message:

    <klippy.extras.gcode_macro.GetStatusWrapperPython object at 0x7f67eb2cd0>

This is an XSS vulnerability. By making Klippy `M118` a message
containing HTML, you could hijack the browser of everyone currently
monitoring the console.

But even if you consider this an unlikely attack vector, this will
still fix quirky visual behavior in current message rendering, though.
@meteyou
Copy link
Copy Markdown
Member

meteyou commented Aug 18, 2025

@jwueller Thank you very much! Pls also add an option in the Interface Settings to disable this feature/fix?

Some projects like AFC-Klipper-Add-On or HappyHare use this for "HTML-Outputs". I would enable the escape per default, but users which use plugins like these, can disable it for "better format html outputs".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants