way of breaking stuff with Joe here on Cyber Eri on demand. I has always in your instructor and I as always, I'm just thrilled to have you here. But I have to say that today's video is actually special to me because we're dealing with something that is near and dear to my heart, and that is the Windows deep bugger.
Now the reason it's so near and dear to my heart is because as people who know me, we can tell you
most of my career I have been a Windows guy Windows Development. I've been elbow deep in the windows, Colonel, I've really focused on, you know, I was working on exploit development, vulnerability research, just general engineering. Ah, lot of my time has been spent in the Windows operating system, just really working with the nuts and bolts of it. And as I was doing that, the tool that was more useful to me than
any other tool in the world
was the Windows debunker. And that's because the windows do bugger is a spectacularly powerful tool with an incredible array of uses.
Now there are people who don't like windbag. Most of those people are people who just don't like Windows, but it is usable in just about every job field. Just like nudie bugger is Windows De Bugger is useful for programmers to find an X and remove bugs in their code. It's useful for vulnerability, researchers exploit developers.
It's useful for network administrators trying to figure out what the heck is going wrong
with one of their network tools. It is just a spectacularly useful tool that could be applied to any discipline that might benefit from understanding what's happening in a process under the hood. And in today's video, we're gonna learn all about it. We're gonna learn how to get windbag. We're gonna learn what it's uses are we're gonna walk through the windows the same we've accounted with Ida
and then we're gonna actually use it, and we're going to examine
a running process and see what information we might be able to glean from it. So I'm very excited about this. If you can't tell just from listening to me, I love Windows and I love windbag, and hopefully you're going to learn to love it, too, over the course of the next 15 to 30 minutes, so thank you for watching breaking stuff with Joe here on cyber. Hurry on demand and let's get started.
So we're gonna go ahead and jump right into our windows 10 PM You've seen a lot of breaking stuff, Joe. Videos before or if you've, you know, been familiar with a lot of my classes. Generally speaking, we're working out of a new bunch of'em or a lab on Cyber Eri. But since this is a window is tool and since we're kind of focused on a Windows product right now, we are going to be using a Windows VM.
So I already have the page up. That's only because this PM has about happened crashing. Whenever I try to go to the Internet with it.
I don't think they all do that, but for some reason, this image is being a little screw with me. But the page you're gonna go to is right here looking for the windbag preview the Earl up here. You don't need to try and copy down. We will include the instructions for finding this page in the supplemental materials.
Then once you get on here, you're just gonna hit this get button and that's going to take you to the download for the installer while specifically it's going to take you to the Microsoft Store where you'll get the download for the installer
so you can see I skipped ahead a little bit here. The install process for windbag is a little bit slower on on this VM that it might be on a normal machine and it didn't see a need for everybody to sit around and wait on it.
So we're just gonna open up
with our Windows menu here. We're gonna open up our windbag preview after it gets installed,
Digs just a couple seconds to load up. It's a pretty big file, so it takes a second
and this is a pretty slow VM.
There we go. So now that windbag is finally open, you can see I've already played around with it a little bit. But when it opens, its gonna have these different sub windows in it. And these different sub windows all kind of contain whatever information you're directing contain. And you can control these by going over here to your view menu and picking which windows you want to see.
So just a quick walk through them command is the actual command window where you're saying, Start, stop, break things like that.
It's where you can actually type interactive commands to your program. Watch is setting watch points so specific variables you want to keep track of or functions. You want to see what their access, things like that those that's where you're gonna set your watch points. Locals. You can see any locally defined variables registers. You can see the contents of the registers as you're executing.
Memory, of course, is going to be whatever is currently started ram that's controlled by the program. You can see your stack frames, your disassembly threads all that. Generally speaking, the way I have mine laid out is I'll have my disassembly
Here are all these other windows
off my disassembly on its own over here on the right and then on the left. I'll just break this up into whatever windows I want to have. So, for example, breakpoints
break points. I'll open that Rio
and drag it down to be
I might include my stack frames
and you can see here that you've just youqing reconfigure it and set it up. However, you want it to be laid out, whatever works best for you. Additionally, these other tabs up here at the top, you've got different break points you can add. You can't add breakpoints until you've got a process that you're attached to one working with, which is why these are all great out right now.
Time travel is kind of an interesting little use or an interesting utility. So it's using stack traces. It will actually allow you to step back and forth through the execution of a program, which is just absolutely phenomenal. Usually with the D buggers you may have seen in our Judy be pro RGB video.
Trying to step backwards through a process is an absolute nightmare.
But using this stack tracing this time travel feature in the Windows de bugger, you kind of move back and forward through the program was very, very useful.
So we've got this revealed these windows laid out. We've got all these different tabs up at the top, and you can see here on our home tab, which is where we're gonna spend most of our time. We have a much different settings, options that we can check out. We have our step commands or step into, Out, Over and Argo command first, we're going to change our theme. Too dark because we're not barbarians and dark theme is always the correct way to go.
And now we're gonna go ahead and move on to our third and most important objective. Because we've already figured out what windbag is. We figured out what it's for. And now we've had a quick look at the menus in the utilities, and we've got it laid out at least kind of how we want it to be laid out. So the next step is going to be actually debug a program. Now, unlike the
the GB example where we could debug the program that was written, that was kind of a trivial program to figure out
here. We're gonna look at an actual Windows utility and see what that D bugger looks like when it's attached to that.
So the debug, the tool we're gonna debug here is a pretty famous Windows execute herbal, which is called New Pad. So we're just gonna do this launch executed all here over in our start debugging menu,
and then we're just going to do note pad
That should give us what we're looking for
and you can see here. Sure enough, system 32 no pad Dr T X C.
And it's slowly loading all the modules. These are all the different deals. All of the different libraries there access by no pad like with most things in Windows. It's a pretty big program.
So here we see we reached a break instruction exception. So that means that this is the program is running and hit the brake that was inserted by the Windows debunker. And that break is sort of, ah,
programming trick. It's sort of it is informing the D bugger. It's informing the operating system. Hey, throw an exception here because of the fact that I need to break in a city bugger I need to get access to this code is the D bugger. So that's all that's really happening here. Even though it says exception, it's not actually an error. It's a built in an exception that the
the operating system knows means that you're attaching the bugger.
we have a break. If we want to actually run the program and C note pad actually running and executing all we're gonna have to do here is used the geeky, which is the go command,
and you could see it's loaded and down here at the bottom, you can see that the note pad window actually came up,
which is very useful, but
we don't really have any ability to do anything with it. Because of that. You can see here that this just says D buggy is running. The code over here isn't changing. There's no information on stacker break points, and the reason for that is that while the program is actively running the D bugger can't really get a lot of context on, it doesn't really know what's happening.
So we want to do is we want to break back into the program,
and while with earlier versions you might have to send a specific commander, go through some process with the new version of windbag, all you have to do is go up here to the top left
and you could see that once again. It broke in with this
break exception and we over here we see that we have some stack from information. We actually have a little bit more data. We you know, we can see where we broke in.
We could see that we were in the base threat way kind of get a start. We're starting to get sort of a frame of reference on this excusable. But if we want to know a little bit more, we want to understand a little bit more. One of the things that we could do
is type a command to get it to get the symbols for this execute herbal. And if you may, you may or may not remember from our previous debugging video from our GDP video that the symbols are essentially the debugging information or the names of functions and variables that just make it easier to interpret it easier to understand.
So we want to do to get that is we're gonna take dot
and then we're going to type srv
asterisk. And I know this is this text can be a little bit hard to read, trying to zoom in, but unfortunately doesn't look like it's quite working for us. That's okay. Right here. What I've written is dot sym path S Y m P A T h, and then SRV with an asterisk, which is a wild card saying Look for
that simple and you can see here, gives about, gives him information out says the simple search path is the path we gave it, and it expands it out to show all of the different places that it's currently searching.
Once we've run that, we're going to just go ahead and hit this. We're gonna run this reload command dot reload,
and it's going to reload the program with its symbols.
And then we can see if they actually got loaded by doing X note pad,
and you can see that all of the different note pad functions got loaded.
Now these are all of the different sort of sub functions or attributes everything that's contained inside of note pad that has a symbol associated with it now because of the fact that Window's executed a lt's get a little bit ridiculously large. This can pretty easily get out of hand. So when you're looking for a specific function or specific symbol, you might want to
give a little bit more contact. So, for example, you might want to do something like no pad
asterisk main asterisk when you're looking for the main function,
and that is with an ex before it.
And you can see here it's actually showing us where the main function is in Windows. That's generally going to be win Maine. So now that we know what that function is, we know where that function is located.
We can create a break point, and we can actually break into the proper execution of this program.
So what we're gonna do there is we're going to have to come and be you. Note, pad
And down here you'll see that that break point is now populated, and we can turn that on and off very easily just by checking this box.
Once we've got that in place, all we need to do is hit that G again and start note pad running. And if everything goes correctly, it should run for about a billionth of a second and break back out.
And it looks like everything is not running correctly because it did not hit that break exception. So that's totally fine. What we could do with that we can figure out what's wrong with it is first just hit a restart
real quick wit for to reload takes just a minute
and then we're going to hit G again.
So what happened there? Was that because we had already been running no padded already past the beginning execution of Wind Main? So we had to restart the program and find it. And, you know, we're gonna leave that in after editing because it's one of the important things to note. When your debugging a program like this when in doubt, if you haven't given it data that you can't easily replicate,
just restarted. I have found so many errors that came about because of something I had done to the program while I was examining it that had just broken everything to pieces. So make sure you have the important details in there and then just hit restart.
Now you can see that we're actually in wind main were in the actual main function of the main execution function of the program. And over here on our window, to the right, you can see this is all of our disassembled code, which is
pretty dramatic looking, and you can do
you can change where you're looking exactly by doing this
address by affecting this address box. So we do know pad in Maine,
Rather instead of wind main. What we're gonna be doing is we're gonna be giving it the pointer of wind Main could be seven ff 7435
And that'll identify. We're back in one main and weaken CR disassembly.
It's very easy to accidentally scroll out into absolute mayhem, so it's worth putting down break points or watches on any of the functions that are important to you so that you can have a look at them. And here you can see we have a bunch of different note pad functions that are being called.
We've got trace logging register. We've got meme sets. We've got all sorts of functions actually being used now because this is a non trivial Windows program. This isn't just a simple thing that I wrote up that we can easily break to pieces. It's a little bit more to try and figure out what exactly is happening, but
we can get a little bit of context on this program and figure out what it was doing if we didn't know what No Pat Waas
by finding out what modules are currently loaded. What sort of code libraries are currently in use and the way would do that is just by typing lm which, which is the command to say. Show us the loaded modules
and you can see here we're gonna get a nice little readout of the module names that start and end locations for them and any information that it might have. So you can see all of these different modules that are being accessed by at all these two models that are being used shelter to Colonel 32 user 32. These are all of the different deals that have been loaded into this program,
and for the ones that it confined,
you'll actually get the P. D B files or the symbol files for those as well.
So we've had a look at what happens inside of window air inside of the Windows note pad, and all we want to do now is just send it back to running so that we can perform whatever operations we want to perform.
And there we can just hit go
And, of course, the D Buggy or the program that's being debugged is going to be running again and we can see that we can interact with it.
Then once we're done, whenever we retired of debugging or we found what we need to find, we're ready to move on. All we want to do here is just stop debugging.
So that was the relatively simple case of just sort of looking at no pad and seeing, seeing how we can open up no pad in windbag in and kind of poke through it a little bit. But what if we wanted to find out a specific piece of functionality? What if we wanted to see whether or not a specific program was writing files or was actually, you know, performing file? I owe on the disk?
We would want to, you know, make use of that. Perhaps if we were performing Mauer reverse engineering
or vulnerability analysis. We were looking for a case where something is being dropped on the disk that we may not know about otherwise, and the way we do that is actually, by creating another break point, you're now you may remember when he looked at are loaded modules just a second ago that one of the modules that got loaded here. Where is it?
Right down to the bottom. Right from my face is nt d l l nt dll for those who don't know contains a lot of sort of the native windows Colonel functions and is used to do a lot of sort of that interaction between the user and colonel
modes of the machine. So if we wanted to prevent or just become aware of people accessing the fire, the command
zw right file, which is the command is being used to perform file I Oh, what we'd do is we'd use BU nt dll
And you could see that that's going to create a new break point for us down here at the bottom.
And that break point is going to exist at the NT d l l N T Wright file function,
and we can go ahead and disable our first break point here,
and then we're just gonna go ahead and hit. Go
and it's gonna run for a couple of seconds
and you can see that the note pad has come up.
We can type in it, we can interact with it. Everything works fine.
What happens when we try and save this file?
You can see that the note pad seems to have completely frozen on us and nothing. It doesn't seem to be interacting at all. And the reason for that is because we've actually hit this right file.
And so, by setting that break point, we were able to let know Pat execute completely, normally perform all of its normal behaviors, and then as soon as it did something we don't want it to do, we were able to say, OK, this is bad or this is activity Maybe not bad or malicious, but this is activity that we want to monitor, and we want to understand what's happening.
Then we can go over here and we can see our frame, our stack frame our list of sort of function calls
and throw all the way back through this. And you can see obviously, that there are tons and tons of functions that are calling it sort of working their way down the stack.
But we can show, you know, it's trying to save a file. It's invoking the same dialogue we can see here that it's going through. User 32.
It's it's trying to access files on disk in order to write information to them. Now, generally speaking, like I said, with a program like note pad, this isn't necessarily going to give you a ton of horrible information you're seeing if it's writing a file. But this can be really, really useful When you're examining malware, you're trying to figure out what a specific execute herbal is doing
because you're able to now identify specific functions that it's loaded
by looking at the modules by setting break points on them and then by waiting for those break points to get hit.
So you might be able to tell, you know, if you set a break point on this anti right file and it never gets touched, well, then it's very likely that whatever you're examining isn't writing files to the disc and windows where if it is, it's doing it through some very special, complex way, because NT dll lives pretty low on that stack of function calls.
And, of course, over here on the right side, you can see that we have our disassembly established.
So there you have it. That's the basic use of windbag, obviously there's a lot more to the tool, and we could spend a lot more time on it. But one of the great things about doing videos like this is giving you the tools you need to be dangerous and the information you need to be dangerous. So I really recommend you pull down a copy of windbag for yourself. You play around with it.
Maybe write your own C program may be trying to a crack me,
but spend some time really playing around with this and seeing how you can personally use it in your role, whether that's, you know, in your day job, adjusting your personal hobbies. But the basic tools that we kind of went through here, and the understanding of what we've done here is going to really help you and set you up for success with using Wen
on this video, we kind of went through very briefly. We talked about what windbag is, where you can get it from how you install it. We show I showed you some of the windows that are used in some of the ways you could modify those windows and make use of it to kind of fit your own needs. And then, of course, we actually walk through not only looking at note pad just looking at us and execute Herbal and seeing how we can examine it with windbag,
but also finding a way to isolate specific functionality based on loaded modules
and go from that into finding out whether or not a program is actually performing a given action. Obviously, there's a ton more you can do with windbag, and I highly encourage you to take the time to check that out. But I want to thank you all for watching this video. It is always an absolute pleasure to get to make these and help people learn about how to use these tools in their everyday lives, in their jobs and in their work.
So thank you all for watching. I have been your instructor, Joe Perry, and you have been watching breaking stuff with Joe