ReverseEngineering – Telegram
ReverseEngineering
1.24K subscribers
40 photos
10 videos
55 files
666 links
Download Telegram
بخش اول بافر اورفلو


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

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

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

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

مثال بدون جزئیات 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
Roadmap Zero Day Hunter

پیش نیازها و پایه یادگیری عمیق زبان C و C پلاس پلاس درک ساختار حافظه stack و heap و calling conventions پروژه های ساده C برای نشان دادن فهم در گیت هاب خروجی ریپوی گیت هاب با چند پروژه کوچک

فاز 1 سیستم عامل و حافظه درک virtual memory syscalls context switch تحلیل نمونه باگ حافظه به صورت تئوری و writeup خروجی writeup از یک bug حافظه

فاز 2 مهندسی معکوس باینری خواندن disassembly دنبال کردن control flow و data flow تهیه پنج آنالیز باینری با flowchart و root cause خروجی پنج writeup آنالیز در گیت هاب

فاز 3 فازینگ هوشمندانه انتخاب هدف های باارزش parsers codecs archive handlers protocol implementations نوشتن harness برای API یا parser و اجرای coverage guided fuzzing پیدا کردن یک تا سه crash reproducible و ثبت triage اولیه خروجی fuzz harness و لیست crashes با توضیح مختصر

فاز 4 triage و تحلیل کرش تعریف uniqueness stability exploitability برای هر crash کاهش testcase به minimal repro و پیدا کردن root cause با backtrace و data flow خروجی triage writeup با suggested mitigation

فاز 5 درک مدافعات و نظریه exploit یادگیری ASLR DEP NX stack canaries CFI sandboxing memory tagging به صورت نظری مقایسه اثر هر mitigation بر احتمال exploit شدن خروجی مستند مقایسه mitigations برای پورتفولیو

فاز 6 تعیین هدف و نقشه حمله خواندن تاریخچه CVE های هدف و pattern یابی اشتباهات مکرر تهیه attack surface map با entry points data flow و prioritized vectors خروجی attack surface doc برای یک پروژه یا کتابخانه

فاز 7 fuzzing پیشرفته و instrumentation طراحی harness های پیچیده برای درگیر کردن deep states integration fuzzing و در صورت نیاز آشنایی با symbolic execution برای مسیرهای سخت خروجی کمپین fuzzing پیشرفته با coverage report



prerequisites and fundamentals
Deep C and C plus plus knowledge
Understanding stack heap and calling conventions
Small C projects on GitHub to demonstrate understanding
Deliverable a GitHub repo with simple C projects

Phase 1 operating systems and memory
Understand virtual memory syscalls and context switch
Analyze a sample memory bug conceptually and write a report
Deliverable a writeup explaining a memory bug

Phase 2 binary reverse engineering
Read disassembly follow control flow and data flow
Produce five binary analysis writeups with flowcharts and root cause
Deliverable five analysis writeups in GitHub

Phase 3 smart fuzzing
Target high value components parsers codecs archive handlers protocol implementations
Write harnesses for APIs or parsers and run coverage guided fuzzing
Find one to three reproducible crashes and perform initial triage
Deliverable fuzz harness and crash list with brief notes

Phase 4 crash triage and analysis
Define uniqueness stability and exploitability for each crash
Minimize testcase to a minimal repro and find root cause using backtrace and data flow
Deliverable triage writeup with suggested mitigation

Phase 5 mitigation theory and exploit understanding
Learn ASLR DEP NX stack canaries CFI sandboxing memory tagging in theory
Compare effects of mitigations on exploitability
Deliverable a mitigations comparison document for portfolio

Phase 6 target selection and attack surface mapping
Study project CVE history and common bug patterns
Create an attack surface map with entry points data flow and prioritized vectors
Deliverable an attack surface document for a chosen project or library

Phase 7 advanced fuzzing and instrumentation
Design complex harnesses to reach deep states
Use integration fuzzing and consider symbolic execution for hard paths
Deliverable an advanced fuzzing campaign with coverage results


References:

MITRE ATT&CK Enterprise Matrix
https://attack.mitre.org/matrices/enterprise/

Google Project Zero disclosure policy:
https://googleprojectzero.blogspot.com/p/vulnerability-disclosure-policy.html

AFLplusplus official:
https://aflplus.plus/

AFLplusplus GitHub:
https://github.com/AFLplusplus/AFLplusplus

AddressSanitizer Clang docs:
https://clang.llvm.org/docs/AddressSanitizer.html

AddressSanitizer LLVM releases docs:
https://releases.llvm.org/11.0.0/tools/clang/docs/AddressSanitizer.html

@reverseengine
🔥41
Media is too big
VIEW IN TELEGRAM
Reverse Engineering Malware Rolling XOR Arm64
6
Forwarded from NSEs
FREE reverse engineering module now available!

Learn assembly fundamentals - perfect for beginners.

• Hands-on debugging with real examples
• Web based: no downloads, installs, or VMs

Start reversing here 👇

https://www.aceresponder.com/learn/rem-intro
8👏2
🔴 معرفی پروژه ی RE-Architect

این پروژه یک پلتفرم خودکار و پیشرفته برای مهندسی معکوس هستش و دارای ویژگی های مانند:

- فایلهای باینری رو میتونه دیکامپایل و تحلیل کنه.
- خلاصه ای از رفتار توابع رو با استفاده از مدلهای یادگیری زبان در میاره.
- ساختار داده های پیچیده رو شناسایی و بازسازی میکنه.
- نمایش گرافیکی قابل پیکربندی داره.
- از دیکامپایلرهای IDA Pro , Ghidra و Binary Ninja پشتیبانی میکنه.
- قابل ‌اجرا روی Windows، Linux، و macOS هستش.
- امکان ایجاد کد Test Harness رو داره. ( قابلیتی که میتونیم یک تابع رو بدون اجرای کل برنامه، تست کنیم. معمولا در مباحث فازینگ کاربرد داره).
- در پایتون توسعه داده شده.

🔴 Introducing the RE-Architect project

This project is an automated and advanced reverse engineering platform and has features such as:

- Can decompile and analyze binary files.
- Summarizes the behavior of functions using language learning models.
- Recognizes and reconstructs complex data structures.
- Has a configurable graphical display.
- Supports IDA Pro, Ghidra, and Binary Ninja decompilers.
- Runs on Windows, Linux, and macOS.
- Has the ability to create Test Harness code. (A feature that allows us to test a function without running the entire program. Usually used in fuzzing topics).
- Developed in Python.

#مهندسی_معکوس
#ReverseEngineering #REArchitect

🆔 @onhex_ir
➡️ ALL Link
1