1 265
Підписники
Немає даних24 години
-37 днів
+730 днів
Архів дописів
1 265
لطفا تا جایی که میتونید پیام ها رو فوروارد کنید تا کانال دیده بشه اینجوری به منم کمک بزرگی میکنید و محتوا ها رفته رفته بهتر و خفن تر میشه ممنون 🩶
Please forward as many messages as you can so that the channel can be seen. This way, you will be a great help to me and the content will gradually become better and more interesting. Thank you 🖤
1 265
amateursCTF 2023 Reverse Engineering Writeups
https://fazect.github.io/amateursctf2023-rev/
@reverseengine
1 265
zer0ptsCTF 2023 Reverse Engineering Writeups
https://fazect.github.io/zer0ptsctf2023-rev/
@reverseengine
1 265
IDA Pro Plugins For Malware Reverse Engineering
https://www.youtube.com/watch?v=pfBA6y4VLwM
@reverseengine
1 265
ساختار دقیق Red Zone
از RSP رو به پایین: 160 بایت آزاد
تابع اجازه داره از اون استفاده کنه
تا زمانی که سیگنال / interrupt نیاد این فضا دست نخورده میمونه
Detailed structure of Red Zone
From RSP down: 160 bytes free
Function is allowed to use it
This space remains untouched until signal/interrupt arrives
@reverseengine
1 265
Collection of ATM Attacks
https://github.com/PT-CyberAnalytics/collection-of-ATM-attacks
@reverseengine
1 265
Structs & Data Layout Assembly
مثال در C:
struct Point { int x; int y; }; int getY(struct Point *p) { return p->y; }معادل اسمبلی:
getY: mov eax, DWORD PTR [rdi + 4] ; offset of y = 4 بایت ret🔍 دستورات:
rdi = آدرس ساختار (p) x در offset 0 بایته ([rdi + 0]) y در offset 4 بایته ([rdi + 4])پس اگر در اسمبلی ببینید [reg + 4] و ورودی rdi هست احتمالا در حال دسترسی به فیلد دوم یک struct هست Structs & Data Layout Assembly Example in C:
struct Point { int x; int y; }; int getY(struct Point *p) { return p->y; }Assembly equivalent:
getY: mov eax, DWORD PTR [rdi + 4] ; offset of y = 4 bytes ret? Commands:
rdi = address of structure (p) x is at offset 0 bytes ([rdi + 0]) y is at offset 4 bytes ([rdi + 4])So if you see [reg + 4] in assembly and the input is rdi, you are probably accessing the second field of a struct @reverseengine
1 265
🔹 Red Zone
در سیستم های x86-64 بر اساس ABI لینوکس پایین RSP اشارهگر استک یک محدودهی 160 بایتی وجود داره که به اون Red Zone میگن
🔸 این فضا مخصوص برای چیه؟
کامپایلر اجازه داره بدون تغییر RSP از این 160 بایت برای ذخیرهه موقت متغیر ها استفاده کنه
🔸 چرا مهمه؟
اگر بخواهید اکسپلویت بنویسی:
ممکن است دادهای پایین RSP قرار گرفته باشخ اما هنوز با SUB RSP رزرو نشده باشه
اشتباه در فهم Red Zone میتونه POC رو کرش کنه یا مانع نوشتن ROP Chain درست بشه
🔹 Red Zone
On x86-64 systems based on the Linux ABI, there is a 160-byte area below the RSP stack pointer called the Red Zone
🔸 What is this special space for?
The compiler is allowed to use these 160 bytes to temporarily store variables without changing the RSP
🔸 Why is it important?
If you want to write an exploit:
There may be data below the RSP that has not yet been reserved by the SUB RSP
A misunderstanding of the Red Zone can crash the POC or prevent the correct ROP Chain from being written
@reverseengine
1 265
In case of a difference, __stack_chk_fail() is called and usually the program is aborted or some other security operation is performed
Difference flags:
fstack-protector :
Enables canary for functions that use arrays or local buffers
fstack-protector-strong :
Much larger coverage includes more functions
fstack-protector-all :
Protects all functions Higher performance cost
Limitations:
Canary does not prevent all techniques. If an attacker can obtain the canary value, info leak or guess it, the protection is lost
Canary does not stop attacks such as ROP attacks, heap-based attacks or logical vulnerabilities
Canary is part of a layered defense mechanism and should be used in conjunction with ASLR, DEP/NX and other mechanisms
@reverseengine
1 265
نگهبان پشته
Stack Canary
یک مکانیزم محافظتیه که برای کاهش اکثر حملات بازنویسی پشته stack buffer overflow به کار میره
مفهوم:
کامپایلر در زمان کامپایل یا هنگام ورود به تابع مقدار محافظی canary کنار داده های محلی و آدرس برگشت قرار میده قبل از خروج از تابع مقدار ذخیره شده با مقدار اصلی مقایسه میشه اگر تغییر داده شده باشه
تابع مخصوصی مثل __stack_chk_fail() فراخونی میشه و برنامه به طور امن تموم میشه به عبارت دیگه کانری حکم زنگ هشدار رو داره که هر گونه دستکاری پشته رو آشکار میکنه
مهاجم با بهره برداری از بافرهای محلی میتونه داده هایی رو فراتر از اندازه مشخص شده بنویسیم و در نتیجه آدرس بازگشت رو تغییر بده تا جریان اجرای برنامه رو به کنترل خودش دربیاره کانری این مسیر ساده سو استفاده رو خیلی سخت میکنه چون برای تغییر آدرس برگشت لازمه کانری با مقدار درست بازنویسی بشه کاری که بدون دونستن مقدار اولیه سخت یا غیرممکنه
انواع Canary
Terminator canary:
شامل بایتهای خاصی مثلا \x00, \n هست تا عملیات های مبتنی بر رشته نتونن اون رو کامل بنویسن
Random canary: مقدار تصادفی تولید شده در زمان شروع برنامه رایج و موثره تا وقتی که مقدار لو نره
Random XOR-based canary:
مقدار تصادفی که با اطلاعات جلسه یا آدرسها ترکیب شده تا حدس زدنش سخت تر بشه
کامپایلرهای مدرن معمولا از canary تصادفی استفاده میکنن
چجوری کامپایلر اون رو پیادهسازی میکنه
با فعالسازی گزینههای محافظتی کامپایلر مانند -fstack-protector یا -fstack-protector-strong روند کلی بهصورت زیره:
در prologue تابع مقدار canary که از مکانیزم تصادفی برنامه یا متغیری در bss. گرفته میشه روی پشته نوشته میشه
در epilogue و قبل از ret مقدار ذخیره شده خونده و با مقدار مرجع مقایسه میشه
در صورت اختلاف __stack_chk_fail() فراخوانی و معمولا برنامه abort میشه یا عملیات ایمن سازی دیگه ای اجرا میشه
فرق فلگها:
fstack-protector :
کانری رو برای توابعی که از آرایهها یا buffer های محلی استفاده میکنه قرار میده
fstack-protector-strong :
پوشش خیلی بزرگ تر توابع بیشتری رو شامل میشه
fstack-protector-all :
از همه توابع محفاظت میکنه هزینه عملکردی بالاتر
محدودیتها:
کانری جلوی همه تکنیک ها رو نمیگیره اگر مهاجم بتونه مقدار canary رو به دست بیاره info leak یا اون رو حدس بزنه محافظت از بین میره
حملاتی مانند ROP حملات مبتنی بر هیپ یا آسیبپذیری های منطقی را کانری متوقف نمیکنه
کانری بخشی از یک ساز و کار دفاعی لایهایه و باید همراه با ASLR، DEP/NX و سایر مکانیزم ها استفاده بشه
Stack Guard
Stack Canary
A protection mechanism used to mitigate most stack buffer overflow attacks
Concept:
The compiler places a guarded canary value next to the local data and return address at compile time or when entering a function. Before exiting the function, the stored value is compared with the original value if it has been changed
A special function such as __stack_chk_fail() is called and the program ends safely. In other words, the canary acts as an alarm that reveals any manipulation of the stack
By exploiting local buffers, an attacker can write data beyond the specified size and thus change the return address to control the flow of program execution. The canary makes this simple path of abuse very difficult because to change the return address, the canary must be overwritten with the correct value, which is difficult or impossible without knowing the initial value
Types of Canary
Terminator canary:
Contains special bytes such as \x00, \n to String-based operations cannot write it completely
Random canary: A random value generated at program startup, effective until the value is leaked
Random XOR-based canary:
A random value that is combined with session information or addresses to make it harder to guess
Modern compilers often use random canaries
How the compiler implements it
By enabling compiler protection options such as -fstack-protector or -fstack-protector-strong, the general process is as follows:
In the prologue function, the canary value is derived from the program's randomization mechanism or a variable in the bss. It is taken and written to the stack
In the epilogue and before ret, the stored value is read and compared with the reference value
1 265
Repost from GO-TO CVE
🎯 Week 77 — Zero-Day Review — Explore CMS XSS → ATO
🔹 Week: 77
🔹 CVE: Zero-Day (pending ID assignment)
🔹 Type: Reflected XSS → Account Takeover (ATO)
🔹 Impact: Session theft, privilege escalation, full admin compromise
🔹 Target: Explore CMS v1.1
#week_77 #Zero_Day
1 265
Windows Kernel Internals: Cache Manager
https://www.i.u-tokyo.ac.jp/edu/training/ss/lecture/new-documents/Lectures/15-CacheManager/CacheManager.pdf
1 265
A Curated List of Resources to Analyse and Study Malware Techniques
https://github.com/fr0gger/Awesome_Malware_Techniques
@reverseengine
1 265
Repost from Source Byte
How to mitigate symbolic link attacks on Windows?
https://www.seljan.hu/posts/how-to-mitigate-symbolic-link-attacks-on-windows/
1 265
Exploiting System Mechanic Driver
https://voidsec.com/exploiting-system-mechanic-driver/?s=09
@reverseengine
1 265
دسترسی به آرایههای دو بعدی در اسمبلی
فرض کنید داخل C بنویسیم:
int arr[3][4]; return arr[i][j];داخل حافظه این آرایه به صورت خط به خط Row-Major Order ذخیره میشه یعنی ترتیب در حافظه این شکلیه:
arr[0][0], arr[0][1], arr[0][2], arr[0][3], arr[1][0], arr[1][1], arr[1][2], arr[1][3], arr[2][0], arr[2][1], arr[2][2], arr[2][3]فرمول محاسبه آدرس عنصر: اگر هر عنصر 4 بایت باشه نوع int آدرس arr[i][j] به صورت زیر حساب میشه:
address = base_address + ((i * number_of_columns) + j) * 4داخل اسمبلی معمولا به شکل زیر پیاده میشه:
mov eax, i imul eax, number_of_columns ; eax = i * 4 add eax, j ; eax = (i * 4) +j mov eax, DWORD PTR [rbx + rax*4] ; eax = arr[i][j]فرض کنید rbx آدرس پایه ای آرایه است Accessing 2D Arrays in Assembly Suppose we write in C:
int arr[3][4]; return arr[i][j];In memory, this array is stored row by row in Row-Major Order That is, the order in memory is as follows:
arr[0][0], arr[0][1], arr[0][2], arr[0][3], arr[1][0], arr[1][1], arr[1][2], arr[1][3], arr[2][0], arr[2][1], arr[2][2], arr[2][3]Formula for calculating the element address: If each element is 4 bytes, the int type address arr[i][j] is calculated as follows:
address = base_address + ((i * number_of_columns) + j) * 4In assembly, it is usually implemented as follows:
mov eax, i imul eax, number_of_columns ; eax = i * 4 add eax, j ; eax = (i * 4) +j mov eax, DWORD PTR [rbx + rax*4] ; eax = arr[i][j]Assume rbx is the base address of the array
