ReverseEngineering – Telegram
ReverseEngineering
1.24K subscribers
40 photos
10 videos
55 files
666 links
Download Telegram
تحلیل باج افزار Qilin که پس از افول یا اسکم شدن بعضی باج افزارهایی مثل LockBit و BlackCat و RansomHub در صدر بیشترین حملات اخیر هست

Qilin ransomware analysis, which is at the forefront of most recent attacks after the decline or shrink of some ransomware such as LockBit, Blackcat and RansomHub

https://www.sans.org/blog/evolution-qilin-raas


@Fuzz0x
1
پیدا کردن شرط چک لایسنس یا رمز

چی کار میکنیم؟

میخوایم بخش‌ هایی از برنامه که رمز لایسنس رو بررسی میکنن پیدا کنیم بفهمیم چه توابعی استفاده شده و دقیقا کجا برنامه تصمیم میگیره اجازه بده یا نده

نمونه برنامه ساده مثال برای تمرین C:

#include <stdio.h>
#include <string.h>

int main() {
char buf[32];
printf("Enter pass: ");
scanf("%31s", buf);
if (strcmp(buf, "1234") == 0) {
printf("Access granted\n");
} else {
printf("Access denied\n");
}
return 0;
}


مرحله به مرحله:

فایل رو کامپایل کنید مثلا gcc test.c -o test.exe و یه نسخه کپی نگه دارید


با strings test.exe نگاه کنید ببینید رشته‌ها مثل Enter pass: Access granted کجا هستن اینا کمک میکنن موقعیت منطقی برنامه رو حدس بزنید


فایل رو توی IDA یا Ghidra باز کنید دنبال رشته‌های بالا بگردید Search _ Strings و از اونجا به تابع مربوط برید معمولا رشته‌ها به راحتی به توابع استفاده‌ شون لینک میشن


توی دیاسمبل دنبال strcmp یا strncmp یا هر تابع مقایسه رشته‌ای باشید نزدیک این فراخوانی‌ها معمولا شرط تصمیم‌گیرنده cmp + jz / jne / je / jne هست


نقطه‌ای که بعد از cmp یه JE یا JNE میبینید همونجا تصمیم‌ گیرنده است اگه شرط برقرار باشه برنامه به شاخه موفقیت میره وگرنه پیام رد میشه


نکات:

دنبال cmp eax, 0
یا مقایسه بازگشتی strcmp(...) == 0 باشید

رشته‌ها بهترین نقطه شروع برای مسیردهی در باینری هستن

همه اینا استاتیکه هنوز برنامه رو اجرا نکردید


تمرین:

خودتون کد بالا رو کامپایل کنید و توی IDA/Ghidra مسیر از رشته _ تابع cmp _ jump رو دنبال کنید




Finding the license or password

Check condition

What are we doing?

We want to find the parts of the program that check the license password, understand what functions are used and where exactly the program decides to allow or deny

Simple program example for practice C :

#include <stdio.h>
#include <string.h>

int main() {
char buf[32];
printf("Enter pass: ");
scanf("%31s", buf);
if (strcmp(buf, "1234") == 0) {
printf("Access granted\n");
} else {
printf("Access denied\n");
}
return 0;
}



Step by step :

Compile the file, e.g. gcc test.c -o test.exe and keep a copy

Look at strings test.exe and see where strings like Enter pass : Access granted are. These will help you guess the logical position of the program

Open the file in IDA or Ghidra and search for the above strings. Search Strings and from there go to the corresponding function. Usually strings are easily linked to the functions they use.

Look for strcmp or strncmp or any string comparison function in the disassembler. Near these calls there is usually a decision-maker condition
cmp + jz / jne / je / jne

The point where you see a JE or JNE after cmp is the decision-maker. If the condition is true, the program goes to the success branch, otherwise the message is rejected.

Tips :

Look for cmp eax, 0

or the recursive comparison strcmp(...) == 0

Strings are the best starting point for routing in binary

This is all static you haven't run the program yet

Exercise :

Compile the above code yourself and follow the path from string cmp function jump in IDA/Ghidra


@reverseengine
2👏1
بخش اول بافر اورفلو


