Windows Driver (Part 2)
Introduction to Protected Processes
في Part 1 قدرنا نكتب Driver و Client بسيط. في هذا الجزء رح نتعمق في موضوع Protected Processes وكيف نقدر نتلاعب فيها. في البداية Protected Processes هي عبارة عن security feature تستخدم لحماية system processes وال resources الخاصة بها. أبسط مثال هو Protected Process Light(PPL) الي موجود على lsass.exe :

نقدر نفعل RunAsPPL لل lsass عن طريق Registry:

Digging into LSASS Protection
ال EPROCESS هو عبارة عن structure تقدر تتخيله مثل object يتخزن فيه كل المعلومات الخاصة بال process مثل PID, Token Information والي رح نركز عليها احنا Protection. نقدر نشوف كل ال members في هذا ال Structure عن طريق هذا الأمر :

الي رح نركز عليها هي:
SignatureLevel
SectionSignatureLevel
Protection (_PS_PROTECTION)
نقدر نتعمق ونشوف ال structure الخاص ب PS_PRTECTION_:

الحلو ان هذا ال sturcture documented من Microsoft هنا:
طيب احنا قدرنا نشوف Protection level الخاص بال lsass والي هو 0x41 وتم الوصول له عن طريق دمج Signer و Type. فيمكن تمثيلها هكذا:
PS_PROTECTED_LSA_LIGHT (0x41)
Lsa (4)
Protected Light (1)
الفكرة الأن هي يا نشيل هذه ال protection كاملة من ال Process او نسوي process ونحط لها protection اعلى من lsass. انا رح اروح مع الخيار الثاني لأنه امتع شوي. رح نعرف نفس ال Structure الي شفناه في WinDBG و Microsoft ورح نعرف structure جديد ياخذ ال PID من Client:
رح نستخدم PsLookupProcessByProcessId عشان نوصل EPROCESS structure الخاص بال process. ال offset الخاصة ب PPROCESS_PROTECTION_OFF حاطها hard coded تقدرون تسون structure و function جديد يجيب ال offset المناسب بكل Windows version بس ما رح اتطرق لها. واخر شي سويته هو اني حطيت Protection Level اعلى من lsass:
ال Protection الحالي تم حسابه ليكون اعلى من lsass:
PS_PROTECTED_WINTCB (0x62)
WinTcb (6)
Protected (2)
اخر شي بنسويه هو تعديل ال Client code:
وهذه النتيجة:

References
Last updated
Was this helpful?
