Debugging Windows Applications with IDA WinDbg Plugin Copyright 2011 Hex-Rays SA



Similar documents
Integrated Virtual Debugger for Visual Studio Developer s Guide VMware Workstation 8.0

Debugging Windows kernel under VMWare using IDA's GDB debugger Copyright 2009 Hex-Rays SA

Back-up Server DOC-OEMSPP-S/2014-BUS-EN-10/12/13

Setting Up a Windows Virtual Machine for SANS FOR526

Using Microsoft Visual Studio API Reference

Using Process Monitor

Table of Contents. FleetSoft Installation Guide

for Networks Installation Guide for the application on a server September 2015 (GUIDE 2) Memory Booster version 1.3-N and later

VirtualXP Users Guide

Hypercom Key Loading and Management (HKLM) RS232 PPP Key Injection PC Setup Guide

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later

AXIS Video Capture Driver. AXIS Video Capture Driver. User s Manual

Backup Server DOC-OEMSPP-S/6-BUS-EN

USER GUIDE. Ethernet Configuration Guide (Lantronix) P/N: Rev 6

PigCHAMP Knowledge Software. Enterprise Edition Installation Guide

v4: How to create a BartPE Rescue CD for Macrium Reflect

VMware/Hyper-V Backup Plug-in User Guide

How to install USB driver (MICRO/I)

NovaBACKUP xsp Version 12.2 Upgrade Guide

for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

Installation Notes for Outpost Network Security (ONS) version 3.2

Install MS SQL Server 2012 Express Edition

OfficeServ Link. User Guide. Version 2.1 June 2005

64-Bit Compatibility with Micromeritics Applications

VisionView Maintenance Utility Release Notes

TOSHIBA GA Printing from Windows

Iridium Extreme TM Satellite Phone. Data Services Manual

Getting Started With Parallels Desktop 7

Authorware Install Directions for IE in Windows Vista, Windows 7, and Windows 8

Fiery E100 Color Server. Welcome

FileMaker 12. ODBC and JDBC Guide

SmartSync Monitor Help

Practice Fusion API Client Installation Guide for Windows

Eclipse installation, configuration and operation

MS 50292: Administering and Maintaining Windows 7

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

Installation and User Guide Zend Browser Toolbar

Introduction 1-1 Installing FAS 500 Asset Accounting the First Time 2-1 Installing FAS 500 Asset Accounting: Upgrading from a Prior Version 3-1

Windows Vista /Windows 7 Installation Guide

Vodafone PC SMS (Software version 4.7.1) User Manual

For most Windows users, system startup is an uneventful,

Installation Guide for Microsoft SQL Server 2008 R2 Express. October 2011 (GUIDE 1)

Impact+OCR 1.1 Readme

SiteCount v2.0 Revised: 10/30/2009

Requirements & Install. Module 2 Single Engine Installation

InventoryControl for use with QuoteWerks Quick Start Guide

Microsoft Visual Studio Integration Guide

Quick Start Guide for VMware and Windows 7

Configuring Kernel Debugging on Windows 7 with VMWare virtual machine

Getting Started with VMware Fusion

A PC

Release Notes - Installing the Wireless Receiver on a PC.

Core Protection for Virtual Machines 1

TECH NOTES. Minimum MLC 226 IP MediaLink Controller Firmware required Applies to

VEEAM ONE 8 RELEASE NOTES

FileMaker. Running FileMaker Pro 10 on Citrix Presentation Server

FileMaker 11. ODBC and JDBC Guide

Printer Sharing of the PT-9500pc in a Windows Environment

Pro-Watch Software Suite Installation Guide Honeywell Release 3.81

Integrated Virtual Debugger for Visual Studio Developer s Guide VMware Workstation 7.0

Setting up VPN Access for Remote Diagnostics Support

Hyper-V Server 2008 Setup and Configuration Tool Guide

SQL EXPRESS INSTALLATION...

Application Note CTAN #374

ATX Document Manager. User Guide

STATISTICA VERSION 10 STATISTICA ENTERPRISE SERVER INSTALLATION INSTRUCTIONS

