XXS in Config Revision Create Page from Current Value field (authenticated) - CVE-2024-56916 #10744

Closed
opened 2025-12-29 21:35:27 +01:00 by adam · 1 comment
Owner

Originally created by @noxlumens on GitHub (Feb 7, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.3

Python Version

3.12

Steps to Reproduce

Configuration History > Config Revision > Add

Summary

Once authenticated, the Configuration History > Add endpoint is vulnerable to cross-site scripting (XSS) due to the current value field rendering user supplied html. An authenticated attacker can leverage the Configuration History endpoint by adding malicious JavaScript to the any banner field. Once a victim edits a Configuration History version or attempts to Add a new version, the XSS payload will trigger.

Affected Endpoint:

https://<ADDRESS>/core/config-revisions/add/ > Edit Configuration Window in the Current Value field.

Current Value XSS

Source Code

/netbox/core/forms/model_forms.py

This section does not filter user supplied input in the {value} template field, which allows input to be interpreted as HTML without sanitizing it.

# Set the field's help text
help_text = self.fields[param.name].help_text
if help_text:
	help_text += '<br />'  # Line break
help_text += _('Current value: <strong>{value}</strong>').format(value=value or '&mdash;')
if value == param.default:
	help_text += _(' (default)')
self.fields[param.name].help_text = help_text

Reproduce the Attack
  1. Navigate to https://<ADDRESS>/core/config-revisions/add/
  2. Paste <script>prompt("Current Value XSS")</script> into any banner field
  3. Click "Create"
  4. Navigate to https://<ADDRESS>/core/config-revisions/add/

Expected Behavior

User supplied input is sanitized.

Observed Behavior

Alert box triggered from user supplied input in any field in config revision > add while editing a configuration.
Image

Originally created by @noxlumens on GitHub (Feb 7, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.3 ### Python Version 3.12 ### Steps to Reproduce # Configuration History > Config Revision > Add ### *Summary* Once authenticated, the `Configuration History > Add` endpoint is vulnerable to cross-site scripting (XSS) due to the `current value` field rendering user supplied html. An authenticated attacker can leverage the Configuration History endpoint by adding malicious JavaScript to the any banner field. Once a victim edits a Configuration History version or attempts to Add a new version, the XSS payload will trigger. ### Affected Endpoint: `https://<ADDRESS>/core/config-revisions/add/ > Edit Configuration Window` in the **Current Value** field. **Current Value XSS** ### Source Code `/netbox/core/forms/model_forms.py` This section does not filter user supplied input in the `{value}` template field, which allows input to be interpreted as HTML without sanitizing it. ```html # Set the field's help text help_text = self.fields[param.name].help_text if help_text: help_text += '<br />' # Line break help_text += _('Current value: <strong>{value}</strong>').format(value=value or '&mdash;') if value == param.default: help_text += _(' (default)') self.fields[param.name].help_text = help_text ``` ##### Reproduce the Attack 1. Navigate to `https://<ADDRESS>/core/config-revisions/add/` 2. Paste `<script>prompt("Current Value XSS")</script>` into any banner field 3. Click "Create" 4. Navigate to `https://<ADDRESS>/core/config-revisions/add/` ### Expected Behavior User supplied input is sanitized. ### Observed Behavior Alert box triggered from user supplied input in any field in `config revision > add` while editing a configuration. ![Image](https://github.com/user-attachments/assets/6b0d7af0-f9ca-4b5b-ac45-c8534ecb82f0)
adam closed this issue 2025-12-29 21:35:27 +01:00
Author
Owner

@DanSheps commented on GitHub (Feb 7, 2025):

Please follow the proper disclosure procedure documented here:

https://github.com/netbox-community/netbox/blob/main/SECURITY.md

@DanSheps commented on GitHub (Feb 7, 2025): Please follow the proper disclosure procedure documented here: https://github.com/netbox-community/netbox/blob/main/SECURITY.md
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10744