CVE-2023-39469
Executive Summary
CVE-2023-39469 is a critical Remote Code Execution (RCE) vulnerability in PaperCut NG, specifically within the External User Lookup functionality. The flaw arises from improper validation of user-supplied strings before they are used to execute Java code, allowing an authenticated attacker to achieve code execution in the context of the SYSTEM user. With a CVSS score of 7.2, this vulnerability poses a significant threat to enterprise print management environments. The vulnerability is currently unpatched, and no public proof-of-concept (PoC) or exploit code has been released. The EPSS score is 0.0%, indicating low exploitation activity in the wild, but the potential for impact remains high.
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 NPM, PyPI, Go, or Ruby packages. It is a server-side Java application vulnerability in PaperCut NG, a commercial print management software.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Base Score: 7.2 (HIGH)
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required for exploitation.
- Privileges Required (PR): Low (L) – The attacker must have valid credentials to the PaperCut NG application.
- User Interaction (UI): None (N) – No user action is needed.
- Scope (S): Unchanged (U) – The vulnerability does not affect other components.
- Confidentiality (C): High (H) – Full system compromise can lead to data exfiltration.
- Integrity (I): High (H) – Arbitrary code execution allows modification of system files.
- Availability (A): High (H) – An attacker could disrupt print services or the entire system.
Threat Level: HIGH. The requirement for authentication reduces the attack surface, but once authenticated, an attacker can achieve full SYSTEM-level compromise.
Deep Dive & Mechanics
The vulnerability resides in the External User Lookup feature of PaperCut NG. This feature is designed to integrate with external user directories (e.g., LDAP, Active Directory) to authenticate and retrieve user information. The flaw is a classic code injection (CWE-94) where user-supplied input is not properly sanitized before being passed to a Java code execution context.
Technical Breakdown:
- Entry Point: The attacker must first authenticate to the PaperCut NG web interface with valid credentials (e.g., as a regular user or operator).
- Vulnerable Function: The External User Lookup functionality accepts a user-supplied string (e.g., a username or search query) to query an external directory.
- Injection Point: This string is concatenated or directly used in a Java code execution path without proper validation or escaping.
- Code Execution: The attacker can inject arbitrary Java code (e.g., using
Runtime.getRuntime().exec()) into the lookup string. When PaperCut processes this string, the injected code is executed in the context of the PaperCut service, which runs as SYSTEM. - Impact: Full SYSTEM-level compromise, allowing the attacker to install malware, exfiltrate data, or pivot to other systems.
Example Attack Flow:
- Attacker logs in to PaperCut NG.
- Attacker navigates to the External User Lookup configuration or uses an API endpoint.
- Attacker submits a crafted payload like:
$(java.lang.Runtime.getRuntime().exec("cmd.exe /c calc.exe")) - PaperCut processes this string, executing the injected Java code.
Vulnerable vs. Patched Code
Since no patch is available, a direct comparison is not possible. However, based on the vulnerability description, the vulnerable code likely resembles:
Vulnerable Code (Java):
String userInput = request.getParameter("username");
// Directly used in a code execution context
String result = executeExternalLookup(userInput);
Patched Code (Hypothetical):
String userInput = request.getParameter("username");
// Input validation and sanitization
if (isValidInput(userInput)) {
String sanitizedInput = sanitizeForCodeExecution(userInput);
String result = executeExternalLookup(sanitizedInput);
} else {
throw new SecurityException("Invalid input");
}
The patch would involve strict input validation, whitelisting allowed characters, and avoiding the use of user input in dynamic code execution contexts.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Valid credentials for a PaperCut NG instance (e.g., operator or admin).
- Network access to the PaperCut NG web interface (typically port 9191 or 9192).
Exploitation Steps:
- Authenticate: Log in to the PaperCut NG web interface.
- Identify Endpoint: Locate the External User Lookup functionality. This is often found under
Settings > User/Group Sync > External User Lookupor via API endpoints like/api/externalUserLookup. - Craft Payload: Use a Java code injection payload. Example:
${"".getClass().forName("java.lang.Runtime").getMethod("exec", "".getClass()).invoke("".getClass().forName("java.lang.Runtime").getMethod("getRuntime").invoke(null), "cmd.exe /c whoami > C:\\temp\\output.txt")} - Inject: Submit the payload in the username or search field.
- Verify: Check for the output file or use a reverse shell payload for interactive access.
Note: No public exploit code is available. The above is a conceptual example.
Blue Team
Detection & Response:
- Monitor Authentication Logs: Look for unusual login patterns or multiple failed attempts followed by successful authentication.
- Audit External User Lookup Requests: Enable detailed logging for the External User Lookup feature. Monitor for anomalous strings containing Java keywords (e.g.,
Runtime,exec,getRuntime). - Network Monitoring: Watch for outbound connections from the PaperCut server to unknown IPs (potential reverse shells).
- File Integrity Monitoring: Monitor for new files created in sensitive directories (e.g.,
C:\Windows\Temp,C:\ProgramData\PaperCut). - Endpoint Detection: Deploy EDR agents on PaperCut servers to detect process injection or unusual child processes (e.g.,
cmd.exeorpowershell.exespawned by Java).
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound connections from the PaperCut server to unknown external IPs on high ports (e.g., 4444, 8080).
- Unusual HTTP requests to
/api/externalUserLookupor similar endpoints containing encoded Java payloads.
- File IOCs:
- Unexpected files in
C:\Windows\TemporC:\ProgramData\PaperCut(e.g.,output.txt,reverse.ps1). - Modified PaperCut configuration files (e.g.,
server.properties).
- Unexpected files in
- Process IOCs:
- Java process spawning
cmd.exe,powershell.exe, orwscript.exe. - Unusual child processes of
java.exeorjavaw.exe.
- Java process spawning
- Log IOCs:
- PaperCut audit logs showing
EXTERNAL_USER_LOOKUPevents with suspicious payloads. - Windows Event ID 4688 (Process Creation) showing
cmd.exeorpowershell.exespawned by Java.
- PaperCut audit logs showing
Detection Engineering
YARA Rule
rule CVE_2023_39469_PaperCut_Code_Injection {
meta:
description = "Detects Java code injection attempts in PaperCut NG External User Lookup"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2023-39469"
strings:
$java_exec = /Runtime\.getRuntime\(\)\.exec\(/ nocase
$java_invoke = /getMethod\("exec"/ nocase
$java_forname = /forName\("java\.lang\.Runtime"/ nocase
$payload = /(\$\{|\$\()\s*.*(exec|Runtime|getRuntime)/ nocase
condition:
any of them
}
Sigma Rule
title: PaperCut NG External User Lookup Code Injection Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit CVE-2023-39469 via Java code injection in PaperCut NG
author: Valters IT
date: 2024-01-01
logsource:
product: windows
service: sysmon
category: process_creation
detection:
selection:
ParentImage|endswith: '\java.exe'
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\wscript.exe'
condition: selection
falsepositives:
- Legitimate PaperCut operations (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2023-39469 PaperCut NG External User Lookup Code Injection"; flow:to_server,established; content:"POST"; http_method; content:"/api/externalUserLookup"; http_uri; content:"Runtime"; nocase; content:"exec"; nocase; distance:0; within:100; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable External User Lookup: If not required, disable the External User Lookup feature in PaperCut NG settings.
- Restrict Access: Limit network access to the PaperCut NG web interface to trusted IPs only.
- Enforce Strong Authentication: Use multi-factor authentication (MFA) for all PaperCut accounts.
- Monitor Logs: Enable and review detailed audit logs for the External User Lookup feature.
Long-Term Fixes:
- Apply Patch: Monitor PaperCut's official channels for a security patch. Apply it immediately upon release.
- Upgrade: Upgrade to a patched version of PaperCut NG when available.
- Input Validation: Implement strict input validation and sanitization for all user-supplied data in custom integrations.
- Least Privilege: Run the PaperCut service with the least privileges necessary (avoid SYSTEM account if possible).
Workarounds:
- Use a Web Application Firewall (WAF) to block requests containing Java code patterns (e.g.,
Runtime,exec). - Implement network segmentation to isolate the PaperCut server from critical systems.
Valters IT
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.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.