Skip to content

Commit ecc60d2

Browse files
committed
MS12-042
1 parent 7356e38 commit ecc60d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+31149
-1
lines changed

MS12-042/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Vulnerability reference:
1313
## Usage
1414
```
1515
c:\> MS12-042.exe -pid xxx
16-
```
16+
```
17+
* [YouTube](https://www.youtube.com/watch?v=whRRFOm-DLI&feature=youtu.be)
18+
1719
![win7](win7.png)
1820

MS12-042/sysret-source/junk.suo

33.5 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* MinHook - Minimalistic API Hook Library
3+
* Copyright (C) 2009 Tsuda Kageyu. All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. The name of the author may not be used to endorse or promote products
15+
* derived from this software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
29+
#pragma once
30+
#include <Windows.h>
31+
32+
// MinHook Error Codes.
33+
typedef enum MH_STATUS
34+
{
35+
// Unknown error. Should not be returned.
36+
MH_UNKNOWN = -1,
37+
38+
// Successful.
39+
MH_OK = 0,
40+
41+
42+
// MinHook is already initialized.
43+
MH_ERROR_ALREADY_INITIALIZED,
44+
45+
// MinHook is not initialized yet, or already uninitialized.
46+
MH_ERROR_NOT_INITIALIZED,
47+
48+
// The hook for the specified target function is already created.
49+
MH_ERROR_ALREADY_CREATED,
50+
51+
// The hook for the specified target function is not created yet.
52+
MH_ERROR_NOT_CREATED,
53+
54+
// The hook for the specified target function is already enabled.
55+
MH_ERROR_ENABLED,
56+
57+
// The hook for the specified target function is not enabled yet, or already disabled.
58+
MH_ERROR_DISABLED,
59+
60+
// The specified pointer is invalid. It points the address of non-allocated and/or non-executable region.
61+
MH_ERROR_NOT_EXECUTABLE,
62+
63+
// The specified target function cannot be hooked.
64+
MH_ERROR_UNSUPPORTED_FUNCTION,
65+
66+
// Failed to allocate memory.
67+
MH_ERROR_MEMORY_ALLOC,
68+
69+
// Failed to change the memory protection.
70+
MH_ERROR_MEMORY_PROTECT
71+
}
72+
MH_STATUS;
73+
74+
#if defined __cplusplus
75+
extern "C" {
76+
#endif
77+
78+
// Initialize the MinHook library.
79+
MH_STATUS WINAPI MH_Initialize();
80+
81+
// Uninitialize the MinHook library.
82+
MH_STATUS WINAPI MH_Uninitialize();
83+
84+
// Creates the Hook for the specified target function, in disabled state.
85+
// Parameters:
86+
// pTarget [in] A pointer to the target function, which will be overridden by the detour function.
87+
// pDetour [in] A pointer to the detour function, which will override the target function.
88+
// ppOriginal [out] A pointer to the trampoline function, which will be used to call the original target function.
89+
MH_STATUS WINAPI MH_CreateHook(void* pTarget, void* const pDetour, void** ppOriginal);
90+
91+
// Enables the already created hook.
92+
// Parameters:
93+
// pTarget [in] A pointer to the target function.
94+
MH_STATUS WINAPI MH_EnableHook(void* pTarget);
95+
96+
// Disables the already created hook.
97+
// Parameters:
98+
// pTarget [in] A pointer to the target function.
99+
MH_STATUS WINAPI MH_DisableHook(void* pTarget);
100+
101+
#if defined __cplusplus
102+
}
103+
#endif
104+
Binary file not shown.
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
========================================================================
2+
CONSOLE APPLICATION : junk Project Overview
3+
========================================================================
4+
5+
AppWizard has created this junk application for you.
6+
7+
This file contains a summary of what you will find in each of the files that
8+
make up your junk application.
9+
10+
11+
junk.vcxproj
12+
This is the main project file for VC++ projects generated using an Application Wizard.
13+
It contains information about the version of Visual C++ that generated the file, and
14+
information about the platforms, configurations, and project features selected with the
15+
Application Wizard.
16+
17+
junk.vcxproj.filters
18+
This is the filters file for VC++ projects generated using an Application Wizard.
19+
It contains information about the association between the files in your project
20+
and the filters. This association is used in the IDE to show grouping of files with
21+
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
22+
"Source Files" filter).
23+
24+
junk.cpp
25+
This is the main application source file.
26+
27+
/////////////////////////////////////////////////////////////////////////////
28+
Other standard files:
29+
30+
StdAfx.h, StdAfx.cpp
31+
These files are used to build a precompiled header (PCH) file
32+
named junk.pch and a precompiled types file named StdAfx.obj.
33+
34+
/////////////////////////////////////////////////////////////////////////////
35+
Other notes:
36+
37+
AppWizard uses "TODO:" comments to indicate parts of the source code you
38+
should add to or customize.
39+
40+
/////////////////////////////////////////////////////////////////////////////
+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|x64">
9+
<Configuration>Debug</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release|Win32">
13+
<Configuration>Release</Configuration>
14+
<Platform>Win32</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{33A91BC5-C798-4CA3-BDE2-ED317FCBCD7F}</ProjectGuid>
23+
<Keyword>Win32Proj</Keyword>
24+
<RootNamespace>junk</RootNamespace>
25+
<ProjectName>sysret</ProjectName>
26+
</PropertyGroup>
27+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
29+
<ConfigurationType>Application</ConfigurationType>
30+
<UseDebugLibraries>true</UseDebugLibraries>
31+
<CharacterSet>NotSet</CharacterSet>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
34+
<ConfigurationType>Application</ConfigurationType>
35+
<UseDebugLibraries>true</UseDebugLibraries>
36+
<CharacterSet>NotSet</CharacterSet>
37+
</PropertyGroup>
38+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
39+
<ConfigurationType>Application</ConfigurationType>
40+
<UseDebugLibraries>false</UseDebugLibraries>
41+
<WholeProgramOptimization>true</WholeProgramOptimization>
42+
<CharacterSet>Unicode</CharacterSet>
43+
</PropertyGroup>
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
45+
<ConfigurationType>Application</ConfigurationType>
46+
<UseDebugLibraries>false</UseDebugLibraries>
47+
<WholeProgramOptimization>true</WholeProgramOptimization>
48+
<CharacterSet>NotSet</CharacterSet>
49+
</PropertyGroup>
50+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
51+
<ImportGroup Label="ExtensionSettings">
52+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
53+
<Import Project="$(VCTargetsPath)\BuildCustomizations\vsyasm.props" />
54+
</ImportGroup>
55+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
56+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
57+
</ImportGroup>
58+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
59+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
60+
</ImportGroup>
61+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
62+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
63+
</ImportGroup>
64+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
65+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
66+
</ImportGroup>
67+
<PropertyGroup Label="UserMacros" />
68+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
69+
<LinkIncremental>true</LinkIncremental>
70+
</PropertyGroup>
71+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
72+
<LinkIncremental>true</LinkIncremental>
73+
</PropertyGroup>
74+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
75+
<LinkIncremental>false</LinkIncremental>
76+
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
78+
<LinkIncremental>false</LinkIncremental>
79+
</PropertyGroup>
80+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
81+
<ClCompile>
82+
<PrecompiledHeader>Use</PrecompiledHeader>
83+
<WarningLevel>Level3</WarningLevel>
84+
<Optimization>Disabled</Optimization>
85+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
86+
</ClCompile>
87+
<Link>
88+
<SubSystem>Console</SubSystem>
89+
<GenerateDebugInformation>true</GenerateDebugInformation>
90+
<TargetMachine>MachineX64</TargetMachine>
91+
</Link>
92+
</ItemDefinitionGroup>
93+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
94+
<ClCompile>
95+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
96+
<WarningLevel>Level3</WarningLevel>
97+
<Optimization>Disabled</Optimization>
98+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
99+
</ClCompile>
100+
<Link>
101+
<SubSystem>Console</SubSystem>
102+
<GenerateDebugInformation>true</GenerateDebugInformation>
103+
</Link>
104+
</ItemDefinitionGroup>
105+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
106+
<ClCompile>
107+
<WarningLevel>Level3</WarningLevel>
108+
<PrecompiledHeader>Use</PrecompiledHeader>
109+
<Optimization>MaxSpeed</Optimization>
110+
<FunctionLevelLinking>true</FunctionLevelLinking>
111+
<IntrinsicFunctions>true</IntrinsicFunctions>
112+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
113+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
114+
</ClCompile>
115+
<Link>
116+
<SubSystem>Console</SubSystem>
117+
<GenerateDebugInformation>true</GenerateDebugInformation>
118+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
119+
<OptimizeReferences>true</OptimizeReferences>
120+
</Link>
121+
</ItemDefinitionGroup>
122+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
123+
<ClCompile>
124+
<WarningLevel>Level3</WarningLevel>
125+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
126+
<Optimization>MaxSpeed</Optimization>
127+
<FunctionLevelLinking>true</FunctionLevelLinking>
128+
<IntrinsicFunctions>true</IntrinsicFunctions>
129+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
130+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
131+
</ClCompile>
132+
<Link>
133+
<SubSystem>Console</SubSystem>
134+
<GenerateDebugInformation>true</GenerateDebugInformation>
135+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
136+
<OptimizeReferences>true</OptimizeReferences>
137+
</Link>
138+
</ItemDefinitionGroup>
139+
<ItemGroup>
140+
<None Include="ReadMe.txt" />
141+
<MASM Include="trigger.asm">
142+
<FileType>Document</FileType>
143+
</MASM>
144+
</ItemGroup>
145+
<ItemGroup>
146+
<ClInclude Include="log.h" />
147+
<ClInclude Include="MinHook\MinHook.h" />
148+
<ClInclude Include="peutil.h" />
149+
<ClInclude Include="sources\include\beaengine\basic_types.h" />
150+
<ClInclude Include="sources\include\beaengine\BeaEngine.h" />
151+
<ClInclude Include="sources\include\beaengine\export.h" />
152+
<ClInclude Include="sources\include\beaengine\macros.h" />
153+
<ClInclude Include="stdafx.h" />
154+
<ClInclude Include="sysret.h" />
155+
<ClInclude Include="targetver.h" />
156+
</ItemGroup>
157+
<ItemGroup>
158+
<ClCompile Include="KrnlUtils.cpp" />
159+
<ClCompile Include="log.cpp" />
160+
<ClCompile Include="peutils.cpp" />
161+
<ClCompile Include="sources\beaengineSources\BeaEngine.c" />
162+
<ClCompile Include="sysret.cpp" />
163+
<ClCompile Include="stdafx.cpp">
164+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
165+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
166+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
167+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
168+
</ClCompile>
169+
</ItemGroup>
170+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
171+
<ImportGroup Label="ExtensionTargets">
172+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
173+
<Import Project="$(VCTargetsPath)\BuildCustomizations\vsyasm.targets" />
174+
</ImportGroup>
175+
</Project>

0 commit comments

Comments
 (0)