1 730
Speculating the entire x86-64 Instruction Set In Seconds with This One Weird Trick
https://blog.can.ac/2021/03/22/speculating-x86-64-isa-with-one-weird-trick
@reverseengine
22 فوریه, 15:43
Copy codeCode (text) → دستورالعملها Data → متغیرهای ثابت Heap → حافظه داینامیک Stack → متغیرهای تابع Mapped DLLs → کتابخانهها RE: وقتی در debugger حافظه رو میبینید این بخش ها رو تشخیص میدید 🟢 4️⃣ Memory Layout Process Memory Layout Each Process usually has these sections: Copy code Code (text) → Instructions Data → Constant variables Heap → Dynamic memory Stack → Function variables Mapped DLLs → Libraries RE: When you look at memory in the debugger, you will recognize these sections @reverseengine
Copy code input → overflow → shellcode → jump → executeبا NX این زنجیره قطع میشه اکسپلویترها چه کار کردن؟ وقتی اجرای کد جدید ممنوع شد ایده ی جدید شکل گرفت: کد جدید اجرا نکنید از کدهای موجود استفاده کنید و این شد: Return Oriented Programming (ROP) یعنی: اجرای gadget های داخل باینری و libc بدون اجرای کد تزریقشده کاملا سازگار با NX یک اشتباه رایج NX ≠ ضد اکسپلویت NX فقط: اجرای کد تزریقی رو میبنده ولی: جلوی ROP رو نمیگیره جلوی ret2libc رو نمیگیره جلوی chain کردن gadget ها رو نمیگیره برای همین هنوز exploit ممکنه فقط روشش عوض شده NX باعث میشه بخشهایی از حافظه مثل استک و هیپ قابل اجرای کد نباشن یعنی دیگه نمیتونید به سادگی Shellcode تزریق کنید و اجراش کنید همین باعث شد تکنیکهای مدرنتر مثل ROP به وجود بیان پس NX اکسپلویت اخر نبود فقط روشش رو عوض کرد NX What is and why direct shellcode is usually not executed About shellcode Put the code on the stack Push RIP onto the stack The code was executed But now this usually does not work The reason is an important security mechanism: NX = Non-Executable What exactly does NX do? NX says: Some memory sections are for data only, not for code execution That is: Stack → Data only Heap → Data only Instruction execution → Forbidden If the CPU tries to execute an instruction from these sections → the program crashes immediately What happens? Suppose: You put the shellcode into the buffer You did the RIP to the address of the same buffer On a system with NX: The executable is not the CPU of this section Segmentation fault That is: You have control of the RIP but you don't have the code execution yet And this is exactly where many beginner exploits fail So why was NX added? Because shellcode injection had become so common NX was introduced to close this scenario:
Copy code input → overflow → shellcode → jump → executeWith NX, this chain is broken What did the exploiters do? When new code execution was banned, a new idea was born: Don't run new code, use existing code And this is what happened: Return Oriented Programming (ROP) That is: Executing gadgets inside binaries and libc Without executing injected code Completely compatible with NX A common mistake NX ≠ anti-exploit NX only: Stops execution of injected code But: It doesn't prevent ROP It doesn't prevent ret2libc It doesn't prevent chaining of gadgets That's why exploits are still possible, just the method has changed NX Makes parts of memory like the stack and heap inaccessible to code That means you can't simply inject shellcode and execute it That's what gave rise to more modern techniques like ROP So NX wasn't the last exploit, it just changed the method @reverseengine

ما از کوکیها برای بهبود تجربه مرور شما استفاده میکنیم.
با کلیک روی «همگی را قبول میکنم»، با سیاست استفاده از کوکیها موافقت میکنید.