Real Midterm Flashcards
The returns of strcpy() store in what register that have the address of what buffer?
EAX, Destination
Which of the following step/steps is/are required to execute a shell code in memory?
Find the vulnerability, store the shellcode to the executable memory, hijack control flow/EIP to shellcode
Will comparing a signed integer with an unsigned integer cause an integer overflow?
Yes
Why is it important to execute an exit() syscall for the code reuse attacks?
To avoid a crash and leave no attack trace
Which one of the following is a safe libc function?
strncpy
A shell code can be used for what?
Creating a new user, changing user password, opening a connection to the attackers machine
Suppose we have the following gadgets
G1:
pop %ebx
ret
G2:
pop %ecx
ret
G3:
movl %ebx, %(ecx)
To achieve the following operation, determine the order of gadgets
store 10 at memory address 0x805000
G2, 0x805000, G1, 10, G3
NOP equivalence for stack pointer (esp) move is a gadget that only contains a what instruction?
ret
Finding gadgets is traditionally a what recursive traverse algorithm and searchable through a what representation?
Backward, Trie
True or false: Type confusion bugs are caused by inappropriate up-casts.
False
Direct function calls are what?
Not exploitable
For ROP attacks, any gadget should ends with a what instruction?
ret
The leave instruction (AT&T) combines what instructions?
mve %ebp, %esp
pop %ebp
Format string specifier %n is significant for what?
Writing the number of characters printed so far in a pointer
The following order can be used in position independent shellcode to get the address of a string
Execute jmp to a call instruction sits right before the string, then call instructions goes back to jump+1 after pushing to the return address to the stack
True or False: In a double free, an exploitation occurs when the program calls free(q) on a region that contains data set by the attacker and the second free(q) will try to use the fake chunk tag.
True
The ret instruction is equivalent to what?
pop %eip
To execute a system call, a shellcode must contain what?
Store syscall id in EAX register
Why is it difficult to detect a Use-After-Free vulnerability?
They only exist in a particular execution path
Code reuse attacks can bypass what defenses?
Code signing and Write or Execute
What vulnerability is a double fetch bug a form of?
A race condition
In Stack Guard implementation the function prologue does what?
Stores a canary word between return address and locals
/GS protection alone is not enough to defend against exception handler based exploits because?
The exception is triggered before the canary is checked
In StackGuard implementation the function epilogue does what?
Checks canary before the function returns
True or False: Context sensitive CFI policy is simple but imprecise compared to Context-insensitive CFI policy
False
The most popular target of heap spray attacks is what?
Browser code
Which of the following register is used by the GCC stack smashing protector to locate the random canary?
%gs
A terminator canary may consist of what?
\n\n\n\n
Which of the following address randomizations is widely deployed?
Address space layout randomization
Which of the following principles should be maintained by an inline reference monitor?
Reference monitors must always be invoked
Where can a reference monitor be implemented?
Wrapping around the target program, inside the kernel or inside the target program
The probability of a successful heap spray attack does not depend on
The length of each targeted sensitive object in the memory
StackGuard protection can be bypassed by what?
Leveraging information leak vulnerability
/GS Stack frame stores the exceptional handlers just before what?
The canary
Which of the following is not a component of CFI defense mechanism?
Code Obfuscation
Applications with Write or Exectute (W^X) protection, their stack/heap memory is what?
Writable, but not executable
Race windows in a Race condition is a what?
Code segment
A race condition vulnerability must consist of what?
A concurrency property
A shared object property
A change state (share object) property
In ProPolice protection mechanisms, in addition to canaries?
Local variables are rearranged by their types
Intel CET Shadow Stacks maintain a shadow copy of what?
The return address
What is a buffer overflow?
A buffer overflow is when data is written outside the bounds of the allocated buffer space
Why are buffer overflows common in C/C++ programs?
They are common in C/C++ programs because there are not automatic bounds checking
What can buffer overflows be leveraged to do?
Hijack the control flow of a program and execute arbitrary code by overriding the function pointers or return addresses
What are some common unsafe C functions that can allow attackers to perform buffer overflows?
strcpy, strcat, gets, and scanf
What is a safeish libc function?
strncpy
What is commonly used to identify potential buffer overflows?
Fuzz testing (by using random inputs)
What can address sanitizing do to help detect buffer overflows?
They help detect out of bound writes during testing
When the return address is overwritten by an attacker during a stack buffer overflow what can occur?
The program can then be used to jump to the attackers code
What are some defenses against buffer overflows?
Bounds checking, canaries, ASLR ie randomizing the addresses, and using safer functions
What was the first major exploit of buffer overflows?
The internet worm using the fingerd service
What are some targets for control flow hijacking using buffer overflows?
Function pointers
exception handlers
vtables
longjmp buffers
What are heap based buffer overflows?
When the allocated heap buffer is overflowed and causes the overwriting of the adjacent heap metadata structures
Why do some defense mechanisms not get implemented?
Because of performance overhead concerns
What are type confusions?
Vulnerabilities that occur when code accesses a memory resource using an incompatible type
Why does type confusions often occur in C/C++?
There are no runtime type safety checks so pointers can be cast to incompatible types
What are some different casting operations that could cause type confusion?
Static casting with static_cast
Dynamic casting with dynamic_cast
C-style casting with (Type)
What is a common cause of type confusion bugs?
Illegal downcasts
What are some defenses against type confusion bugs?
Runtime type checking, strict casting rules and using type safe languages like java
What is an integer overflow?
An integer value that exceeds its maximum value and as a result wraps around
Can converting from a signed to an unsigned integer cause an integer overflow?
Yes