uz
Feedback

Firibgarlarga uchmang! Telemetrio bunday kanallarni topadi va belgilaydi 👉 Belgini ko‘rmoqchi bo‘lsangiz, obuna bo‘ling

ReverseEngineering

ReverseEngineering

Kanalga Telegram’da o‘tish
1 730
Obunachilar
-124 soatlar
-47 kun
+28230 kun
Postlar arxiv
Feature | CFGFast | CFGEmulated | :--- | :--- | :--- | Analysis Method | Static | Simulation-based Speed ​​| Generally faster | Generally slower Path Coverage | More limited | More comprehensive Accuracy | Lower | Higher (in certain conditions) Input Dependency | Lower | Higher Primary Use Case | Initial, rapid analysis | Analyzing control flow with execution context CFGFast is a good starting point, as it can extract an approximate control-flow structure without requiring a full execution of the program. In contrast, CFGEmulated attempts to gather more detailed information about the control flow by simulating execution paths. However, neither method guarantees the identification of every possible execution path within a program. Why is a CFG important in reverse engineering? Imagine you are dealing with a large executable file and do not yet know which parts warrant further investigation. With a CFG, you can: * Examine the overall structure of functions. * Identify significant conditional branches. * Trace the connections between basic blocks. * Analyze the paths leading to a specific function. * Select complex sections of the program for deeper analysis. Essentially, a CFG provides a map of the program's control flow. Note, however, that this map is not always complete; some connections may go undetected due to indirect jumps, obfuscated code, or inherent limitations in the analysis process. In this section, we explored the CFG and its core components, and saw how to extract the control-flow structure of an executable file using angr. We also examined the differences between CFGFast and CFGEmulated @reverseengine
12 Noy, 16:50

Note that if the executable is stripped or angr cannot recognize the function name, it may not be possible to access it with the name main Difference between CFGFast and CFGEmulated angr has two known methods for extracting CFG
12 Noy, 16:50

Part 39 Buffer Overflow
Extracting and Analyzing CFG with angr So far, we have learned how to examine the program execution paths with Symbolic Execution and find the appropriate input to reach a specific path with angr But before we go into analyzing the paths, it is better to understand the overall structure of the program This is where CFG or Control Flow Graph comes into play CFG is a graphical representation of the program execution flow and shows us how the different instructions and blocks are connected Using CFG, we can better understand the structure of conditions, loops, jumps and the relationship between functions CFG is made up of what parts? In a CFG, we usually deal with two main concepts Basic Block A Basic Block is a set of instructions whose execution starts from the beginning and continues sequentially Usually, a Basic Block has only one entry point and its execution flow is transferred to another section through the final instruction Edge Edge shows the relationship between two Basic Blocks For example, when there is a condition in the program, the program execution may be divided into two different paths Basic Block A Check the condition True Basic Block B First path False Basic Block C Second path In fact, Nodes are the Basic Blocks and Edges determine the relationship between them Creating a CFG with angr To start, we consider a simple executable file
#include <stdio.h>

int main(int argc, char **argv)

{
if (argc < 2)
return 1;

 if (argv[1][0] == 'A') {
         puts("Path A");
     } else {
         puts("Path B");
     }

     puts("Finished");

     return 0;
 }
Compile the program
gcc -O0 -fno-pie -no-pie sample.c -o sample
Now we create a Python script called cfg.py
import angr

