1. Home
  2. Explore
  3. Computer Science
  4. Building Secure Systems

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Building Secure Systems

Speaker 1Speaker 2

Building Secure Systems

18:42
0:00-18:42
  1. Maria

    Welcome to the course. Before we get into security itself, a quick picture of how the class works: Professor Mickens, a visiting professor from Microsoft Research, will co-lecture and cover topics including web security. Four teaching assistants will also be available, and the course will use lectures, research papers, and hands-on labs.

  2. Corey

    And the lectures are organized around case studies rather than one textbook, because there isn’t really a single textbook that fits the subject. Students read an assigned paper ahead of time, answer questions about it, and submit a question of their own by 10 p.m. before the lecture. Then class discusses what the system does, what problem it solves, when it works, and where it falls short.

  3. Maria

    The labs make that practical. The first lab, in C and Assembly, asks students to exploit buffer-overflow vulnerabilities in a web server using carefully crafted requests. Later labs explore defenses, finding code bugs, browser-based worms, and other security problems. Each lab may use a different programming language, so starting early is especially helpful for the first one.

  4. Corey

    The course also encourages questions during lecture: security depends on details, and mistakes are inevitable, so interrupting to clarify something is welcome. There are office hours and tutorial help, including support for reading binaries, disassembling programs, and understanding the stack. Lectures are being videotaped, Piazza is the online question forum, and students should check the course schedule for the quizzes.

  5. Maria

    There’s also an important boundary around the labs and research. Learning how to break a system doesn’t mean you’re entitled to try those techniques on any system you can reach. The course points students to MIT’s network-use rules, and if you’re unsure whether an activity is appropriate, ask a lecturer or TA.

  6. Corey

    All right: what do we mean by security? The basic idea is achieving a goal while an adversary is trying to stop you. The adversary might want to steal files, delete data, or make a service unavailable. A secure system is one that can still accomplish its intended goal despite the kinds of attacks its design is meant to withstand.

  7. Maria

    A useful way to reason about a security system is to separate three things: the policy, the threat model, and the mechanism. The policy says what you want the system to allow or prevent. The threat model says what you assume the adversary can do. The mechanism is the software, hardware, and system design that tries to enforce the policy under those assumptions.

  8. Corey

    For example, a course’s grades file might have a confidentiality policy: only course staff may read it. It might also have an integrity policy: only course staff may change it or submit final grades. And it might have an availability goal: the website should stay up even if someone tries a denial-of-service attack.

  9. Maria

    The threat model matters because an adversary who can do absolutely anything makes almost any security goal impossible. You might assume, for instance, that the attacker doesn’t know the password and doesn’t have physical access to your laptop or phone. But those assumptions need scrutiny, and it is usually safer to be conservative: attackers may be able to do more than you first expect.

  10. Corey

    Then the mechanism has to enforce the policy as long as the threat model holds. That sounds simple, but security is a negative goal: you have to prevent every relevant way an attacker might violate the policy. It’s easy to test that an authorized TA can open a file. It’s much harder to establish that nobody else can, because an unauthorized person may try many different routes.

  11. Maria

    That difference explains why security is so hard. A system can pass the obvious test and still fail through a stolen password, an overlooked interface, a software bug, or an assumption nobody questioned. Security work is iterative: find a weak link, figure out whether the threat model or mechanism was wrong, make a change, and test again.

  12. Corey

    So when a course studies systems and finds a way to break each one, the lesson isn’t that computers are useless. Every system has limits, and learning those limits tells us where a design is appropriate and where it isn’t. Improving security can also make new capabilities practical. For example, sandboxing can let a browser run native code without requiring users to trust and install every program themselves.

  13. Maria

    Let’s start with policy mistakes. Account-recovery questions are a clear example. A site may originally intend that only someone who knows the password can log in. If it later allows someone to log in by answering recovery questions, the policy has changed: access now requires either the password or those answers.

  14. Corey

    And that second route may be much weaker than it sounds. The lecture gives Sarah Palin’s Yahoo account as an example: her recovery questions asked for facts such as where she went to school, and those answers were available on her Wikipedia page. Someone could use publicly available information to reset her password. The system’s policy was broader than the designers or user might have realized.

  15. Maria

    A more complicated policy failure can emerge when several services interact. The lecture describes journalist Mat Honan’s account compromise as a chain involving Gmail, Apple’s me.com service, and Amazon. Each company had account-recovery and account-management features, but together those features created a path an attacker could exploit.

  16. Corey

    Here’s the chain. Gmail sent a password-reset link to a backup email address at me.com. Apple allowed an account password reset using billing information and the last four digits of a credit card. Meanwhile, Amazon let someone add a new credit card to an account without signing in, and its password reset accepted a credit card number associated with that account.

  17. Maria

    Amazon didn’t reveal the full saved card numbers, but it did reveal their last four digits. The attacker could add a card, use Amazon’s account process to get the information needed for the Apple reset, access me.com, and then use the Gmail reset link. The important point is that the vulnerability wasn’t obvious from looking at only one service. The risk came from the whole chain.

  18. Corey

    So policy design has to consider what other systems reveal and what recovery options actually permit. A feature that seems reasonable on its own may weaken another service’s security when combined with it. There isn’t always a simple rule that prevents every such problem; careful reasoning about the complete system is essential.

  19. Maria

    Threat models can fail too, especially when they make optimistic assumptions about people. A design might assume users choose strong passwords, avoid suspicious links, and recognize when a website is fake. In practice, people choose predictable passwords and sometimes follow links or enter passwords on the wrong site. A system shouldn’t rely too heavily on ideal human behavior.

  20. Corey

    Threat models can also become outdated. In the mid-1980s, Kerberos used 56-bit DES keys, which could have seemed like a plausible choice at the time. Decades later, computers could search the possible keys much more effectively. Students eventually demonstrated that a Kerberos account key could be recovered in roughly a day with the help of specialized hardware.

  21. Maria

    That example shows why security assumptions need to be revisited as technology changes. Another assumption might be that an attacker can’t tamper with your computer’s hardware. If you’re worried about a powerful government adversary, revelations about hardware back doors make that assumption much harder to justify. The right threat model depends on who you’re trying to defend against.

  22. Corey

    The web’s certificate system illustrates another risky assumption. When you connect to an HTTPS website, its certificate is supposed to establish that a particular key belongs to a particular site, such as Amazon.com. Browsers rely on certificates issued by certificate authorities, or CAs.

  23. Maria

    The weakness is that there are many certificate authorities, and the system assumes they can all be trusted. The lecture notes that hundreds of organizations can issue certificates, and any one of them can potentially issue a certificate for a domain name. If even one authority is compromised or makes a mistake, an attacker may be able to impersonate a site. Depending on every authority being perfectly secure is a very demanding threat-model assumption.

  24. Corey

    Another example came from a DARPA effort to test secure operating systems. A red team tried to break into systems developed by research teams. In one case, the operating system itself seemed secure, but the machine storing its source code wasn’t well protected. Attackers changed the source code to add a back door, and the researchers later built that compromised code into the system.

  25. Maria

    That’s a reminder to include the software supply and development process in your threat model. You can’t assess only the finished program and ignore where its source code came from or who could modify it. Security assumptions about the surrounding tools and machines can matter just as much as assumptions about the system users.

  26. Corey

    Now to mechanism failures: the code and hardware that enforce a policy can be complicated, and complexity creates many opportunities for mistakes. One example in the lecture involved Apple’s iCloud find-my-iPhone interface. The system limited repeated password guesses on some interfaces, but failed to apply the same protection to this one.

  27. Maria

    That missing rate limit mattered because attackers can try predictable passwords over and over. If a system makes them wait after a few failed attempts, guessing becomes much slower. But if one interface allows millions of guesses, that protection elsewhere doesn’t help. The policy and threat model may be sensible, yet a forgotten check in one mechanism can expose the account.

  28. Corey

    The Citibank example is another missing-check problem. A website displayed credit-card account information using an identifier in the URL. A user found that changing the identifier could show another person’s information. The site should have checked not only that the identifier was valid, but also that the account belonged to the logged-in user.

  29. Maria

    And notice how easy it is to underestimate URLs. A developer might think that a user can’t reach a page unless the site shows them the link. But an attacker can modify a URL directly. Either way, the system must enforce access control at the point where it serves the information, rather than relying on the user not to change an identifier.

  30. Corey

    A different kind of mechanism mistake involved Bitcoin applications on Android. A Bitcoin balance is controlled by a private key, so keeping that key unpredictable is essential. The Android applications used Java’s SecureRandom API, which is intended to produce secure pseudorandom values from an initial random seed.

  31. Maria

    A pseudorandom-number generator can expand a relatively small amount of genuinely random input into many values, but only if it is seeded properly. A bug meant that under some circumstances the generator was not initialized with a seed and effectively started from zeros. Anyone who knew that could reproduce the same values and potentially the same keys.

  32. Corey

    There was also a related signature issue: Bitcoin’s signature scheme required a fresh random nonce each time a signature was made. Reusing the same nonce for two signatures could allow someone to use the signatures to recover the private key. So randomness errors could put users’ Bitcoins at risk even if their original key had been generated elsewhere.

  33. Maria

    These cases make a broader point: small implementation details can have large consequences. A forgotten check, a repeated nonce, or an uninitialized random generator can undermine the security of an entire system. That’s why engineers need a precise understanding of what the program does, including its corner cases.

  34. Corey

    A particularly useful way to test a system is to push its boundaries. What happens with the largest input? The smallest? An unexpected character? A value that almost fits? Security failures often appear when two components interpret the same data differently.

  35. Maria

    SSL certificate names offer a neat example. The certificate format stores a string with an explicit length, while C programs commonly represent strings by ending them with a zero byte. If the certificate contains a name that starts with “amazon.com,” then a zero byte, then extra characters, the certificate parser may treat the whole thing as one name while C code sees only “amazon.com.”

  36. Corey

    An attacker who owned a domain such as foo.com could request a certificate for a name beginning with amazon.com and continuing with a zero byte and “.foo.com.” The certificate authority might see a valid subdomain of foo.com, while browser code using C string rules might interpret the name as amazon.com. Different encodings of the same data can create a security gap.

  37. Maria

    That’s not the same problem as trusting too many certificate authorities; it’s a separate mechanism problem in how names are represented and interpreted. The general lesson is to look for disagreements between components. If one part of a system sees a longer string and another stops early, an attacker may be able to exploit that difference.

  38. Corey

    The lecture then turns to buffer overflows, which are especially relevant to the first lab. Imagine a web server receiving a request and processing it in C. The request may be completely controlled by the attacker, so the server must handle its size and contents safely.

  39. Maria

    The simplified demonstration uses a C function that reads input into a fixed-size buffer with gets, then converts the input to an integer. The compiler warns that gets is dangerous because it doesn’t know the size of the buffer. If the user types more characters than the buffer can hold, the function keeps writing past the buffer’s end.

  40. Corey

    In the demonstrated program, the buffer sits on the stack alongside other values, including a saved frame pointer and the function’s return address. On the x86 system shown, the stack grows downward, but the buffer’s indexed contents extend through adjacent stack locations. A long input can overwrite those neighboring values.

  41. Maria

    If the overflow changes the return address to a string of A characters, the function eventually tries to return to the address represented by those characters. That address isn’t valid executable code, so the program crashes. A crash is already a problem for availability, but an attacker may be able to do something more controlled than merely fill the stack with A’s.

  42. Corey

    Right. If the attacker can place a chosen value where the return address goes, they can try to redirect the program’s execution. The debugger demonstration shows that the return address determines where execution continues after the function returns. Understanding the stack and the calling convention helps explain how an overflow can become control of the program.

  43. Maria

    The example also highlights why exploiting a bug takes care. After the input overflows the buffer, the program still executes other instructions. In this case, converting the input to an integer writes a zero value, which affects what the debugger displays as the string. An attacker has to account for what happens between corrupting memory and reaching the corrupted return address.

  44. Corey

    If the program contains useful code, an attacker might redirect execution to it. If the attacker can instead make the return address point into the input buffer and the system allows that memory to execute, the attacker can supply code as part of the request. Historically, code that starts a shell was common, which is why injected code came to be called shellcode.

  45. Maria

    Changing the direction in which a stack grows doesn’t automatically solve the problem. A function call still places return information on the stack, and a buffer overflow can reach nearby control data. The exact layout changes, but the broader danger remains: unchecked writes can overwrite values that influence execution.

  46. Corey

    Modern systems can mark different memory areas with different permissions. In particular, they can make the stack non-executable, so an attacker can’t simply put code in the buffer and run it. That helps, but it doesn’t eliminate the vulnerability, because an attacker may redirect execution to code that is already in the program, such as a useful library routine.

  47. Maria

    That kind of approach is often called a return-to-libc attack. It shows the difference between making an attack harder and removing the underlying bug. The most direct fix is to avoid unsafe input handling and correct the source code. But because many programs already exist, defenses such as non-executable memory can still make exploitation more difficult.

  48. Corey

    There’s a broader design lesson here: don’t make the security of a system depend on every piece of software getting every detail right. If each component must correctly enforce the policy, any one bug may be enough to break the whole design.

  49. Maria

    A stronger approach is to minimize the trusted computing base: the small set of components that actually must be correct for the security policy to hold. If the rest of the software can be buggy without violating that policy, then the system has fewer places where a mistake can become a security failure.

  50. Corey

    So the framework to carry forward is: state the policy, make the threat model explicit and keep it current, and design mechanisms that enforce the policy without relying on unrealistic assumptions. Then test the details, especially the boundaries and the interactions between components.

  51. Maria

    And don’t confuse finding weaknesses with giving up on security. The goal is to understand where a system fails, under what assumptions, and how to make it better. Security is demanding precisely because every detail can matter, but careful designs and well-chosen mechanisms can make systems both safer and more capable.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent