A school laptop has many guards
Think about a school laptop. A password stops a stranger. A program checks files for harm. The teacher lets you install only some programs. The school checks the people who run the IT.
No single guard is enough. By the end of this lesson: I can give a benefit and a drawback of each main guard.
Key words
| Word | What it means | Example |
|---|---|---|
| Anti-malware | Software that finds and removes harmful software. | a virus scanner |
| Signature | A known pattern of a harmful file that a scanner looks for. | a known bad piece of code |
| Quarantine | A safe place to lock away a suspect file. | a locked box for a file |
| Intrusion detection | A system that watches for signs of an attack and raises an alert. | a burglar alarm |
| Hardening | Making a system harder to attack by removing what it does not need. | switching off unused services |
| Least privilege | Giving each person only the access they need. | a student cannot edit marks |
| Vetting | Checking a person's background before you hire them. | asking a past boss about the person |
| Access control | Rules and tools that decide who may use what. | a login and a list of roles |
The cells students fill in are left blank in this preview.
Quick check: which guard?
Have a go
Quick check: which guard?
3 questionsGuards that work on the machine
| Guard | What it does | Benefit | Drawback |
|---|---|---|---|
| Security settings (hardware) | A password when the computer starts. USB ports switched off | Stops a thief or a USB attack | Staff may find it annoying |
| Security settings (software) | Screen lock after a few minutes. Only trusted programs allowed | Stops others using it while you are away | May block a tool people need |
| Anti-malware | Scans files. Finds known and suspect software. Quarantines or deletes it | Catches most common malware | Slows the machine. Misses very new malware. Sometimes blocks good files |
| Software access control | Logins and roles decide who can open what | Limits the damage one account can do | Needs setting up and looking after |
| Device hardening | Remove unused software. Close unused ports. Change default passwords. Install updates | Fewer weak points to attack | Takes time. A fix may break an old program |
The cells students fill in are left blank in this preview.
How anti-malware decides
flowchart TD
file([A file arrives]) --> scan{Does it match a known signature?}
scan -->|yes| quarantine[Quarantine it and alert the user]
scan -->|no| behave{Does it act in a suspect way?}
behave -->|yes| quarantine
behave -->|no| allow[Allow it]
quarantine --> choose[User or admin chooses: delete or restore]
Match the guard to its purpose
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
The alarm that does not lock the door
An intrusion detection system watches for signs of an attack. For example: 50 wrong passwords in one minute. It sends an alert. It does not stop the attack by itself. It is the alarm and not the locked door.
A drawback: an alarm can ring when nothing is wrong. Someone must read each alert.
Guards about people
| Guard | What it is | Benefit | Drawback |
|---|---|---|---|
| User access policy | Written rules: who may use what, and how to do it safely | Everyone knows the rules | Rules nobody reads do nothing |
| Staff vetting | Checks on a person before they are hired | Less risk of a bad hire | Takes time and money. Cannot know what a person will do later |
| Staff training | Lessons on phishing (fake messages that trick you), passwords and reporting | Fewer mistakes | People forget. It must be repeated |
The cells students fill in are left blank in this preview.
Least privilege
Tip
Ask: what is the least access this person needs to do their job? Give that. No more. If their account is stolen, the thief gets only that little access.
Your turn: build three small guards
Build three small guards. The first is an anti-malware scan: find files that hold a known bad snippet. The second is an intrusion alert: find users with too many failed logins. The third is access control: say if a role may do an action. Press Run Tests.
def scan(files, signatures):
# files is a dictionary: file name -> the text inside it.
# signatures is a list of known bad text snippets.
# Give back a sorted list of the names of files that contain ANY signature.
return []
def failed_login_alerts(attempts, limit):
# attempts is a list of entries. Each entry is a list: [user, worked].
# For example [["sam", True], ["eve", False], ["eve", False]].
# worked is True if the login worked and False if it failed.
# Give back a sorted list of users with limit or more FAILED logins.
return []
def can_do(role, action, policy):
# policy is a dictionary: role -> list of actions that role may do.
# Give back True only if the role has the action. An unknown role may do nothing.
return False
Make a free account to save your work, or press Start lab to work through the whole lesson.
Extra: Detection and prevention
Note
A system that also blocks the attack is called an intrusion prevention system. Detection is the alarm. Prevention is the locked door.
Extra: The one rule: your lab only
Warning
The hardening lab is your own private copy of a web server. Change only that. Never change or attack a server that is not yours: it is a crime under the Computer Misuse Act 1990.
Extra: Harden a web server in five steps
Press Start the lab on the bar at the top of this lesson. Wait until it says it is running.
A web server often tells every visitor its exact version. An attacker can search for weak points in that version. Hardening means it should say less.
Extra: 1. See what the server says
curl -I http://webA command for the lesson’s lab terminal. It is shown here and not run.
Extra: 2. Run the lab check
docker exec web lab-checkA command for the lesson’s lab terminal. It is shown here and not run.
Extra: 3. Fix one thing
docker exec web sed -i 's/server_tokens on/server_tokens off/' /etc/nginx/conf.d/default.confA command for the lesson’s lab terminal. It is shown here and not run.
Extra: 4. Load the change
docker exec web nginx -s reloadA command for the lesson’s lab terminal. It is shown here and not run.
Extra: 5. Look again
curl -I http://webA command for the lesson’s lab terminal. It is shown here and not run.
Scenario: what went wrong?
Have a go
Scenario: what went wrong?
4 questionsKey words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go