Windows User Mode Exploit Development: Offensive Security
Windows User Mode Exploit Development: Offensive Security
Windows User Mode Exploit Development: Offensive Security
Offensive Security
All rights reserved. No part of this publication, in whole or in part, may be reproduced,
copied, transferred or any other right reserved to its copyright owner, including
photocopying and all other copying, any transfer or transmission using any network or
other means of communication, any broadcast for distant learning, in any form or by any
means such as any information storage, transmission or retrieval system, without prior
written permission from the author.
Table of Contents
1 Windows User Mode Exploit Development: General Course Information
1.1 About the EXP-301 Course
1.2 Provided Materials
1.2.1 EXP-301 Course Materials
1.2.2 Access to the Internal VPN Lab Network
1.2.3 The Offensive Security Student Forum
1.2.4 Live Support and RocketChat
1.2.5 OSED Exam Attempt
1.3 Overall Strategies for Approaching the Course
1.3.1 Welcome and Course Information Emails
1.3.2 Course Materials
1.3.3 Course Exercises
1.4 About the EXP-301 VPN Labs
1.4.1 Control Panel
1.4.2 Reverts
1.4.3 Kali Virtual Machine
1.4.4 Lab Behavior and Lab Restrictions
1.5 About the OSED Exam
1.6 Wrapping Up
2 WinDbg and x86 Architecture
2.1 Introduction to x86 Architecture
2.1.1 Program Memory
2.1.2 CPU Registers
2.2 Introduction to Windows Debugger
2.2.1 What is a Debugger?
2.2.2 WinDbg Interface
2.2.3 Understanding the Workspace
2.2.4 Debugging Symbols
2.3 Accessing and Manipulating Memory from WinDbg
2.3.1 Unassemble from Memory
2.3.2 Reading from Memory
2.3.3 Dumping Structures from Memory
2.3.4 Writing to Memory
2.3.5 Searching the Memory Space
6.8 Wrapping Up
7 Creating Custom Shellcode
7.1 Calling Conventions on x86
7.2 The System Call Problem
7.3 Finding kernel32.dll
7.3.1 PEB Method
7.3.2 Assembling the Shellcode
7.4 Resolving Symbols
7.4.1 Export Directory Table
7.4.2 Working with the Export Names Array
7.4.3 Computing Function Name Hashes
7.4.4 Fetching the VMA of a Function
7.5 NULL-Free Position-Independent Shellcode (PIC)
7.5.1 Avoiding NULL Bytes
7.5.2 Position-Independent Shellcode
7.6 Reverse Shell
7.6.1 Loading ws2_32.dll and Resolving Symbols
7.6.2 Calling WSAStartup
7.6.3 Calling WSASocket
7.6.4 Calling WSAConnect
7.6.5 Calling CreateProcessA
7.7 Wrapping Up
8 Reverse Engineering for Bugs
8.1 Installation and Enumeration
8.1.1 Installing Tivoli Storage Manager
8.1.2 Enumerating an Application
8.2 Interacting with Tivoli Storage Manager
8.2.1 Hooking the recv API
8.2.2 Synchronizing WinDbg and IDA Pro
8.2.3 Tracing the Input
8.2.4 Checksum, Please
8.3 Reverse Engineering the Protocol
8.3.1 Header-Data Separation
8.3.2 Reversing the Header
8.3.3 Exploiting Memcpy