en
Feedback

Don't get caught by a cheater! Telemetrio finds and tags such channels 👉 If you want to see the tag, subscribe

ReverseEngineering

ReverseEngineering

Open in Telegram
1 730
Subscribers
-124 hours
-67 days
+28130 days
Posts Archive
چرا گجت‌ یک دفعه کرش میکنن؟ خیلی وقتا ROP Chain رو درست می‌نویسید آفست‌ها هم درسته ولی برنامه بعد از یکی‌ دو گجت کرش میکنه 90 درصد مواقع دلیلش اینه: دارید ROP رو داخل Red Zone میذارید یعنی شما فکر میکنی RSP اینجاست ولی داده‌ هایی که تزریق کردید تو 160 بایت پایین‌ تره جایی که اصلا تضمین نشده سالم بمونه یه تابع داخلی صدا زده می‌شه → Red Zone رو overwrite میکنه → ROP میره هوا یه interrupt میاد → سیستم‌ عامل اون فضا رو میگیره کرش میکنه حتی یه printf ساده → Red Zone رو زیر پا میذاره → گجت بعدی اجرا نمیشه ساده‌ترین نمونه کرش در ROP برنامه بعد از اجرای اولین گجت روی گجت دوم سیگنال میگیره و از بین میره چون payload داخل Red Zone بوده و libc اون محدوده رو با داده‌های خودش پر کرده Why do gadgets crash all at once? Many times you write the ROP Chain correctly, the offsets are correct, but the program crashes after one or two gadgets 90% of the time the reason is this: You are putting the ROP in the Red Zone That is, you think the RSP is here, but the data you injected is 160 bytes below where it is not guaranteed to be intact An internal function is called → It overwrites the Red Zone → ROP goes to the air An interrupt comes → The operating system takes that space and crashes Even a simple printf → It violates the Red Zone → The next gadget does not run The simplest example of a crash in ROP After executing the first gadget, the program receives a signal on the second gadget and dies Because the payload was in the Red Zone and libc filled that area with its own data @reverseengine
20 Nov 2025, 15:45

چرا Exploit Dev به Red Zone حساسه؟ اگر روی استک payload میزارید shellcode/ROP ممکنه داخل Red Zone باشه کامپایلر RSP رو تغییر نداده ولی داده‌ای که تزریق کرد داخل همون محدوده است پس: اگر تابع دیگه ای صدا زده بشه داده پاک میشه اگر interrupt بشه کرش میکنه چند تا payloadها با stomp شدن Red Zone از کار میوفتن خیلی از فراخوانی‌ های داخلی libc اولین کاری که میکنن اینه که از Red Zone استفاده بکنن اگر ROP Chain شما داخل این محدوده باشه overwrite میشه کرش Stack Alignment وابسته به Red Zone اگر اشتباهی فکر کنید فضای زیر RSP امن نیست ممکنه SUB/ADD اشتباه بزنی و استک misalign میشه Misalignment: سیستم‌ کال کرش کنه libc کرش کنه ROP Chain درست اجرا نشه مثال عملی کد C
#include <stdio.h> void test() { char *p = (char *)__builtin_frame_address(0); printf("RSP: %p\n", p); char buffer[32]; buffer[0] = 'A'; printf("buffer: %p\n", buffer); } int main() { test(); return 0; }
آدرس buffer پایین RSP است اما RSP کم نشده! این یعنی buffer داخل Red Zone هست نکته طلایی: کامپایلر حتی بدون رزرو استک در Red Zone متغیر میزاره Why is Exploit Dev sensitive to Red Zone? If you put the shellcode/ROP payload on the stack, it may be in the Red Zone The compiler did not change the RSP, but the data it injected is in the same range So: If another function is called, the data will be cleared If it is interrupted, it will crash Some payloads will fail when the Red Zone is stomped Many internal libc calls do the first thing they do is use the Red Zone If your ROP Chain is in this range, it will be overwritten and crash Stack Alignment Dependent on the Red Zone If you mistakenly think that the space below the RSP is not safe, you may make a SUB/ADD mistake and the stack will be misaligned Misalignment: System call crashes libc crashes ROP Chain does not execute correctly Practical example C code
#include <stdio.h> void test() { char *p = (char *)__builtin_frame_address(0); printf("RSP: %p\n", p); char buffer[32]; buffer[0] = 'A'; printf("buffer: %p\n", buffer); } int main() { test(); return 0; }
The buffer address is below RSP But RSP is not decreased! This means the buffer is in the Red Zone Golden tip: The compiler places variables in the Red Zone even without stack reservation @reverseengine
20 Nov 2025, 15:37

