Welcome back.
Remember in the previous lesson I gave you an exercise a problem to solve or a challenge and that is
to find a way to bash the file so that when he runs it will not quit.
Instead you will continue to show the flag.
So in this lesson I will give you the solution.
So in this lesson I will show you how to patch using jumps and how to assemble jam instructions.
So let us get started.
We will open our bash file using excessive for DB e.g.
then we will press F nine to go to the entry point.
Next we will scroll down and look for our patch on a patch.
The gem instruction with two piece.
So now we need the program to stop at the correct place and is still a seating issue passed there.
So how do we make the program pass instead of seating so the tip I gave you was to use jam so here is
the solution after the program runs in cost.
This uh instruction if we show the flag and we want the flag to keep on showing instead of a seating
so why we need to do is that it must prevent a session from continuing.
How do we prevent a session continuing.
One way is to use a jam over here.
We can assemble a jam here to return to the previous instruction.
Over and over again in a tight loop so it will keep on looping.
If I put a jam to the previous address top here when it comes to this live instruction you agenda on
top so let's try.
So now I will assemble the jam instruction at this address this double create or express spacebar to
open the assemble dialog make sure this is checked and here we are going to jam to this address.
The address just before leave.
So we should copy this address.
Let me close this first and copy this address so select this address rightly copy select address now
come down to the living structure and press spacebar or double T and type J.
And B unconditional and jam and a rightly can paste address issue copy up here no it is that you get
an error in very state.
What you need to do is a pretty pen zero axing front zero eyes is a symbol for hex decimal.
So you need to put your eyes in front to tell the assembler that you are using hexadecimal.
Then make sure this is Czech and then click Okay.
So notice we are jumping to this address whenever we come in here.
We jump to the previous address click OK and entry X to close the assembler.
So now we have modified our leave instruction to jump to previous address and it has also feeling the
extra bytes if knobs.
So this is important to maintain the size of the of the program so whenever it comes here you jumped
the previous line again and again repeatedly.
So let us now create a new batch file.
Press on F on the file and select pacifier and then click on Bashar.
Button now select and you knew for how far it best to the easy safe
and you can close the data and now look the new batch to open it.
Press F nine.
Go to entry point and notice this time you don't have her any bricks.
Just go ahead.
Press the F nine to run and you can see the program did not exit is it open.
So you have solve the challenge now let us try to test it from the command line.
So we open come online
idea are too low key and you push too far and try to run it from here.
Press enter
and you can see the program stay open.
Up AC so this is how we can best the fire using and jam.
So if you wanted to see the file you just close it
so.
Same thing here.
Even I see the far the yes and the debugger.
So once again when you want a special file you have a jump first you get the address get the address.
You want to jump to so the address you want to jump to is here so once you get the address that you
want to jump to you.
Just assembly using a new instruction jump followed by 0 x in front to indicate is hexadecimal and then
you base your address on the one instruction before it and then make sure this is check.
Okay so that is all.
So thank you for watching.
In this lesson we have learned how to best jumps.
How to best file if demonstrations.
I'll see you in the next lesson.