Hello Lucee! Let us hack Apple again?
Lucee, a CFML server, had multiple code paths where user-controlled input was evaluated as CFML expressions, leading to remote code execution. The authors found that functions like isDefined() in Mura/Masa CMS could be exploited pre-authentication on Apple's Lucee server.
Published on blog.projectdiscovery.io
Research Nuclei Templates
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Lucee is an open source CFML server, an alternative to Adobe ColdFusion. The authors had previously analysed ColdFusion internals, in particular how CFM and CFC files are handled, parsed and executed, and turned the same questions on Lucee. In earlier work they had already compromised Lucee's admin panel and achieved pre-auth RCE on several Apple servers running Lucee underneath.
This write-up follows the follow-up research: several failed attempts against Apple's production Lucee deployment, and the path that finally worked through Mura/Masa CMS, a CMS deployed on top of Lucee by Apple. Along the way the researchers found a Java deserialisation flaw reachable through REST mappings, which at the time of finding also affected Lucee's own update server, and a family of CFML expression evaluation sinks reachable through cookies, session functions and CMS-level functions.

Setup
After reviewing Lucee's web.xml, the researchers set up a JVM debugger in IntelliJ with Lucee's source code attached. They placed a breakpoint at Request::exe() and stepped through request handling from there. The starting observation was that Lucee's admin panel is fairly locked down: only four CFM files are reachable unauthenticated, so the interesting surface is in how Lucee maps and processes requests, not in the admin files themselves.
Finding it
Attempt 1: request handling and REST mappings
While reading core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java, which deals with headers, query parameters and the request body, the researchers noticed a call to JavaConverter.deserialize(), described in the code as a wrapper on readObject() for Java deserialisation.
public static Object getRequestBody(PageContext pc, boolean deserialized, ...) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
...
if(deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
...
return defaultValue;
}
public static Object toObject(PageContext pc, byte[] data, int format, ...) {
switch (format) {
...
case UDF.RETURN_FORMAT_JAVA: //5
try {
return JavaConverter.deserialize(new ByteArrayInputStream(data));
}
catch (Exception pe) {
}
break;
}
The reasoning was that a request with Content-Type: application/java should reach this sink. A URLDNS gadget was sent with that content type and nothing happened. A breakpoint on getRequestBody() showed the code was never reached at all.
Tracing the call chain showed that several conditions must line up before the sink is reachable. The researchers summarised the stack as follows:
Request:exe() - Determines the type of request and handles it appropriately.
↓
PageContextImpl:executeRest() - Looks for Rest mappings and executes the RestRequestListener.
↓
RestRequestListener() -- Sets the "client" attribute with the value "lucee-rest-1-0" on the request object.
↓
ComponentPageImpl:callRest() - Examines the "client" attribute; if it's "lucee-rest-1-0", proceeds to execute callRest() followed by _callRest().
↓
ComponentPageImpl:_callRest() - If the rest mapping involves an argument, invokes ReqRspUtil.getRequestBody with the argument deserialized: true.
↓
ReqRspUtil.getRequestBody() - If the deserialized argument is true, triggers the toObject() function, which deserializes the request body based on the provided content type.
↓
toObject() - Java Deserialization on the request body if the content type is "application/java".
↓
JavaConverter.deserialize() - The final step where the Java Deserialization process occurs.
So the precondition is a REST mapping whose function takes at least one argument. The researchers deployed the following mapping to reproduce it:
component restpath="/java" rest="true" {
remote String function getA(String a) httpmethod="GET" restpath="deser" {
return a;
}
}
With that in place, the deserialisation path is reachable. The researchers then found that Lucee's critical update server exposes a REST endpoint, https://update.lucee.org/rest/update/provider/echoGet, which manages update requests coming from Lucee installations.

At the time of finding, that server was vulnerable to the exploit, which could have allowed an attacker to compromise the update server and open the door to a supply chain attack against any Lucee installation receiving malicious updates. Lucee's maintainers implemented a hotfix for the update server and released an updated Lucee version with the necessary fixes, tracked as CVE-2023-38693.
This finding did not apply to Apple's host, because Apple did not expose any REST mappings.
Attempt 2: CFML expression interpretation through cookies
Reading the codebase selectively, the researchers looked at CFMLExpressionInterpreter. When the constructor's boolean argument limited is False (the default is True), the method CFMLExpressionInterpreter.interpret(...) is capable of executing CFML expressions. In other words, CFMLExpressionInterpreter(false).interpret("function(arg)") lets an attacker execute any function of Lucee.
A search for places where CFMLExpressionInterpreter(false) is initialised turned up several occurrences. One of them was StorageScopeCookie, whose name suggests a relation to cookies:
public abstract class StorageScopeCookie extends StorageScopeImpl {
protected static CFMLExpressionInterpreter evaluator = new CFMLExpressionInterpreter(false);
protected static Struct _loadData(PageContext pc, String cookieName, int type, String strType, Log log) {
String data = (String) pc.cookieScope().get(cookieName, null);
if (data != null) {
try {
Struct sct = (Struct) evaluator.interpret(pc, data);
...
}
...
}
...
}
}
StorageScopeCookie._loadData() takes the cookie name as an argument, reads its value from the page context and passes that value to interpret(). Following the code flows, three paths stood out as reachable from a Lucee application:
sessionInvalidate()->invalidateUserScope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)sessionRotate()->invalidateUserScope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)PageContext.scope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)
The cookie name is built in ClientCookie:
public final class ClientCookie extends StorageScopeCookie implements Client {
private static final String TYPE = "CLIENT";
public static Client getInstance(String name, PageContext pc, Log log) {
if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name));
String cookieName = "CF_" + TYPE + "_" + name;
return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log));
}
}
Calling sessionInvalidate() or sessionRotate() reaches ClientCookie.getInstance(), which constructs the cookie name CF_CLIENT_LUCEE.

