Computer Security
Computer Security: Core Concepts, Cryptography, and Threats
Why computer security is difficult
Computer security is difficult partly because software is extremely complex. Developers can make mistakes that do not stop a program from working normally but create weaknesses that an attacker can exploit. These weaknesses are called vulnerabilities. Both attackers and security professionals may exploit them: attackers to gain access or cause harm, and defenders to identify and fix the weaknesses.
The consequences can extend far beyond inconvenience or financial loss. Computer systems may control or support essential services, including health care and energy infrastructure. Attacks on such systems can disrupt services and, in severe cases, contribute to loss of life.
The internet’s original design prioritized communication and connectivity rather than encryption. Security has since been added through multiple technologies and layers, but it was not the original organizing principle of the network. This history helps explain why protecting information on the internet requires additional measures.
Security terminology
Black-hat hackers are people who use their technical skills for malicious or unauthorized purposes.
White-hat hackers use similar skills to identify weaknesses and improve security, usually with authorization.
Security is not determined only by the strength of a technology. The way people configure, use, and maintain it can introduce vulnerabilities.
Privacy and internet communication
Privacy is difficult to define
Privacy is both a technical and a social issue. Laws and policies in different places may recognize privacy rights, but the boundaries of those rights can remain disputed. Governments may claim exceptions for reasons such as public safety or law enforcement, while leaving the extent of those exceptions unclear.
This uncertainty matters for computer security because a system cannot protect privacy well unless it is clear what information should be private, who may access it, and under what circumstances. Engineering bodies have argued broadly that privacy is valuable and that software should help people protect it, but translating that principle into specific rules and system designs is complex.
The postcard analogy
A useful way to understand internet communication is to imagine that every message travels on a postcard. Anyone who can access the postcard may be able to read it. Internet data is not literally sent as a postcard, but the analogy highlights a central risk: information transmitted without encryption may be visible to other parties along its route.
If the underlying communication system is open, users must take additional steps to protect information they want to keep confidential. Encryption is one of the most important of those steps.
Four questions for evaluating internet security
Security analysis repeatedly returns to four questions:
What needs to be private?
The system must identify which information, communications, or activities require protection.What is the reward for attacking the system?
An attacker’s potential gain may be financial, political, strategic, or personal. Greater rewards can attract more capable or persistent attackers.What effort would an attack require?
Security depends partly on how much time, expertise, computing power, and other resources an attacker must expend. A system that is difficult to attack may still be vulnerable if the potential reward is high enough.How connected is the system?
A system connected to networks is exposed to more potential routes of attack than an isolated system. Connectivity is useful, but it also expands the number of ways an attacker may reach a target.
Organizations sometimes use air-gapped systems: computers or networks that are physically disconnected from other networks, including the internet. Backups may be placed on such systems and then disconnected. This reduces exposure through network connections, although it does not eliminate every possible security risk.
Connectivity can also spread through organizations socially. If a senior executive receives permission to connect a new device to a company network, other employees may soon ask to do the same. A one-off exception can become a wider practice, increasing the number of connected devices and the associated security risks.
Other factors that shape security
Internet security is affected by more than technology:
Jurisdiction and law: Internet activity may cross national borders, so it can be unclear which laws apply. Legal requirements can also differ across territories. Restrictions on exporting encryption technologies, for example, can complicate commercial use.
Online disinhibition: People may behave differently online than they do face to face, including engaging in antisocial or risky behavior.
Shared interests and connectivity: People with similar interests can find one another more easily online. This can support productive collaboration, but it can also help harmful groups form and share knowledge.
Cryptography and secure key exchange
The basic purpose of cryptography
Cryptography protects information by transforming it so that people without the required secret information cannot readily understand it. A sender uses a key and a mathematical process to encrypt a message. A recipient who has the appropriate key can decrypt it.
A perfectly secure theoretical method is the one-time pad:
The sender and recipient share a truly random key that is at least as long as the message.
The key is used only once.
If these conditions are met and the key remains secret, the encrypted message cannot be deciphered from the ciphertext alone.
The one-time pad is impractical for many ordinary communications because it requires the sender and recipient to securely share and store enormous quantities of random key material. Encrypting large amounts of data would require a correspondingly large supply of secret key material. Practical cryptography therefore usually relies on shorter keys and mathematical algorithms that are considered computationally difficult to break.
Alice, Bob, and Eve
Cryptography often uses standard names for participants:
Alice is commonly the sender.
Bob is commonly the recipient.
Eve is an eavesdropper who tries to observe or intercept their communication.
These names make it easier to describe security protocols without repeatedly referring to unnamed participants.
The key-distribution problem
A practical encryption system needs a way for two parties to obtain a shared secret key. If Alice and Bob must first meet in person to exchange a key, secure communication with strangers or online businesses becomes difficult. If the initial key exchange is intercepted, later communications may also be compromised.
The Diffie–Hellman–Merkle key exchange addresses this problem by allowing two parties to establish a shared secret over a public communication channel. The method does not send the shared secret itself across the channel.
The role of modular arithmetic
The exchange uses public values, conventionally called a base g and a modulus p. Each participant chooses a private number, then uses it to calculate a public value. A simplified form is:
The operation “modulo p” means that the result is the remainder after division by p. Applying the modulus makes the sequence of results appear irregular, even though each result is generated from a mathematical process.
For example, let g=5 and p=23. The powers of 5 are initially straightforward:
51=5
52=25
53=125
54=625
Taking each result modulo 23 gives:
51mod23=5
52mod23=2
53mod23=10
54mod23=4
The remainders do not resemble the steadily increasing powers, which illustrates why working backward from a public result can be difficult when suitable, sufficiently large parameters are used.
How the exchange creates a shared secret
Suppose Alice chooses private value a and Bob chooses private value b.
Alice calculates gamodp and publishes the result.
Bob calculates gbmodp and publishes the result.
Alice raises Bob’s public value to her private power.
Bob raises Alice’s public value to his private power.
Both arrive at the same shared value because:
Using the example values g=5 and p=23, Alice can choose a=6 and Bob can choose b=15:
Alice’s public value is 56mod23=8.
Bob’s public value is 515mod23=19.
Alice calculates 196mod23=2.
Bob calculates 815mod23=2.
The shared secret is 2. The public values and public parameters are visible to Eve, but the private values are not transmitted. With suitably strong parameters, recovering the private value from the public value is computationally difficult.
A small example such as p=23 is useful for understanding the arithmetic but is not secure. Real systems use much larger parameters or other mathematical constructions.
Computational difficulty and key sizes
The security of this exchange is related to the difficulty of the discrete logarithm problem: given public values such as g, p, and gamodp, an attacker must try to recover a. Security analysis considers the best known algorithms for this problem, the computing power available now and in the future, and a safety margin.
No estimate can guarantee that an algorithm will remain secure forever. New mathematical techniques or changes in computing technology could make a previously difficult problem easier. Cryptographic parameters therefore need to be selected and updated according to current security recommendations.
Elliptic-curve cryptography
Elliptic-curve cryptography uses operations defined on points on an elliptic curve rather than relying on the same form of exponentiation modulo a number. Its underlying mathematics is different, but it supports related cryptographic tasks.
In a simplified geometric explanation, a line or tangent drawn through points on the curve can be used to define an operation that produces another point on the curve. Repeating this operation creates a sequence of points that is difficult to reverse without secret information. The visual geometry is only an illustration; practical systems use precise algebraic rules.
Elliptic-curve systems can provide strong security with shorter keys than some other approaches. Shorter keys can make them more efficient in storage and computation, which has contributed to their widespread use.
Man-in-the-middle attacks and certificates
A key-exchange protocol can establish a shared secret without proving who is on the other side. This leaves it vulnerable to a man-in-the-middle attack.
In this attack:
Alice believes she is communicating with Bob.
Eve intercepts the communication and establishes one connection with Alice and another with Bob.
Eve relays messages between them, making each believe the other is the direct correspondent.
Eve may be able to read or alter messages while maintaining both conversations.
The attack is not prevented merely by encrypting a connection to an unknown party. The participants also need a way to verify identity.
Websites commonly use digital certificates to help establish that a site is genuine. A certificate is associated with a site’s identity and is vouched for by a certificate authority. A browser can display certificate information when a user inspects the padlock or equivalent security indicator. Certificates and the systems that validate them are intended to make impersonation harder, although the chain of trust that supports them is itself a security system that must be managed correctly.
Hacking: changing motives and methods
Early experimentation and phone phreaking
Some early hacking activity was driven by intellectual curiosity: people wanted to understand how technical systems worked and whether their security claims were reliable.
Phone phreaking exploited telephone systems that used tones to control switching equipment. By generating the appropriate tones, phreakers could sometimes manipulate the system and make calls without paying. The activity could be presented as experimentation or resistance to large companies, but it still exploited weaknesses in systems.
Demonstrating a vulnerability
A similar tension appeared in early computer-security incidents. The Chaos Computer Club demonstrated a vulnerability in a Hamburg bank after, according to the account, the bank had not acted on earlier warnings. The group removed money to demonstrate that the weakness was real and returned it after publicizing the issue.
Such incidents illustrate a difficult security question: demonstrating a vulnerability can pressure an organization to fix it, but proof-of-concept attacks can also cause real harm.
The Morris worm and buffer overflows
The Morris worm was an early computer worm that spread across the internet. Part of its operation relied on a buffer overflow: a software flaw that occurs when a program receives more data than a buffer can safely hold. If the program fails to handle excess data correctly, its memory or execution state may be disrupted in ways an attacker can exploit.
A worm is malicious or disruptive software that can spread from system to system, often without requiring a user to manually copy it each time. The Morris worm spread rapidly enough that it took considerable effort to contain. Its creator was prosecuted under US computer-crime law, illustrating how an experiment intended to test propagation could become a serious legal and operational incident.
The shift to financial crime and cyber warfare
From the 1990s onward, commercial use of the internet increased the financial rewards available to attackers. Hacking increasingly became a means of:
Theft: obtaining money, credentials, data, or other valuable resources.
Extortion: threatening disruption, data exposure, or other harm unless a payment is made.
Cyber warfare: using digital attacks in support of state or military aims.
Cyberattacks can cause widespread, indiscriminate harm. This raises the possibility that some attacks may be comparable to acts considered war crimes, especially when they cause serious civilian damage. Whether a particular incident meets a legal definition depends on its circumstances and the applicable law.
Checksums and cryptographic hash functions
Why transmitted data needs checking
Data can be corrupted during storage or transmission. A receiver therefore needs a way to check whether the received data matches what was sent.
A simple parity bit adds a bit to indicate whether the number of 1 bits in a block is even or odd. If a bit changes during transmission, the parity may no longer match. Parity is inexpensive, but it provides limited protection and may fail to detect some patterns of errors.
A checksum is a value calculated from a block of data and sent or stored with it. The receiver calculates the checksum again and compares the result. If the values differ, the data may have been corrupted. Checksums are useful for detecting accidental errors, but they are not necessarily designed to resist deliberate tampering.
What a hash function does
A hash function maps data of varying length to a fixed-size digital value called a hash or digest. The hash acts like a compact fingerprint of the data. A small change to the input should generally produce a substantially different result.
Hash functions are useful for checking files or messages without comparing the entire data directly. If two parties calculate the same suitable hash for a file, that provides evidence that the files match, although the strength of that evidence depends on the hash function’s security properties and how the hashes are exchanged.
Cryptographic hash properties
Cryptographic hash functions are designed to have important security properties:
Preimage resistance: Given a hash, it should be difficult to recover an input that produces it.
Second-preimage resistance: Given one input, it should be difficult to find a different input with the same hash.
Collision resistance: It should be difficult to find any two different inputs that produce the same hash.
A collision occurs when two distinct inputs have the same hash. A cryptographic hash is not intended to be encryption: it has no decryption key, and its purpose is not to allow the original data to be recovered.
The SHA-1 hash function was demonstrated to have a practical collision in 2017 in an attack named SHAttered. The two different files involved produced the same SHA-1 hash. This showed that SHA-1 should no longer be relied on for applications requiring strong collision resistance. SHA-256 is a commonly used member of the SHA-2 family; cryptographic algorithms and recommendations must still be reviewed as computing methods evolve.
Hashes, passwords, and cryptocurrency
Public keys, addresses, and wallets
Cryptocurrency systems use cryptographic keys to control transactions. In simplified terms:
A user has a private key, which must remain secret.
Mathematical operations derive a corresponding public key.
A cryptocurrency address is derived from public-key information using hashing and other formatting steps.
The address can be shared to receive funds, while the private key is used to authorize transactions.
Actual address-generation processes are more detailed than a single hash operation. The key security principle is that anyone who obtains the private key may be able to control the funds associated with it.
A public ledger, such as a blockchain, records transactions that can be observed by network participants. The ledger’s transparency helps users verify transaction history, but it can also provide attackers with information useful for searching for weakly protected keys.
Why brain wallets are insecure
A brain wallet attempts to derive a private key from a phrase that a person can remember. A user selects a memorable string, hashes it, and uses the result as a private key.
This seems convenient because no separate secret file or physical wallet needs to be stored. However, human-chosen phrases are not reliably random. Attackers can try likely phrases, quotations, common password patterns, and dictionary entries, then hash each candidate and check whether it matches an address associated with funds.
The problem is made worse when a fast general-purpose hash such as SHA-256 is used directly. Password-storage systems typically use deliberately slower, resource-intensive functions, often with a unique salt, to make large-scale guessing more expensive. Even these approaches cannot make a weak password strong, but they can increase the cost of guessing.
The public ledger can help attackers test guesses: they can monitor addresses and transactions and identify a candidate key that corresponds to an address with funds. Demonstrations and reported incidents involving memorable phrases show that money can be stolen quickly when private keys are based on predictable human choices.
This is not necessarily a failure in the mathematics of the cryptocurrency’s core protocol. It may instead be a failure in the surrounding system: users chose weak secrets or used them in an unsafe way. This distinction is fundamental in security. A sound cryptographic design can still be undermined by poor key management.
The birthday problem and collisions
The birthday problem explains why collisions can arise sooner than intuition might suggest. In a class of people, the chance that someone shares a birthday with one particular person is relatively low when the class is small. But the chance that any two people share a birthday rises much more quickly because there are many possible pairs to compare.
The same idea applies to hash functions. An attacker looking for any two inputs with the same hash can search pairs of candidates rather than target one specific input. As a result, the effort needed to find a collision is generally lower than the effort needed to match a specific target hash. Cryptographic systems account for this distinction when selecting hash lengths and security parameters.
The birthday analogy is not identical to every attack on a wallet or ledger. It illustrates why collision search and large-scale guessing require careful analysis rather than relying only on the apparent size of a hash.
State actors, supply chains, and vulnerability decisions
State-sponsored cyber activity
State actors may use cyber operations for intelligence gathering, disruption, or strategic advantage. Such activity can include:
Breaking codes or exploiting weaknesses in cryptographic systems.
Conducting industrial espionage, including targeting organizations involved in a technology supply chain.
Finding and retaining software vulnerabilities for possible future use.
A supply-chain attack targets a supplier, update mechanism, or other part of the process through which trusted software or services reach their users. If attackers compromise a supplier’s systems, they may be able to distribute malicious or altered software through a channel that customers already trust.
The SolarWinds incident was an example of a supply-chain attack. SolarWinds software was used to manage networks, and attackers compromised part of the company’s software-distribution process. Malicious updates were issued through a channel customers regarded as legitimate, making detection and response difficult.
The vulnerabilities equities process
Governments may discover software vulnerabilities that could be used for intelligence or security operations. Keeping a vulnerability secret may provide a strategic advantage, but it also leaves the vulnerable software exposed to other attackers, including attackers targeting the government’s own systems.
A vulnerabilities equities process is a way of weighing these competing interests. The decision involves balancing:
The potential intelligence or operational benefit of retaining the vulnerability.
The risk that the vulnerability will be discovered or independently exploited.
The harm to the public and organizations if the weakness remains unpatched.
The possibility that the vulnerability could affect the government’s own systems.
This is an example of a broader security dilemma: information that helps one party exploit a weakness may leave everyone who uses the affected technology exposed.
Ransomware and critical infrastructure
Ransomware is malicious software or an attack strategy that blocks access to systems or data, often by encrypting files, and demands payment to restore access or prevent further harm. Ransomware can target hospitals, public services, businesses, and infrastructure providers.
Attacks on an oil pipeline or a health-care system demonstrate why the consequences can be wider than the loss of data. A pipeline disruption can affect fuel supplies and public behavior; an attack on a health system can interfere with essential care. Paying a ransom may restore access in some cases, but it can also encourage further attacks and does not guarantee that systems will be safely restored.
Encryption, law enforcement, and security trade-offs
End-to-end encryption is designed so that only the communicating users’ devices hold the keys needed to read the messages. The service provider may deliver the messages but cannot normally read their contents.
Law-enforcement agencies may argue that strong encryption makes it harder to investigate crime or protect children. The counterargument is that encryption also protects ordinary users, businesses, and public institutions from criminals and other attackers. Because internet communication is fundamentally exposed to interception unless protected, encryption is a central defense rather than merely a tool used by criminals.
A comparison illustrates the tension: asking people to avoid encryption because criminals might use it resembles asking people not to lock their doors because criminals also use locks. The analogy is not a complete account of law-enforcement concerns, but it highlights that a security measure may protect many legitimate users even when it complicates some investigations.
Ethical security research and bug bounties
A bug bounty is a program that rewards researchers for responsibly reporting security flaws. Organizations use these programs to encourage people to find and disclose vulnerabilities before malicious attackers exploit them.
Bug bounties provide a legal and constructive way for security researchers to use skills that could otherwise be misused. The reward reflects the value an organization places on finding and fixing flaws. Such programs do not remove the need for careful rules: researchers need clear authorization, limits on testing, and a responsible process for reporting findings.
Quantum computing and cryptography
Quantum computing raises questions about whether future computers could break cryptographic systems that are currently considered secure. The relevant issue is not simply that quantum computers are “faster” at everything. Their potential effect depends on which algorithms they can run and on the cryptographic problem being addressed.
The security implications remain a specialized and evolving subject. The possibility of powerful quantum methods does not automatically mean that all encryption will fail. Defenders can also adopt new cryptographic methods, including approaches designed to resist attacks from quantum computers. The outcome will depend on the development and deployment of both computing technology and cryptographic defenses.
Trust and chains of verification
Computing systems often represent trust through mechanisms such as certificates, identities, and authentication. A chain of trust links one trusted entity to another: for example, a browser may trust a certificate authority, which vouches for a website’s certificate.
This model is useful but limited. Human trust is complex and depends on context, relationships, evidence, and past behavior. Computer systems tend to reduce trust to formal credentials and verification steps. Designing reliable systems therefore requires careful decisions about who is trusted, how that trust is established, how it can be revoked, and what happens when a trusted party is compromised.
Central security principles
Computer security depends on more than strong cryptographic algorithms. It also depends on sound system design, secure key management, clear rules for trust and access, careful treatment of vulnerabilities, and awareness of how people actually use technology.
The internet’s openness creates both its power and its risks: connectivity enables communication and commerce, while also creating opportunities for interception and attack. Security measures must therefore be matched to the value of the information, the likely capabilities and incentives of attackers, and the consequences of a failure.

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