The idea
Esme runs the one server behind the Kingfisher Swimming Club's website. This morning a member says tonight's times on the timetable page are wrong, times nobody set. See confidentiality, integrity and availability break on that box one by one, and what each one really costs.
Steps
-
Keep it secret: confidentiality
Security sounds like one thing, but it is really three promises a system makes about its data and its service. The oldest name for them is the CIA triad: confidentiality, integrity and availability. A security problem is almost always one of these three breaking, and naming which one tells you what to fix.
Start with the first. Confidentiality means only the people who should read something can read it. The club's member list, names and phone numbers, is confidential: members gave it to the club, not to the street.
Esme's server does its real job on port 80, the club's public site. But it also runs a second, plain file service on port 8081 that someone set up to move files around and never closed. Nothing stops anyone on the same network from asking it for whatever it holds.
You are checking Esme's server, with her say-so, from
member, an ordinary laptop on the club's network. Outside a lab, reading an exposed file on a system whose owner has not authorised you in writing is unauthorised access, a crime in most countries even when no password is in the way.Fetch the public page first, the way a member would. Then ask the file service on port 8081 for
members.csv.member:~# curl -sS -m 3 http://10.0.1.10/ member:~# curl -sS -m 3 http://10.0.1.10:8081/members.csv
-
Keep it unchanged: integrity
The second promise is integrity: the data is what it is supposed to be, and has not been quietly changed. A member said tonight's times are wrong, so a page on the server may have been altered.
How would Esme even know? You cannot eyeball a file and tell whether one character moved. The trick is a fingerprint.
A hash function reads every byte of a file (a byte is one character's worth of data) and boils it down to one short string; change a single byte and the string changes completely. Esme uses SHA-256, a common hash function, through the
sha256sumcommand. While the site's pages were known-good, she recorded a hash of each in/srv/records/baseline.sha256.To check for tampering, you hash the files again now and compare each against the recorded value.
sha256sum -cdoes both in one go: it reads the recorded list, re-hashes each file, and printsOKorFAILEDper file.Look at the timetable the way a member does, then run the check on the server.
member:~# curl -sS -m 3 http://10.0.1.10/timetable.html clubServer:~# sha256sum -c /srv/records/baseline.sha256
-
Keep it reachable: availability
The third promise is the one people forget: availability. Data that is perfectly secret and perfectly unchanged is still useless if nobody can reach it. For the club, that means a member can load the page and book a lane.
A service knocked offline is a security failure too, not only an IT annoyance: it is the whole goal of a denial-of-service attack, and the reason backups and spare capacity are security controls. Doing that to a service you do not own is a crime; here the lab does it to its own server.
From
member, book a lane first so you have a baseline. Then the lab drops every packet to the server's port 80, as if the server or its link had gone dark. Try to book again, and finally the lab restores it.member:~# curl -sS -m 3 http://10.0.1.10/book member:~# curl -sS -m 3 http://10.0.1.10/book member:~# curl -sS -m 3 http://10.0.1.10/book
-
Three promises, three fixes
You broke each promise in turn. Now close the one that is still open.
The file service on port 8081 should never have faced the network. The quickest way to stop the network reaching it is the server's own firewall, a table of rules that decides which connections the machine accepts: drop anything that tries to open a connection to port 8081. The public site on port 80 is untouched.
Add the rule on the server, then go back to
memberand try the leak again.As you do, hold the whole picture. Confidentiality broke because a service was exposed: reduce what the box offers, and put a login, permissions and encryption in front of what is left.
Integrity broke quietly: permissions prevent the change, a recorded baseline detects it, a clean copy restores it. Availability broke loudly: keep the service running and able to recover. Three promises, and a different kind of control behind each.
clubServer:~# iptables -A INPUT -p tcp --dport 8081 -j DROP member:~# curl -sS -m 3 http://10.0.1.10:8081/members.csv member:~# curl -sS -m 3 http://10.0.1.10/
Run these steps on real machines