project = angr.Project(
"./sample",
auto_load_libs=False

cfg = project.analyses.CFGFast()

print("Number of nodes:", len(cfg.graph.nodes))
print("Number of edges:", len(cfg.graph.edges))
Here we used CFGFast This analysis tries to extract the CFG of the program by examining the structure of the executable file, instructions and information about jumps Its main advantage is high speed and is also useful for initial examination of large programs Examination of Basic Blocks After creating the CFG, we can examine the blocks in the program
for node in cfg.graph.nodes():
print(
"Address:", hex(node.addr),
 "Size:", node.size,
"Function:", node.function_address
)
The information we get includes addr Basic Block starting address size Block size in bytes function_address Function address to which the block belongs Of course, some blocks may not be assigned to a specific function or their function information may not be complete Checking the connection between blocks Now we want to see what blocks each block is connected to
for source, destination in cfg.graph.edges():
print(
hex(source.addr),
"->",
hex(destination.addr)
)
The output shows the connection between the Nodes For example, if the output includes this connection
0x401150 -> 0x401160
0x401150 -> 0x401180
0x401160 ->  0x401190
0x401180 -> 0x401190
We can see that block 0x401150 has two output paths and both paths eventually reach block 0x401190 This structure usually corresponds to a condition and two execution branches Checking the CFG of a specific function Sometimes we don't need to analyze the entire program and we just want to check the structure of a specific function For this we can use the function address
main_function = cfg.kb.functions["main"]

print("Main address:", hex(main_function.addr))
print("Blocks:", len(main_function.blocks))

for block in main_function.blocks:
print(
hex(block.addr),
block.size
)
This code finds the main function from the information extracted by angr and displays the Basic Blocks related to it This method is useful when Let's focus on a specific part of the program
12 Noy, 16:50

ویژگی CFGFast | CFGEmulated | ---------------- | ------------------ | --------------------------------- | روش تحلیل استاتیک مبتنی بر شبیه‌ سازی سرعت معمولا بیشتر معمولا کمتر بررسی مسیرها محدودتر دقیق‌ تر در برخی شرایط وابستگی به ورودی کمتر بیشتر کاربرد تحلیل اولیه و سریع بررسی جریان کنترل با وضعیت اجرایی CFGFast برای شروع انتخاب مناسبیه چون بدون اجرای کامل برنامه می‌تونه ساختار تقریبی جریان کنترل رو استخراج کنه در مقابل CFGEmulated با شبیه‌ سازی مسیرهای اجرا تلاش میکنه اطلاعات بیشتری درباره جریان کنترل به دست بیاره البته هیچکدوم تضمین نمی‌کنن که تمام مسیرهای ممکن برنامه رو شناسایی کنن چرا CFG در مهندسی معکوس مهمه؟ فرض کنید با یک فایل اجرایی بزرگ رو به‌ رو هستید و هنوز نمیدونید کدوم قسمت برنامه ارزش بررسی بیشتری داره با CFG می‌تونید ساختار کلی توابع رو بررسی کنید شاخه‌های شرطی مهم رو پیدا کنید ارتباط بین Basic Blockها رو دنبال کنید مسیر رسیدن به یک تابع خاص رو بررسی کنید بخش‌های پیچیده برنامه رو برای تحلیل عمیق‌تر انتخاب کنید در واقع CFG یک نقشه از جریان کنترل برنامه در اختیارتون قرار میده البته این نقشه همیشه کامل نیست و ممکنه بعضی ارتباط‌ها به دلیل پرش‌های غیرمستقیم، کد مبهم یا محدودیت‌های تحلیل شناسایی نشن در این قسمت با CFG و اجزای اصلی اون آشنا شدیم و دیدیم چطور با angr میشه ساختار جریان کنترل یک فایل اجرایی رو استخراج کرد همچنین تفاوت CFGFast و CFGEmulated رو هم بررسی کردیم @reverseengine
12 Noy, 16:44

بخش سی و نهم بافر اورفلو
استخراج و تحلیل CFG با angr تا اینجا یاد گرفتیم چطور با Symbolic Execution مسیرهای اجرای برنامه رو بررسی کنیم و با angr ورودی مناسب برای رسیدن به یک مسیر مشخص رو پیدا کنیم اما قبل از اینکه سراغ تحلیل مسیرها بریم بهتره ساختار کلی برنامه رو بشناسیم اینجاست که CFG یا Control Flow Graph وارد ماجرا میشه CFG نمایش گرافیکی جریان اجرای برنامه هست و به ما نشون میده که دستورالعمل‌ ها و بلاک‌ های مختلف چطور به هم متصل شدن با استفاده از CFG میتونیم ساختار شرط‌ها، حلقه‌ها، پرش‌ها و ارتباط بین توابع رو بهتر درک کنیم CFG از چه بخش‌هایی تشکیل شده؟ در یک CFG معمولا با دو مفهوم اصلی سروکار داریم Basic Block یک Basic Block مجموعه‌ای از دستورالعمل‌ هاست که اجرای اون از اول شروع میشه و به‌ صورت متوالی ادامه پیدا میکنه به‌طور معمول یک Basic Block فقط یک نقطه ورود داره و جریان اجرای اون از طریق دستورالعمل پایانی به بخش دیگه‌ای منتقل میشه Edge Edge ارتباط بین دو Basic Block رو نشون میده برای مثال وقتی یک شرط در برنامه وجود داره ممکنه اجرای برنامه به دو مسیر مختلف تقسیم بشه Basic Block A بررسی شرط True Basic Block B مسیر اول False Basic Block C مسیر دوم در واقع Nodeها همون Basic Block ها هستن و Edgeها ارتباط بین اون‌ها رو مشخص میکنن ساخت CFG با angr برای شروع یک فایل اجرایی ساده در نظر میگیریم
#include <stdio.h>

int main(int argc, char **argv)
{
    if (argc < 2)
        return 1;

    if (argv[1][0] == 'A') {
        puts("Path A");
    } else {
        puts("Path B");
    }

    puts("Finished");

    return 0;
}
برنامه رو کامپایل میکنیم
gcc -O0 -fno-pie -no-pie sample.c -o sample
حالا یک اسکریپت پایتون با نام cfg.py میسازیم
import angr

project = angr.Project(
    "./sample",
    auto_load_libs=False
)

cfg = project.analyses.CFGFast()

print("Number of nodes:", len(cfg.graph.nodes))
print("Number of edges:", len(cfg.graph.edges))
اینجا از CFGFast استفاده کردیم این تحلیل تلاش میکنه با بررسی ساختار فایل اجرایی دستورالعمل‌ ها و اطلاعات مربوط به پرش‌ها، CFG برنامه رو استخراج کنه مزیت اصلیش سرعت بالاست و برای بررسی اولیه برنامه‌های بزرگ هم کاربرد داره بررسی Basic Block ها بعد از ساخت CFG میتونیم بلاک‌های موجود در برنامه رو بررسی کنیم
for node in cfg.graph.nodes():
    print(
        "Address:", hex(node.addr),
        "Size:", node.size,
        "Function:", node.function_address
    )
اطلاعاتی که میگیریم شامل این موارده addr آدرس شروع Basic Block size اندازه بلاک برحسب بایت function_address آدرس تابعی که بلاک به اون تعلق داره البته ممکنه بعضی از بلاک‌ها به تابع مشخصی نسبت داده نشن یا اطلاعات تابعی اون‌ها کامل نباشه بررسی ارتباط بین بلاک‌ ها حالا میخوایم ببینیم هر بلاک به چه بلاک‌ هایی متصل شده
for source, destination in cfg.graph.edges():
    print(
        hex(source.addr),
        "->",
        hex(destination.addr)
    )
خروجی ارتباط بین Nodeها رو نشون میده مثلا اگر خروجی شامل این ارتباط باشه
0x401150 -> 0x401160
0x401150 -> 0x401180
0x401160 -> 0x401190
0x401180 -> 0x401190
میتونیم متوجه بشیم که بلاک 0x401150 دو مسیر خروجی داره و هر دو مسیر در نهایت به بلاک 0x401190 میرسن این ساختار معمولا با یک شرط و دو شاخه اجرایی مطابقت داره بررسی CFG یک تابع مشخص گاهی لازم نیست کل برنامه رو تحلیل کنیم و فقط می‌خوایم ساختار یک تابع خاص رو بررسی کنیم برای این کار میتونیم از آدرس تابع استفاده کنیم
main_function = cfg.kb.functions["main"]

print("Main address:", hex(main_function.addr))
print("Blocks:", len(main_function.blocks))

for block in main_function.blocks:
    print(
        hex(block.addr),
        block.size
    )
این کد تابع main رو از اطلاعات استخراج‌شده توسط angr پیدا میکنه و Basic Block های مربوط به اون رو نمایش میده این روش زمانی مفیده که بخوایم روی یک بخش مشخص از برنامه تمرکز کنیم توجه کنید که اگر فایل اجرایی stripped باشه یا angr نتونه نام تابع رو تشخیص بده، ممکنه دسترسی با نام main امکان‌پذیر نباشه تفاوت CFGFast و CFGEmulated angr دو روش شناخته‌ شده برای استخراج CFG داره
12 Noy, 16:44

FIFO and FCFS and the Convoy Effect Problem The First Processor Scheduling Algorithm Let's go to one of the simplest CPU Scheduling Algorithms FIFO or FCFS
First Come, First Served 
The idea is very simple Any Process that enters the Ready queue first gets the CPU first How does FIFO work? Suppose we have three Jobs
B = 3ms
C = 3ms 
All enter the system at time zero The Scheduler executes them in the order they entered
Timeline
0 24 27 30 |-----------------|-----|----| A B C
That is, first A must be completely executed so that B can take its turn
After B is finished, it is C's turn
Calculating scheduling criteria
For each job, we calculate the waiting time and response time

Because everyone logged in at time zero
Turnaround = Completion - Arrival
Result
A = 24ms B = 27ms C = 30ms
Average Turnaround
(24 + 27 + 30) / 3
= 27ms
Average Response Time in this example is also equal to
(0 + 24 + 27) / 3 = 17ms
Do you see the problem?

Jobs B and C only require 3ms of CPU time, but they have to wait a long time
What is the main problem with FIFO?
 Suppose a long job enters the queue
After that, several short jobs enter

Ready Queue

┌──────────────────┐
│ A = 100ms │
├─  No short jobs

Suppose a large job is constantly waiting for I/O operations
In this situation, the CPU may remain idle while other jobs cannot be executed properly due to queueing
Of course, the exact behavior depends on how the operating system manages queues and I/O

Is FIFO always bad?
 No

FIFO has several advantages

Simple implementation

Low administrative overhead

Predictable execution order

Prevents starvation due to fixed priorities in situations where jobs eventually finish and the queue is limited

But it is not a good choice for interactive systems

Because the user expects short programs to respond quickly

For example, when you click on a window

It does not make sense for the system to first complete a long CPU-bound task and then wait for your click

The relationship between FIFO and CPU-bound and I/O-bound

To better understand the Convoy Effect, we need to understand two types of behavior

CPU-bound

A program that spends most of its execution time on CPU calculations
CPU → CPU → CPU → CPU → CPU
I/O-bound

A program that constantly waits for input and output operations
CPU → I/O → CPU → I/O → CPU
In a real system, there is a combination of these two types of programs

If a long CPU-bound job is ahead of short I/O-bound jobs  It may reduce the effective use of system resources

Of course, when a job stops for I/O, it is removed from the Ready queue and the Scheduler can execute other ready jobs

The Convoy Effect problem is most evident when I/O-bound jobs are placed behind a long-running job after each return from I/O
Relationship with Reverse Engineering
This is also important in analyzing program behavior
Suppose a program has multiple threads
Process A ├── Thread 1 ├── Thread 2 └── Thread 3
If one of the threads occupies the CPU for a long time, other threads may wait to execute
As a result, you may encounter behaviors such as:
Delay in program response
Change in the order of thread execution
Delay in event processing
Change in the timing of concurrent operations
So when analyzing a multithreaded binary, it is not enough to know only the order of instructions
We must also consider the behavior of the Scheduler and the state of the threads

FIFO
One of the simplest scheduling algorithms  Yes

The rule is
First Come ↓ First Served ` But the main problem is that short jobs may wait behind a long job We call this problem Convoy Effect @reverseengine
12 Noy, 16:09

FIFO و FCFS و مشکل Convoy Effect اولین الگوریتم زمان‌ بندی پردازنده میریم سراغ یکی از ساده‌ترین الگوریتم‌ های CPU Scheduling FIFO یا FCFS
First In, First Out
First Come, First Served
ایده خیلی ساده‌ ست هر Process که زودتر وارد صف Ready بشه زودتر CPU رو دریافت میکنه FIFO چطور کار میکنه؟ فرض کنید سه Job داریم
A = 24ms
B = 3ms
C = 3ms
همه توی زمان صفر وارد سیستم شدن Scheduler اون‌ها رو به ترتیب ورود اجرا میکنه
A → B → C
Timeline
0                 24    27    30
|-----------------|-----|-----|
        A            B     C
یعنی ابتدا A باید کاملا اجرا بشه تا B نوبت بگیره بعد از پایان B هم نوبت به C میرسه محاسبه معیارهای زمان‌ بندی برای هر Job زمان انتظار و زمان پاسخ رو محاسبه میکنیم چون همه توی زمان صفر وارد سیستم شدن
Turnaround = Completion - Arrival
نتیجه
A = 24ms
B = 27ms
C = 30ms
میانگین Turnaround
(24 + 27 + 30) / 3

= 27ms
میانگین Response Time هم توی این مثال برابر میشه با
(0 + 24 + 27) / 3

= 17ms
مشکل رو میبینید؟ Job های B و C فقط 3ms زمان CPU لازم دارن اما باید مدت زیادی منتظر بمونن مشکل اصلی FIFO چیه؟ فرض کنید یه Job طولانی وارد صف بشه بعد از اون چند Job کوتاه هم وارد بشن
Ready Queue

┌─────────────┐
│ A = 100ms   │
├─────────────┤
│ B = 2ms     │
├─────────────┤
│ C = 2ms     │
├─────────────┤
│ D = 2ms     │
└─────────────┘
چون FIFO ترتیب ورود رو حفظ میکنه Job های کوتاه مجبور میشن منتظر تموم‌شدن A بمونن در نتیجه حتی کارهای خیلی کوچک هم ممکنه با تأخیر زیادی اجرا بشن Convoy Effect به این مشکل Convoy Effect میگیم Convoy یعنی گروهی از Job های کوچک پشت یه Job بزرگ گیر میفتن مثلا:
Long Job
    │
    ▼
CPU = 100ms
    │
    ▼
Short Job 1
    │
    ▼
Short Job 2
    │
    ▼
Short Job 3
مشکل فقط تاخیر Jobهای کوتاه نیست فرض کنید Job بزرگ مرتبا منتظر عملیات I/O میمونه توی این شرایط ممکنه CPU بیکار بمونه در حالی که Job های دیگه هم به دلیل ترتیب صف نتونن به شکل مناسبی اجرا بشن البته رفتار دقیق به نحوه مدیریت صف‌ها و I/O در سیستم‌عامل بستگی داره FIFO همیشه بده؟ نه FIFO چند تا مزیت داره پیاده‌سازی ساده سربار مدیریتی کم ترتیب اجرای قابل پیش‌بینی جلوگیری از گرسنگی ناشی از اولویت‌ های ثابت در شرایطی که Job ها نهایتا تموم بشن و صف محدود باشه اما برای سیستم‌ های تعاملی انتخاب مناسبی نیست چون کاربر انتظار داره برنامه‌ های کوتاه سریع پاسخ بگیرن مثلا وقتی روی یه پنجره کلیک میکنید منطقی نیست سیستم ابتدا یه کار CPU-bound طولانی رو کامل کنه و بعد به کلیک شما برسه ارتباط FIFO با CPU-bound و I/O-bound برای درک بهتر Convoy Effect باید دو نوع رفتار رو بشناسیم CPU-bound برنامه‌ای که بیشتر زمان اجرای خودش رو صرف محاسبات CPU میکنه
CPU → CPU → CPU → CPU → CPU
I/O-bound برنامه‌ای که مرتبا منتظر عملیات ورودی و خروجی میمونه
CPU → I/O → CPU → I/O → CPU
توی یه سیستم واقعی ترکیبی از این دو نوع برنامه وجود داره اگر یه Job طولانی CPU-bound جلوی Job های کوتاه و I/O-bound قرار بگیره ممکنه استفاده موثر از منابع سیستم کاهش پیدا کنه البته وقتی یه Job برای I/O متوقف میشه از صف Ready خارج میشه و Scheduler میتونه Jobهای آماده دیگه رو اجرا کنه مشکل Convoy Effect بیشتر وقتی خودش رو نشون میده که Jobهای I/O-bound بعد از هر بار برگشت از I/O دوباره پشت یه Job طولانی قرار بگیرن ارتباط با Reverse Engineering این موضوع توی تحلیل رفتار برنامه‌ها هم اهمیت داره فرض کنید یه برنامه چند Thread داره
Process A
 ├── Thread 1
 ├── Thread 2
 └── Thread 3
اگر یکی از Thread ها برای مدت زیادی CPU رو اشغال کنه Threadهای دیگه ممکنه برای اجرا منتظر بمونن در نتیجه ممکنه با رفتارهایی مثل موارد زیر مواجه بشید تأخیر در پاسخ برنامه تغییر ترتیب اجرای Threadها تأخیر در پردازش رویدادها تغییر زمان‌بندی عملیات همزمان پس هنگام تحلیل یه Binary چندنخی فقط دونستن ترتیب دستورها کافی نیست باید رفتار Scheduler و وضعیت Threadها رو هم در نظر بگیریم FIFO یکی از ساده‌ترین الگوریتم‌ های Scheduling هست قانونش اینه
First Come
     ↓
First Served
اما مشکل مهمش اینه که Job های کوتاه ممکنه پشت یه Job طولانی منتظر بمونن به این مشکل میگیم Convoy Effect @reverseengine
12 Noy, 16:04

|
              v
        Detection Logic
              |
              v 
Alert In this architecture, events can be related based on time, Process ID, Thread ID, and other properties For example, a process alone does not behave suspiciously, but a set of events related to it may require security investigation The important point is that EDRs do not necessarily use only ETW Depending on the product, they may also use Kernel Callbacks, proprietary network information sensors, and other sources Limitations of ETW No event logging system is perfect and without limitations There are also several important issues in ETW Event Loss If the volume of events is large or the collection resources are insufficient, some events may be lost Provider Coverage Each provider only provides information related to its own domain Session Configuration Session settings determine which events are collected Event Interpretation Logging an event alone does not mean understanding the behavior of the application Its information must be analyzed For this reason, we should not assume that everything in The system event must have been recorded in ETW Practical exercise with Windows tools You can use official Microsoft tools to get familiar with ETW Windows Performance Recorder Used to start and manage Windows performance traces Windows Performance Analyzer (WPA) Used to open and analyze trace files and examine the timeline of events Sysmon Used to record security information about processes, network connections, and other events in the Windows Event Log Sysmon documentation A good exercise is to record a trace of normal system activity with WPR and then open it in WPA Pay attention to timestamps, processes, and event relationships The mental model of ETW looks like this
|
v
Generate Event
|
v
ETW Session
|
v
Consumer
|
v
Event Analysis
|
 v
Behavior Correlation 
A few things to remember ETW is the Event Logging and Transport Infrastructure in Windows Provider generates events Controller manages the Session Consumer receives and analyzes events EDR can use ETW as a source of Telemetry The absence of an Event does not mean that the behavior is not certain @reverseengine
12 Noy, 15:56

ETW and Windows Event Tracing How does Windows record events in the system? So far, we have talked about API Call Tracing and analyzing process behavior Now we come to one of the important Windows mechanisms that plays a big role in the EDR architecture of malware analysis and system behavior analysis The name of this mechanism ETW = Event Tracing for Windows In simple terms, ETW is an internal Windows infrastructure that allows various system components to generate and record events so that other tools can receive and analyze them ETW Suppose a Process runs, opens a file, or establishes a network connection The operating system and some software can publish information about these events in the form of Events ETW provides an infrastructure to manage this flow of events Simple model
|
v
ETW Events
|
v
Event Session
|
v
Consumer
|
 v
Event Analysis 
It is important to note that ETW itself is not an antivirus or EDR It is just an infrastructure for generating and receiving events Main parts of ETW To understand ETW, we need to know three terms
Provider Controller Consumer
Each has a specific task Provider Is a part of the system or a software that generates Events For example:
|
v
ETW Provider
|
v
Event Generation 
A Provider can publish information about specific activities For example, some Providers provide events related to Kernel, Process, Network or application performance Controller Is responsible for managing ETW Session For example, it can create or stop Session and manage settings related to Event collection Consumer Is a program that receives and processes the generated Events For example, a monitoring tool can receive Events and display them in an understandable way Overview Provider
|  Generate Events
    v
 ETW Session
    |
    v
 Consumer
    |
    v
Analysis 
ETW Session To collect events from ETW, a concept called Session is usually used Session determines which events are to be collected with which settings Example:
│
├── Provider A
├── Provider B
├── Provider C
│
└── Event Collection 
A Session can receive events from multiple Providers Of course, each Provider does not necessarily publish all its events in each Session Settings and activation level are important Difference between Provider and Event Do not confuse these two concepts Provider is the source of event generation Event is a specific event or information that is published from that source For example: Provider: Microsoft-Windows-Kernel-Process Events: Process Start Process Stop Other Process Events This example is only to understand the relationship between Provider and Event and is not a complete list of Provider events Each Event can have information such as the following
Process ID Thread ID Timestamp Event ID Event Data
 This information is We help correlate different events Use of ETW in Security Analysis Suppose a program is running and we want to examine its behavior Just seeing the Process is not enough We may want to know What processes were created What modules were loaded What system-wide activities occurred What events are related to a specific Process What was the sequence of events ETW can be used to collect some of this information Analytic model
+
Image Load Events
+
System Events
+
Network Events
|
v
Event Correlation
|
v
Behavior Analysis 
Of course, not all of this information is necessarily obtained from a Provider or even just from ETW ETW connection with EDR One of the important uses of ETW is to provide Telemetry for monitoring and security tools Suppose an EDR wants to examine the behavior of a Process It may receive information from several sources
|
┌─────────┐
| |
 ETW Other Sensors
       |              |
       └──────┬──────┘
              |
              v
        Event Pipeline
              |
              v
12 Noy, 15:54

Correlation
             |
             v
       Detection Logic
             |
             v
          Alert
توی این معماری Event ها میتونن بر اساس زمان Process ID، Thread ID و سایر ویژگی‌ها با هم مرتبط بشن مثلا یه Process به‌تنهایی رفتار مشکوکی نداره اما مجموعه‌ای از رویدادهای مرتبط با اون ممکنه نیاز به بررسی امنیتی داشته باشن نکته مهم اینه که EDRها الزاما فقط از ETW استفاده نمیکنن بسته به محصول ممکنه از Kernel Callbackها، سنسورهای اختصاصی اطلاعات شبکه و منابع دیگه هم استفاده کنن محدودیت‌ های ETW هیچ سیستم ثبت رویدادی کامل و بدون محدودیت نیست توی ETW هم چند موضوع مهم وجود داره Event Loss اگر حجم Event ها زیاد باشه یا منابع جمع‌آوری کافی نباشن، ممکنه بعضی رویدادها از دست برن Provider Coverage هر Provider فقط اطلاعات مربوط به حوزه خودش رو ارائه میده Session Configuration تنظیمات Session تعیین میکنن چه Eventهایی جمع‌آوری بشن Event Interpretation ثبت یه Event به‌تنهایی به معنی درک رفتار برنامه نیست باید اطلاعاتش تحلیل بشه به همین دلیل ما نباید فرض کنیم هر چیزی که توی سیستم اتفاق افتاده حتما در ETW هم ثبت شده تمرین عملی با ابزارهای ویندوز برای آشنایی با ETW میتونید از ابزارهای رسمی Microsoft استفاده کنید Windows Performance Recorder (WPR) برای شروع و مدیریت Traceهای عملکردی ویندوز استفاده میشه مستندات WPR Windows Performance Analyzer (WPA) برای باز کردن و تحلیل فایل‌های Trace و بررسی Timeline رویدادها استفاده میشه مستندات WPA Sysmon برای ثبت اطلاعات امنیتی درباره Process ها Network Connection ها و رویدادهای دیگه در Windows Event Log استفاده میشه مستندات Sysmon یه تمرین مناسب اینه که با WPR یه Trace از فعالیت عادی سیستم ثبت کنید و بعد اون رو توی WPA باز کنید به Timestampها، Processها و ارتباط Eventها توجه کنید مدل ذهنی ETW به این شکله
Provider
   |
   v
Generate Event
   |
   v
ETW Session
   |
   v
Consumer
   |
   v
Event Analysis
   |
   v
Behavior Correlation
چند نکته رو به خاطر داشته باشید ETW زیرساخت ثبت و انتقال Event در ویندوزه Provider رویداد تولید میکنه Controller Session رو مدیریت میکنه Consumer رویدادها رو دریافت و تحلیل میکنه EDR میتونه از ETW به‌عنوان یکی از منابع Telemetry استفاده کنه نبودن یه Event به معنی نبودن قطعی اون رفتار نیست @reverseengine
12 Noy, 15:51

ETW و Windows Event Tracing ویندوز چطور اتفاقات داخل سیستم رو ثبت میکنه؟ تا اینجا درباره API Call Tracing و تحلیل رفتار Process ها صحبت کردیم حالا میرسیم به یکی از مکانیزم‌های مهم ویندوز که توی معماری EDR تحلیل بدافزار و بررسی رفتار سیستم نقش زیادی داره اسم این مکانیزم ETW = Event Tracing for Windows به زبان ساده ETW یه زیرساخت داخلی ویندوزه که به اجزای مختلف سیستم اجازه میده رویدادها رو تولید و ثبت کنن تا ابزارهای دیگه بتونن اون‌ها رو دریافت و تحلیل کنن ETW فرض کنید یه Process اجرا میشه یه فایل باز میکنه یا یه ارتباط شبکه‌ای برقرار میکنه سیستم‌ عامل و بعضی نرم‌افزارها میتونن اطلاعات مربوط به این اتفاقات رو به شکل Event منتشر کنن ETW زیرساختی برای مدیریت این جریان رویدادها فراهم میکنه مدل ساده
Application / Windows
         |
         v
     ETW Events
         |
         v
    Event Session
         |
         v
      Consumer
         |
         v
    Event Analysis
نکته مهم اینه که ETW خودش یه آنتی‌ویروس یا EDR نیست فقط زیرساختی برای تولید و دریافت رویدادهاست بخش‌های اصلی ETW برای درک ETW باید سه اصطلاح رو بشناسیم
Provider
Controller
Consumer
هرکدوم وظیفه مشخصی دارن Provider بخشی از سیستم یا یه نرم‌افزاره که Event تولید میکنه مثلا:
Windows Component
       |
       v
ETW Provider
       |
       v
Event Generation
یه Provider میتونه اطلاعات مربوط به فعالیت‌های مشخصی رو منتشر کنه برای مثال بعضی Providerها رویدادهای مرتبط با Kernel، Process، شبکه یا عملکرد برنامه‌ها رو ارائه میدن Controller وظیفه مدیریت ETW Session رو بر عهده داره برای مثال میتونه Session رو ایجاد یا متوقف کنه و تنظیمات مربوط به جمع‌آوری Eventها رو مدیریت کنه Consumer برنامه‌ ایه که Event های تولیدشده رو دریافت و پردازش میکنه مثلا یه ابزار مانیتورینگ میتونه Event ها رو دریافت کنه و به شکل قابل فهم نمایش بده نمای کلی
Provider
   |
   | Generate Events
   v
ETW Session
   |
   v
Consumer
   |
   v
Analysis
ETW Session برای جمع کردن Event ها از ETW معمولا از مفهومی به نام Session استفاده میشه Session مشخص میکنه چه رویدادهایی با چه تنظیماتی جمع‌آوری بشن مثال:
ETW Session
│
├── Provider A
├── Provider B
├── Provider C
│
└── Event Collection
یه Session میتونه Eventهای چند Provider رو دریافت کنه البته هر Provider الزاما تمام Event های خودش رو توی هر Session منتشر نمیکنه تنظیمات و سطح فعال‌سازی اهمیت دارن تفاوت Provider و Event این دو مفهوم رو با هم اشتباه نگیرید Provider منبع تولید رویداده Event یه اتفاق یا اطلاعات مشخصیه که از اون منبع منتشر میشه مثلا:
Provider:
Microsoft-Windows-Kernel-Process

Events:
    Process Start
    Process Stop
    Other Process Events
این مثال فقط برای درک ارتباط Provider و Event هست و فهرست کامل رویدادهای Provider محسوب نمیشه هر Event میتونه اطلاعاتی مثل موارد زیر داشته باشه
Process ID Thread ID Timestamp Event ID Event Data
این اطلاعات به ما کمک میکنن اتفاقات مختلف رو به هم مرتبط کنه کاربرد ETW در تحلیل امنیتی فرض کنید یه برنامه در حال اجراست و میخوایم رفتارش رو بررسی کنیم صرفا دیدن Process کافی نیست ممکنه بخوایم بدونیم چه Process هایی ایجاد شدن چه Module هایی بارگذاری شدن چه فعالیت‌ هایی در سطح سیستم اتفاق افتاده چه رویداد هایی با یه Process مشخص ارتباط دارن ترتیب اتفاقات چطور بوده ETW میتونه برای جمع کردن بخشی از این اطلاعات استفاده بشه مدل تحلیلی
Process Events
      +
Image Load Events
      +
System Events
      +
Network Events
      |
      v
Event Correlation
      |
      v
Behavior Analysis
البته همه این اطلاعات الزاما از یه Provider یا حتی فقط از ETW به دست نمیان ارتباط ETW با EDR یکی از کاربردهای مهم ETW فراهم کردن Telemetry برای ابزارهای مانیتورینگ و امنیتیه فرض کنید یه EDR میخواد رفتار یه Process رو بررسی کنه ممکنه اطلاعاتی از چند منبع دریافت کنه
Windows
             |
      ┌──────┴──────┐
      |             |
     ETW        Other Sensors
      |             |
      └──────┬──────┘
             |
             v
       Event Pipeline
             |
             v
12 Noy, 15:51

Because, as is often the case, the entire logic for program execution is not embedded directly within the instructions. @reverseengine
12 Noy, 15:36

But in Windows x64, the presence of Unwind Metadata is very important For example:
mov rbx, rcx 
These commands are part of building the Stack Frame and saving the Registers To restore the previous state, the system needs to know What registers were saved How much Stack Space was allocated How to restore the previous state of the Stack This information is recorded in Unwind Metadata So when analyzing Windows binaries, examining ".pdata" and ".xdata" can help to better understand the structure of the functions Exception Handling In GCC and Clang In programs built with GCC or Clang and using the "Itanium C++ ABI", the structure of Exception Handling is different One of the important concepts in this model "LSDA" stands for "Language-Specific Data Area" This information specifies what behaviors exist for Exceptions in different areas of a function Including Which areas of code are Cleanup Need -Which Handlers can receive a specific Exception Where should execution control be transferred to in case of an Exception In some ELF binaries, we can find information related to this process in sections such as the following .gcc_except_table Of course, we should note that ".eh_frame" mostly contains information related to Call Frame and Unwinding, and LSDA information is usually obtained through References in the Frame-related information Also, the exact structure depends on the Compiler and Build and ABI settings The Role of Personality Function In the Itanium ABI-based Exception Handling model, there is a concept called "Personality Function" This function is responsible for interpreting information related to Exception Handling for the relevant language or Runtime For example, in GCC for ++C, we may encounter this symbol __gxx_personality_v0 This function plays a role in the Handler and Cleanup process If we find such symbols in the Binary, they can be a clue to the existence of an Exception Handling mechanism Be based on C++ Of course, the presence of this symbol alone does not determine the complete structure of Exception Handling How to check Exception Handling in Ghidra When analyzing a Binary, we can follow this path Windows x64 Check the ".pdata" section Find references to "RUNTIME_FUNCTION" Follow the Unwind Information address Check the "UNWIND_INFO" structures Analyze the paths related to the Exception if there is a Handler or related information Linux and ELF Check the ".eh_frame" section Look for ".gcc_except_table" - Check symbols like "__gxx_personality_v0" Follow the references related to LSDA Match the Cleanup and Handler paths with the Disassembly The goal is to combine the Metadata information with the actual Control Flow of the program An important point about Control Flow analysis Suppose in a We have a function with this structure Resource a;
operation();
}
catch (...) {
handle_error();
}
} 
We may see several different paths in Disassembly
| v operation() | +------ Success | | | v | Cleanup | +------ Exception | v Exception Handler | v Cleanup
The point here is that the Exception path is not necessarily the same as a regular Jump in the code The Runtime may find the appropriate path using Metadata and Unwind Mechanism Therefore, if we only look at Direct Branches, we may miss part of the Control Flow of the program For Reverse Engineering of C++ programs, Exception Handling is not just a language feature and is considered part of the Binary Execution Structure
|
v
Stack Unwinding
|
v
Cleanup / Destructor
|
v
Exception Metadata
|
+------ Windows x64
| |
|  +-- .pdata
| +-- .xdata
| +-- UNWIND_INFO
|
+------ Itanium ABI
|
+-- .eh_frame
+-- LSDA
+-- Personality Function 
The main point is that when analyzing Binary, in addition to Assembly instructions, we must also examine the peripheral information related to the execution of the program
12 Noy, 15:36

Why Unwind Metadata is more important on x64 In older architectures, it was possible to extract much of the Stack Frame information from the Prologue and Epilogue instructions
12 Noy, 15:34

C++ Exception Handling Inside Reverse Engineering Exception Handling In ++C, when something unusual happens during program execution, we can use "Exception Handling" to move the program execution path to a specific section For example:
throw std::runtime_error("Invalid value");
}
}

int main() {
try {
process(-1);
}
catch (const std::exception& e) {
// Handle exception
}
} 
Here, the "process" function throws an Exception But the important thing is that the program does not go directly from the "throw" location to the next instruction Runtime should check which Handler is responsible for handling this Exception This process includes steps such as finding the appropriate Handler and freeing resources related to functions that are removed from the Stack This process is usually called "Stack Unwinding" Stack Unwindin Suppose several functions are executed in succession | v function_A() | v function_B() | v function_C() Now an Exception is thrown inside "function_C" If "function_C" cannot handle it, the Exception is passed to the calling function If "function_B" also does not have a suitable Handler, the Handler search process continues to "function_A" This process continues until a suitable Handler is found
|
| throw
v
function_B()
|
v
function_A()
|
v
main()
|
 v
catch(...) 
During this path, local resources of functions that are removed from the stack must be properly freed For example, the destructor of local objects must be executed This is very important in C++ because resource management is an important part of the language's execution model Why is Stack Unwinding Important for Reverse Engineering Suppose we examine a function in Disassembly and see that it has several different exit paths Some of these paths may be related to normal execution of the function and some are used for Exception Handling If we misinterpret these paths, we may not understand the actual Control Flow of the program correctly For example: Resource resource;
 } 
If "risky_operation" throws an Exception, the Destructor of "resource" should be executed in the Stack Unwinding path So we may see paths in the Binary that at first glance look like normal function execution but are actually used for Cleanup and Exception handling This is especially important when we want to reconstruct the program execution paths and the relationship between functions from the Assembly Exception Handling In Windows x64 In Windows x64, the Exception Handling system uses side information stored in special sections of the executable file One of the important sections ".pdata" This section usually contains information about the address range of functions and Unwind Information Another important section ".xdata" which holds more information about how to unwind the Stack Of course, these names are related to common sections in PE files and do not necessarily exist in all Binaries with the same name One of the important structures in this model "RUNTIME_FUNCTION" This structure is the scope Specifies the address of a function and its unwind information Conceptually RUNTIME_FUNCTION BeginAddress EndAddress UnwindInfoAddress These fields are stored as RVA in 64-bit Windows The information in this structure allows the system to find the function scope and its unwind information when needed UNWIND_INFO The "UNWIND_INFO" structure holds information about how to reconstruct the state of the function's execution For example, suppose a function uses Stack Space
sub rsp, 0x40
In order for the system to unwind this function, it needs to know how the Stack Frame was constructed Unwind information can include the following: The size of the space allocated to the Stack Nonvolatile registers stored How to recover the registers Exception Handler information, if any As a result, Unwind Information is not just for C++ exceptions Windows uses this mechanism for things like Stack Walking And also uses Thread Execution State Recovery
12 Noy, 15:34

چون همیشه همه منطق اجرای برنامه مستقیما داخل Instruction ها قرار نگرفته @reverseengine
12 Noy, 15:25

اما داخل Windows x64 وجود Unwind Metadata اهمیت زیادی داره مثلا:
sub rsp, 0x40
mov rbx, rcx 
این دستور ها بخشی از ساخت Stack Frame و ذخیره Registerها هستن سیستم برای برگردوندن وضعیت قبلی باید بدونه چه Register هایی ذخیره شدن چه مقدار Stack Space اختصاص داده شده وضعیت قبلی Stack چطور بازیابی بشه این اطلاعات در Unwind Metadata ثبت میشن پس موقع تحلیل Binaryهای ویندوزی بررسی ".pdata" و ".xdata" میتونه به فهم بهتر ساختار توابع کمک کنه Exception Handling در GCC و Clang در برنامه‌هایی که با GCC یا Clang و با استفاده از "Itanium C++ ABI" ساخته میشن ساختار Exception Handling متفاوته یکی از مفاهیم مهم در این مدل "LSDA" مخفف "Language-Specific Data Area" هست این اطلاعات مشخص میکنن که در محدوده‌ های مختلف یه تابع چه رفتار هایی برای Exception وجود داره از جمله کدوم محدوده‌های کد به Cleanup نیاز دارن -کدوم Handlerها میتونن Exception مشخصی رو دریافت کنن در صورت بروز Exception کنترل اجرا باید به کجا منتقل بشه در بعضی Binaryهای ELF اطلاعات مرتبط با این فرایند رو میتونیم در بخش‌هایی مثل موارد زیر پیدا کنیم
.gcc_except_table 
البته باید توجه کنیم که ".eh_frame" بیشتر شامل اطلاعات مربوط به Call Frame و Unwinding هست و اطلاعات LSDA معمولا از طریق Referenceهای موجود در اطلاعات مرتبط با Frame به دست میان همچنین ساختار دقیق به Compiler و تنظیمات Build و ABI بستگی داره نقش Personality Function در مدل Exception Handling مبتنی بر Itanium ABI مفهومی به نام "Personality Function" وجود داره این تابع مسئول تفسیر اطلاعات مربوط به Exception Handling برای زبان یا Runtime مربوطه است مثلاً در GCC برای ++C ممکنه با این Symbol مواجه بشیم __gxx_personality_v0 این تابع در فرایند بررسی Handler ها و Cleanup ها نقش داره اگر در Binary اینجور Symbol هایی پیدا کنیم میتونن سرنخی از وجود سازوکار Exception Handling مبتنی بر ++C باشن البته وجود این Symbol به‌ تنهایی ساختار کامل Exception Handling رو مشخص نمیکنه چطور Exception Handling رو در Ghidra بررسی کنیم موقع تحلیل یه Binary می‌تونیم این مسیر رو دنبال کنیم Windows x64 بخش ".pdata" رو بررسی کنید Reference های مربوط به "RUNTIME_FUNCTION" رو پیدا کنید آدرس Unwind Information رو دنبال کنید ساختارهای "UNWIND_INFO" رو بررسی کنید اگر Handler یا اطلاعات مرتبط وجود داشت مسیرهای مربوط به Exception رو تحلیل کنید Linux و ELF بخش ".eh_frame" رو بررسی کنید دنبال ".gcc_except_table" بگردید - Symbol هایی مثل "__gxx_personality_v0" رو بررسی کنید Reference های مرتبط با LSDA رو دنبال کنید مسیر های Cleanup و Handler رو با Disassembly تطبیق بدید هدف اینه که اطلاعات Metadata رو با Control Flow واقعی برنامه ترکیب کنیم یه نکته مهم درباره تحلیل Control Flow فرض کنید توی یه تابع چنین ساختاری داریم
    Resource a;

    try {
        operation();
    }
    catch (...) {
        handle_error();
    }
} 
ممکنه در Disassembly چند مسیر مختلف ببینیم
       |
       v
  operation()
       |
       +------ Success
       |          |
       |          v
       |       Cleanup
       |
       +------ Exception
                  |
                  v
             Exception Handler
                  |
                  v
               Cleanup 
نکته اینجاست که مسیر Exception حتما شبیه یه Jump معمولی در کد نیست ممکنه Runtime با استفاده از Metadata و Unwind Mechanism مسیر مناسب رو پیدا کنه بنابراین اگر فقط به Direct Branch ها نگاه کنیم ممکنه بخشی از Control Flow برنامه رو از دست بدیم برای Reverse Engineering برنامه‌ های C++ Exception Handling فقط یه قابلیت زبانی نیست و بخشی از ساختار اجرایی Binary محسوب میشه مفاهیم مهم
       |
       v
Stack Unwinding
       |
       v
Cleanup / Destructor
       |
       v
Exception Metadata
       |
       +------ Windows x64
       |          |
       |          +-- .pdata
       |          +-- .xdata
       |          +-- UNWIND_INFO
       |
       +------ Itanium ABI
                  |
                  +-- .eh_frame
                  +-- LSDA
                  +-- Personality Function 
نکته اصلی اینه که موقع تحلیل Binary باید علاوه بر دستور های Assembly اطلاعات جانبی مربوط به اجرای برنامه رو هم بررسی کنیم
12 Noy, 15:25

C++ Exception Handling داخل Reverse Engineering Exception Handling در ++C وقتی یه اتفاق غیر عادی موقع اجرای برنامه رخ میده میتونیم با استفاده از "Exception Handling" مسیر اجرای برنامه رو به یه بخش مشخص منتقل کنیم مثلا
    if (value < 0) {
        throw std::runtime_error("Invalid value");
    }
}

int main() {
    try {
        process(-1);
    }
    catch (const std::exception& e) {
        // Handle exception
    }
} 
اینجا تابع "process" یه Exception ایجاد میکنه اما نکته مهم اینه که برنامه مستقیما از محل "throw" به دستور بعدی نمیره Runtime باید بررسی کنه که کدوم Handler مسئول رسیدگی به این Exception هست این فرایند شامل مراحلی مثل پیدا کردن Handler مناسب و آزادسازی منابع مربوط به توابعی میشه که از Stack خارج میشن به این فرایند معمولاً "Stack Unwinding" گفته میشه Stack Unwindin فرض کنید چند تابع پشت سر هم اجرا شدن
  |
  v
function_A()
  |
  v
function_B()
  |
  v
function_C() 
حالا داخل "function_C" یه Exception ایجاد میشه اگر "function_C" نتونه اون رو مدیریت کنه Exception به تابع فراخواننده منتقل میشه اگر "function_B" هم Handler مناسبی نداشته باشه فرایند جست‌ و جو Handler به "function_A" ادامه پیدا میکنه این روند ادامه پیدا میکنه تا یه Handler مناسب پیدا بشه به‌صورت مفهومی
    |
    | throw
    v
function_B()
    |
    v
function_A()
    |
    v
main()
    |
    v
catch(...) 
در طول این مسیر منابع محلی توابعی که از Stack خارج میشن باید به شکل مناسبی آزاد بشن مثلا Destructor مربوط به Objectهای محلی باید اجرا بشه این موضوع توی ++C اهمیت زیادی داره چون مدیریت منابع بخش مهمی از مدل اجرای این زبان محسوب میشه چرا Stack Unwinding برای Reverse Engineering مهمه فرض کنید توی Disassembly یه تابع رو بررسی میکنیم و می‌بینیم چند مسیر خروج متفاوت داره بعضی از این مسیرها ممکنه مربوط به اجرای عادی تابع باشن و بعضی دیگه برای Exception Handling استفاده بشن اگر این مسیرها رو اشتباه تفسیر کنیم ممکنه Control Flow واقعی برنامه رو درست متوجه نشیم برای مثال
    Resource resource;

    risky_operation();
} 
اگر "risky_operation" یه Exception ایجاد کنه Destructor مربوط به "resource" باید در مسیر Stack Unwinding اجرا بشه بنابراین ممکنه توی Binary مسیرهایی ببینیم که در نگاه اول شبیه اجرای عادی تابع به نظر میرسن اما در واقع برای Cleanup و مدیریت Exception استفاده میشن این موضوع به‌خصوص وقتی مهمه که بخوایم مسیرهای اجرای برنامه و ارتباط بین توابع رو از روی Assembly بازسازی کنیم Exception Handling در Windows x64 در Windows x64 سیستم Exception Handling از اطلاعات جانبی ذخیره‌ شده در بخش‌های مخصوص فایل اجرایی استفاده میکنه یکی از بخش‌ های مهم ".pdata" این بخش معمولا شامل اطلاعات مربوط به محدوده آدرس توابع و Unwind Information هست بخش مهم دیگه ".xdata" که اطلاعات بیشتری درباره نحوه Unwind کردن Stack نگه می‌داره البته این اسم ها مربوط به Section های رایج در فایل‌های PE هستن و لزوما در تمام Binary ها با همین نام وجود ندارن یکی از ساختارهای مهم در این مدل "RUNTIME_FUNCTION" این ساختار محدوده آدرس یه تابع و اطلاعات مربوط به Unwind اون رو مشخص میکنه به‌صورت مفهومی RUNTIME_FUNCTION ------------------------- BeginAddress EndAddress UnwindInfoAddress این فیلدها در نسخه 64 بیتی Windows به‌صورت RVA ذخیره میشن اطلاعات موجود در این ساختار به سیستم اجازه میده در زمان نیاز محدوده تابع و اطلاعات مربوط به Unwind اون رو پیدا کنه UNWIND_INFO ساختار "UNWIND_INFO" اطلاعات مربوط به نحوه بازسازی وضعیت اجرای تابع رو نگه میداره مثلا فرض کنید یه تابع از Stack Space استفاده کرده `` sub rsp, 0x40 ` برای اینکه سیستم بتونه از این تابع Unwind کنه، باید بدونه Stack Frame چطور ساخته شده اطلاعات Unwind میتونه شامل موارد زیر باشه اندازه فضای اختصاص‌ یافته به Stack -Register های Nonvolatile ذخیره‌ شده نحوه بازیابی Register ها اطلاعات مربوط به Exception Handler در صورت وجود در نتیجه Unwind Information فقط برای Exceptionهای ++C نیست Windows از این ساز و کار برای کارهایی مثل Stack Walking و بازیابی وضعیت اجرای Thread هم استفاده میکنه در x64 چرا Unwind Metadata اهمیت بیشتری داره داخل معماری‌ های قدیمی‌ تر ممکن بود اطلاعات مربوط به Stack Frame تا حد زیادی از روی دستورهای Prologue و Epilogue استخراج بشه
12 Noy, 15:25

خیلی ممنون از کسایی که رای دادن همون تو تلگرام ادامه میدیم 🩶 Thanks a lot to those who voted we’ll continue right there on Telegram 🖤
12 Noy, 02:40

Ko'rish tajribangizni yaxshilash uchun cookie fayllaridan foydalanamiz.
«Hammasini qabul qilish» tugmasini bosib, siz cookie fayllaridan foydalanish siyosatiga rozilik bildirasiz.