6.4 Bad Chars

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with

Already have an account? Sign In »

14 hours 43 minutes
Video Transcription
Hello, everybody. And welcome to episode number 31 off the Buffer Overflow Siris.
But characters,
my name is Alejandro. Gonna be instructor for today's session. The Learning Operatives of the session is to understand the concepts behind the buffer overflow attack and apply the techniques to implement it before overflow attack. So let's get down to business, shall we?
First of all, just cleared that one out and let me give you some background about why we care about back characters.
Uh, before we actually create or payload, we need to identify if the application doesn't support like or use some characters as they can crash or execution flow. You know, this means that they will block or shell code from executing.
When I say shell colleges, because that's the core will be creative. You know, you can create any any type of payload.
And you know these characters can again crash. Oh, our affect their execution. Execution flow off your payload.
The most problematic characters is the new bite, which is, you know, has a hex aqui equivalent off 00 Another example of a common back. Carter's is the carriage return by which has hex key violent off zero d,
the last one especially dangerous when dealing with some protocols, like puppetry. For example,
assed, this protocol uses these characters to deter mined. When a command has an or input has end S O, we need to modify off proof of concept to send those back characters. Tow your payload. So
there's a bunch of places on the Internet where you can actually find but the bad character list, which is a really, really long list. But, you know, you can let me just give you the link to the one that I find I used. But, you know, again, you can use any other,
uh, tool or Paige,
because you know, yeah,
any other tool bridge? This is the list that I'm using right now.
So, yeah, there's that again. If you can just type bad characters list on the Internet and that that's it. So let me just modify or purple concept
O. B. O.
here entered this cultural list,
which again I just took it from from from the page. I just show you
and other I have that here. I remove all of this because at the end, remember, where will be executed.
Everything after or bees are created. I mean, after a bizarre created. So let me just put but
here. And I remember these will up at this point, we're filling up the from the EVP, which is the bottom of the stack. Then we found out the four e eyepiece and the E S P is the one that we're finding out we're actually executed or payload.
So we need to see what this application doesn't like.
So yeah, there's that. So we saved that.
And, you know, we again have to go to that process that you already know. But, you know, we have to continue doing that.
We attach it once again,
we run it
and we see what this doesn't like
and, you know, faith in,
uh, book
and was executed on and let me drag this out. It's past, you know? Okay, the baby contains okay, but you can see that the PSB right now, it doesn't contain much information. That's telling me something. Um,
the EVP contains Ford. You know, the 40 ones which are the ace, which is good so far,
and a AP content to 42 42 42 42 which is representing the four base. The four bees was sent. But you know, if I go here to SP and I put falling dump
Okay, see the character? Zero. But then I don't see the correct the residual one. Remember that we sent that out in your in your park.
0001 but I don't see that in your windows XB machine. It stays in zero. It doesn't go from 01 So cereal 000 which is they hex decimal representation off the no bite or the new character
is clearly affecting the, uh,
execution flow. So let me just again restored this
another. I have a running. Let me just, uh, eliminate
this your character from my string
and see what other character is actually affecting this.
So I executed
and I now see C for two for one tsp me following dump. Okay. 12 Tree for 56789 Do a zero of easy Easy. It seems good so far. Let me see if I can find anything here.
Anything, anything. Oh, no. I see the FF character, which is the last character, were actually sending Remember?
S f
Okay, So, uh, let me just show you the windows here again.
So it seems that when we deleted the 00 character, which is, you know, a good representation of the new bite in after sending the updated both buffer again the memory *** shelf that are respected characters from 012 f f.
This means that the only back harder that is actually affecting the flow off up. The execution on this application is 00
So, you know, it seems that we good to go. I mean, it seems that, you know, just to summarize or paler should not include the character 00 Otherwise, the content for pale wood will change or will not be executed.
We don't need to find a generic address that the DSP points to at the time of the crash.
You know, I have seen some people in some media be editorials hard coating the E S P address, and these will work for that specific video. Maybe. But every time you restart the application or restart the operating system, this will not work as it changes for every execution.
So we need to find a generic again. Address that E s P points too
s so we can put it on the P. I don't know if that makes sense. Remember the E S P at the top of the stack and the is the address that points to the next instruction to be executed. So right now, again, we need to find a generic generic address. That s P points too
kind of five. John PSB, for example.
Uh, we need to find a module or library, for example, a dll that is loaded by the bone server application. And it doesn't change at execution time or reboot on. It has to be, you know, good, readable or executed. Vel
For that, we used you. Remember that we talked about this at the beginning off of this
for awful for Siri's the morning at the fight. You know, again, it's a python script that will help us to identify several things like the one we're looking right now. Again, we're looking for all the modules or libraries loaded by the bone server with application crashes,
depending on what person off immunity? The bugger. Maybe Mona. It's installed already. Let me just show you the application. At the beginning of the series, I really showed you where to download a Demona pipe. The modern python script. Oh, my God. This again.
And right now, you just have to go to your local P C
and program files Immunity, Inc. Immunity, bugger and pie commands. And there would you will find the monastery. But you just have to copy paste it basically, which is this one, uh, copy Paste the Monas crypt. And you're good to go. That's it.
That's how you actually stall Mona. So that's that. And now, knowing that now we have more now in place, we need to find
what modules are loaded. When when we execute our exploit. And, of course, we need to redirect or execution to that point.
What is represented by the 00 hex? I put in us an inside joke right now because I did put a dash 00 But you cannot see anything here. So what it's put it, uh, what is represented by that? Well, the new character, as you can imagine,
what do we care about? But but characters? Because if we actually use,
but characters in any off if any
over process in any part of the process because at the end I really showed you how it affects our execution flow. I mean, how it affects our pill will be executed. But this king, This is also true for any memory after us that will be using in the upcoming medias.
We cannot use memory addresses that actually contains the bad characters
in any point because at the end, remember that will be using that operas to redirect or execution, meaning that we will use that actress in the Pointer. So if we find an address that is suitable for us for a number of reasons. But it contains that the character 00 again, the new character,
it will cut the connection. It will never make the redirection to the other part and off course.
You will never execute our payload. Yeah, that's why we care about my characters.
This video will learn some concepts behind the buffer overflow attack and we implemented some techniques to execute the bull for overflow attack
supplemental materials again, the Hiker playbook tree. Ah, amazing book And again, city F one a one of these guys has some had some serious
concepts and and, you know, exercises you can practice on
in the next video. We'll see how to read, redirect or execution s so we can put some system address on the I p and actually jumped to another location so we can actually execute her pay. Look what that's it for today, folks. I hope you enjoyed the video and talk to you soon.
Up Next
Offensive Penetration Testing

This is a deep course about penetration testing. In this course, you’ll learn from basic to the most advanced and modern techniques to find vulnerabilities through information gathering, create and/or use exploits and be able to escalate privileges in order to test your information systems defenses.

Instructed By