未加星标

Kernel Debugging 101 Part1

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

This is for someone who wants to jump into kernel debugging but like me thought it was very difficult to get setup and working properly. It turns out its actually a lot easier than you think.

The Stuff You Will Need

# IDAPro 6.8+

I am going to be using IDA for some of this, if you need a copy I suggest you call HackingTeam

# VisualStudio 2015 + windows10 SDK + WDK (Windows Driver Kit)

You might want to compile some stuff and its very useful to have.

# WinDBG for Win7

There is a small error with using the newer windbg when debugging a older host. It boils down to not being able to display registers properly. So if you are going to be using a Win7 VM then you will want to install this.

http://msdl.microsoft.com/download/symbols/debuggers/dbg_x86_6.11.1.404.msi

# Symbols

Because I’m on a slow connect I chose to download my symbols all at once from here. I just install them to the C:\Symbols path

https://developer.microsoft.com/en-us/windows/hardware/download-symbols

You want retail symbols most likely, to find out the difference look here.

whats-the-difference-between-retail-symbols-and-checked-symbols Install and Configuration

# Symbol Path

Before we start you are going to want to set your Symbol path. Windbg will look for symbols based on this entry. Make sure you obviously have the C:\Symbols directory setup.

_NT_SYMBOL_PATH = srv*C:\Symbols*http://msdl.microsoft.com/download/symbols


Kernel Debugging 101   Part1

# Change ida config for windbb

Now you are going to want to change the ida.cfg file located in “ C:\Program Files (x86)\IDA 6.8\cfg ” Look for the line that says DBGTOOLS

it should be commented out, change it accordingly. (

SpecialNote

: If you are doing x64 kernel debugging still use the x86 path!)

Win7

DBGTOOLS = “C:\\Program Files\\Debugging Tools for Windows (x86)\\”;

Win8+

DBGTOOLS = “C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\”;

Does it work?

Ok so lets do a quick dry run to make sure everything is working, we will use a Windows10 x64 VM for the test since its easy to setup.

# modify bcdedit for network debugging Win8+

As administrator just exicute this and copy the key someplace as you will need it later on.

bcdedit.exe /debug on

bcdedit.exe /dbgsettings NET HOSTIP:192.168.1.101 PORT:50000

# load windbg and connect to kernel

Now load windbg and go under File->Kernel Debug (ctrl+k) and enter your key. You can pause the VM by issuing a break.

# load driver symbols

To force load the driver symbols for all the loaded drivers, be sure to note the difference between kernel and user mode

.reload /f

# change to user mode

.process /i [addy_of_user_proc]

g

.reload /f /user

# change to kernel mode

.process /i [addy_of_kernel_proc]

g

.reload /f

Verify IDA can kernel debug

We now have to make sure IDA is setup properly, make sure windbg is closed and your VM is restarted. Now open IDAx64 as admin and go to Debugger->Attach->Widbg Debugger

( Warning : If you didn’t set the dbgtools option you’ll get a cant connect error.)

Win8+

net:port=50000,key=YOUR.KEY.GOES.HERE

Win7

com:port=\\.\pipe\mypipe\,pipe,reconnect

I have my setting like this.


Kernel Debugging 101   Part1
Kernel Debugging 101   Part1

If it worked you might get a error like this.


Kernel Debugging 101   Part1

Once loaded you should have something like this…


Kernel Debugging 101   Part1

And thats it you should be all setup!

What to do now?

There are a few things you can do now, one of them is follow along with this tutorial. I should admit that I have not actually done this myself as I only read through it.

Debug Universal Drivers Step by Step Lab (Echo Kernel-Mode) https://msdn.microsoft.com/en-us/library/windows/hardware/mt269367(v=vs.85).aspx

You could also follow along with @TheColonial as he exploits capcom.sys

Hackingz Ze Komputerz Exploiting CAPCOM.SYS https://www.youtube.com/watch?v=pJZjWXxUEl4

Or just go off and play on your own, there is a lot to learn and it can get VERY complicated at times.

In the next post I will go over how to change your theme to look like the above picture. In another post I will go over some of the awesome plugins you can use and how you can follow along with IDA while directly using windbg.

Anyways Happy Holidays and Good Luck with your BugHunting!

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

主题: WindowsTIAPCRY
分页:12
转载请注明
本文标题:Kernel Debugging 101 Part1
本站链接:http://www.codesec.net/view/535075.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(47)