Hello and welcome back.
In this lesson, I'm going to show you how to patch the file to change the password to your own password.
So let's reload this previous program, which we did before, which is crackme_1.
This one.
So just open that now.
And if you remember previously, we have breakpoints.
We've already set the breakpoints over here.
So let's run to that breakpoint.
Now currently, let me resize the windows so that you can see the running window at the back.
So let's run to that breakpoint.
And now it has hit our breakpoint.
And we will step over it.
I will go to the graph view by right-clicking it and clicking on Graph.
And resize the window a bit.
And now I'm going to step over by pressing this.
Keep on stepping over until it comes to this line where it will wait for your input.
So let's keep on stepping over until it comes there.
Now you see the text beginning to appear.
And now we are here.
Let's step over this one more time until the process turns to running state.
Now it has turned to running state, which means that it is waiting for you to input.
So let's go here now and key in any wrong password.
123456789,
hit Enter.
And now once you hit Enter, it comes back to the pause state.
That means it is waiting for you to step,
step over.
So let's step over now,
continuing
stepping over.
And now it's coming to this line where it's going to move the real password into -.
So this is the password you want to change.
We want to change this into our own password.
So to change that, we must go to the memory where this password is being stored.
So to go to that memory, we click on this line first,
and we see that the memory is 00578860.
We can go there now by right-clicking this and Follow in Dump.
And then select that memory address, straight away
it takes you there, as you can see.
So this window here is the memory dump where you can see the data that is stored in memory,
and at that address you will see there is the password.
So we want to change this password to our own password.
Now notice that we have all these bytes that we can use up to here to change it to our own password.
The last byte we can't use because the last byte is a null terminator.
In programming, we all know,
we all know that every string must terminate with a null terminator.
So a null terminator is simply byte zero zero.
So we must have a null terminator there.
So we can use all these bytes for our new password,
all these bytes here, leaving the null terminator.
That, and also we don't want to overwrite and come over here because this next string, "Congratulations,"
is required by the program when it prints a congratulatory message.
So now to change these bytes to our own password, we just right-click this, right-click this
and then select Binary, Edit.
And here you can see you can either change the password using the ASCII text field or Unicode.
But this one is not Unicode.
This is ASCII because if it is Unicode, every character will have two bytes.
That means if it's Unicode, you will see E and then a dot, A and then a dot, S and then a dot.
But in this case, there is no dot after each character.
That means this is in ASCII.
That means each character is one byte.
So we need to use this box.
So over here now we can enter our new password.
We must make sure that our new password must not exceed this available bytes.
So the available bytes here you can count is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15 bytes.
That means we can enter a new password which is 15 characters long.
So let's enter CrackingLessons, which is 15 characters long, CrackingLessons.
So this is 15 characters long, and it will eat up up to this byte and leaving one null terminator at
the back.
And then now we click Okay.
So you can see that we have already modified the password to become our own password, CrackingLessons.
Now we can patch it.
Just go to File and select Patch File, and then click on Patch.
And then we give it a new name,
crackme_1-2, click Save.
Click Okay.
And now we can close this and run our new patch,
this one.
So double-click this, and first we will enter the real password,
the previous password, easy password.
And this time it will reject it.
It says failed.
Now we enter our own new password.
CrackingLessons, Enter.
And it says Congratulations.
You entered the correct password.
So this is how we can patch the file to modify the password to your own password.
So that's all for this video.
Thank you for watching.