تا حالا فکر کردید یک ورودی ساده چطور میتونه یک برنامه رو از کار بندازه

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

تئوری ساده استک و بافر:

بافر یعنی محلی در حافظه که برای نگهداری داده ها مثل رشته ها یا آرایه ها اختصاص داده میشه اگر ورودی بیشتر از فضای اختصاص یافته باشه داده های مجاور بازنویسی میشن
در برنامه های ساده معمولا بافر روی استک قرار می گیرد و کنار اون آدرس بازگشت تابع و متغیرهای دیگر قرار دارن وقتی بافر بازنویسی میشه ممکنه آدرس بازگشت تغییر کنه یا برنامه کرش کنه

مثال بدون جزئیات exploit:

تصور کنید تابعی هست که یک آرایه شونزده بایتی داره و کاربر به جای شونزده بایت شصت و چهار بایت می فرسته بخشی از حافظه که بیرون از آرایه است بازنویسی میشه و باعث رفتار غیرمنتظره میشه این رفتار ممکنه تنها کرش باشه یا در شرایط خاص بتونه باعث اجرای کد بشه

Part 1 Buffer Overflow


Have you ever wondered how a simple input can crash a program ?

The goal is to familiarize yourself with the concept of buffer and overflow

Simple theory of stack and buffer :

A buffer is a place in memory that is allocated to store data such as strings or arrays. If the input exceeds the allocated space, the adjacent data is overwritten.

In simple programs, the buffer is usually placed on the stack, and next to it are the function's return address and other variables. When the buffer is overwritten, the return address may change or the program may crash.

Example without exploit details :

Imagine a function that has a sixteen-byte array and the user sends sixty-four bytes instead of sixteen bytes. A part of the memory that is outside the array is overwritten, causing unexpected behavior. This behavior may only be a crash, or in special circumstances, it may cause code execution.

@reverseengine
2
CreateProcessAsPPL

This is a utility for running processes with Protected Process Light (PPL) protection, enabling bypass of EDR/AV solution defensive mechanisms. It leverages legitimate Windows clipup.exe functionality from System32 to create protected processes that can overwrite antivirus service executable files.

Source:
https://github.com/2x7EQ13/CreateProcessAsPPL

Research:
https://www.zerosalarium.com/2025/08/countering-edrs-with-backing-of-ppl-protection.html

@reverseengine
2
تفاوت مهم رجیستر های RSP & RBP

RSP Stack Pointer

همیشه به بالای استک Top of Stack اشاره میکنه

هر push / pop یا call / ret مستقیم این رجیستر رو تغییر میده

دائما در حال تغییره

RBP Base Pointer - Frame Pointer

یک آدرس ثابت در کل عمر تابع

برای دسترسی به آرگومان‌ ها و متغیرهای محلی استفاده میشه

اول تابع با push rbp / mov rbp, rsp ست میشه و در اخر آزاد میشه


Important Difference Between RSP & RBP Registers

RSP Stack Pointer

Always points to the top of the stack

Every push / pop or call / ret directly changes this register

Constantly changing

RBP Base Pointer - Frame Pointer

A fixed address throughout the life of the function

Used to access arguments and local variables

First set by push rbp / mov rbp, rsp and finally freed

@reverseengine
7
Function Prologue (شروع تابع)

وقتی یک تابع کال میشه اولین چیزی که CPU میبینه اینه:

push rbp ; قبلی RBP ذخیره

mov rbp, rsp ;تنظیم فریم جدید روی استک

sub rsp, 0x20 ; رزرو فضا برای متغیرهای محلی (اختیاری)



چرا این کارها انجام میشه؟

push rbp نگه داشتن فریم قبلی (فریم والد)

mov rbp, rsp ساخت فریم جدید برای تابع

sub rsp, X ایجاد فضای خالی برای متغیرهای لوکال




Function Prologue (Function Start)

When a function is called, the first thing the CPU sees is:

push rbp ; store previous RBP

mov rbp, rsp ; set new frame on stack

sub rsp, 0x20 ; reserve space for local variables (optional)


Why are these things done?

push rbp keep previous frame (parent frame)

mov rbp, rsp create new frame for function

sub rsp, X create free space for local variables


@reverseengine
👍31