Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Buffer Overflow Attack: How do I print the pass value to be -12 and execute the hidden_func() for the C program below? buffer1.c: Assembly Code
Buffer Overflow Attack: How do I print the pass value to be -12 and execute the hidden_func() for the C program below?
buffer1.c:
Assembly Code for fun2:
Assembly Code for hidden_func:
My Buffer Attack( It's printing pass value -12, but not printing the hidden func):
\#includestdio.h int func1() \{ printf("executing func1() "); return 1; \} int hidden_func( ) \{ printf("executing hidden_func () ") ); \}. int func2() \{ signed short pass =0; char arr[12]; gets(arr); printf("pass:\%d ", pass); puts (arr); return 0; \} int main () \{ func2(); return 0 ; \} \begin{tabular}{|c|c|c|c|} \hline 000000000004005e2 & +: & push & % rbp \\ \hline 000000000004005e3 & +1 & mov & %rsp,% rbp \\ \hline 000000000004005e6 & +4: & sub & $010,% rsp \\ \hline 000000000004005ea & +8 & movw & $,2(%rbp) \\ \hline 000000000004005f0 & +14: & lea & 1(% rbp), \%rax \\ \hline 000000000004005f4 & +18: & mov & % rax, \%rdi \\ \hline 000000000004005f7 & +21: & callq & 4004c \\ \hline 000000000004005fc & +26: & movswl & 2(% rbp), \%eax \\ \hline 00000000000400600 & +3: & mov & % eax,\%esi \\ \hline 00000000000400602 & +32: & mov & $04006fa,%edi \\ \hline 00000000000400607 & +37: & mov & $x,% eax \\ \hline 0000000000040060c & +42: & callq & 0400490 printf@plt> \\ \hline 00000000000400611 & +47 : & lea & 1(% rbp), % rax \\ \hline 00000000000400615 & +51: & mov & % rax, \%rdi \\ \hline 00000000000400618 & +54: & callq & 0400480 \\ \hline 0000000000040061d & +59: & mov & $x,% eax \\ \hline 00000000000400622 & +64: & leaveq & \\ \hline 00000000000400623 & +65: & retq & \\ \hline \end{tabular} End of assembler dump. Dump of assembler code for function hidden_func: 00000000004005d2+: push % rbp 000000000004005d3+1: mov % rsp, % rbp x00000000004005d6 : callq 0400480Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started