
MSI Dump - أداة تقوم بتحليل حزم تثبيت MSI الضارة، وتستخرج الملفات، والتدفقات، والبيانات الثنائية، وتدمج ماسح YARA.
msidumpMSI Dump - أداة تحلل حزم تثبيت MSI الخبيثة، تستخرج الملفات والبيانات الثنائية والتدفقات (streams) وتدمج ماسح YARA.
في مستندات Office الممكّنة بماكرو، يمكننا بسرعة استخدام oletools mraptor لتحديد ما إذا كان المستند خبيثًا. وإذا أردنا تحليله بشكل أعمق، يمكننا استخدام oletools olevba أو oledump.
لتحليل ملفات MSI الخبيثة، كان لدينا حتى الآن أداة واحدة فقط، لكنها موثوقة وجديرة بالثقة وهي lessmsi.
ومع ذلك، لا تنفذ lessmsi الميزات التي كنت أبحث عنها:
ومن هنا يأتي دور msidump.
تساعد هذه الأداة في التقييمات السريعة وكذلك الفحوصات التفصيلية لمجموعات MSI الخبيثة. تتيح لنا:
file/MIME لتحديد نوع البيانات الداخليةتم إنشاؤها كأداة مساعدة لمنشور المدونة الذي أصدرته هنا:
WindowsInstaller.Installer، فمن غير الممكن حاليًا دعم أنظمة Linux الأصلية. ربما يمكن أن يساعد wine python msidump.py، لكن لم أجرب ذلك بعد.cmd> python msidump.py evil.msi -y rules.yara

هنا نرى أن ملف MSI المدخل محقون بنص VBScript مشبوه ويحتوي على العديد من الملفات القابلة للتنفيذ داخله.
نرى من جدول التقييم أنه موجود في جدول Binary. لنستخرجه:
python msidump.py putty-backdoored.msi -l binary -i UBXtHArj
يمكننا تحديد أي سجل نريد تفريغه إما باسمه/معرفه أو برقم الفهرس (هنا سيكون 7).

لنلق نظرة على مثال آخر. هذه المرة يوجد ملف قابل للتنفيذ مخزن في جدول Binary سيتم تنفيذه أثناء التثبيت:

لاستخراج هذا الملف سنستخدم:
python msidump.py evil2.msi -x binary -i lmskBju -O extracted
حيث:
-x binary يخبر باستخراج محتويات جدول Binary-i lmskBju يحدد أي سجل بالضبط لاستخراجه-O extracted يحدد دليل الإخراج
للحصول على أفضل تجربة إخراج، قم بتشغيل الأداة على نافذة وحدة تحكم مكبرة أو أعد توجيه الإخراج إلى ملف:
python msidump.py [...] -o analysis.log
PS D:\> python .\msidump.py --help
options:
-h, --help show this help message and exit
Required arguments:
infile Input MSI file (or directory) for analysis.
Options:
-q, --quiet Surpress banner and unnecessary information. In triage mode, will display only verdict.
-v, --verbose Verbose mode.
-d, --debug Debug mode.
-N, --nocolor Dont use colors in text output.
-n PRINT_LEN, --print-len PRINT_LEN
When previewing data - how many bytes to include in preview/hexdump. Default: 128
-f {text,json,csv}, --format {text,json,csv}
Output format: text, json, csv. Default: text
-o path, --outfile path
Redirect program output to this file.
-m, --mime When sniffing inner data type, report MIME types
Analysis Modes:
-l what, --list what List specific table contents. See help message to learn what can be listed.
-x what, --extract what
Extract data from MSI. For what can be extracted, refer to help message.
Analysis Specific options:
-i number|name, --record number|name
Can be a number or name. In --list mode, specifies which record to dump/display entirely. In --extract mode dumps only this particular record to --outdir
-O path, --outdir path
When --extract mode is used, specifies output location where to extract data.
-y path, --yara path Path to YARA rule/directory with rules. YARA will be matched against Binary data, streams and inner files
------------------------------------------------------
- What can be listed:
--list CustomAction - Specific table
--list Registry,File - List multiple tables
--list stats - Print MSI database statistics
--list all - All tables and their contents
--list olestream - Prints all OLE streams & storages.
To display CABs embedded in MSI try: --list _Streams
--list cabs - Lists embedded CAB files
--list binary - Lists binary data embedded in MSI for its own purposes.
That typically includes EXEs, DLLs, VBS/JS scripts, etc
- What can be extracted:
--extract all - Extracts Binary data, all files from CABs, scripts from CustomActions
--extract binary - Extracts Binary data
--extract files - Extracts files
--extract cabs - Extracts cabinets
--extract scripts - Extracts scripts
------------------------------------------------------
CustomAction الخبيثة بناءً على تقييم أرقامها، وهو عرضة للتهرب.
على ما يبدو، عند تسمية أداتي، لم أفكر في التحقق مما إذا كان الاسم مستخدمًا بالفعل.
هناك أداة أخرى تسمى msidump وهي جزء من حزمة msitools GNU:
هذا المشروع وغيره هو نتيجة ليالٍ بلا نوم والكثير من العمل الشاق. إذا أعجبك ما أفعله وتقدر أنني دائمًا أعود بالمصلحة للمجتمع، فكر في شراء فنجان قهوة لي (أو ربما بيرة) فقط لتقول شكرًا! 💪
Mariusz Banach / mgeeky, (@mariuszbit)
<mb [at] binary-offensive.com>