Building Secure Systems
- 55Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What does it mean for a system to be secure when an adversary is present?
55 questions
- 1
What does it mean for a system to be secure when an adversary is present?
Model answer
It means the system can still achieve its intended goal despite an adversary trying to prevent it.
Explanation
Security is framed as achieving a goal in the presence of someone who may try to steal, delete, or disrupt.
- 2
What are the three basic parts used to reason about a security system?
Model answer
They are the policy, the threat model, and the mechanism.
Explanation
The policy states the desired security goal, the threat model describes the adversary and assumptions, and the mechanism enforces the policy under those assumptions.
- 3
What is a security policy?
Model answer
A security policy is a statement of what a system should allow or prevent.
Explanation
For example, a policy might specify who may read or modify a grades file.
- 4
How do confidentiality, integrity, and availability differ as security goals?
Model answer
Confidentiality restricts who can access information, integrity restricts who can change it, and availability aims to keep a service usable.
Explanation
These are distinct kinds of policies: protecting secrecy, preventing unauthorized modification, and maintaining access despite disruption.
- 5
What is a threat model, and why does a security design need one?
Model answer
A threat model states assumptions about an adversary’s capabilities; it is needed because a system cannot be meaningfully designed against an entirely unconstrained adversary.
Explanation
For example, a design may assume the attacker does not know a password or have physical access to a device.
- 6
What role does a mechanism play in a security system?
Model answer
A mechanism is the system’s software, hardware, or design that enforces the policy, assuming the threat model holds.
Explanation
A security result depends on the mechanism correctly enforcing the policy against the capabilities described by the threat model.
- 7
Why is enforcing a negative security goal often harder than confirming that a permitted action works?
Model answer
A negative goal must rule out every way an unauthorized person might succeed, while confirming a permitted action may require testing only that the intended user can perform it.
Explanation
Showing that TAs can read a file is easier than ensuring that no one else can, because the latter requires considering many possible attacks.
- 8
Why is security design an iterative process?
Model answer
Designers may discover that their assumptions were incomplete or their mechanisms had bugs, so they must revise the threat model or system and reassess its weaknesses.
Explanation
Each round of testing can reveal a new weakest link, prompting changes and another evaluation.
- 9
Why does finding a way to break a system not necessarily make that system useless?
Model answer
A system can still be useful within the conditions where its design works; identifying its limits helps determine when it is appropriate to use.
Explanation
Testing weaknesses helps clarify which assumptions and use cases a system can safely support.
- 10
How can security mechanisms enable new capabilities rather than only prevent attacks?
Model answer
They can make it practical to run powerful or untrusted software in settings where it would otherwise be unsafe.
Explanation
For example, sandboxing can allow native code to run in a browser without relying on the user to choose trustworthy software.
- 11
How can account recovery questions weaken an account’s security policy?
Model answer
They expand the ways to log in: an attacker may need the password or the answers to the recovery questions.
Explanation
If the original policy grants access only to someone who knows the password, adding a recovery route creates an additional path to access.
- 12
Why were publicly available personal details a risk for Sarah Palin’s Yahoo account recovery?
Model answer
Her recovery answers included personal facts that could be found on her Wikipedia page, so someone could use public information to recover access.
Explanation
Recovery questions do not provide a strong secret if their answers are publicly discoverable.
- 13
In the described account-takeover chain, how did a request to reset a Gmail password reveal the next target?
Model answer
Gmail sent a recovery link to a backup email address and displayed that address, identifying the Apple email account the attacker needed to access.
Explanation
The recovery process connected access to Gmail with access to the backup account.
- 14
How did the attacker obtain access to the victim’s Amazon account in the described chain?
Model answer
Amazon allowed a new credit card to be added to an account without requiring the user to sign in, and then accepted one of the account’s credit card numbers for password recovery.
Explanation
The ability to add a card and the separate password-reset procedure combined to create an account-recovery weakness.
- 15
How did Amazon’s display of partial credit card information help complete the account-takeover chain?
Model answer
After accessing Amazon, the attacker could see the last four digits of the victim’s saved card and use them to reset the password for the Apple email account.
Explanation
Amazon concealed full card numbers but revealed enough information for the next recovery step described in the attack.
- 16
How did access to the Apple email account lead to access to Gmail in the described attack?
Model answer
Once the attacker accessed the backup email account, they could follow Gmail’s recovery link and reset the Gmail password.
Explanation
Each service’s recovery mechanism depended on access to another account, so the weaknesses formed a chain.
- 17
What does the account-takeover example show about evaluating security policies across multiple services?
Model answer
Individually plausible recovery features can combine into an insecure chain, so the interactions between systems must be considered.
Explanation
The full vulnerability was apparent only when the recovery procedures and information disclosed by several services were traced together.
- 18
Why should security designers avoid relying on ideal human behavior in a threat model?
Model answer
People may choose weak passwords, click suspicious links, or enter passwords on deceptive sites, so a design that assumes they will not do these things is fragile.
Explanation
Human actions often differ from the assumptions a system designer might prefer.
- 19
Why should threat-model assumptions be conservative?
Model answer
An attacker may have more capabilities than expected, so conservative assumptions reduce the risk of overlooking realistic attacks.
Explanation
The content advises erring on the side of caution because adversaries may surprise system designers.
- 20
Why can a threat model become outdated even if it was reasonable when first chosen?
Model answer
Changes in technology or attacker capabilities can make previously difficult attacks practical.
Explanation
Assumptions about what attackers can compute or access need to be revisited over time.
- 21
Why did the use of 56-bit DES keys in Kerberos become an inadequate security assumption?
Model answer
Computing power increased enough that attackers could enumerate the possible keys, making a key size that once seemed plausible vulnerable.
Explanation
The example shows that cryptographic parameters can become unsafe as technology advances.
- 22
How might concern about a government adversary change the threat model for a computer system?
Model answer
The threat model may need to account for hardware tampering or backdoors, not only attacks on installed software.
Explanation
If an adversary can compromise hardware, ordinary software protections may not be sufficient.
- 23
Why is it unrealistic to assume that every certificate authority will always remain trustworthy?
Model answer
There are many certificate authorities, and any one of them may be poorly secured or compromised.
Explanation
A system that trusts all authorities depends on every one of them maintaining security.
- 24
What did the secure-operating-system example reveal about the security of software development infrastructure?
Model answer
An attacker who can alter the stored source code may insert a backdoor that later appears in the built operating system.
Explanation
The security of a system depends not only on its final code but also on how that code is stored and produced.
- 25
How should the adversary considered in a threat model depend on the system’s context?
Model answer
The model should reflect the likely adversary and their capabilities; protection against a government may require different assumptions from protection against casual local attackers.
Explanation
Security requirements and feasible protections depend on who is trying to attack the system.
- 26
Why is a mechanism failure especially consequential for a system’s security?
Model answer
The mechanism consists of the components that enforce the policy, so a flaw can let an adversary bypass the intended protection.
Explanation
Mechanisms include complex software and hardware, leaving many opportunities for implementation mistakes.
- 27
Why can limiting password guesses help protect accounts with weak or predictable passwords?
Model answer
Rate limiting slows an attacker’s attempts, making it harder to try enough guesses to find a predictable password.
Explanation
After a small number of failures, a system can delay further attempts rather than allow millions of guesses.
- 28
What mechanism mistake enabled password guessing through the iCloud “Find My iPhone” interface?
Model answer
That interface failed to enforce the password-guessing limit that existed on other interfaces for the same accounts.
Explanation
An attacker could make many guesses through the unprotected interface, despite protections elsewhere.
- 29
What access-control weakness was illustrated by the Citibank account URL example?
Model answer
Changing an account identifier in the URL could expose another user’s account if the server did not verify that the requested account belonged to the logged-in user.
Explanation
A valid-looking identifier is not sufficient authorization; the server must check the user’s right to access that specific account.
- 30
Why is a pseudorandom number generator useful for cryptographic key generation, and what must happen first?
Model answer
It can expand a small amount of genuinely random input into many pseudorandom values, but it must first be initialized with a sufficiently random seed.
Explanation
Without a good seed, the generated sequence may be predictable.
- 31
How did the Android SecureRandom bug threaten Bitcoin users?
Model answer
In some circumstances, the generator was not seeded and effectively began from all zeros, making its output and resulting private keys predictable.
Explanation
An attacker who could reproduce the predictable key could gain the ability to spend the associated Bitcoins.
- 32
Why could repeated nonce values expose a Bitcoin user’s private key even if the key itself was generated securely?
Model answer
The signature scheme relies on a fresh nonce for each signature; reusing a nonce in two signatures can allow an attacker to derive the private key.
Explanation
The vulnerability concerns randomness used during signing, not only randomness used when initially generating the key.
- 33
What general lesson do the password-limit, account-identifier, and randomness examples illustrate about security mechanisms?
Model answer
A small implementation omission can defeat a policy and have serious consequences, even when other parts of the system are designed sensibly.
Explanation
Examples include failing to apply a check at one interface, failing to verify ownership, or failing to initialize a generator.
- 34
Why should security testing examine boundary cases and unusual inputs?
Model answer
Corner cases can reveal behavior that ordinary inputs do not, and even small differences in handling can undermine security.
Explanation
Testing the largest, smallest, or strangest inputs can expose flaws in a system’s assumptions and implementation.
- 35
Why can different string encodings create a security vulnerability?
Model answer
If two components interpret the same bytes differently, an attacker may supply an input that one component accepts but another treats as a different value.
Explanation
Disagreement between representations can cause components to enforce different security decisions.
- 36
What is the role of certificate authorities in the described HTTPS certificate system?
Model answer
A certificate authority signs a certificate asserting that a particular key belongs to a named website.
Explanation
A browser relies on the certificate and its signature to associate a website’s identity with a key.
- 37
How can a compromised certificate authority enable a website impersonation attack?
Model answer
If an authority can issue a certificate for a domain, compromising it may let an attacker obtain a certificate that impersonates that domain.
Explanation
The described system allows any trusted authority to issue certificates for host names, making each authority part of the security dependency.
- 38
How do the certificate’s length-prefixed name and a C string represent string endings differently?
Model answer
The certificate representation gives the string’s length, while a C string ends when it encounters a zero byte.
Explanation
Different termination rules can lead to inconsistent interpretations of the same data.
- 39
How could a null byte in a certificate name lead a browser to interpret a different host name than the certificate encodes?
Model answer
A name such as
amazon.com\0x.foo.comcould be accepted as a longer name, while C software might stop at the zero byte and read it asamazon.com.Explanation
The length-based representation and null-terminated interpretation disagree about where the name ends.
- 40
Why might a certificate authority issue a certificate for a deceptive name ending in someone else’s domain?
Model answer
If the requester controls
foo.com, the authority may treat a name such asamazon.com\0x.foo.comas a subdomain offoo.comand issue a certificate for it.Explanation
The browser’s different interpretation of the embedded zero byte could then make the certificate appear to name
amazon.com. - 41
What is the basic buffer-overflow vulnerability in a C function that reads an unbounded request into a fixed-size buffer?
Model answer
If the input is longer than the buffer, the read can continue past its allocated space and overwrite adjacent memory.
Explanation
A function such as
getsdoes not know the buffer’s capacity and may write beyond it. - 42
In the example C program, why can an oversized input overwrite a function’s return address?
Model answer
The buffer and return address are both stored on the stack, and writing beyond the buffer can reach and overwrite the return address.
Explanation
The overflow continues into nearby stack data because the input routine is not restricted to the buffer’s length.
- 43
What happens when a function returns after its return address has been overwritten with an invalid value?
Model answer
The processor attempts to continue execution at the overwritten address, which may be invalid and cause the program to crash.
Explanation
The return instruction uses the address stored on the stack to resume execution.
- 44
How can an attacker turn a buffer overflow from a crash into control of program execution?
Model answer
The attacker can craft the overflowing input to replace the return address with a chosen destination.
Explanation
If execution jumps to an attacker-selected location, the attacker may redirect the program’s behavior.
- 45
What is shellcode in the context of a buffer-overflow attack?
Model answer
Shellcode is attacker-supplied code placed in the input buffer and executed after the attacker redirects control to it.
Explanation
The example describes using such code to request a shell that accepts commands.
- 46
Why does analysis of a buffer overflow need to account for code that runs after the overflow?
Model answer
Later operations may alter corrupted data or prevent execution from reaching the overwritten return address, so the attacker’s input must account for that sequence.
Explanation
In the example, converting the input to an integer affected memory after the buffer had been overwritten.
- 47
Would making the stack grow upward eliminate the example’s buffer-overflow risk?
Model answer
No. The vulnerable input could still overwrite other stack data, including a return address associated with a nested function call.
Explanation
Changing stack direction changes which neighboring data is reached, but does not make an unbounded write safe.
- 48
How can a non-executable stack make a buffer-overflow attack harder?
Model answer
It prevents the processor from executing code placed in stack memory, blocking a direct jump to attacker-supplied shellcode there.
Explanation
Modern systems can mark memory regions as non-executable, separating data storage from code execution.
- 49
Why does a non-executable stack not prevent every buffer-overflow attack?
Model answer
An attacker may redirect execution to existing executable code instead of code injected onto the stack.
Explanation
The lecture describes attacks that reuse code already present in the program or system libraries.
- 50
What is the basic idea of a return-to-libc attack?
Model answer
It redirects execution to existing library code rather than executing newly injected code on the stack.
Explanation
Reusing executable code can bypass defenses that prevent stack data from being executed.
- 51
What is the most direct way to fix the buffer-overflow flaw in the example program?
Model answer
Change the source code so it does not use an unbounded input function such as
getsand instead respects the buffer’s size.Explanation
Exploit-mitigation techniques can make attacks harder, but correcting the unsafe code addresses the underlying flaw.
- 52
Why are exploit-mitigation defenses useful even when they do not eliminate the underlying programming bug?
Model answer
They can make exploitation more difficult, reducing the chance that an existing bug can be used successfully.
Explanation
The content describes protections such as non-executable memory as practical defenses, while noting they are not perfect.
- 53
What does it mean to minimize a system’s trusted computing base?
Model answer
It means reducing the components whose correct behavior must be trusted to enforce the security policy.
Explanation
If fewer components must be correct for security, fewer mechanism bugs can undermine the policy.
- 54
How can a system architecture reduce its dependence on every application component being bug-free?
Model answer
It can arrange for a small set of components to enforce the security policy, while other components cannot violate it even if they contain bugs.
Explanation
This architecture limits the security consequences of mistakes in components outside the trusted computing base.
- 55
Why is a system’s policy difficult to specify as “do exactly what the code does”?
Model answer
That description would treat the program’s bugs as intended behavior, rather than stating the actual goal the system should achieve.
Explanation
A useful policy describes intended permissions and protections, not merely the behavior of a particular implementation.

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