Through the Endless Inertia
Lindsheaven Virtual Plaza
@perplex_files
Tags:
#exploit #ebook #reversing #programming #emulation #cpp #roadmap #comp_arch #comp_theory #math #c #assembly #misc #crypto #rootkit #malware #hardware #arduino #learning #tool #bsd #quantum #embedded #lisp #channel #notes #linux #my #windows #book #graphics #info_theory #ic #privacy #android #ios #physics #playlist #philosophy #electronics
#sat
Telegram Channels:
https://t.me/p_file/60
Twitter Channels:
https://t.me/p_file/343
Links for Articles:
https://t.me/p_file/299
Book/links recommendations:
Information Theory
Computer Science and Programming
Physics and Math
Philosophy
Books for free:
zlibrary.onion
Github Awesome Links:
https://t.me/p_file/195
Youtube Channels:
Programming and Hacking
Hardware
Math
Useful Links:
Playlists
Undergrad Courses
Tags:
#exploit #ebook #reversing #programming #emulation #cpp #roadmap #comp_arch #comp_theory #math #c #assembly #misc #crypto #rootkit #malware #hardware #arduino #learning #tool #bsd #quantum #embedded #lisp #channel #notes #linux #my #windows #book #graphics #info_theory #ic #privacy #android #ios #physics #playlist #philosophy #electronics
#sat
Telegram Channels:
https://t.me/p_file/60
Twitter Channels:
https://t.me/p_file/343
Links for Articles:
https://t.me/p_file/299
Book/links recommendations:
Information Theory
Computer Science and Programming
Physics and Math
Philosophy
Books for free:
zlibrary.onion
Github Awesome Links:
https://t.me/p_file/195
Youtube Channels:
Programming and Hacking
Hardware
Math
Useful Links:
Playlists
Undergrad Courses
Forwarded from p.txt
A Corelan tutorial about Heap Spraying, from the simple way (to older browsers) to simple bypasses of common mitigations of this technique (chunk randomization, different variable names and so on). I think it is a pretty interesting post.
https://www.corelan.be/index.php/2011/12/31/exploit-writing-tutorial-part-11-heap-spraying-demystified/
https://www.corelan.be/index.php/2011/12/31/exploit-writing-tutorial-part-11-heap-spraying-demystified/
Corelan | Exploit Development & Vulnerability Research
Exploit writing tutorial part 11 : Heap Spraying Demystified
Introduction [toc] A lot has been said and written already about heap spraying, but most of the existing documentation and whitepapers have a focus on Internet Explorer 7 (or older versions). Although there are a number of public exploits available that…
Forwarded from p.txt
image_2021-04-29_20-37-17.png
18.8 KB
Cache & Plunger technique – oleaut32.dll
Every time a chunk gets freed, the heap manager will try to place the pointer to that freed chunk on the cache (there are a few conditions that need to be met for that to happen, but those conditions are not that important right now). These pointers could point anywhere in the heap, so everything that is placed on the cache may appear somewhat random. When a new allocation happens, the cache system will see if it has a chunk of the requested size and can return it directly. This improves performance and also prevents further fragmentation to a certain extent.
Blocks larger than 32767 bytes are never cached and always freed directly.
The cache management table is structured based on chunk sizes. Each “bin” in the cache list can hold freed blocks of a given size. There are 4 bins :
Allocating chunks that are returned by the cache manager could be located anywhere in the heap, the address would not be reliable.
Since the cache can only hold up to 6 blocks per bin
Every time a chunk gets freed, the heap manager will try to place the pointer to that freed chunk on the cache (there are a few conditions that need to be met for that to happen, but those conditions are not that important right now). These pointers could point anywhere in the heap, so everything that is placed on the cache may appear somewhat random. When a new allocation happens, the cache system will see if it has a chunk of the requested size and can return it directly. This improves performance and also prevents further fragmentation to a certain extent.
Blocks larger than 32767 bytes are never cached and always freed directly.
The cache management table is structured based on chunk sizes. Each “bin” in the cache list can hold freed blocks of a given size. There are 4 bins :
Allocating chunks that are returned by the cache manager could be located anywhere in the heap, the address would not be reliable.
Since the cache can only hold up to 6 blocks per bin
Forwarded from p.txt
This is the Intel Software Developer's Manual. Here you will learn about the functioning of the Intel's CPUs, from the basic environment (Data types, types of procedure calls, instruction sets and general instructions/registers) to the memory management, paging, protection system of the CPU (rings, memory protection, paging protection), task management, etc. Basically you will learn beyond assembly, you will learn how the CPU manages all the memory/environment and how it is performed. This can be useful for driver development, system management, VM purposes, rootkits, to know more about any assembly instruction and its particularity, or just for knowing more about what happens behind an application and its instructions. It is divided in 4 chapters, the information about the CPU's behavior are located in chapters 1 (the introduction to the architecture) and 3 (the system programming guide, with all the information of the Intel's CPU behavior). Chapter 2 has the Instruction Set Reference of all the assembly instructions (from A-Z, and every instruction has a detailed description), and chapter 4 it is about MSR (Model Specific Registers).
Forwarded from p.txt
https://xenproject.org/2012/06/13/the-intel-sysret-privilege-escalation/
What is the SYSRET Intel Vulnerability?
This vulnerability is found on Intel's CPUs, and it is caused by a flaw in the SYSRET instruction, in which is used to fastly execute code of a different access right (with a higher required privilege).
How can the vulnerability be exploited? Basically by generating a #GP exception while in hypervision code execution (in this example of the link above), as known, generating a exception can lead you to overwrite the stack frame with your own values (in this case), and then control the RIP using the same privileges as the hypervision mode. To generate the exception, the RCX needs to be changed to a non-canonical value (in 64 bit mode, addresses are not completely made in 64 bit format, but 48 bit, that is, a canonical address), the SYSRET does not check if the address provided by RCX is a valid address (canonical), and then the exception is generated before the access right is changed to the guest mode privileges (on AMD processors, the #GP exception is generated after the privilege changed), making it possible to change the stack frame and execute your code in hypervision mode. This vulnerability is useful to make rootkits to escalate privileges to NT SYSTEM, like in the following technique, where it shows how to change the token pointers of a program to the SYSTEM token (pid 4).
http://mcdermottcybersecurity.com/articles/x64-kernel-privilege-escalation
Here is a POC of SYSRET:
https://github.com/shahriyarj/sysret
What is the SYSRET Intel Vulnerability?
This vulnerability is found on Intel's CPUs, and it is caused by a flaw in the SYSRET instruction, in which is used to fastly execute code of a different access right (with a higher required privilege).
How can the vulnerability be exploited? Basically by generating a #GP exception while in hypervision code execution (in this example of the link above), as known, generating a exception can lead you to overwrite the stack frame with your own values (in this case), and then control the RIP using the same privileges as the hypervision mode. To generate the exception, the RCX needs to be changed to a non-canonical value (in 64 bit mode, addresses are not completely made in 64 bit format, but 48 bit, that is, a canonical address), the SYSRET does not check if the address provided by RCX is a valid address (canonical), and then the exception is generated before the access right is changed to the guest mode privileges (on AMD processors, the #GP exception is generated after the privilege changed), making it possible to change the stack frame and execute your code in hypervision mode. This vulnerability is useful to make rootkits to escalate privileges to NT SYSTEM, like in the following technique, where it shows how to change the token pointers of a program to the SYSTEM token (pid 4).
http://mcdermottcybersecurity.com/articles/x64-kernel-privilege-escalation
Here is a POC of SYSRET:
https://github.com/shahriyarj/sysret
Xen Project
The Intel SYSRET privilege escalation - Xen Project
The Xen Security team recently disclosed a vulnerability, Xen Security Advisory 7 (CVE-2012-0217), which would allow guest administrators to escalate to hypervisor-level privileges. The impact is much wider than Xen; many other operating systems seem to have…
p.txt
image_2021-04-29_20-37-17.png
The Feng Shui and Plunger techniques are, as written here, methods to allocate all the buffers freed in the garbage collector, making sure the next heaps will come from the system heap. The article below shows an interesting exploit, using not only this technique, but the lookaside-list to make a fake vtable and get code execution through a virtual function call.
http://www.phreedom.org/research/heap-feng-shui/heap-feng-shui.html
http://www.phreedom.org/research/heap-feng-shui/heap-feng-shui.html
A simple technique against SEHOP mitigation. This Microsoft mitigation some additional verifications in order to avoid SEH corruption and SEH-based exploits, but under certain conditions, it can be bypassed. As this article explains, you need to create a fake SEH to bypass the verification (made by RtlIsValidHandler), so you will need to recreate the chain , putting a 0xFFFFFFFF and a pointer to ntdll!FinalExceptionHandler in the last exception handler (EH), otherwise the exploit will fail, since you made all the chain, you will need to find a pointer to the last EH (containing the 0xFFFFFFFF etc), this pointer needs to be a valid instruction too, because since we need to point to the next handler, the pop pop ret will return exactly to this pointer, making it executable, fortunately we are free to put any value in the 2 last bytes of this pointer, so we can make a conditional JMP (0xFF74 in the POC) to another JMP (before the pointer, this one will lead us to another JMP next to the shellcode and before the last EH), and lastly this JMP will fall in the shellcode . The first JMP is necessary to making our first pointer simple and easy to adjust, and because you probably could not use this pointer to jump directly to the shellcode or to the next handler of the last EH, since this JMP aka pointer is limited, we use another JMP before the pointer and it leads to another JMP (i don't know if this one is necessary, if the first one can jump into the shellcode, you won't need the second one). The real problem about this article is the pointer to the ntdll!FinalExceptionHandler, Windows has ASLR and you can't simple guess this function address, so this technique would be suitable under these conditions (i think):
- You don't need to full overwrite the stack to make an exception, this way you can put the shellcode before the last EH (since you can set the displacement between the first and the last EH) and make a JMP into it;
- You can somehow get the address of ntdll!FinalExceptionHandler and put it in the last EH.
http://index-of.es/EBooks/sehop_en.pdf
- You don't need to full overwrite the stack to make an exception, this way you can put the shellcode before the last EH (since you can set the displacement between the first and the last EH) and make a JMP into it;
- You can somehow get the address of ntdll!FinalExceptionHandler and put it in the last EH.
http://index-of.es/EBooks/sehop_en.pdf
A post about flink and blink structures. This is not related to exploits or hacking, since the site focuses on kernel structures and Windows, but it can be useful for hacking (eg: heap exploitation). Basically it is a list where the flink points to the next entry, and blink points to the entry backwards, if the structure is empty, the blink and flink will point to themselves. Often used in drivers to store data.
http://bsodtutorials.blogspot.com/2013/10/linked-lists-flink-and-blink.html?m=1
http://bsodtutorials.blogspot.com/2013/10/linked-lists-flink-and-blink.html?m=1
Blogspot
Linked Lists - Flink and Blink
Okay, linked lists are used often in Windows and are usually part of larger data structures. They are typically seen with the Windows Debugg...
p.file
A post about flink and blink structures. This is not related to exploits or hacking, since the site focuses on kernel structures and Windows, but it can be useful for hacking (eg: heap exploitation). Basically it is a list where the flink points to the next…
Osronline
The NT Insider:Kernel-Mode Basics: Windows Linked Lists
OSR Open Systems Resources, Inc. The Windows device driver and file systems experts. Seminars - Development - Consulting - Training
How a group of hackers (FIN7) used SHIM databases to inject a malicious DLL in services.exe. I really liked this method, the SHIM implementation and SHIM databases made by Microsoft patch executables through in-memory patches, when the .exe is loaded into memory (the same for drivers), this malware uses a SDB file with the 2nd stage code inside, and modifies the registry keys that store the SDB path for an application, this way when services.exe is loaded, Windows checks if there is any .sdb file for it, if so, the application is patched with the code inside it, in this case the code patched is ScRegisterTCPEndpoint function, when the function is called, the program decompresses and reads the shellcode stored in the registry HKLM\SOFTWARE\Microsoft\DRM, then it sleeps for 4 minutes and loads a new process named svchost.exe with the malware's DLL.
https://www.fireeye.com/blog/threat-research/2017/05/fin7-shim-databases-persistence.html
https://www.fireeye.com/blog/threat-research/2017/05/fin7-shim-databases-persistence.html
Google Cloud Blog
To SDB, Or Not To SDB: FIN7 Leveraging Shim Databases for Persistence | Google Cloud Blog
Simple tutorial about how to use the PEB to control EIP. In the example, he abuses a Heap Overflow vulnerability, where he can write any data to any address through FLINK and BLINK pointers (this can work too if you can overwrite a pointer that deals with memory writing after the overflow), but the main part are the FastPebLockRoutine and FastPebUnlockRoutine pointers from PEB, which pointer to RtlEnterCriticalSection and RtlLeaveCriticalSection respectively. If you can write anything at any address, then you can overwrite one of these function pointers with a pointer to your shellcode (since he controls both EAX and ECX registers), these functions are called by ExitProccess() and some exception handler functions, that's why he does not care about that exception being generated after the PEB overwriting. This method works well in Windows XP, but because of ASLR, their addresses are randomized, the only way to bypass this is knowing somehow one of these addresses, then it can be used in modern exploitations.
https://www.exploit-db.com/papers/13178
https://www.exploit-db.com/papers/13178
Exploit Database
Windows Heap Overflows using the Process Environment Block (PEB)
54473267732EFADF62E7A8E13D2F0F7F.pdf
195.3 KB
Yet another Heap Overflow discussion, but i'm uploading this because of some interesting topics like Vectored Exception Handling in Heap Exploitation, PEB overwrite and SetUnhandledExceptionFilter overwrite in order to control the program's execution. All these topics can be found in the Heap Overflows section of The Shellcoders Handbook, and despite are simple topics, i think you need to bear in mind that they exist.
Simple and short tuto about stripped binaries, main commands here are objdump and file (an interesting approach would be r2, which you could replace the "file" command with "iI" and it returns a lot of information). I'm sending some stuff about stripped binaries later.
https://medium.com/@zlkidda/day-1-quest-for-my-first-zero-day-dealing-with-stripped-binaries-8501460e2781
https://medium.com/@zlkidda/day-1-quest-for-my-first-zero-day-dealing-with-stripped-binaries-8501460e2781
Medium
Day 1: Quest for my first Zero day — Dealing with stripped binaries
Day 0: Day 0: Writing my first shell code — Quest for my first Zero Day