Newline in markdown links bypasses XSS filter #6447

Closed
opened 2025-12-29 19:40:49 +01:00 by adam · 0 comments
Owner

Originally created by @magicOz on GitHub (May 4, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v.3.2.2

Python version

3.8

Steps to Reproduce

The markdown filter fails to sanitize/strip links and references which contains newlines (\n).

8d682041a4/netbox/utilities/templatetags/builtins/filters.py (L153-L158)

The following payload will produce two links which both will trigger a XSS when clicked.

[XSS1][a]
[a
]: javascript:alert(/XSS1/)

[XSS2](
javascript:alert(/XSS2/))

Expected Behavior

Maybe add the flag re.DOTALL to the regexp?

Observed Behavior

XSS

Originally created by @magicOz on GitHub (May 4, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v.3.2.2 ### Python version 3.8 ### Steps to Reproduce The markdown filter fails to sanitize/strip links and references which contains newlines (\n). https://github.com/netbox-community/netbox/blob/8d682041a43b6176198f64bd80a46ea9ed99d2d8/netbox/utilities/templatetags/builtins/filters.py#L153-L158 The following payload will produce two links which both will trigger a XSS when clicked. ``` [XSS1][a] [a ]: javascript:alert(/XSS1/) [XSS2]( javascript:alert(/XSS2/)) ``` ### Expected Behavior Maybe add the flag `re.DOTALL` to the regexp? ### Observed Behavior XSS
adam added the type: bugstatus: accepted labels 2025-12-29 19:40:49 +01:00
adam closed this issue 2025-12-29 19:40:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6447