DMP V2.0.1 Installation and Upgrade Reference

Symantec Virtual Machine Management 7.1 User Guide

Getting Started with VMware Fusion. VMware Fusion for Mac OS X

Windows 2003 Server Installation Guide

IceWarp Unified Communications. Installation Guide. Version 10.4

ScriptLogic Enterprise Security Reporter. VERSION 3 Installation Guide

Creating client-server setup with multiple clients

Dokmee Enterprise Installation

Quick Start Guide for Parallels Virtuozzo

Important Notes for WinConnect Server VS Software Installation:

VERSION NINE. Be A Better Auditor. You Have The Knowledge. We Have The Tools. INSTALLATION GUIDE

Server & Client Optimization

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Managing Multi-Hypervisor Environments with vcenter Server

Install Device Drivers and Toolkit for Windows 7

General Tips: Page 1 of 20. By Khaled Elshaer.

Outlook Connector Installation & Configuration groupwaresolution.net Hosted MS Exchange Alternative On Linux

Immotec Systems, Inc. SQL Server 2005 Installation Document

Configure SPLM 2012 on Windows 7 Laptop

Running a Program on an AVD

KX-Series PBX TAPI Service Provider

COM Port Stress Test

SalesPad for Dynamics GP DataCollection Installation & Setup

FREQUENTLY ASKED QUESTIONS (FAQs) 123Scan 2 Scanner Configuration Utility 19 April 2011

isupplier PORTAL ACCESS SYSTEM REQUIREMENTS

Suite. How to Use GrandMaster Suite. Exporting with ODBC

Load Balancing. Outlook Web Access. Web Mail Using Equalizer

Installation Instruction STATISTICA Enterprise Small Business

Windows Dial Up Networking (DUN) for AirLink Modems Application Note - How To

Equalizer VLB Beta I. Copyright 2008 Equalizer VLB Beta I 1 Coyote Point Systems Inc.

EXPRESSCLUSTER X for Windows Quick Start Guide for Microsoft SQL Server Version 1

Setting Up the Development Workspace

Topaz Installation Sheet

Transcription:

Debugging Windows Applications with IDA WinDbg Plugin Copyright 2011 Hex-Rays SA Quick overview: The Windbg debugger plugin is an IDA Pro debugger plugin that uses Microsoft's debugging engine (dbgeng) that is used by Windbg, Cdb or Kd. To get started, you need to install the latest Debugging Tools from Microsoft website: https://msdn.microsoft.com/en-us/windows/hardware/hh852365 or from the Windows SDK / DDK package. Please make sure you should install the x86 version of the debugging tools which is used by both IDA Pro and IDA Pro 64. The x64 version will NOT work. After installing the debugging tools, make sure you select «Debugger / Switch Debugger» and select the WinDbg debugger. Also make sure you specify the correct settings in the Debugger specific options dialog:

User mode: Select this mode for user mode application debugging (default mode) Kernel mode: Select this mode to attach to a live kernel. Non Invasive debugging: Select this mode to attach to a process non-invasively Output flags: These flags tell the debugging engine which kind of output messages to display and which to omit Kernel mode debugging with reconnect and initial break: Select this option when debugging a kernel and when the connection string contains 'reconnect'. This option will assure that the debugger breaks as soon as possible after a reconnect. To make these settings permanent, please edit the IDA\cfg\dbg_windbg.cfg file. To specify the debugging tools folder you may add to the PATH environment variable the location of Windbg.exe or edit %IDA%\cfg\ida.cfg and change the value of the DBGTOOLS key. After the debugger is properly configured, edit the process options and leave the connection string value empty because we intend to debug a local user-mode application.

Now hit F9 to start debugging: The Windbg plugin is very similar to IDA Pro's Win32 debugger plugin, nonetheless by using the former, one can benefit from the command line facilities and the extensions that ship with the debugging tools. For example, one can type!chain to see the registered Windbg extensions:

