Computer Science › Section E · Networking and the internet › Topic E.6

Cybersecurity: attacks and defences

Connecting a computer to a network exposes it to everyone else on that network. This topic surveys the main kinds of attack, from malicious software to tricks played on people, and the layered defences that organisations and individuals use against them.

What security protects

Cybersecurity is the protection of computers, networks and data from attack. Its goals are often summed up as the CIA triad. Confidentiality: only authorised people can read the data. Integrity: data cannot be changed without detection. Availability: systems and data are usable when needed. A vulnerability is a weakness, such as unpatched software or a weak password; a threat is anyone or anything that might exploit it; risk combines how likely an attack is with how much harm it would do. Attacks can target software, hardware or people, so defences must cover all three.

Malicious software

Malware is software written to do harm. A virus inserts itself into an existing program and runs whenever that host program runs, often copying itself into other programs. A worm is a stand-alone program that spreads across a network by itself, and its flood of copies can slow or overload whole networks. A Trojan horse poses as something desirable, such as a game or a utility, that the victim installs willingly. Spyware secretly gathers information, such as keystrokes typed into password boxes, and reports it to the attacker. Ransomware encrypts a victim's files and demands payment to unlock them.

Attacks on people

Many attacks trick a person instead of a machine. Phishing sends messages posing as a bank, employer or government agency, asking the victim to enter a password, pay a bill or open an attachment. Spear phishing tailors the message to one person using details about them, making it far more convincing. Pretexting invents a believable story, such as a caller claiming to be the IT help desk. Baiting leaves infected USB drives where curious people will plug them in. Spam, unwanted bulk email, is a common carrier for phishing and Trojan horses. Training, and checking requests through a separate trusted channel, are the main defences.

Attacks across the network

Some attacks come from other machines. A denial of service (DoS) attack floods a server with so many messages that it cannot serve real users, an attack on availability. In a distributed denial of service (DDoS) attack the flood comes from many machines at once, usually a botnet of ordinary computers and devices already infected with hidden software that waits for the attacker's signal. Unpatched, poorly protected hosts therefore endanger everyone. Spoofing is pretending to be someone else, for example by forging a packet's source address. In a man-in-the-middle attack the attacker secretly relays traffic between two parties, able to read or alter it.

When input becomes instructions

A large class of attacks exploits programs that mix untrusted input with their own commands. In SQL injection, a program builds a database query by pasting a user's text into it; specially crafted text can then end the intended value early and add query instructions of the attacker's own, for example to read other users' records. The defence is a parameterised query, which sends the query and the user's data separately, so the data can never be treated as part of the command. Similarly, a buffer overflow occurs when a program copies input into memory without checking its length. Validating every input and patching software close these holes.

Worked example: naming the attack and the goal

Classify each incident by attack type and the CIA goal most directly harmed. 1. A hospital's files are encrypted and a ransom is demanded: ransomware, harming availability, since staff cannot use the records. 2. An email that looks like it is from the school asks staff to log in on a copycat site: phishing, aiming at confidentiality of their passwords. 3. A shop's website stops responding as thousands of machines send it requests: DDoS, harming availability. 4. An attacker on a café network secretly changes the bank details in an invoice being sent: man-in-the-middle, harming integrity. Check: each answer names the property lost, not just the method used.

Firewalls, proxies and filters

A firewall filters traffic passing a point in the network. At an organisation's gateway it can block messages to or from known troublesome addresses, block incoming connections to services that should not be reachable from outside, and drop incoming packets that claim an inside source address, a sign of spoofing. A firewall on one computer blocks incoming traffic for servers it does not run. A spam filter is a filter for email, often trained on examples users mark. A proxy server relays requests between internal clients and outside servers, so those servers never learn the internal network's details, and it can scan what comes back.

Worked example: a school's gateway firewall

A school's network uses private addresses beginning 10.20. Its gateway firewall allows replies to connections started inside and new incoming connections only to its web server on port 443, and drops everything else. 1. A reply to a student's request for a news page: allowed, because the connection began inside. 2. A new connection to the web server on port 443: allowed, the one open service. 3. A new connection to a staff laptop's remote-desktop port: dropped, as no rule allows it. 4. A packet from outside whose source address begins 10.20: dropped, because an inside address cannot arrive from outside, so it is spoofed. Check: only traffic the school chose to accept gets through.

Defence in depth

No single defence is perfect, so systems layer them. Install security updates promptly, since attackers target known holes. Keep antivirus software running and updated, remembering that it mainly recognises threats already known, so brand-new ones can slip past. Apply least privilege, giving each user and program only the access it needs, so one compromised account does limited damage. Keep backups offline, a key defence against ransomware. Use strong authentication, covered in the topic Cybersecurity: encryption and authentication. Audit logs and traffic to spot unusual patterns early. Organised incident response began after a worm disrupted the early internet in November 1988, leading to the CERT Coordination Center at Carnegie Mellon University.

The law

Laws add a deterrent and a route to justice. In the United States the Computer Fraud and Abuse Act, first passed in 1984 and amended several times since, makes it a crime to access a computer without authorisation and to knowingly spread code that causes damage. The Electronic Communications Privacy Act of 1986 forbids intercepting others' electronic communications. Similar laws exist elsewhere, such as the UK's Computer Misuse Act 1990. Two limits remain: a law does not stop an attack, and attackers in other countries are hard to prosecute. Security testers therefore work only with written permission from the system's owner.

Common mistakes to avoid

First, confusing a virus, which needs a host program, with a worm, which spreads by itself. Second, assuming ransomware threatens only confidentiality; locking files mainly destroys availability. Third, trusting a message because it shows a familiar logo or name. Fourth, believing antivirus software or a firewall alone makes a system safe. Fifth, thinking a DDoS needs the attacker's own machines; botnets use other people's. Sixth, fixing SQL injection by banning a few characters instead of using parameterised queries. Seventh, thinking that just looking around a system without permission is legal.

Key takeaways

Security protects confidentiality, integrity and availability against threats that exploit vulnerabilities. Malware includes viruses, worms, Trojan horses, spyware and ransomware. Phishing and other social engineering target people. DoS and DDoS attacks, often from botnets, hit availability; spoofing and man-in-the-middle attacks deceive or intercept. Injection attacks turn input into commands and are stopped by parameterised queries and input validation. Firewalls, proxies and spam filters filter traffic. Defence in depth adds updates, antivirus, least privilege, backups, strong authentication and monitoring. Laws such as the Computer Fraud and Abuse Act make unauthorised access a crime.

Flashcards

Flashcard

CIA triad

Confidentiality, integrity, availability

The three goals of security.

Test your understanding

Question 1 of 5

Attackers encrypt a clinic's patient files and demand payment for the key. Which security goal is most directly harmed?

Question 2 of 5

What distinguishes a worm from a virus?

Question 3 of 5

In a DDoS attack, where does the flood of traffic usually come from?

Question 4 of 5

A school's gateway firewall receives a packet from the internet whose source address is one of the school's own internal addresses. What should it do?

Question 5 of 5

Which change best protects a login form from SQL injection?

← Previous topicNext topic →