6
0
mirror of https://github.com/JKornev/hidden synced 2024-06-28 09:52:05 +00:00

Added exclude\protect list loading from HiddenCLI to driver

Fixed memory leak on the CreateProcessNotifyCallback
This commit is contained in:
JKornev 2016-09-05 22:30:18 +03:00
parent a25458a4c8
commit 5d1787ffbc
3 changed files with 39 additions and 5 deletions

@ -16,14 +16,14 @@ PsRulesContext g_excludeProcessRules;
PsRulesContext g_protectProcessRules; PsRulesContext g_protectProcessRules;
// Use this variable for hard code full path to applications that can see hidden objects // Use this variable for hard code full path to applications that can see hidden objects
// For instance: L"\\??\\C:\\Windows\\System32\\calc.exe", // For instance: L"\\Device\\HarddiskVolume1\\Windows\\System32\\calc.exe",
// Notice: this array should be NULL terminated // Notice: this array should be NULL terminated
CONST PWCHAR g_excludeProcesses[] = { CONST PWCHAR g_excludeProcesses[] = {
NULL NULL
}; };
// Use this variable for hard code full path to applications that will be protected // Use this variable for hard code full path to applications that will be protected
// For instance: L"\\??\\C:\\Windows\\System32\\cmd.exe", // For instance: L"\\Device\\HarddiskVolume1\\Windows\\System32\\cmd.exe",
// Notice: this array should be NULL terminated // Notice: this array should be NULL terminated
CONST PWCHAR g_protectProcesses[] = { CONST PWCHAR g_protectProcesses[] = {
NULL NULL
@ -191,6 +191,7 @@ VOID CreateProcessNotifyCallback(PEPROCESS Process, HANDLE ProcessId, PPS_CREATE
if (!NT_SUCCESS(status)) if (!NT_SUCCESS(status))
{ {
DbgPrint("FsFilter1!" __FUNCTION__ ": path normalization failed with code:%08x, path:%wZ\n", status, CreateInfo->ImageFileName); DbgPrint("FsFilter1!" __FUNCTION__ ": path normalization failed with code:%08x, path:%wZ\n", status, CreateInfo->ImageFileName);
ExFreePool(normalized.Buffer);
return; return;
} }

@ -10,14 +10,18 @@
+ Протестировать фишки с ObRegisterCallback + Протестировать фишки с ObRegisterCallback
+ Стерание всех флагов + Стерание всех флагов
- Реализовать PsMonitor со всеми вытекающими - Реализовать PsMonitor со всеми вытекающими
- Реализовать рабочий прототип + Реализовать рабочий прототип
+ Для Exclude + Для Exclude
+ Для Protected + Для Protected
+ Добавить флаг наследования + Добавить флаг наследования
- Реализовать интерфейс для IOCTL + Реализовать интерфейс для IOCTL
- Реализовать интерфейс для File & Reg мониторов + Реализовать интерфейс для File & Reg мониторов
+ Вынести Process Table в отдельный файл + Вынести Process Table в отдельный файл
+ Переименовать Process Tree в Process Table + Переименовать Process Tree в Process Table
- Протестировать интерфейсы
+ Добавить в HiddenCLI загрузку excluded и protected процессов
- Добавить проект HiddenTest
- Реализовать тесты в проекте HiddenTest
- Реализовать конвертирование NT path в кернел путь \\Deivce\\HardDisk.. - Реализовать конвертирование NT path в кернел путь \\Deivce\\HardDisk..
+ Портировать в PsMonitor + Портировать в PsMonitor
- Портировать в Device API - Портировать в Device API

@ -38,6 +38,15 @@ CONST PWCHAR g_excludeRegValues[] = {
L"\\Registry\\MACHINE\\SOFTWARE\\zz", L"\\Registry\\MACHINE\\SOFTWARE\\zz",
}; };
CONST PWCHAR g_protectProcesses[] = {
L"\\Device\\HarddiskVolume1\\Windows\\System32\\calc.exe",
L"\\Device\\HarddiskVolume1\\Windows\\System32\\calc2.exe",
};
CONST PWCHAR g_excludeProcesses[] = {
L"\\Device\\HarddiskVolume1\\Windows\\System32\\cmd.exe",
L"\\Device\\HarddiskVolume1\\Windows\\System32\\cmd2.exe",
};
int wmain(int argc, wchar_t *argv[]) int wmain(int argc, wchar_t *argv[])
{ {
@ -94,6 +103,26 @@ int wmain(int argc, wchar_t *argv[])
cout << "Error, Hid_AddHiddenDir failed with code: " << HID_STATUS_CODE(hid_status) << endl; cout << "Error, Hid_AddHiddenDir failed with code: " << HID_STATUS_CODE(hid_status) << endl;
} }
// Load excluded processes
count = _countof(g_excludeProcesses);
for (int i = 0; i < count; i++)
{
HidObjId objId;
hid_status = Hid_AddExcludedImage(hid_context, g_excludeProcesses[i], WithoutInherit, &objId);
if (!HID_STATUS_SUCCESSFUL(hid_status))
cout << "Error, Hid_AddExcludedImage failed with code: " << HID_STATUS_CODE(hid_status) << endl;
}
// Load protected processes
count = _countof(g_protectProcesses);
for (int i = 0; i < count; i++)
{
HidObjId objId;
hid_status = Hid_AddProtectedImage(hid_context, g_protectProcesses[i], WithoutInherit, &objId);
if (!HID_STATUS_SUCCESSFUL(hid_status))
cout << "Error, Hid_AddProtectedImage failed with code: " << HID_STATUS_CODE(hid_status) << endl;
}
Hid_Destroy(hid_context); Hid_Destroy(hid_context);
cout << "Completed!" << endl; cout << "Completed!" << endl;