W5.1 - Pointer Subterfuge

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/38

flashcard set

Earn XP

Description and Tags

CS6301

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

39 Terms

1
New cards

What is pointer subterfuge?

A class of attacks that exploit how programs use pointers by manipulating pointer values to redirect program execution to attacker-controlled code

2
New cards

What are the two main types of pointer subterfuge attacks?

• Function pointer attacks - overwriting function pointers to redirect execution to shellcode
• Data pointer attacks - modifying data pointers to achieve arbitrary memory writes

3
New cards

What is a pointer in programming?

A variable that stores the memory address of another variable, function, array element, or data structure

4
New cards

What are the main memory segments in UNIX executables?

• Text segment - executable code (read-only)
• Data segment - initialized global variables and constants
• BSS segment - uninitialized global variables
• Heap - dynamically allocated memory
• Stack - local variables and function call information

5
New cards

Where are initialized global variables stored?

In the data segment

6
New cards

Where are uninitialized global variables stored?

In the BSS (Block Started by Symbols) segment

7
New cards

What does BSS stand for?

Block Started by Symbols

8
New cards

Where are local variables stored?

On the stack

9
New cards

Where are static local variables stored?

In the data segment if initialized, BSS segment if uninitialized

10
New cards

What are the three prerequisites for a buffer overflow to overwrite a pointer?

• Buffer must be in the same memory segment as target pointer
• Buffer must be at lower memory address than target pointer
• Buffer must be susceptible to overflow (no bounds checking)

11
New cards

Why are function pointers particularly vulnerable to attacks?

Because they directly control program execution flow - when overwritten with malicious addresses, they can redirect execution to shellcode

12
New cards

What is the difference between static and indirect function calls in assembly?

• Static calls use immediate values as displacement (secure, cannot be overwritten)
• Indirect calls reference memory locations that can be overwritten (vulnerable)

13
New cards

What is an arbitrary memory write vulnerability?

A condition where an attacker can write arbitrary values to arbitrary memory locations by controlling both the target address and the value to be written

14
New cards

How does an arbitrary memory write attack work?

By overflowing a buffer to overwrite both a pointer variable (target address) and a value variable, then when the code executes *ptr = val, it writes attacker-controlled data to an attacker-chosen location

15
New cards

What is the Global Offset Table (GOT)?

A mechanism in ELF binaries that contains absolute addresses of library functions to enable position-independent code and dynamic linking

16
New cards

How does the GOT work during program execution?

• Initially points to runtime linker (RTL)
• First function call goes through RTL which resolves real address
• RTL updates GOT entry with actual function address
• Subsequent calls go directly to function through GOT

17
New cards

Why is the GOT vulnerable to attacks?

Because GOT entries are at fixed, predictable addresses and can be overwritten to redirect function calls to shellcode

18
New cards

How can you find GOT entry addresses?

Use the objdump command with --dynamic-reloc flag on the executable

19
New cards

What are virtual functions in C++?

Function members declared with the virtual keyword that enable polymorphism through runtime dispatch rather than compile-time binding

20
New cards

What is the difference between virtual and non-virtual function calls?

• Non-virtual functions use static binding (base class function called)
• Virtual functions use dynamic binding (derived class function called based on object type)

21
New cards

What is a Virtual Function Table (VTBL)?

An array of function pointers used by C++ compilers to implement virtual function dispatch at runtime

22
New cards

What is a Virtual Pointer (VPTR)?

A pointer stored in each object's header that points to the object's class VTBL

23
New cards

How can attackers exploit virtual pointers?

• Overwrite VPTR to point to attacker-controlled VTBL
• Overwrite function pointers within legitimate VTBL
• Both result in arbitrary code execution when virtual functions are called

24
New cards

What is the primary defense against pointer subterfuge?

Eliminate the root vulnerabilities that allow memory to be improperly overwritten through proper input validation and bounds checking

25
New cards

What are common sources of vulnerabilities that enable pointer subterfuge?

• Buffer overflows
• Dynamic memory management errors
• Format string vulnerabilities

26
New cards

What is W^X protection?

Write XOR Execute - a mitigation where memory pages can be either writable OR executable, but never both

27
New cards

What is a limitation of W^X protection?

It cannot prevent return-to-libc attacks or return-oriented programming (ROP) attacks

28
New cards

What is ASLR?

Address Space Layout Randomization - loads shared libraries and other components into different memory locations at each program execution

29
New cards

What is a limitation of ASLR?

It can be bypassed through information leakage attacks that reveal memory addresses

30
New cards

Why are pointer subterfuge attacks particularly dangerous?

• Bypass traditional defenses like stack canaries
• Enable precise control over memory writes
• Target critical program infrastructure
• Facilitate complex exploit chains

31
New cards

What is the relationship between buffer location and target pointer for successful attacks?

The buffer must be at a lower memory address than the target pointer so that overflow will reach and overwrite the pointer

32
New cards

How do GOT attacks differ from direct function pointer attacks?

GOT attacks target the dynamic linking mechanism itself, affecting all calls to specific library functions rather than individual function pointers

33
New cards

What makes virtual pointer attacks unique to C++?

They exploit the object-oriented programming mechanism of virtual function dispatch, which is specific to C++ and similar OOP languages

34
New cards

What is shellcode in the context of pointer subterfuge?

Malicious executable code that attackers inject and redirect program execution to through pointer manipulation

35
New cards

Why must the buffer and target pointer be in the same memory segment?

Because buffer overflows can only overwrite contiguous memory within the same segment - they cannot cross segment boundaries

36
New cards

What happens when a corrupted function pointer is called?

Instead of executing the intended function, the program jumps to the attacker-controlled address, typically executing shellcode

37
New cards

How does pointer subterfuge enable "write-what-where" capabilities?

By controlling both the pointer (where to write) and the value variable (what to write) through buffer overflow

38
New cards

What is the significance of the runtime linker (RTL) in GOT attacks?

The RTL is responsible for resolving function addresses and updating GOT entries, making the GOT a high-value target for redirection attacks

39
New cards

What is the difference between overwriting VPTR vs VTBL entries?

• VPTR overwrite changes which table the object uses
• VTBL entry overwrite changes specific function addresses within the table
• Both achieve code execution but through different mechanism

Explore top flashcards