global _start
section .data
random: db "Hello" 0xA
random_length: equ $-random
section .text
mov eax, 0x4
mov ebx, 0x1
mov ecx, random
mov edx, random_length
int 0x80
mov eax, 0x1
xor ebx, ebx
int 0x80
int main(){
int a = 1;
int b = 13;
}
*main
a = 1
b = 13
void trigger_me(){
int num2 = 31;
}
int main(){
int num = 1;
trigger_me();
}
*main
num = 1
*trigger_me
num2 = 31
Will pop it in EIP ->
Will pop it in EIP ->
void some_random_func(){
char buff[10];
gets(buff)
}
int main(){
some_random_func();
}
The stack when our value is <= 10:
buff[10] = "Hi"
0x080bf12
0x080bfc7
void some_random_func(){
char buff[10];
gets(buff)
}
int main(){
some_random_func();
}
The stack when our value is > 10:
0x080bf12
0x080bfc7
buff[10] =
"Hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
void some_random_func(){
char buff[10];
gets(buff)
}
int main(){
some_random_func();
}
The stack when our value is > 10:
0x080bf12
0x080bfc7
buff[10] =
0xSHELLCODEADDR