Monthly Archives: January 2017

Hello- world assembly

Hello world program in assembly language on a 64 bit x86 machine.

  1. Open a file named hello.asm
  2. Paste the following code
  3. SECTION .data
    msg: db “Hi World”,10
    len: equ $-msgSECTION .text
    global _start
    mov edx,len
    mov ecx,msg
    mov ebx,1
    mov eax,4
    int 0x80
    mov ebx,0
    mov eax,1
    int 0x80
  4. nasm -f elf64 hello.asm
  5. gcc -o hello hello.o -nostartfiles -nostdlib -nodefaultlibs
  6. ./hello


Wish to inject something in this binary?

Lets keep it simple!

I am going to use ghex to read or write on this binary file. System: 64 bit x86 and  OS: Ubuntu 14.04.

$sudo apt-get install ghex

Follow these steps:

1) ghex hello

2) Go to the place where you can find string “hello world”, replace it with “BUSTED”

3) You can add some signature to this file as well lets say string “ABCDEFGDIJK”. Place it in the file as well (may be three places away from “BUSTED”).

4) Remove everything following this signature string from the binary file.

5) $./hello

6) “BUSTED” You should be able to see this as output



Leave a comment

Posted by on January 23, 2017 in Uncategorized