Local Variables روی استک وقتی تابع متغیر محلی داره کامپایلر اون رو روی استک میزاره ساختار فریم استک کامل بعد از اجرای prologue:
push rbp mov rbp, rsp sub rsp, X ; ایجاد فضا برای متغیرهای محلی
ساختار میشه:
[ rbp+16 ] آرگومان سوم [ rbp+8 ] آدرس برگشت [ rbp+0 ] RBP قبلی [ rbp-8 ] متغیر محلی 1 [ rbp-16 ] متغیر محلی 2
مثال:
int foo(int x) { int t = x + 3; return t * 2; }
اسمبلی:
foo: push rbp mov rbp, rsp sub rsp, 16 ; فضای متغیر محلی mov DWORD PTR [rbp-4], edi ; t = x add DWORD PTR [rbp-4], 3 ; t = x + 3 mov eax, DWORD PTR [rbp-4] add eax, eax ; eax = t * 2 leave ret
نکات مهم: متغیر t روی استک قرار میگیره آدرسش rbp-4 چون int هست سایز 4 بایت eax خروجی تابع Local Variables on the Stack When a function has a local variable, the compiler pushes it onto the stack Complete stack frame structure After executing the prologue:
push rbp mov rbp, rsp sub rsp, X ; Create space for local variables
The structure becomes:
[ rbp+16 ] Third argument [ rbp+8 ] Return address [ rbp+0 ] Previous RBP [ rbp-8 ] Local variable 1 [ rbp-16 ] Local variable 2
Example:
int foo(int x) { int t = x + 3; return t * 2; }
Assembly:
foo: push rbp mov rbp, rsp sub rsp, 16 ; Local variable space mov DWORD PTR [rbp-4], edi ; t = x add DWORD PTR [rbp-4], 3 ; t = x + 3 mov eax, DWORD PTR [rbp-4] add eax, eax ; eax = t * 2 leave ret
Important notes: The variable t is placed on the stack, its address is rbp-4 Because it is an int, its size is 4 bytes eax is the output of the function @reverseengine
20 Nov 2025, 15:27

19 Nov 2025, 15:52

Android App Reverse Engineering https://youtu.be/BijZmutY0CQ @reverseengine
19 Nov 2025, 15:48

Reverse Engineering WhatsApp Encryption for Chat Manipulation https://www.youtube.com/watch?v=N0Ne623fKWc @reverseengine
19 Nov 2025, 15:47

A Linux Toolkit for Reverse-Engineering and Analyzing Malware https://remnux.org @reverseengine
19 Nov 2025, 15:46

19 Nov 2025, 15:46

19 Nov 2025, 15:39

19 Nov 2025, 15:36

Epic EPIC is a Toolkit for Developing and Building C-to-PIC Shell Code https://github.com/Print3M/epic @reverseengine
19 Nov 2025, 15:23

19 Nov 2025, 04:56

18 Nov 2025, 23:32

18 Nov 2025, 23:30

https://www.irisc2.com/blog/javelin-fud-loader Fully Undetectable Windows Shellcode Loader Now Available in IRIS C2 @reverseengine
18 Nov 2025, 23:28

18 Nov 2025, 23:27

Time Trvel Triage: An Introduction to Time Travel Debugging using a .NET Process Hollowing https://cloud.google.com/blog/topics/threat-intelligence/time-travel-debugging-using-net-process-hollowing?linkId=17730646 @reverseengine
18 Nov 2025, 23:26

We use cookies to improve your browsing experience.
By clicking “Accept all”, you agree to the cookie policy.