Linux Binary Exploitation - Return-oritend ProgramingAngel Boy
The document discusses using return-oriented programming (ROP) to bypass address space layout randomization (ASLR) and data execution prevention (DEP). It describes using the procedure linkage table (PLT) to leak the address of functions like puts to bypass ASLR. A ROP chain is then constructed to call read to read "/bin/sh" into memory and execute it, achieving arbitrary code execution.
Play with FILE Structure - Yet Another Binary Exploit TechniqueAngel Boy
The document discusses exploiting the FILE structure in C programs. It provides an overview of how file streams and the FILE structure work. Key points include that the FILE structure contains flags, buffers, a file descriptor, and a virtual function table. It describes how functions like fopen, fread, and fwrite interact with the FILE structure. It then discusses potential exploitation techniques like overwriting the virtual function table or FILE's linked list to gain control of program flow. It notes defenses like vtable verification implemented in modern libc libraries.
The document discusses C++ exploitation techniques including name mangling, virtual function tables, vtable hijacking, vectors, strings, and memory allocation/deallocation functions like new and delete. It provides details on how virtual function tables are used to implement polymorphism in C++ and how vtable hijacking can be used to exploit vulnerabilities by forcing a vtable and hijacking the virtual function pointer to call shellcode. It also explains how vectors and strings are implemented dynamically in memory and their memory layout.
The document provides an overview of various exploitation techniques, particularly focusing on buffer overflows, return-oriented programming (ROP), and return-to-libc attacks. It discusses methods for manipulating the stack, executing shellcode, and mitigating measures like Data Execution Prevention (DEP) and Address Space Layout Randomization (ASLR). Additionally, it includes tools for exploiting vulnerabilities and highlights advanced topics like sigreturn-oriented programming (SROP).
MacOS memory allocator (libmalloc) ExploitationAngel Boy
The document discusses the memory allocator libmalloc used in MacOS. It details the data structures used to manage tiny chunks of memory less than 1008 bytes, including blocks, chunks, magazines, free lists, bitmaps and regions. The mechanism of allocating, freeing and caching tiny chunks is also described.
Windows 10 Nt Heap Exploitation (Chinese version)Angel Boy
The document discusses Windows memory allocation and the NT heap. It describes the core data structures used, including the _HEAP, _HEAP_ENTRY chunks, and _HEAP_LIST_LOOKUP BlocksIndex. It explains how allocated, freed, and VirtualAlloc chunks are structured and managed in the Back-End, including using freelist chains and BlocksIndex to efficiently service allocation requests.
Windows 10 Nt Heap Exploitation (English version)Angel Boy
The document discusses the Windows memory allocator and heap exploitation. It describes the core components and data structures of the NT heap, including the _HEAP structure, _HEAP_ENTRY chunks, BlocksIndex structure, and FreeLists. It also explains the differences between the backend and frontend allocators as well as how chunks of different sizes are managed.
The document provides an overview of basic penetration testing techniques including buffer overflow vulnerabilities, return oriented programming (ROP), format string vulnerabilities, and ways to bypass data execution prevention (DEP) and address space layout randomization (ASLR). It discusses stack-based buffer overflows, the structure of the x86 stack, overwriting the return address, and controlling the instruction pointer. It also covers ROP techniques like ret2libc, gadgets, chaining, and using libc functions. Finally, it briefly mentions tools like pwntools, ROPgadget, and techniques like IO wrapping and LD_PRELOAD hijacking.
The document provides a detailed overview of the PCI (Peripheral Component Interconnect) system, explaining its architecture, including host and client relationships, data transfer speeds, and I/O configurations. It outlines the initialization process for PCI host controllers, resource allocation, and the structure of PCI device drivers, along with examples of initialization code and resource management. Additionally, it covers the mechanisms for using basic APIs to interact with PCI devices and considerations specific to ARM architecture.
Modern Kernel Pool Exploitation: Attacks and TechniquesMichael Scovetta
The document discusses modern techniques for exploiting vulnerabilities in the Windows kernel memory pool. It provides an overview of the kernel pool structures and internals in Windows 7 and earlier versions. Specific topics covered include the pool descriptor, pool headers, free lists, lookaside lists, large allocations, and the use of bitmaps. The goal is to identify weaknesses that can be leveraged for privilege escalation attacks.
The document provides an introduction to debuggers, focusing on using gdb to debug a simple C program called crash1.c that has two bugs. It explains how to compile the program with debugging information, run it in gdb, and diagnose the segmentation fault that occurs when the program is executed without command line arguments. The guide details the use of various gdb commands to inspect the state of the program and locate errors, emphasizing the importance of proper compilation for effective debugging.
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
The document discusses the process of creating a virtual address space for user applications in a Linux environment, specifically focusing on the x86_64 architecture using kernel version 5.11. Key topics include the structure of virtual memory, the execution of different types of programs (statically and dynamically linked), and the mechanics of processes like loading binaries and managing memory space. It also covers important functions such as load_elf_binary() and various kernel parameters related to address space layout randomization (ASLR).
This document discusses reverse engineering techniques including bypassing hackshield, analyzing Windows binaries with IDA Pro and Ollydbg, unpacking binaries with UPX and protecting binaries with encryption and anti-debugging techniques. It also covers basic x86 assembly instructions and reversing concepts like the stack, registers, and anti-debugging APIs.
The document presents a detailed overview of packet processing in Linux, focusing on the XDP (Express Data Path) technology and its applications for enhancing network performance. It covers various packet processing concepts such as filtering, forwarding, NAT, and traffic control, while demonstrating practical examples using netfilter and traffic control commands. Additionally, it provides insights into performance metrics, showcasing packet drop rates and test environments to illustrate the effectiveness of these techniques.
This document provides an overview of QEMU, including its use of dynamic translation and Tiny Code Generator (TCG) to emulate target CPUs on the host system. It discusses how QEMU translates target instructions into a RISC-like intermediate representation (TCG ops), optimizes and converts them to host instructions. The document also mentions Linaro's work with QEMU and a QEMU monitor tool for debugging ARM systems emulated by QEMU.
The document discusses C++ exploitation techniques including name mangling, virtual function tables, vtable hijacking, vectors, strings, and memory allocation/deallocation functions like new and delete. It provides details on how virtual function tables are used to implement polymorphism in C++ and how vtable hijacking can be used to exploit vulnerabilities by forcing a vtable and hijacking the virtual function pointer to call shellcode. It also explains how vectors and strings are implemented dynamically in memory and their memory layout.
The document provides an overview of various exploitation techniques, particularly focusing on buffer overflows, return-oriented programming (ROP), and return-to-libc attacks. It discusses methods for manipulating the stack, executing shellcode, and mitigating measures like Data Execution Prevention (DEP) and Address Space Layout Randomization (ASLR). Additionally, it includes tools for exploiting vulnerabilities and highlights advanced topics like sigreturn-oriented programming (SROP).
MacOS memory allocator (libmalloc) ExploitationAngel Boy
The document discusses the memory allocator libmalloc used in MacOS. It details the data structures used to manage tiny chunks of memory less than 1008 bytes, including blocks, chunks, magazines, free lists, bitmaps and regions. The mechanism of allocating, freeing and caching tiny chunks is also described.
Windows 10 Nt Heap Exploitation (Chinese version)Angel Boy
The document discusses Windows memory allocation and the NT heap. It describes the core data structures used, including the _HEAP, _HEAP_ENTRY chunks, and _HEAP_LIST_LOOKUP BlocksIndex. It explains how allocated, freed, and VirtualAlloc chunks are structured and managed in the Back-End, including using freelist chains and BlocksIndex to efficiently service allocation requests.
Windows 10 Nt Heap Exploitation (English version)Angel Boy
The document discusses the Windows memory allocator and heap exploitation. It describes the core components and data structures of the NT heap, including the _HEAP structure, _HEAP_ENTRY chunks, BlocksIndex structure, and FreeLists. It also explains the differences between the backend and frontend allocators as well as how chunks of different sizes are managed.
The document provides an overview of basic penetration testing techniques including buffer overflow vulnerabilities, return oriented programming (ROP), format string vulnerabilities, and ways to bypass data execution prevention (DEP) and address space layout randomization (ASLR). It discusses stack-based buffer overflows, the structure of the x86 stack, overwriting the return address, and controlling the instruction pointer. It also covers ROP techniques like ret2libc, gadgets, chaining, and using libc functions. Finally, it briefly mentions tools like pwntools, ROPgadget, and techniques like IO wrapping and LD_PRELOAD hijacking.
The document provides a detailed overview of the PCI (Peripheral Component Interconnect) system, explaining its architecture, including host and client relationships, data transfer speeds, and I/O configurations. It outlines the initialization process for PCI host controllers, resource allocation, and the structure of PCI device drivers, along with examples of initialization code and resource management. Additionally, it covers the mechanisms for using basic APIs to interact with PCI devices and considerations specific to ARM architecture.
Modern Kernel Pool Exploitation: Attacks and TechniquesMichael Scovetta
The document discusses modern techniques for exploiting vulnerabilities in the Windows kernel memory pool. It provides an overview of the kernel pool structures and internals in Windows 7 and earlier versions. Specific topics covered include the pool descriptor, pool headers, free lists, lookaside lists, large allocations, and the use of bitmaps. The goal is to identify weaknesses that can be leveraged for privilege escalation attacks.
The document provides an introduction to debuggers, focusing on using gdb to debug a simple C program called crash1.c that has two bugs. It explains how to compile the program with debugging information, run it in gdb, and diagnose the segmentation fault that occurs when the program is executed without command line arguments. The guide details the use of various gdb commands to inspect the state of the program and locate errors, emphasizing the importance of proper compilation for effective debugging.
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
The document discusses the process of creating a virtual address space for user applications in a Linux environment, specifically focusing on the x86_64 architecture using kernel version 5.11. Key topics include the structure of virtual memory, the execution of different types of programs (statically and dynamically linked), and the mechanics of processes like loading binaries and managing memory space. It also covers important functions such as load_elf_binary() and various kernel parameters related to address space layout randomization (ASLR).
This document discusses reverse engineering techniques including bypassing hackshield, analyzing Windows binaries with IDA Pro and Ollydbg, unpacking binaries with UPX and protecting binaries with encryption and anti-debugging techniques. It also covers basic x86 assembly instructions and reversing concepts like the stack, registers, and anti-debugging APIs.
The document presents a detailed overview of packet processing in Linux, focusing on the XDP (Express Data Path) technology and its applications for enhancing network performance. It covers various packet processing concepts such as filtering, forwarding, NAT, and traffic control, while demonstrating practical examples using netfilter and traffic control commands. Additionally, it provides insights into performance metrics, showcasing packet drop rates and test environments to illustrate the effectiveness of these techniques.
This document provides an overview of QEMU, including its use of dynamic translation and Tiny Code Generator (TCG) to emulate target CPUs on the host system. It discusses how QEMU translates target instructions into a RISC-like intermediate representation (TCG ops), optimizes and converts them to host instructions. The document also mentions Linaro's work with QEMU and a QEMU monitor tool for debugging ARM systems emulated by QEMU.
Pegasus: Designing a Distributed Key Value System (Arch summit beijing-2016)涛 吴
Pegasus is a high-performance, highly available, and strongly consistent distributed KV storage system developed by Xiaomi, addressing the limitations of existing systems like HBase. The design choices focus on using C++ for better performance, a shared commit log for improved data consistency, and features like automatic failover and flexible data modeling. Pegasus aims to ensure high availability, optimized performance, and an easy-to-use interface while supporting extensive scalability for massive workloads.
17. Stack Overflow
• From crash to exploit
• 隨意任意輸入⼀一堆資料應該只能造成 crash
• 需適當的構造資料,就可巧妙的控制程式流程
• EX :
• 適當得構造 return address 就可在函數返回時,跳到攻擊者的程式碼
18. Stack Overflow
• From crash to exploit
• Overwrite the the return address
• 因 x86 底下是 little-endian 的,所以填入 address 時,需要反過來來填入
• e.g.
• 假設要填入 0x00400646 就需要填入
x46x06x40x00x00x00x00x000
• p64(0x400646) # in pwntools
19. Outline
• Buffer Overflow
• Return to Text / Shellcode
• Protection
• Lazy binding
• Return to Library
20. Return to Text
• 控制 eip 後跳到原本程式中的程式碼
• 以 bofeasy 範例例來來說,我們可以跳到 l33t 這個 function
• 可以 objdump 來來找尋函式真正位置
78. Outline
• Buffer Overflow
• Return to Text / Shellcode
• Protection
• Lazy binding
• Return to Library
79. Return to Library
• 在⼀一般正常情況下程式中很難會有 system 等,可以直接獲得 shell 的
function
• 在 DEP/NX 的保護下我們也無法直接填入 shellcode 去執⾏行行我們的程式碼
80. Return to Library
• ⽽而在 Dynamic Linking 情況下,⼤大部份程式都會載入 libc ,libc 中有非常多
好⽤用的 function 可以達成我們的⽬目的
• system
• execve
• …
81. Return to Library
• 但⼀一般情況下都會因為 ASLR 關係,導致每次 libc 載入位置不固定
• 所以我們通常都需要 information leak 的漏洞洞來來或取 libc 的 base address
進⽽而算出 system 等 function 位置,再將程式導過去
84. Return to Library
• printf : 0x7ffff7a62800 (0x55800)
• libc base : 0x7ffff7a62800 - 0x55800 = 0x7ffff7a0d000
• system : 0x7ffff7a0d000 + 0x45390 = 0x7ffff7a52390
CODE VMA
DATA VMA
STACK
Library
system (base + 0x45390)
printf (0x7ffff7a62800)
base (0x7ffff7a62800)
85. Return to Library
• 在獲得 system 位置之後,我們可以複寫 return address 跳到 system 上,
這邊要注意的是參參數也要⼀一起放上,
• 但在 x86-64 Linux 上傳遞參參數是⽤用 register 傳遞的,第⼀一個參參數會放在 rdi
所以我們必須想辦法將 /bin/sh 的位置放在 rdi 上
• 可利利⽤用 pop rdi ; ret 的⽅方式將參參數放到 rdi
86. Return to Library
address of /bin/sh
new ret
system
aaaaaaaa
aaaaaaaa
aaaaaaaa
rsp
stack overflow ret
address of pop rdi
ret
pop rdi
ret
87. Return to Library
address of /bin/sh
new ret
system
aaaaaaaa
aaaaaaaa
aaaaaaaa
rsp
stack overflow ret
address of pop rdi
ret
pop rdi
ret
88. Return to Library
address of /bin/sh
new ret
system
aaaaaaaa
aaaaaaaa
aaaaaaaa
rsp
stack overflow ret
address of pop rdi
ret
pop rdi
ret
rdi address of /bin/sh
89. Return to Library
address of /bin/sh
new ret
system
aaaaaaaa
aaaaaaaa
aaaaaaaa
rsp
stack overflow ret
address of pop rdi
ret
pop rdi
ret
rdi address of /bin/sh
system(“/bin/sh”)