Now that we have discussed MOV instruction and add instruction, let's discuss some differences between
these two instructions which can benefit us in exploit development.
Let's assume that we want to move the value to in the ATX register.
I have shown you earlier, when moving small values into a register like are eggs using more instruction,
it is going to cause null bytes.
So let's discuss how we can achieve this without causing any null bytes.
So let's create a new program called NULL Bytes Dot Nazan and let's use the same old global directive
which is global start.
And let's use a start here and let's use move our eggs comma to.
Let's save the program and let's quickly assemble and link it.
That boy is missing here.
Let's surrender once again.
There you go.
Now let's use object dump and let's try a dash cam and then bash the lights.
Let's hit enter.
As you can see here, this instruction is causing null bites.
Now, you have to remember that in larger programs, the ATX register may contain some values and you
may not be able to store the intended values.
So it is always a good idea to initialize the target register with the value zero.
So let's first do that, then NHLBI start Nazan.
And.
Move rigs come up zero, let's assemble and linking once again.
There it is.
Let's once again use object dump and see what happens.
Look at that.
We tried moving the value zero into the register and even this instruction has caused some null bytes.
So typically we can overcome this problem by performing an exclusive or operation on a register with
itself.
So let's see how we can do that.
I'm opening my null bytes Darwinism once again, and instead of using MOV instruction, I'm going to
use Anzar ATX, Qamar IREX.
Now, regardless of what value Attic's contains before executing this design instruction, it is going
to become zero, right?
So let's assemble and link it and see if we have removed null bytes from this first instruction and
once again assemble and link it.
And let's use object up and Baringo.
The first instruction doesn't have any null bytes anymore, but the second instruction still have it.
So one way to do it, if you still want to use more instruction, is to use the subbranches, just like
we have seen earlier.
So let's quickly do that.
So instead of using IDEX, I'm going to use L, which is a sub register and let's quickly assemble and
link it.
Next used object once again and look at that, we have avoided Lullabye in the second instruction as
well, right?
This is a nice way of doing it, but there is another way that is using ad instruction.
So what we can do is we can simply replace this move in instruction by just using our eggs, but by
using add instruction.
So we are using add our eggs comma to essentially we are adding the value to to zero.
So our eggs ultimately contains the value too.
So let's save the file, assemble and link it once again.
Let's use object up and look at that.
Even the add instruction doesn't come with any animal bites.
So clearly we can use add instruction as an alternative to move instruction if we want to avoid null
bytes.
I'm going to discuss how this exclusive our instruction works in the next video.
So see you there.