HTML injection in Custom Field Choice description field allows content spoofing #11472

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

Originally created by @jnovinger on GitHub (Aug 11, 2025).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.5

Python Version

3.10

Steps to Reproduce

  1. Log in to NetBox with appropriate permissions
  2. Navigate to Customization > Custom Field Choices
  3. Click Add to create a new custom field choice
  4. Fill in the required Name field (e.g., "TEST_CHOICE")
  5. In the Description field, enter the following HTML payload:
    "><a href=https://example.com>CLICK ME</a>
    
  6. Complete any other required fields and click Create
  7. Navigate back to the Custom Field Choices list
  8. Observe the description field for the newly created choice

Note: We should check other description fields for this behavior.

Expected Behavior

The HTML payload should be escaped and displayed as plain text. Special characters like <, >, and quotes should be encoded to prevent HTML interpretation.

Observed Behavior

The HTML payload is rendered as actual HTML in the interface. The injected anchor tag <a href=https://example.com>CLICK ME</a> appears as a clickable link, allowing potential content spoofing and social engineering attacks.

Originally created by @jnovinger on GitHub (Aug 11, 2025). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.5 ### Python Version 3.10 ### Steps to Reproduce 1. Log in to NetBox with appropriate permissions 2. Navigate to **Customization > Custom Field Choices** 3. Click **Add** to create a new custom field choice 4. Fill in the required **Name** field (e.g., "TEST_CHOICE") 5. In the **Description** field, enter the following HTML payload: ``` "><a href=https://example.com>CLICK ME</a> ``` 6. Complete any other required fields and click **Create** 7. Navigate back to the Custom Field Choices list 8. Observe the description field for the newly created choice Note: We should check other description fields for this behavior. ### Expected Behavior The HTML payload should be escaped and displayed as plain text. Special characters like `<`, `>`, and quotes should be encoded to prevent HTML interpretation. ### Observed Behavior The HTML payload is rendered as actual HTML in the interface. The injected anchor tag `<a href=https://example.com>CLICK ME</a>` appears as a clickable link, allowing potential content spoofing and social engineering attacks.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:45:41 +01:00
adam closed this issue 2025-12-29 21:45:41 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 20, 2025):

This is actually valid behavior because we support Markdown rendering for custom field descriptions, and the HTML given is permitted because it can be created using Markdown. The provided HTML is sanitized. For example, <a href="#" onclick="alert('foo')">click me</a> will render a link but omit the potentially dangerous onclick attribute.

I'm going to close this out as I don't believe any changes are needed.

@jeremystretch commented on GitHub (Aug 20, 2025): This is actually valid behavior because we support Markdown rendering for custom field descriptions, and the HTML given is permitted because it can be created using Markdown. The provided HTML is sanitized. For example, `<a href="#" onclick="alert('foo')">click me</a>` will render a link but omit the potentially dangerous `onclick` attribute. I'm going to close this out as I don't believe any changes are needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11472