x86_64 Assembly
Packages required:
- nasm – the Netwide Assembler, a portable 80×86 assembler
- ld – The GNU linker (compiler)
User Input
section .data
text1 db "What is your name? "
text2 db "Hello, "
section .bss
name resb 16
section .text
global _start
_start:
call _printText1
call _getName
call _printText2
call _printName
mov rax, 60
mov rdi, 0
syscall
_getName:
mov rax, 0
mov rdi, 0
mov rsi, name
mov rdx, 16
syscall
_printText1:
mov rax, 1
mov rdi, 1
mov rsi, text1
mov rdx, 19
syscall
ret
_printText2:
mov rax, 1
mov rdi, 1
mov rsi, text2
mov rdx, 7
syscall
ret
_printName:
mov rax, 1
mov rdi, 1
mov rsi, name
mov rdx, 16
syscall
ret

Breakdown
There are 4 subroutines in this program:
- _printText1
- _getName
- _printText2
- _printName
_getName utilizes the read syscall and stores the user input
The name variable has 16 bytes assigned it , a basic buffer overflow can be executed to inject a command.
