Skip to content

Commit 60547de

Browse files
author
Kristian Covic
committed
initial commit; have socket deadlock issue
0 parents  commit 60547de

15 files changed

+860
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x64
2+
.vs

LaucherTestApp/LaucherTestApp.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// LaucherTestApp.cpp : This file contains the 'main' function. Program execution begins and ends there.
2+
//
3+
4+
#include <iostream>
5+
#include <Windows.h>
6+
#include <securitybaseapi.h>
7+
#include <sddl.h>
8+
#include <format>
9+
int main()
10+
{
11+
std::cout << "Fumble my token NOW\n";
12+
getchar();
13+
std::cout << "screw you - unlows your box\n";
14+
15+
/*
16+
HANDLE hToken;
17+
18+
if (!OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &hToken)) {
19+
std::cout << std::format("Could not get process token handle, GLE {:x}", GetLastError());
20+
exit(-1);
21+
}
22+
23+
SID mandatoryLabel = {};
24+
25+
// construct the mandatory label SID; S-1-16-<label value>
26+
mandatoryLabel.Revision = 1;
27+
28+
// only the last byte of the array actually holds the security authority value
29+
// the other 5 bytes always have to be 0, either reserved or the whole thing is big fucking endian
30+
mandatoryLabel.IdentifierAuthority.Value[5] = 16;
31+
mandatoryLabel.SubAuthorityCount = 1;
32+
mandatoryLabel.SubAuthority[0] = MANDATORY_LEVEL_TO_MANDATORY_RID(MANDATORY_LEVEL::MandatoryLevelHigh);
33+
34+
TOKEN_MANDATORY_LABEL label = {};
35+
label.Label.Attributes |= SE_GROUP_INTEGRITY;
36+
label.Label.Sid = &mandatoryLabel;
37+
38+
39+
if (!SetTokenInformation(hToken, TOKEN_INFORMATION_CLASS::TokenIntegrityLevel, &label, sizeof(label))) {
40+
std::cout << std::format("Could not elevate to medium, GLE {:x}", GetLastError());
41+
exit(-1);
42+
}
43+
*/
44+
45+
46+
HANDLE hFile = CreateFile(L"\\\\?\\PhysicalDrive1", GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
47+
48+
if (hFile == 0 || hFile == INVALID_HANDLE_VALUE) {
49+
std::cout << std::format("Could not open file, GLE {:x}", GetLastError());
50+
}
51+
char buf[512] = {};
52+
DWORD bytesRead;
53+
ReadFile(hFile, buf, sizeof(buf), &bytesRead, nullptr);
54+
55+
std::cout << buf;
56+
57+
}
58+
59+
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
60+
// Debug program: F5 or Debug > Start Debugging menu
61+
62+
// Tips for Getting Started:
63+
// 1. Use the Solution Explorer window to add/manage files
64+
// 2. Use the Team Explorer window to connect to source control
65+
// 3. Use the Output window to see build output and other messages
66+
// 4. Use the Error List window to view errors
67+
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
68+
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" 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="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</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+
<VCProjectVersion>17.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{a55da548-c645-47da-b5e2-dfbce8a5488c}</ProjectGuid>
25+
<RootNamespace>LaucherTestApp</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v143</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v143</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v143</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v143</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<ClCompile>
75+
<WarningLevel>Level3</WarningLevel>
76+
<SDLCheck>true</SDLCheck>
77+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78+
<ConformanceMode>true</ConformanceMode>
79+
</ClCompile>
80+
<Link>
81+
<SubSystem>Console</SubSystem>
82+
<GenerateDebugInformation>true</GenerateDebugInformation>
83+
</Link>
84+
</ItemDefinitionGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
86+
<ClCompile>
87+
<WarningLevel>Level3</WarningLevel>
88+
<FunctionLevelLinking>true</FunctionLevelLinking>
89+
<IntrinsicFunctions>true</IntrinsicFunctions>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
</ClCompile>
94+
<Link>
95+
<SubSystem>Console</SubSystem>
96+
<GenerateDebugInformation>true</GenerateDebugInformation>
97+
</Link>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
100+
<ClCompile>
101+
<WarningLevel>Level3</WarningLevel>
102+
<SDLCheck>true</SDLCheck>
103+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
104+
<ConformanceMode>true</ConformanceMode>
105+
</ClCompile>
106+
<Link>
107+
<SubSystem>Console</SubSystem>
108+
<GenerateDebugInformation>true</GenerateDebugInformation>
109+
</Link>
110+
</ItemDefinitionGroup>
111+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
112+
<ClCompile>
113+
<WarningLevel>Level3</WarningLevel>
114+
<FunctionLevelLinking>true</FunctionLevelLinking>
115+
<IntrinsicFunctions>true</IntrinsicFunctions>
116+
<SDLCheck>true</SDLCheck>
117+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
118+
<ConformanceMode>true</ConformanceMode>
119+
<LanguageStandard>stdcpp20</LanguageStandard>
120+
</ClCompile>
121+
<Link>
122+
<SubSystem>Console</SubSystem>
123+
<GenerateDebugInformation>true</GenerateDebugInformation>
124+
</Link>
125+
</ItemDefinitionGroup>
126+
<ItemGroup>
127+
<ClCompile Include="LaucherTestApp.cpp" />
128+
</ItemGroup>
129+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
130+
<ImportGroup Label="ExtensionTargets">
131+
</ImportGroup>
132+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="LaucherTestApp.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

SandboxCtfLauncher.sln

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36310.24 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SandboxCtfLauncher", "SandboxCtfLauncher\SandboxCtfLauncher.vcxproj", "{33E796E6-C460-43CB-9073-82CFD7069908}"
7+
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LaucherTestApp", "LaucherTestApp\LaucherTestApp.vcxproj", "{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|x64 = Debug|x64
13+
Debug|x86 = Debug|x86
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{33E796E6-C460-43CB-9073-82CFD7069908}.Debug|x64.ActiveCfg = Debug|x64
19+
{33E796E6-C460-43CB-9073-82CFD7069908}.Debug|x64.Build.0 = Debug|x64
20+
{33E796E6-C460-43CB-9073-82CFD7069908}.Debug|x86.ActiveCfg = Debug|Win32
21+
{33E796E6-C460-43CB-9073-82CFD7069908}.Debug|x86.Build.0 = Debug|Win32
22+
{33E796E6-C460-43CB-9073-82CFD7069908}.Release|x64.ActiveCfg = Release|x64
23+
{33E796E6-C460-43CB-9073-82CFD7069908}.Release|x64.Build.0 = Release|x64
24+
{33E796E6-C460-43CB-9073-82CFD7069908}.Release|x86.ActiveCfg = Release|Win32
25+
{33E796E6-C460-43CB-9073-82CFD7069908}.Release|x86.Build.0 = Release|Win32
26+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Debug|x64.ActiveCfg = Debug|x64
27+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Debug|x64.Build.0 = Debug|x64
28+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Debug|x86.ActiveCfg = Debug|Win32
29+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Debug|x86.Build.0 = Debug|Win32
30+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Release|x64.ActiveCfg = Release|x64
31+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Release|x64.Build.0 = Release|x64
32+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Release|x86.ActiveCfg = Release|Win32
33+
{A55DA548-C645-47DA-B5E2-DFBCE8A5488C}.Release|x86.Build.0 = Release|Win32
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
GlobalSection(ExtensibilityGlobals) = postSolution
39+
SolutionGuid = {43855510-9883-4317-9477-42A7EF559B8F}
40+
EndGlobalSection
41+
EndGlobal
221 KB
Binary file not shown.
3.29 KB
Binary file not shown.

0 commit comments

Comments
 (0)