!gle is another command to get the last error value of a given Win32 API call. Another benefit of using the Windbg debugger plugin is the use of symbolic information. Normally, if the debugging symbols path is not set, then the module window will only show the exported names. For example kernel32.dll displays 1359 names:

Let us configure a symbol source by adding this environment variable before running IDA: set _NT_SYMBOL_PATH=srv*C:\Temp\pdb*http://msdl.microsoft.com/download/symbols It is also possible to set the symbol path directly while debugging: and then typing.reload /f to reload the symbols. Now we try again and notice that more symbol names are retrieved from kernel32.dll: Now we have 5818 symbols instead!

It is also possible to use the x command to quickly search for symbols: (Looking for any symbol in any module that contains the word continue )

Debugging a remote process: We have seen how to debug a local user mode program, now let us see how to debug a remote process. First let us assume that pca is the target machine (where we will run the debugger server and the debugged program) and pcb is the machine where IDA Pro and the debugging tools are installed. To start a remote process: On pca, type: dbgsrv -t tcp:port=5000 (change the port number as needed) On pcb, setup IDA Pro and Windbg debugger plugin: Application/Input file : these should contain a path to the debuggee residing in pca Connection string: tcp:port=5000,server=pca Now run the program and debug it remotely. To attach to a remote process, use the same steps to setup pca and use the same connection string when attaching to the process. More about connection strings and different protocols (other than TCP/IP) can be found in debugger.chm in the debugging tools folder.

Debugging the kernel with VMWare: We will now demonstrate how to debug the kernel through a virtual machine. In this example we will be using VMWare 6.5 and Windows XP SP3. Configuring the virtual machine: Run the VM and then edit c:\boot.ini file and add one more entry (see in bold): [operating systems] multi(0)disk(0)rdisk(0)partition(1)\windows="microsoft Windows XP Professional" /noexecute=optin /fastdetect multi(0)disk(0)rdisk(0)partition(1)\windows="local debug" /noexecute=optin /fastdetect /debug /debugport=com1 /baudrate=115200 For MS Windows Vista please see: http://msdn.microsoft.com/en-us/library/ms791527.aspxp Actually the last line is just a copy of the first line but we added the /debug switch and some configuration values. Now shutdown the virtual machine and edit its hardware settings and add a new serial port with option use named pipes :

Press Finish and start the VM. At the boot prompt, select Local debug from the boot menu: Configuring Windbg debugger plugin: Now run IDA Pro and select Debugger / Attach / Windbg Then configure it to use Kernel mode debugging and use the following connection string: com:port=\\.\pipe\com_1,baud=115200,pipe It is possible to use the 'reconnect' keyword in the connection string: com:port=\\.\pipe\com_1,baud=115200,pipe,reconnect

Also make sure the appropriate option is selected from the debugger specific options. Please note that the connection string (in step 1) refers to the named pipe we set up in the previous steps. Finally, press OK to attach and start debugging.

When IDA attaches successfully, it will display something like this: If you do not see named labels then try checking your debugging symbols settings. Note: In kernel mode IDA Pro will display one entry in the threads window for each processor. For example a two processor configuration yields: VMWare configuration Threads in IDA

This screenshot shows how we are debugging the kernel and changing the disassembly listing (renaming stack variables, or using structure offsets): At the end you can detach from the kernel and resume it or detach from the kernel and keep it suspended. To detach and resume, simply select the Debugger / Detach, however to detach and keep the kernel suspended select Debugger / Terminate Process.

Debugging the kernel through kdsrv.exe In some cases, when debugging a 64bit kernel using a 1394 cable then 64bit drivers are needed, thus dbgeng (32bits) will not work. To workaround this problem we need to run the kernel debugger server from the x64 debugging tools folder and connect to it: Go to Debugging Tools (x64) installation Run kdsrv.exe (change the port number/transport appropriately): kdsrv -t tcp:port=6000 Now run ida64 and specify the following connection string (change the transport value appropriately): kdsrv:server=@{tcp:port=6000,server=127.0.0.1},trans=@{com:port=\\.\pipe\com_3,bau d=115200,pipe}