ReverseEngineering – Telegram
ReverseEngineering
1.24K subscribers
40 photos
10 videos
55 files
666 links
Download Telegram
2
fridahandbook.pdf
4.9 MB
Frida Hand Book

All You Need to Know About Frida

@reverseengine
Forwarded from RadvanSec (Sin0x001)
تکنیک Narrator DLL Hijack

ویندوز ابزاری به نام Narrator دارد که برای دسترسی افراد دارای نیازهای ویژه (Accessibility) کاربرد دارد.

Narrator.exe هنگام اجرا یک DLL به نام MSTTSLocOneCoreEnUS.dll را بارگذاری می‌کند که باید در مسیر %windir%\system32\speech_onecore\engines\tts باشد.

اگر حمله‌کننده بتواند نسخه مخربی از این DLL را در همان مسیر قرار دهد، با اجرای Narrator کد مخرب اجرا خواهد شد (بدون نیاز به وارد کردن توابع export خاص).

برای فریب بیشتر، در اثبات مفهوم (PoC) ارائه شده، سازندگان یک نسخه از DLL را طوری تغییر داده‌اند که Narrator در حالت «سکوت» اجرا شود (یعنی صدایی تولید نکند یا نشان دادن چیزی نداشته باشد) تا کاربر متوجه نشود که چیزی غیرعادی در حال رخ دادن است.


⭐️ @RadvanSec
1
RadvanSec
Photo
Narrator DLL Hijack Technique

Windows has a tool called Narrator that is used for accessibility purposes.

When Narrator.exe runs, it loads a DLL called MSTTSLocOneCoreEnUS.dll, which should be located in the path %windir%\system32\speech_onecore\engines\tts.

If an attacker can place a malicious version of this DLL in the same path, running Narrator will execute malicious code (without the need to import specific export functions).

To further trickery, in the proof of concept (PoC) provided, the developers have modified a version of the DLL so that Narrator runs in a "silent" mode (i.e., does not make any sound or display anything) so that the user does not notice that something unusual is happening.

⭐️ @RadvanSec
1
ابزار strings یکی از ابزارهای پایه‌ ای اما بسیار کاربردی در دنیای مهندسی معکوس فارنزیک و تحلیل بدافزاره این ابزار برای استخراج رشته‌ های متنی قابل‌ خوندن Printable Strings از فایل‌ های باینری استفاده میشه

کاربرد

وقتی یک فایل باینری مثل Executable exe، ELF، dll و غیره رو باز میکنید بیشتر دیتا ها در قالب باینری و غیرقابل‌ خوندنن اما بخش‌ هایی از اونها ممکنه شامل رشته‌های ASCII یا Unicode باشه

مثلا:

مسیر فایل‌ ها

URL ها

اسم API ها

کلید های رجیستری

پیغام‌های خطا

و حتی نام کاربر یا رمز عبور هارد کد شده


ابزار strings دقیقا همین قسمت‌ ها رو بیرون میکشه




چجوری استفاده کنید

در لینوکس GNU binutils

strings [options] <filename>


مثال ساده:

strings malware_sample.exe


این دستور تمام رشته‌ های قابل چاپ ASCII با طول پیش‌ فرض 4 کاراکتر یا بیشتر رو نشان میده



دستورات مهم

توضیح دستورات

-n <number>
تعیین حداقل طول رشته مثلا -n 6


-e l
سرچ برای رشته های یونیکد UTF-16LE مهم برای فایل های ویندوز


-t x
نمایش ادرس افست هر رشته به صورت هگز



-a
سرچ داخل کل فایل حتی بخش هایی که کامل نادیده گرفته میشن


-f نمایش نام فایل قبل از هر رشته خیلی مهمه برای تحلیل بدافزار


مثال‌ های کاربردی

استخراج رشته‌ های معمولی از فایل اجرایی

strings program.exe > strings.txt


خروجی داخل فایل strings.txt ذخیره میشه تا بتونید راحت‌ تر سرچ کنید


استخراج رشته‌های Unicode
مخصوص ویندوز

strings -e l malware.exe > unicode_strings.txt


چون تعداد زیادی از رشته‌ها در PE Files به‌ صورت Unicode ذخیره میشن


نمایش رشته‌ ها با آدرس در فایل

strings -t x suspicious.dll | grep "http"


برای پیدا کردن URL ها و دیدن محل تقریبی اونها داخل فایل


استخراج همزمان از چند فایل

strings -f *.exe | grep "api"


نشون میده توی کدوم فایل رشته‌ ی مورد نظر رو دیدید


نکات برای تحلیل بدافزار

در تحلیل بدافزارها strings معمولا اولین  قدمه

میتونید چیزهایی مثل:

دامنه‌های C2 (Command & Control)

مسیرهای فایل‌های موقت

آدرس‌های API مشکوک

رشته‌ های رمزنگاری‌ شده قبل از دیکد شدن رو شناسایی کنید

مثلا:

strings sample.exe | grep -Ei "http|ftp|.onion|cmd|powershell"



نکته

برای فایل‌های PE یا ELF ابزارهایی مثل زیر مکمل strings هستن:

ابزار:

rabin2 -zz
استخراج رشته‌ ها با جزئیات بیشتر

binwalk
برای استخراج و آنالیز باینری‌ های Embedded


floss (FireEye)
نسخه‌ی پیشرفته‌ تر strings
که رشته‌ های رمز شده و دیکد شده هم استخراج میکنه



The strings tool is one of the basic but very useful tools in the world of forensic reverse engineering and malware analysis. This tool is used to extract readable text strings Printable Strings from binary files.

Usage

When you open a binary file like Executable exe, ELF, dll, etc., most of the data is in binary format and unreadable, but parts of it may contain ASCII or Unicode strings.

For example:

File paths

URLs

API names

Registry keys

Error messages

And even hardcoded usernames or passwords

The strings tool extracts exactly these parts.

How to use

In Linux GNU binutils

strings [options] <filename>


Simple example:

strings malware_sample.exe


This command shows all printable ASCII strings with a default length of four characters or more

Important commands

Explanation Commands

-n <number> Set the minimum string length, e.g. -n 6

-e l Search for Unicode UTF-16LE strings Important for Windows files

-t x Display the offset address of each string in hex

-a Search the entire file, even parts that are completely ignored

-f Display the file name before each string Very important for malware analysis

Useful examples

Extracting regular strings from an executable file

strings program.exe > strings.txt


The output is saved in the strings.txt file so that you can search more easily

Extracting Unicode strings
Specific to Windows

strings -e l malware.exe > unicode_strings.txt


Because a large number of strings are stored in PE Files as Unicode

Display strings with addresses in the file

strings -t x suspicious.dll | grep "http"


To find URLs and see their approximate location in the file

Extract multiple files at once

strings -f *.exe | grep "api"


Shows in which file you saw the string

Tips for malware analysis

In malware analysis, strings are usually the first step

You can find things like:
3
C2 (Command & Control) domains

Temporary file paths

Suspicious API addresses

Identify encrypted strings before decoding

For example:

strings sample.exe | grep -Ei "http|ftp|.onion|cmd|powershell"


Note

For PE or ELF files, there are tools like the following to complement strings:

Tools:

rabin2 -zz
Extract strings in more detail

binwalk
For extracting and analyzing embedded binaries

floss (FireEye)
A more advanced version of strings
that extracts both encrypted and decoded strings


@reverseengine
3