x64 Reverse Engineering (Part 27 - x64 Assembly [Part 1])

x64 Reverse Engineering (Part 27 - x64 Assembly [Part 1])

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

Today we begin our actual x64 code basics. Over the next few weeks I will create very simple examples so we get a grasp of the x64 architecture. Let's start with a basic code block:

No alt text provided for this image

We begin by declaring the .data section to which all of our global data is stores. If we had a string or some other form of hard coded data it would go in that block. In our example we will leave it empty.

The .text section declares where the entry point of the program will begin in our case we use _start or you can use main.

We simply move the value of decimal 16 or hex 10 into the 64-bit RAX register. We will see in a moment that the processor will use only the lower EAX when we debug in GDB.

The last piece is just a simple exit routine which we move 60 into RAX and then syscall. It simply returns operation back to the OS.

Let's compile and link:

No alt text provided for this image

Let's debug in GDB:

No alt text provided for this image

Let's set the debugger for intel syntax and set a break on start:

No alt text provided for this image

As we can see 16 decimal or hex 10 is about to be moved into EAX but as we can see it has not been completed until we step forward.

No alt text provided for this image

Now we can view our registers.

No alt text provided for this image

We can see that RAX holds decimal 16 or hex 10 successfully.

We will spend several weeks on these simple examples so you can get comfortable with how the processor operates and its internal workings.

要查看或添加评论,请登录

Kevin Thomas的更多文章

社区洞察

其他会员也浏览了