-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b441cb8
Showing
14 changed files
with
1,260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
x64/ | ||
UnKover/x64/ | ||
.vs/ | ||
UnKover/.vs/ | ||
testEnvironments.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# unKover | ||
|
||
A PoC anti-rootkit that can detect drivers mapped to kernel memory. Think [Moneta](https://github.com/forrest-orr/moneta), but for the kernel (obviously this is a simplified comparison). | ||
|
||
The idea is to have a small & concise anti-rootkit to aid you (the rootkit dev) in honing your rootkits evasion abilities while also showcasing detection vectors with minimal FP rate that can detect many of the openly available driver mapper + rootkit combinations. | ||
|
||
While some open source anti-cheats with capabilities far beyond this tool's exist (such as donnaskiez [ac](https://github.com/donnaskiez/ac)), I wanted something that I can easily tweak according to my needs. Maybe it will be useful for you too. | ||
|
||
Techniques implemented: | ||
|
||
* NMI Callbacks: Periodically sends Non-Maskable Interrupts (NMIs) to each core and analyzes the currently running thread's call stack for any pointers to unbacked memory. | ||
* APC StackWalks: Same as the NMI check, but with an APC queued to each system thread. | ||
* System thread analysis: Periodically check all system threads for start-addresses pointing to unbacked memory. | ||
* Driver Object analysis: Periodically check all driver objects registered on the system, and check if their DriverEntry points to unbacked memory. | ||
|
||
<p align="center"> | ||
<img src="./img/detect.jpg" alt="unKover output"/> | ||
</p> | ||
|
||
So far its quite trivial to bypass these, especially given the implementations :) Hopefully that will change in the future. | ||
|
||
## Installation | ||
|
||
You need to enable testsigning to load the driver. I also recommend to enable debugging for the kernel. | ||
|
||
Run the following from an administrative prompt and reboot afterwards: | ||
|
||
```cmd | ||
bcdedit /set testsigning on | ||
bcdedit /debug on | ||
``` | ||
|
||
Then you can load the driver with `sc.exe` or use OSR DriverLoader: | ||
|
||
```cmd | ||
sc.exe create Unkover binPath= "C:\path\to\Unkover.sys" type= kernel start= demand | ||
sc.exe start Unkover | ||
``` | ||
|
||
Afterwards, output will appear in the debug logs (view with e.g. WinDbg or DebugView) | ||
|
||
### Credits | ||
|
||
* DeviceObject scanning code partly taken from https://github.com/not-wlan/driver-hijack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; | ||
; Unkover.inf | ||
; | ||
|
||
[Version] | ||
Signature="$WINDOWS NT$" | ||
Class=System | ||
ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} | ||
Provider=%ManufacturerName% | ||
DriverVer= | ||
CatalogFile=Unkover.cat | ||
PnpLockdown=1 | ||
|
||
;This template is supported for OS version 17763 (Windows 10 version 1809) and after. | ||
;For Windows OS prior to Windows 10 1809 set DefaultDestDir = 12 | ||
[DestinationDirs] | ||
DefaultDestDir = 13 | ||
|
||
|
||
[SourceDisksNames] | ||
1 = %DiskName%,,,"" | ||
|
||
[SourceDisksFiles] | ||
|
||
|
||
[Manufacturer] | ||
|
||
[Strings] | ||
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name | ||
DiskName="Unkover Source Disk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34031.279 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Unkover", "Unkover.vcxproj", "{CA2BD34A-0096-4A66-B78E-8645283F2CF4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|ARM64 = Debug|ARM64 | ||
Debug|x64 = Debug|x64 | ||
Release|ARM64 = Release|ARM64 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|ARM64.Deploy.0 = Debug|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|x64.ActiveCfg = Debug|x64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|x64.Build.0 = Debug|x64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Debug|x64.Deploy.0 = Debug|x64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|ARM64.Build.0 = Release|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|ARM64.Deploy.0 = Release|ARM64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|x64.ActiveCfg = Release|x64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|x64.Build.0 = Release|x64 | ||
{CA2BD34A-0096-4A66-B78E-8645283F2CF4}.Release|x64.Deploy.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {7D2F4B82-117C-4D89-8C66-30BD8AB2E52E} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|ARM64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>ARM64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|ARM64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>ARM64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{CA2BD34A-0096-4A66-B78E-8645283F2CF4}</ProjectGuid> | ||
<TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> | ||
<Configuration>Debug</Configuration> | ||
<Platform Condition="'$(Platform)' == ''">x64</Platform> | ||
<RootNamespace>Unkover</RootNamespace> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<TargetVersion>Windows10</TargetVersion> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> | ||
<ConfigurationType>Driver</ConfigurationType> | ||
<DriverType>WDM</DriverType> | ||
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<TargetVersion>Windows10</TargetVersion> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> | ||
<ConfigurationType>Driver</ConfigurationType> | ||
<DriverType>WDM</DriverType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> | ||
<TargetVersion>Windows10</TargetVersion> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> | ||
<ConfigurationType>Driver</ConfigurationType> | ||
<DriverType>WDM</DriverType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> | ||
<TargetVersion>Windows10</TargetVersion> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> | ||
<ConfigurationType>Driver</ConfigurationType> | ||
<DriverType>WDM</DriverType> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> | ||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> | ||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<DriverSign> | ||
<FileDigestAlgorithm>sha256</FileDigestAlgorithm> | ||
</DriverSign> | ||
<ClCompile> | ||
<TreatWarningAsError>false</TreatWarningAsError> | ||
<BufferSecurityCheck>false</BufferSecurityCheck> | ||
<ControlFlowGuard>false</ControlFlowGuard> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<DriverSign> | ||
<FileDigestAlgorithm>sha256</FileDigestAlgorithm> | ||
</DriverSign> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<Inf Include="Unkover.inf" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<FilesToPackage Include="$(TargetPath)" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="unKover\Driver.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="unKover\apc.hpp" /> | ||
<ClInclude Include="unKover\deviceobjects.hpp" /> | ||
<ClInclude Include="unKover\meta.hpp" /> | ||
<ClInclude Include="unKover\nmi.hpp" /> | ||
<ClInclude Include="unKover\threads.hpp" /> | ||
<ClInclude Include="unKover\utils.hpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="README.md" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
<Filter Include="Driver Files"> | ||
<UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier> | ||
<Extensions>inf;inv;inx;mof;mc;</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Inf Include="Unkover.inf"> | ||
<Filter>Driver Files</Filter> | ||
</Inf> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="unKover\Driver.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="unKover\meta.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="unKover\nmi.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="unKover\threads.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="unKover\utils.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="unKover\deviceobjects.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="unKover\apc.hpp"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="README.md" /> | ||
</ItemGroup> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.