Any application that uses sessionInvalidate() or sessionRotate() could therefore expose RCE through the CF_CLIENT_LUCEE cookie, where Lucee is the application context name and may differ per deployment.
A search of Lucee's own codebase for these functions in unauthenticated CFM files or CFCs found nothing. Extending the search to Mura/Masa CMS, which Apple also deploys on its Lucee server, turned up two calls, one of them unauthenticated under the logout action (core/mura/login/loginManager.cfc#L505).
Exploiting that path depends on the rotateSessions setting being enabled in Mura/Masa, and it is set to false by default, so this could not be triggered on Apple's deployment.
The PageContext.scope() flow was examined next. Debugging showed that in this scenario the cookie name would be CF_CLIENT_. More importantly, exploiting it requires enabling the Client Management setting in the Lucee admin, which is disabled by default. That path was also blocked on Apple's configuration.

A PoC for this case exists regardless:

Attempt 3: variable interpreter, functions and Mura CMS
The next idea was to find more functions that accept user input as a string and can lead to code execution. VariableInterpreter.parse(,,limited) initialises CFMLExpressionInterpreter(limited), so calls to VariableInterpreter.parse(,,false) are candidates. The researchers identified the following sinks in VariableInterpreter where user input passed to parse() would serve the purpose:
getVariable→VariableInterpreter.parse(,,false)getVariableEL→VariableInterpreter.parse(,,false)getVariableAsCollection→VariableInterpreter.parse(,,false)getVariableReference→VariableInterpreter.parse(,,false)removeVariable→VariableInterpreter.parse(,,false)isDefined→VariableInterpreter.parse(,,false)
To narrow the search, they looked at classes importing VariableInterpreter and identified these suspects:
core/src/main/java/lucee/runtime/PageContextImpl.javacore/src/main/java/lucee/runtime/functions/decision/IsDefined.java#L41core/src/main/java/lucee/runtime/functions/struct/StructGet.java#L37core/src/main/java/lucee/runtime/functions/struct/StructSort.java#L74core/src/main/java/lucee/runtime/functions/system/Empty.java#L34core/src/main/java/lucee/runtime/tag/SaveContent.java#L87core/src/main/java/lucee/runtime/tag/Trace.java#L170
Because PageContextImpl is complex, they started with the function classes. StructGet("abc") hit the breakpoint at VariableInterpreter.parse(), but the payload used earlier for CFMLExpressionInterpreter.interpret() did not execute imageRead(). Reading parse() showed why: the string is split on [ and passed to CFMLExpressionInterpreter.interpretPart(), so the payload had to be changed to x[imageRead('')]. With that form, imageRead() executed, meaning arbitrary functions can be called from StructGet("").
The conclusion was that the following functions allow CFML evaluation and therefore RCE when they contain user input:
StructGet("...")isDefined("...")Empty("...")
A search of the Masa/Mura CMS codebase found no calls to StructGet() or Empty(), but plenty of calls to isDefined(). The reason for the abundance is that isDefined(String var) checks whether a given string is defined as a variable, so isDefined("url.search") does not pass the value of the search query parameter. A call of the form isDefined("#url.search#") is needed, where the supplied string is checked for being a defined variable.
Grepping for isDefined\(.#\) found a few calls, most importantly in the FEED API at core/mura/client/api/feed/v1/apiUtility.cfc#L122 and in the JSON API, both of which could be triggered pre-auth:
function processRequest(){
try {
var responseObject=getpagecontext().getresponse();
var params={};
var result="";
getBean('utility').suppressDebugging();
structAppend(params,url);
structAppend(params,form);
structAppend(form,params);
...
if (isDefined('params.method') && isDefined('#params.method#')){
...
}
}
}
The params struct is populated from both the url and form structs, which hold GET and POST parameters respectively, so it contains user input. isDefined("#param.method#") therefore poses an RCE risk when Mura/Masa CMS runs on a Lucee server.

Exploitation
Step 1: reach the deserialisation sink through a REST mapping
Deploy a REST mapping whose function takes at least one argument, as in the component restpath="/java" example above, then send a request to the mapped path with Content-Type: application/java and a serialised gadget in the body. The URLDNS gadget was used to confirm reachability. The request only reaches JavaConverter.deserialize() when the client attribute is lucee-rest-1-0, which RestRequestListener sets, and when the mapping involves an argument, which makes _callRest() call ReqRspUtil.getRequestBody with deserialized: true.
Step 2: apply it to the update server
At the time of finding, https://update.lucee.org/rest/update/provider/echoGet was vulnerable to the same exploit. Compromising the update server would have allowed malicious updates to be served to Lucee installations, a supply chain attack. The maintainers hotfixed the server and released a fixed Lucee version, CVE-2023-38693. This did not apply to Apple's host, which exposed no REST mappings.
Step 3: try the cookie path through session functions
On an application that calls sessionInvalidate() or sessionRotate(), send a cookie named CF_CLIENT_LUCEE (with Lucee replaced by the application context name) whose value is a CFML expression. The value is read by StorageScopeCookie._loadData() and passed to CFMLExpressionInterpreter(false).interpret(). On Apple's Mura/Masa deployment this required rotateSessions, which is false by default, so it did not trigger.
Step 4: try the cookie path through PageContext.scope()
Here the cookie name would be CF_CLIENT_, but the Client Management setting must be enabled in the Lucee admin, and it is disabled by default. This also did not trigger on Apple's configuration.
Step 5: reach isDefined in Mura/Masa pre-auth
The FEED API and JSON API call isDefined('#params.method#') on a struct populated from GET and POST parameters. Supplying a method parameter whose value is a CFML expression causes evaluation on the Lucee server. This is the path that produced code execution on Apple.
Root cause
Three distinct mistakes combine in this research.
First, ReqRspUtil.getRequestBody() deserializes the request body with JavaConverter.deserialize() when the content type maps to UDF.RETURN_FORMAT_JAVA, and _callRest() passes deserialized: true whenever a REST mapping function takes an argument. Any REST mapping with an argument therefore turns the request body into a deserialisation sink.
Second, StorageScopeCookie holds a static CFMLExpressionInterpreter constructed with limited = false, and _loadData() feeds a cookie value straight into interpret(). Because ClientCookie derives the cookie name from the application context name, any code path that reaches getClientScope() (session invalidation, session rotation, PageContext.scope()) exposes cookie-driven CFML evaluation. The default-off settings (rotateSessions, Client Management) blocked these paths on Apple's deployment.
Third, VariableInterpreter.parse(,,false) evaluates CFML, and several built-in functions (StructGet, isDefined, Empty) pass their string argument into it. In parse() the string is split on [ and handed to interpretPart(), which is why the working payload takes the form x[imageRead('')] rather than the plain expression used against interpret(). Mura/Masa's isDefined('#params.method#') interpolates a request parameter into that argument, so pre-auth user input reaches the evaluator.
Impact
On Apple's production Lucee server, the result was remote code execution through Mura/Masa CMS, reachable pre-auth via the FEED API and JSON API. The REST deserialisation issue did not affect Apple because no REST mappings were exposed, but it did affect Lucee's update server at the time of finding, where compromise could have enabled a supply chain attack against Lucee installations. The cookie-based paths were blocked on Apple by default-off settings (rotateSessions and Client Management), though any deployment that enables them, or that calls the relevant session functions, would be exposed.
These findings were reported to both Apple and the Lucee team. Apple fixed the report within 48 hours. The Lucee team said they were aware of this class of issue and had already implemented a fix by adding an optional setting in the Admin panel.

Fix
For the cookie parsing issue, the researchers published a Nuclei template to detect vulnerable instances. It was also added to the nuclei-templates project:
id: lucee-rce
info:
name: Lucee < [redacted] - Remote Code Execution
author: rootxharsh,iamnoooob,pdresearch
severity: critical
metadata:
max-request: 1
shodan-query: http.title:"Lucee"
verified: true
tags: lucee,rce,oast
http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}
Cookie: CF_CLIENT_=render('<cfscript>writeoutput(ToBinary("{{base64('{{randstr}}')}}"))</cfscript>');
matchers:
- type: dsl
dsl:
- contains(body, "{{randstr}}")
- contains(header, "cfid")
- contains(header, "cftoken")
condition: and
On the defensive side, the advice is to run the latest stable release of Lucee and to apply the settings in the Lucee admin panel that disable evaluation of these functions.

Lucee also implemented a fix for the cookies that were being parsed as CFML expressions.

Variants to test
- REST mappings with arguments. Look for Lucee REST mappings whose functions take at least one argument, then send a request to the mapped path with
Content-Type: application/javaand a benign serialised gadget such asURLDNS. - Session functions in application code. Grep CFM and CFC files for
sessionInvalidate()andsessionRotate(). If either is reachable unauthenticated, send aCF_CLIENT_<CONTEXT>cookie whose value is a CFML expression. - Client Management enabled. Where the Lucee admin has Client Management turned on, try the
CF_CLIENT_cookie with an expression payload. StructGet,isDefinedandEmptywith interpolated input. Search application code for these functions receiving#...#-interpolated request data. Send a value of the formx[imageRead('')](or another function call inside brackets) and watch for the function executing.- Mura/Masa FEED and JSON APIs. On Mura/Masa deployments, send a
methodparameter to the FEED API or JSON API with a CFML expression as its value. - Update server style endpoints. Check whether any Lucee installation exposes REST endpoints similar to
rest/update/provider/echoGetand whether they accept a body withContent-Type: application/java.
What happened, in plain words
Two security researchers, Harsh Jaiswal and Rahul Maini, spent time looking at a piece of server software called Lucee. Lucee is a program that runs on a web server and builds web pages from files written in a language called CFML. It is an alternative to a better known product from Adobe called ColdFusion. Apple runs Lucee on some of its servers, and the researchers wanted to see whether they could make one of those servers run code of their choosing. That is the worst kind of security bug, called remote code execution, or RCE: an outsider gets the server to run their commands as if the server's owner had typed them.

The article walks through three attempts. The first two did not work against Apple, because Apple's setup did not have the features the bugs needed switched on. The third attempt did work: the researchers found a way in through a content management system called Mura, also known as Masa CMS, which Apple had installed on top of Lucee. Along the way they also found a serious bug in Lucee's own update server, the machine that Lucee installations contact to download updates. If that server had been taken over, an attacker could have pushed malicious updates to every Lucee installation that trusted it, which is called a supply chain attack. Apple fixed the report within 48 hours, and the Lucee team said they had already dealt with this kind of issue.
Before going further, a few words on the building blocks, because the rest of the article uses them constantly.
- A web server is the program that answers when your browser asks for a page. It receives a request, decides what to do, and sends back a response.
- A request is the message your browser sends: a method (like GET, which asks for something, or POST, which sends data), a path (the part of the URL after the domain), some headers (small labelled pieces of information such as the content type), and sometimes a body (the actual data being sent).
- A cookie is a small piece of text that a website asks your browser to store and send back on every later request to that site. It is how a site remembers who you are between page loads. Because the browser sends it automatically, a server that trusts cookie contents without checking them is in trouble.
- An API (application programming interface) is a way for one program to talk to another over the network, usually by sending requests to specific addresses and getting structured answers back, rather than full web pages meant for humans.
- A REST endpoint is a particular address on a server that an API exposes, for example
/rest/update/provider/echoGet. Each endpoint does one job. - Serialisation is turning a live object in a program's memory into a stream of bytes so it can be stored or sent over a network. Deserialisation is the reverse: turning those bytes back into an object. If an attacker controls the bytes, they can sometimes craft them so that the object rebuilt on the server does something harmful. That class of bug is called insecure deserialisation.
- A gadget is a pre-existing piece of code inside the target program that, when triggered during deserialisation, produces a side effect the attacker wants, such as making the server contact an outside address.
URLDNSis a well known gadget that makes the server perform a DNS lookup, which the attacker can watch for to confirm the bug is real. - CFML is the programming language Lucee understands. A CFM file is a page written in CFML, and a CFC file is a component, roughly what other languages call a class or a module.
- Pre-auth means reachable without logging in first.
Setting up to read the code
The researchers did not guess. They read Lucee's source code, which is publicly available, and ran it under a debugger. A debugger is a tool that lets you pause a running program at a chosen line and inspect what is in memory at that moment. They used IntelliJ, a code editor, with Lucee's source attached, and put a breakpoint (a deliberate pause) at a method called Request::exe(), which is where Lucee starts handling an incoming request. From there they stepped through the code one line at a time.
They started with a useful observation: Lucee's admin panel, the web interface where an administrator configures the server, is fairly locked down. Only four CFM files can be reached without logging in. So the interesting surface is not the admin files but the way Lucee takes an incoming request and routes it to code. That routing is where the bugs turned out to be.
Attempt 1: request handling and REST mappings
While reading a file called ReqRspUtil.java, which handles headers, query parameters and the request body, they spotted a call to JavaConverter.deserialize(). The code itself describes this as a wrapper around readObject(), the standard Java mechanism for rebuilding an object from bytes. In plain terms: somewhere in Lucee, the body of an incoming request can be deserialised.
public static Object getRequestBody(PageContext pc, boolean deserialized, ...) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
...
if(deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
...
return defaultValue;
}
public static Object toObject(PageContext pc, byte[] data, int format, ...) {
switch (format) {
...
case UDF.RETURN_FORMAT_JAVA: //5
try {
return JavaConverter.deserialize(new ByteArrayInputStream(data));
}
catch (Exception pe) {
}
break;
}
Line by line, in plain words:
getRequestBodyis a function that takes the page context (the current request's surroundings), a true/false flag calleddeserialized, and other arguments not shown.- It grabs the underlying HTTP request object, so it can read things like headers and body.
- It works out the content type, the header that tells the server what kind of data is in the body (for example
text/htmlorapplication/json). - If the
deserializedflag is true, it converts the content type into a number and callstoObjectwith the body data and that number. toObjectis a switch statement: it picks a branch based on the format number. The branch shown isUDF.RETURN_FORMAT_JAVA, which has the value 5.- In that branch, it calls
JavaConverter.deserializeon the body bytes. That is the dangerous step: bytes from the network become a live Java object. - Any exception is swallowed silently, so a failed attempt leaves no trace in the response.
The reasoning was simple: if the request's content type is application/java, the format number should be 5, and the body should be deserialised. They sent a request with that content type carrying a URLDNS gadget, which would make the server do a DNS lookup they could observe. Nothing happened. They put a breakpoint on getRequestBody() and found the code was never even reached.
So why not? They traced the calls and found that several conditions have to line up first. They summarised the chain like this:
Request:exe() - Determines the type of request and handles it appropriately.
↓
PageContextImpl:executeRest() - Looks for Rest mappings and executes the RestRequestListener.
↓
RestRequestListener() -- Sets the "client" attribute with the value "lucee-rest-1-0" on the request object.
↓
ComponentPageImpl:callRest() - Examines the "client" attribute; if it's "lucee-rest-1-0", proceeds to execute callRest() followed by _callRest().
↓
ComponentPageImpl:_callRest() - If the rest mapping involves an argument, invokes ReqRspUtil.getRequestBody with the argument deserialized: true.
↓
ReqRspUtil.getRequestBody() - If the deserialized argument is true, triggers the toObject() function, which deserializes the request body based on the provided content type.
↓
toObject() - Java Deserialization on the request body if the content type is "application/java".
↓
JavaConverter.deserialize() - The final step where the Java Deserialization process occurs.
Reading that chain in plain words: Lucee first decides what kind of request it is. If the path matches a REST mapping, it runs a listener that stamps a label lucee-rest-1-0 onto the request. Later code checks that label, and only if it is present does it continue into the REST handling. Then, crucially, only if the mapped function takes at least one argument does it call getRequestBody with deserialized: true. Only then does the body get deserialised, and only if the content type maps to Java.
So the precondition is a REST mapping whose function takes at least one argument. To prove it, the researchers deployed this mapping on a test Lucee instance:
component restpath="/java" rest="true" {
remote String function getA(String a) httpmethod="GET" restpath="deser" {
return a;
}
}
Line by line:
componentdeclares a CFC, a Lucee component file.restpath="/java"says this component is exposed under the URL path/java.rest="true"marks it as a REST component, so Lucee's REST machinery will handle it.remote String function getA(String a)declares a function namedgetAthat takes one string argumentaand returns a string.remotemeans it can be called from outside.httpmethod="GET"says it answers GET requests.restpath="deser"puts it at/java/deser.return a;simply returns the argument.
The point of this mapping is not what it does but that it takes an argument, which is what makes _callRest() pass deserialized: true and reach the deserialisation sink.
With that in place, the deserialisation path is reachable. The researchers then found something bigger: Lucee's own update server exposes a REST endpoint at https://update.lucee.org/rest/update/provider/echoGet. That server is the one every Lucee installation contacts to check for and download updates.

At the time of finding, that server was vulnerable to the same exploit. If an attacker had compromised it, they could have served malicious updates to any Lucee installation that trusted it, which is the supply chain attack mentioned earlier. Lucee's maintainers acted quickly: they hotfixed the update server and released an updated Lucee version with the necessary fixes, tracked as CVE-2023-38693. A CVE is a public identifier assigned to a known vulnerability so people can refer to it unambiguously.
This finding did not apply to Apple's host, because Apple did not expose any REST mappings. So the researchers moved on.
Attempt 2: CFML expression interpretation through cookies
They began reading classes selectively. One that caught their eye was CFMLExpressionInterpreter. This class takes a true/false argument called limited. When limited is False (the default is True), the method CFMLExpressionInterpreter.interpret(...) is able to execute CFML expressions. In other words, CFMLExpressionInterpreter(false).interpret("function(arg)") lets an attacker run any function Lucee offers. Think of it as a calculator that, instead of just adding numbers, will run whatever instruction you write on the paper.
They searched the codebase for places where CFMLExpressionInterpreter(false) is created, and found several. One was StorageScopeCookie, whose name suggests it deals with cookies:
public abstract class StorageScopeCookie extends StorageScopeImpl {
protected static CFMLExpressionInterpreter evaluator = new CFMLExpressionInterpreter(false);
protected static Struct _loadData(PageContext pc, String cookieName, int type, String strType, Log log) {
String data = (String) pc.cookieScope().get(cookieName, null);
if (data != null) {
try {
Struct sct = (Struct) evaluator.interpret(pc, data);
...
}
...
}
...
}
}
Line by line:
StorageScopeCookieis an abstract class, meaning it is a template that other classes build on.- It holds a shared (
static) interpreter object, created withlimitedset tofalse. That is the dangerous setting. _loadDatatakes a cookie name, reads the cookie's value from the page context, and if the value is not empty, passes it toevaluator.interpret(pc, data).- In plain words: whatever text is in that cookie gets treated as a CFML expression and executed.
Following the code flows, three paths stood out as reachable from a Lucee application:
sessionInvalidate()->invalidateUserScope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)sessionRotate()->invalidateUserScope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)PageContext.scope()->getClientScope()->ClientCookie.getInstance()->StorageScopeCookie._loadData(...)
A session is the server's memory of a logged-in user between requests. sessionInvalidate() throws that memory away (a logout), and sessionRotate() replaces the session identifier with a new one (a common security measure). Both, and also a plain scope lookup, end up calling getClientScope(), which reaches the cookie loader.
The cookie name is built in ClientCookie:
public final class ClientCookie extends StorageScopeCookie implements Client {
private static final String TYPE = "CLIENT";
public static Client getInstance(String name, PageContext pc, Log log) {
if (!StringUtil.isEmpty(name)) name = StringUtil.toUpperCase(StringUtil.toVariableName(name));
String cookieName = "CF_" + TYPE + "_" + name;
return new ClientCookie(pc, cookieName, _loadData(pc, cookieName, SCOPE_CLIENT, "client", log));
}
}
Line by line:
ClientCookieextendsStorageScopeCookie, so it inherits the dangerous loader.TYPEis the fixed stringCLIENT.getInstancetakes a name, normalises it to upper case and to a variable-style name, then builds the cookie name asCF_+CLIENT+_+ name.- It then constructs a
ClientCookie, passing the cookie name and the result of_loadData, which reads and evaluates the cookie.
Calling sessionInvalidate() or sessionRotate() therefore reaches ClientCookie.getInstance(), which builds the cookie name CF_CLIENT_LUCEE.

Any application that uses sessionInvalidate() or sessionRotate() could therefore expose RCE through the CF_CLIENT_LUCEE cookie, where Lucee is the application context name and may differ per deployment. The context name is simply the label Lucee uses for that particular application.
A search of Lucee's own codebase for these functions in unauthenticated CFM files or CFCs found nothing. Extending the search to Mura/Masa CMS, which Apple also deploys on its Lucee server, turned up two calls, one of them unauthenticated under the logout action (core/mura/login/loginManager.cfc#L505).
Exploiting that path depends on the rotateSessions setting being enabled in Mura/Masa, and it is set to false by default, so this could not be triggered on Apple's deployment. A setting is a configuration switch; if it is off, the code path that depends on it never runs.
The PageContext.scope() flow was examined next. Debugging showed that in this scenario the cookie name would be CF_CLIENT_. More importantly, exploiting it requires enabling the Client Management setting in the Lucee admin, which is disabled by default. That path was also blocked on Apple's configuration.

A proof of concept (PoC), a small demonstration that the bug is real, exists for this case regardless:

Attempt 3: variable interpreter, functions and Mura CMS
The next idea was to find more functions that accept user input as a string and can lead to code execution. VariableInterpreter.parse(,,limited) creates CFMLExpressionInterpreter(limited), so any call to VariableInterpreter.parse(,,false) is a candidate. The researchers identified these sinks in VariableInterpreter where user input passed to parse() would serve the purpose:
getVariable→VariableInterpreter.parse(,,false)getVariableEL→VariableInterpreter.parse(,,false)getVariableAsCollection→VariableInterpreter.parse(,,false)getVariableReference→VariableInterpreter.parse(,,false)removeVariable→VariableInterpreter.parse(,,false)isDefined→VariableInterpreter.parse(,,false)
A sink is simply a place where data ends up somewhere dangerous. To narrow the search, they looked at classes that import VariableInterpreter and identified these suspects:
core/src/main/java/lucee/runtime/PageContextImpl.javacore/src/main/java/lucee/runtime/functions/decision/IsDefined.java#L41core/src/main/java/lucee/runtime/functions/struct/StructGet.java#L37core/src/main/java/lucee/runtime/functions/struct/StructSort.java#L74core/src/main/java/lucee/runtime/functions/system/Empty.java#L34core/src/main/java/lucee/runtime/tag/SaveContent.java#L87core/src/main/java/lucee/runtime/tag/Trace.java#L170
Because PageContextImpl is complex, they started with the function classes. StructGet("abc") hit the breakpoint at VariableInterpreter.parse(), but the payload used earlier for CFMLExpressionInterpreter.interpret() did not execute imageRead(). Reading parse() showed why: the string is split on [ and passed to CFMLExpressionInterpreter.interpretPart(), so the payload had to be changed to x[imageRead('')]. With that form, imageRead() executed, meaning arbitrary functions can be called from StructGet("").
The conclusion was that the following functions allow CFML evaluation and therefore RCE when they contain user input:
StructGet("...")isDefined("...")Empty("...")
A search of the Masa/Mura CMS codebase found no calls to StructGet() or Empty(), but plenty of calls to isDefined(). The reason for the abundance is that isDefined(String var) checks whether a given string is defined as a variable, so isDefined("url.search") does not pass the value of the search query parameter. A call of the form isDefined("#url.search#") is needed, where the supplied string is checked for being a defined variable. The #...# syntax means "insert the value here", so the parameter's value becomes part of the string being checked.
Grepping (searching the source files for a text pattern) for isDefined\(.#\) found a few calls, most importantly in the FEED API at core/mura/client/api/feed/v1/apiUtility.cfc#L122 and in the JSON API, both of which could be triggered pre-auth:
function processRequest(){
try {
var responseObject=getpagecontext().getresponse();
var params={};
var result="";
getBean('utility').suppressDebugging();
structAppend(params,url);
structAppend(params,form);
structAppend(form,params);
...
if (isDefined('params.method') && isDefined('#params.method#')){
...
}
}
}
Line by line:
processRequestis the function that handles an incoming API call.- It gets the response object, so it can write back to the caller.
- It creates an empty struct called
params. A struct is a collection of named values, like a dictionary. - It creates an empty string called
result. - It asks a utility bean (a helper object) to suppress debugging output.
structAppend(params,url)copies all URL query parameters intoparams.structAppend(params,form)copies all form (POST) parameters intoparams.structAppend(form,params)copies everything back intoform.- The
ifchecks two things: first, whether a key calledmethodexists inparams; second, whether the value ofparams.method, inserted via#...#, is itself a defined variable. That second check is the dangerous one, because the value comes from the user.
The params struct is populated from both the url and form structs, which hold GET and POST parameters respectively, so it contains user input. isDefined("#param.method#") therefore poses an RCE risk when Mura/Masa CMS runs on a Lucee server.

Exploitation
Step 1: reach the deserialisation sink through a REST mapping
Deploy a REST mapping whose function takes at least one argument, as in the component restpath="/java" example above, then send a request to the mapped path with Content-Type: application/java and a serialised gadget in the body. The URLDNS gadget was used to confirm reachability. The request only reaches JavaConverter.deserialize() when the client attribute is lucee-rest-1-0, which RestRequestListener sets, and when the mapping involves an argument, which makes _callRest() call ReqRspUtil.getRequestBody with deserialized: true.
Step 2: apply it to the update server
At the time of finding, https://update.lucee.org/rest/update/provider/echoGet was vulnerable to the same exploit. Compromising the update server would have allowed malicious updates to be served to Lucee installations, a supply chain attack. The maintainers hotfixed the server and released a fixed Lucee version, CVE-2023-38693. This did not apply to Apple's host, which exposed no REST mappings.
Step 3: try the cookie path through session functions
On an application that calls sessionInvalidate() or sessionRotate(), send a cookie named CF_CLIENT_LUCEE (with Lucee replaced by the application context name) whose value is a CFML expression. The value is read by StorageScopeCookie._loadData() and passed to CFMLExpressionInterpreter(false).interpret(). On Apple's Mura/Masa deployment this required rotateSessions, which is false by default, so it did not trigger.
Step 4: try the cookie path through PageContext.scope()
Here the cookie name would be CF_CLIENT_, but the Client Management setting must be enabled in the Lucee admin, and it is disabled by default. This also did not trigger on Apple's configuration.
Step 5: reach isDefined in Mura/Masa pre-auth
The FEED API and JSON API call isDefined('#params.method#') on a struct populated from GET and POST parameters. Supplying a method parameter whose value is a CFML expression causes evaluation on the Lucee server. This is the path that produced code execution on Apple.
Root cause
Three distinct mistakes combine in this research.
First, ReqRspUtil.getRequestBody() deserializes the request body with JavaConverter.deserialize() when the content type maps to UDF.RETURN_FORMAT_JAVA, and _callRest() passes deserialized: true whenever a REST mapping function takes an argument. Any REST mapping with an argument therefore turns the request body into a deserialisation sink.
Second, StorageScopeCookie holds a static CFMLExpressionInterpreter constructed with limited = false, and _loadData() feeds a cookie value straight into interpret(). Because ClientCookie derives the cookie name from the application context name, any code path that reaches getClientScope() (session invalidation, session rotation, PageContext.scope()) exposes cookie-driven CFML evaluation. The default-off settings (rotateSessions, Client Management) blocked these paths on Apple's deployment.
Third, VariableInterpreter.parse(,,false) evaluates CFML, and several built-in functions (StructGet, isDefined, Empty) pass their string argument into it. In parse() the string is split on [ and handed to interpretPart(), which is why the working payload takes the form x[imageRead('')] rather than the plain expression used against interpret(). Mura/Masa's isDefined('#params.method#') interpolates a request parameter into that argument, so pre-auth user input reaches the evaluator.
Impact
On Apple's production Lucee server, the result was remote code execution through Mura/Masa CMS, reachable pre-auth via the FEED API and JSON API. The REST deserialisation issue did not affect Apple because no REST mappings were exposed, but it did affect Lucee's update server at the time of finding, where compromise could have enabled a supply chain attack against Lucee installations. The cookie-based paths were blocked on Apple by default-off settings (rotateSessions and Client Management), though any deployment that enables them, or that calls the relevant session functions, would be exposed.
These findings were reported to both Apple and the Lucee team. Apple fixed the report within 48 hours. The Lucee team said they were aware of this class of issue and had already implemented a fix by adding an optional setting in the Admin panel.

Fix
For the cookie parsing issue, the researchers published a Nuclei template to detect vulnerable instances. Nuclei is a scanner that runs small, reusable checks called templates against a target. The template was also added to the nuclei-templates project:
id: lucee-rce
info:
name: Lucee < [redacted] - Remote Code Execution
author: rootxharsh,iamnoooob,pdresearch
severity: critical
metadata:
max-request: 1
shodan-query: http.title:"Lucee"
verified: true
tags: lucee,rce,oast
http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}
Cookie: CF_CLIENT_=render('<cfscript>writeoutput(ToBinary("{{base64('{{randstr}}')}}"))</cfscript>');
matchers:
- type: dsl
dsl:
- contains(body, "{{randstr}}")
- contains(header, "cfid")
- contains(header, "cftoken")
condition: and
Line by line:
id: lucee-rcegives the template a name.- The
infoblock describes it: a name, the authors, a severity of critical, and metadata such as a Shodan search query (Shodan is a search engine for internet-connected devices) and averifiedflag. tagsare labels used for filtering.- The
httpblock contains the actual request.rawmeans the request is written out literally. - The request is a
GET /to the target host, with aCookieheader namedCF_CLIENT_. Its value is arender()expression containing a small CFML script that writes out a random string ({{randstr}}, which Nuclei generates per run and base64-encodes). - The
matchersblock decides whether the target is vulnerable. It uses a small expression language (DSL) to check three things: the response body contains the random string, and the response headers containcfidandcftoken(Lucee's session cookies). condition: andmeans all three must be true.
On the defensive side, the advice is to run the latest stable release of Lucee and to apply the settings in the Lucee admin panel that disable evaluation of these functions.

Lucee also implemented a fix for the cookies that were being parsed as CFML expressions.

Variants to test
- REST mappings with arguments. Look for Lucee REST mappings whose functions take at least one argument, then send a request to the mapped path with
Content-Type: application/javaand a benign serialised gadget such asURLDNS. - Session functions in application code. Grep CFM and CFC files for
sessionInvalidate()andsessionRotate(). If either is reachable unauthenticated, send aCF_CLIENT_<CONTEXT>cookie whose value is a CFML expression. - Client Management enabled. Where the Lucee admin has Client Management turned on, try the
CF_CLIENT_cookie with an expression payload. StructGet,isDefinedandEmptywith interpolated input. Search application code for these functions receiving#...#-interpolated request data. Send a value of the formx[imageRead('')](or another function call inside brackets) and watch for the function executing.- Mura/Masa FEED and JSON APIs. On Mura/Masa deployments, send a
methodparameter to the FEED API or JSON API with a CFML expression as its value. - Update server style endpoints. Check whether any Lucee installation exposes REST endpoints similar to
rest/update/provider/echoGetand whether they accept a body withContent-Type: application/java.
Glossary
- API: a defined way for one program to talk to another over a network, usually by sending requests to specific addresses and receiving structured answers.
- Breakpoint: a deliberate pause point set in a debugger so you can inspect a running program at that line.
- CFC: a Lucee component file, roughly a class or module in other languages.
- CFM: a Lucee page file written in CFML.
- CFML: the programming language Lucee understands.
- ColdFusion: Adobe's commercial server product that also runs CFML; Lucee is an open source alternative.
- Content type: a header that tells the server what kind of data is in the request body, such as
application/java. - Cookie: a small piece of text a website asks your browser to store and send back on later requests, used to remember who you are.
- CVE: a public identifier assigned to a known vulnerability so people can refer to it unambiguously.
- Debugger: a tool that lets you pause a running program, inspect its memory and step through it line by line.
- Deserialisation: turning a stream of bytes back into a live object in a program's memory.
- DNS lookup: asking the domain name system to translate a name into an address; a common way to confirm a server made an outbound connection.
- Endpoint: a particular address on a server that an API exposes, each doing one job.
- Gadget: a pre-existing piece of code inside a target program that, when triggered during deserialisation, produces a side effect the attacker wants.
- GET / POST: two HTTP methods; GET asks for something, POST sends data.
- Header: a small labelled piece of information attached to a request or response, such as the content type or a cookie.
- Hotfix: a quick patch applied to a live system to close a vulnerability.
- Insecure deserialisation: a vulnerability where an attacker controls the bytes being deserialised, so the rebuilt object does something harmful.
- IntelliJ: a code editor and development environment used to read and debug code.
- JVM: the Java Virtual Machine, the runtime that executes Java programs.
- Lucee: an open source CFML server, an alternative to Adobe ColdFusion.
- Mura / Masa CMS: a content management system that can run on top of Lucee.
- Nuclei: a scanner that runs small, reusable checks called templates against a target.
- Out-of-band: a signal that comes back through a different channel than the main request, such as a DNS lookup to a host you control.
- PoC (proof of concept): a small demonstration that a vulnerability is real.
- Pre-auth: reachable without logging in first.
- RCE (remote code execution): a vulnerability that lets an outsider make a server run their commands.
- Request: the message a browser or client sends to a server: method, path, headers and sometimes a body.
- REST: a style of API where each address (endpoint) does one job and requests use standard HTTP methods.
- REST mapping: a configuration that tells Lucee which URL path maps to which component function.
- Serialisation: turning a live object in memory into a stream of bytes so it can be stored or sent.
- Session: the server's memory of a user between requests, usually tied to a cookie.
- Sink: a place in code where data ends up somewhere dangerous, such as an evaluator or a deserializer.
- Struct: a collection of named values, like a dictionary.
- Supply chain attack: compromising an upstream component (such as an update server) so that everyone who trusts it receives malicious code.
- URLDNS: a well known deserialisation gadget that makes the target perform a DNS lookup, used to confirm a bug.
- Web server: the program that answers requests from browsers and other clients.
- web.xml: a configuration file that describes how a Java web application maps URLs to code.