A ROP (Return-Oriented Programming) attack can be used to execute arbitrary instructions by chaining together small pieces of code called "gadgets." Your goal is to create a stack layout for a ROP attack that calls a function located at '0x4018bd3'. Below is the assembly code for the function 'getbuf', which allocates 8 bytes of stack space for a 'char' array. This array is then passed to the 'gets' function. Additionally, you are provided with five useful gadgets and their addresses. Use these gadgets to construct the stack layout. Assembly for getbuf 1 getbuf: 2 sub $8, %rsp 3 mov %rsp, %rdi 4 call gets 56 add $8, %rsp ret #Allocate 8 bytes for buffer #Load buffer address into %rdi #Call gets with buffer #Restore the stack pointer #Return to caller. Stack Layout (fill in Gadgets each 8-byte section) Address Gadget Address Value (8 bytes) 0x4006a7 pop %rdi; ret 0x7fffffffdfc0 Ox4006a9 pop %rsi; ret 0x7fffffffdfb8 0x4006ab pop %rax; ret 0x7fffffffdfb0 0x7fffffffdfa8 Ox4006ad mov %rax, %rbx; ret Ox4006b0 pop %rbp; ret 0x7fffffffdfa0 0x7fffffffdf98 0x7fffffffdf90 0x7fffffffdf88 Original Return Address is at 0x7fffffffdf898 Task: Fill in the stack layout on the left with the values (addresses or constants) necessary to create a ROP chain that will execute a call to the function at '0x4018bd3'. • Use the provided gadgets to control the values in registers as needed.
A ROP (Return-Oriented Programming) attack can be used to execute arbitrary instructions by chaining together small pieces of code called "gadgets." Your goal is to create a stack layout for a ROP attack that calls a function located at '0x4018bd3'. Below is the assembly code for the function 'getbuf', which allocates 8 bytes of stack space for a 'char' array. This array is then passed to the 'gets' function. Additionally, you are provided with five useful gadgets and their addresses. Use these gadgets to construct the stack layout. Assembly for getbuf 1 getbuf: 2 sub $8, %rsp 3 mov %rsp, %rdi 4 call gets 56 add $8, %rsp ret #Allocate 8 bytes for buffer #Load buffer address into %rdi #Call gets with buffer #Restore the stack pointer #Return to caller. Stack Layout (fill in Gadgets each 8-byte section) Address Gadget Address Value (8 bytes) 0x4006a7 pop %rdi; ret 0x7fffffffdfc0 Ox4006a9 pop %rsi; ret 0x7fffffffdfb8 0x4006ab pop %rax; ret 0x7fffffffdfb0 0x7fffffffdfa8 Ox4006ad mov %rax, %rbx; ret Ox4006b0 pop %rbp; ret 0x7fffffffdfa0 0x7fffffffdf98 0x7fffffffdf90 0x7fffffffdf88 Original Return Address is at 0x7fffffffdf898 Task: Fill in the stack layout on the left with the values (addresses or constants) necessary to create a ROP chain that will execute a call to the function at '0x4018bd3'. • Use the provided gadgets to control the values in registers as needed.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 3PE
Related questions
Question

Transcribed Image Text:A ROP (Return-Oriented Programming) attack can be used to execute arbitrary
instructions by chaining together small pieces of code called "gadgets." Your goal is
to create a stack layout for a ROP attack that calls a function located at '0x4018bd3'.
Below is the assembly code for the function 'getbuf', which allocates 8 bytes of stack
space for a 'char' array. This array is then passed to the 'gets' function. Additionally,
you are provided with five useful gadgets and their addresses. Use these gadgets to
construct the stack layout.
Assembly for getbuf
1 getbuf:
2
sub
$8, %rsp
3
mov
%rsp, %rdi
4
call
gets
56
add
$8, %rsp
ret
#Allocate 8 bytes for buffer
#Load buffer address into %rdi
#Call gets with buffer
#Restore the stack pointer
#Return to caller.
Stack
Layout
(fill
in
Gadgets
each
8-byte
section)
Address
Gadget
Address
Value (8 bytes)
0x4006a7 pop %rdi; ret
0x7fffffffdfc0
Ox4006a9 pop %rsi; ret
0x7fffffffdfb8
0x4006ab pop %rax; ret
0x7fffffffdfb0
0x7fffffffdfa8
Ox4006ad mov %rax, %rbx; ret
Ox4006b0 pop %rbp; ret
0x7fffffffdfa0
0x7fffffffdf98
0x7fffffffdf90
0x7fffffffdf88
Original Return Address is at
0x7fffffffdf898
Task:
Fill in the stack layout on the left with the values (addresses or constants)
necessary to create a ROP chain that will execute a call to the function at
'0x4018bd3'.
• Use the provided gadgets to control the values in registers as needed.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr