This is an auxiliary repository with code examples to some of the vulnerabilities, exploits and other stuff I covered in class. I've also added several links to cool articles and videos that demonstrate how to "harness" what we learn to more effectively think about and solve problems.
-
Inline Assembly
This example demonstrates how to inline Assembly code in a C program, and even read/write values from C to Assembly.
-
Linux
This example covers two Linux topics: how permissions on files and directories work, and how a filesystem is mounted.
-
Binaries
This example demonstrates how the static linker does relocations and patches object files in the compilation process.
-
Patching
This example demonstrates how a binary can be patched (with Python) to alter its execution flow.
-
Variable Overflow
This example demonstrates how a buffer overflow on the stack can be used to overwrite a variable and thus alter the program execution flow.
-
Stack Overflow
This example demonstrates how a buffer overflow on the stack can be used to overwrite the return address and hijack control.
-
Unsigned Bug
This example demonstrates how an unsigned int can overflow (or rather, underflow) and cause a bug.
-
Integer Overflow
This example demonstrates how a mixup between signed and unsigned integers can cause an integer overflow, bypass a seemingly safe copy, and overflow a buffer.
-
Canary
This example demonstrates how canaries are used to protect from buffer overflows on the stack.
-
Format String
This example demonstrates how format string vulnerabilities can cause information disclosure (which can then be used in another exploit).
-
DEP
This example demonstrates how data execution prevention makes the stack non-executable.
-
Return to Libc
This example demonstrates how a buffer overflow on a non-exectuable stack can hijack control by jumping to libc functions.
-
ROP
This example demonstrates how a buffer overflow on a non-executable stack can hijack control by jumping to gadgets in executable segments.
-
Heap Overflow
This example demonstrates how a buffer overflow on the heap can overwrite a function pointer and hijack control.
-
Use After Free
This example demonstrates how a use after free bug can be exploited to acquire memory referenced by a wild pointer, rewrite it and hijack control.
-
Metadata Corruption
This example demonstrates how a buffer overflow on the heap can overwrite dlmalloc metadata and write to arbitrary memory, and how this can be used to overwrite a PLT entry and hijack control.
-
Raymond Hettinger: Transforming Code into Beautiful, Idiomatic Python.
-
David Beazley: Discovering Python (mainly inspirational).
-
Brandon Rhodes: How to Shut Down Tolkien (mainly inspirational).