The IDA Pro Book
Chris Eagle
Copyright 2011
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The information in this book is distributed on an As Is basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.
No Starch Press
Dedication
This book is dedicated to my mother.
PRAISE FOR THE FIRST EDITION OF THE IDA PRO BOOK
I wholeheartedly recommend The IDA Pro Book to all IDA Pro users.
Ilfak Guilfanov, creator of IDA Pro
A very concise, well laid out book.... The step by step examples, and much needed detail of all aspects of IDA alone make this book a good choice.
Cody Pierce, TippingPoint DVLabs
Chris Eagle is clearly an excellent educator, as he makes the sometimes very dense and technically involved material easy to read and understand and also chooses his examples well.
Dino Dai Zovi, Trail of Bits blog
Provides a significantly better understanding not of just IDA Pro itself, but of the entire RE process.
Ryan Linn, The Ethical Hacker Network
This book has no fluff or filler, its solid information!
Eric Hulse, Carnal0wnage blog
The densest, most accurate, and, by far, the best IDA Pro book ever released.
Pierre Vandevenne, Owner and CEO of DataRescue SA
I highly recommend this book to anyone, from the person looking to begin using IDA Pro to the seasoned veteran.
Dustin D. Trammell, Security Researcher
This book does definitely get a strong buy recommendation from me. Its well written and it covers IDA Pro more comprehensively than any other written document I am aware of (including the actual IDA Pro Manual).
Sebastian Porst, Senior Software Security Engineer, Microsoft
Whether you need to solve a tough runtime defect or examine your application security from the inside out, IDA Pro is a great tool and this book is THE guide for coming up to speed.
Joe Stagner, Program Manager, Microsoft
Acknowledgments
As with the first edition, I would like to thank my family for putting up with me while I worked on this project. I am ever grateful for their patience and tolerance.
I would also like to thank everyone who helped make the first edition a success, in particular the readers who I hope have found it to be a useful addition to their reverse engineering libraries. Without your support and many kind words, this edition would never have been possible.
Once again I wish to thank my technical editor Tim Vidas for all of his input over the course of this project, as well as his wife Sheila for allowing me to borrow him a second time.
Thanks also to the developers at Hex-Rays, not only for the product you have built but also for putting up with my bug reports, too many of which turned out to be false alarms. Ilfak, you have as usual been more than generous with your time; Elias, Igor, and Daniel, you have all provided insights that I could have obtained nowhere else. Together you all make IDA my favorite piece of software.
Finally, I would like to thank Alison Law and everyone else at No Starch Press for their hard work in keeping this version of the book moving along as smoothly as I could ever have hoped.
Introduction
Writing a book about IDA Pro is a challenging task. The fact that it is a complex piece of software with more features than can even be mentioned, let alone detailed in a book of reasonable size, is the least of the difficulties. New releases of IDA also tend to occur frequently enough that any book will almost certainly be one, if not two, versions behind by the time it hits the streets. Including version 5.3, which was released just as the first edition was going to press, seven new versions of IDA have been released since the first edition was published. The release of version 6.0 with a new, Qt-based graphical user interface motivated me to update the book and address many of the features that have been introduced in the interim. Of course, true to form, another version of IDA (6.1) was released late in the process just to make things more exciting.
My goal with this edition remains to help others get started with IDA and perhaps develop an interest in reverse engineering in general. For anyone looking to get into the reverse engineering field, I cant stress how important it is that you develop competent programming skills. Ideally, you should love code, perhaps going so far as to eat, sleep, and breathe code. If programming intimidates you, then reverse engineering is probably not for you. It is possible to argue that reverse engineering requires no programming at all because all you are doing is taking apart someone elses program; however, without committing to developing scripts and plug-ins to help automate your work, you will never become a truly effective reverse engineer. In my case, programming and reverse engineering substitute for the challenge of The New York Times Sunday crossword puzzle, so it is rarely tedious.
For continuity purposes, this edition preserves the overall structure of the first edition while elaborating and adding material where appropriate. There are a number of ways to read this book. Users with little reverse engineering background may wish to begin with discuss IDAs user interface features and basic capabilities.
Readers possessing some familiarity with IDA may wish to begin with provides a bit of a diversion useful for readers interested in running IDA on non-Windows platforms (Linux or OS X).
More advanced IDA users may find addresses the much-asked question of whether IDA can be used to patch binary files.
IDA is a quite capable tool right out of the box; however, one of its greatest strengths is its extensibility, which users have taken advantage of to make IDA do some very interesting things over the years. IDAs extensibility features are covered in walk you through plug-ins, file loaders, and processor modules.
With the bulk of IDAs capabilities covered, concludes the section by presenting some useful IDA extensions (plug-ins) that have been published over the years.
The book concludes with expanded coverage of IDAs built-in debugger in concludes the book with a discussion of IDAs remote debugging capabilities and the use of the Bochs emulator as an integrated debugging platform.
At the time of this writing, IDA version 6.1 was the most current version available, and the book is written largely from a 6.1 perspective. Hex-Rays is generous enough to make an older version of IDA available for free; the freeware version of IDA is a reduced-functionality version of IDA 5.0. While many of the IDA features discussed in the book apply to the freeware version as well, provides a brief rundown of some of the differences a user of the freeware version can expect to encounter.