A blank page finds nothing
Ask a group "what could go wrong with the canteen app?" and you get three ideas, all about passwords. Then the room goes quiet.
A checklist works better than a blank page. STRIDE is a checklist of six kinds of threat that you walk across every part of your diagram.
By the end of this lesson
Note
I can use STRIDE to list the threats to each part of a data flow diagram.
Key words
| Word | What it means |
|---|---|
| Threat | something that could go wrong for the system |
| STRIDE | six kinds of threat, one letter each |
| Spoofing | pretending to be someone or something else |
| Tampering | changing data or code without permission |
| Repudiation | denying you did something, with no proof either way |
| Elevation of privilege | gaining rights you were not given |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
4 questionsEach letter breaks one property
STRIDE was written at Microsoft in 1999. Each letter is the opposite of something you want. Spoofing breaks authentication. Tampering breaks integrity. Repudiation breaks the proof of who did what.
Information disclosure breaks confidentiality. Denial of service breaks availability. Elevation of privilege breaks authorisation. Knowing the property tells you the kind of fix.
STRIDE in the canteen app
| Letter | Threat | Property broken | Example |
|---|---|---|---|
| S | Spoofing | Authentication | Signing in as another student |
| T | Tampering | Integrity | Changing the price in an order |
| R | Repudiation | Proof of action | An admin denies changing the menu |
| I | Information disclosure | Confidentiality | Reading other orders |
| D | Denial of service | Availability | Flooding the order page at 11:55 |
| E | Elevation of privilege | Authorisation | A student reaching the Admin page |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsNot every letter fits every part
A data flow cannot sign in, so it cannot be spoofed. It can be changed, read or blocked: T, I and D. An external entity can be spoofed or deny an action: S and R.
A data store can be changed, read, filled up or hold the only log: T, R, I and D. A process can suffer all six. Walking these letters across each part is STRIDE per element.
Try it: count candidate threats
letters = {"external entity": "SR", "process": "STRIDE", "data store": "TRID", "data flow": "TID"}
things = [["Student", "external entity"], ["Web app", "process"], ["save order", "data flow"]]
total = 0
for t in things:
print(t[0], letters[t[1]])
total = total + len(letters[t[1]])
print("candidate threats:", total)
# Add ["Orders database", "data store"]. How many threats now?
Make a free account to save your work and track your progress.
Check
Have a go
Check
3 questionsThe script asks the questions for you
The lab script holds the canteen model from lesson 1, with its Admin page. It gives each part its letters and turns every letter into a question. Run it to count the candidate threats, then ask for the ones about the card payments.
Write the STRIDE script, part 1
docker exec jupyter sh -c "mkdir -p steps && printf '%s\n' 'import sys' 'letters = {\"external entity\": \"SR\", \"process\": \"STRIDE\", \"data store\": \"TRID\", \"data flow\": \"TID\"}' 'ask = {' ' \"S\": \"Spoofing: can someone pretend to be\",' ' \"T\": \"Tampering: can someone change\",' ' \"R\": \"Repudiation: can someone deny what they did with\",' ' \"I\": \"Information disclosure: can someone read\",' ' \"D\": \"Denial of service: can someone stop\",' ' \"E\": \"Elevation of privilege: can someone gain rights through\",' '}' 'things = [' ' [\"Student\", \"external entity\"], [\"Card payments\", \"external entity\"], [\"Admin\", \"external entity\"],' ' [\"Web app\", \"process\"], [\"Kitchen screen\", \"process\"], [\"Admin page\", \"process\"],' ' [\"Orders database\", \"data store\"],' ' [\"sign in and order\", \"data flow\"], [\"order status\", \"data flow\"], [\"save order\", \"data flow\"],' > steps/stride.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the STRIDE script, part 2
docker exec jupyter sh -c "printf '%s\n' ' [\"orders to cook\", \"data flow\"], [\"payment request\", \"data flow\"], [\"payment result\", \"data flow\"],' ' [\"edit menu\", \"data flow\"], [\"menu changes\", \"data flow\"],' ']' 'threats = []' 'for t in things:' ' for letter in letters[t[1]]:' ' threats.append([letter, t[0]])' 'if len(sys.argv) > 1:' ' word = sys.argv[1].lower()' ' for th in threats:' ' if word in th[1].lower():' ' print(th[0], ask[th[0]], th[1] + \"?\")' 'else:' ' for letter in \"STRIDE\":' ' n = 0' ' for th in threats:' ' if th[0] == letter:' ' n = n + 1' ' print(letter, ask[letter].split(\":\")[0], n)' ' print(\"candidate threats\", len(threats))' >> steps/stride.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Count the candidate threats
docker exec jupyter python3 steps/stride.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
What stride.py printed
| Letter | Candidate threats |
|---|---|
| S | 6 |
| T | 12 |
| R | 7 |
| I | 12 |
| D | 12 |
| E | 3 |
| All | 52 |
The cells students fill in are left blank in this preview.
Ask about the card payments
docker exec jupyter python3 steps/stride.py paymentShown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think every STRIDE line is a real threat to fix. Each line is a question. "Can someone read payment result?" has a short answer if the flow uses TLS. Answer each question, and keep only the threats you cannot answer yet.
Check
Have a go
Check
3 questionsAssignment: STRIDE per element
Write STRIDE per element as code.
letters_for(kind) returns the letters for one kind: "SR", "STRIDE", "TRID" or "TID", and "" for anything else. threats(things) takes a list of [name, kind] and returns [letter, name] for every letter of every thing, in order. count_letter(threat_list, letter) counts the threats with one letter.
def letters_for(kind):
# The STRIDE letters for one kind of element, as a string such as "SR".
return ""
def threats(things):
# things is a list of [name, kind]. Return [letter, name] for every letter of every thing, in order.
return []
def count_letter(threat_list, letter):
# How many threats in the list have this letter?
return 0
Make a free account to save your work and track your progress.
Exit quiz
Have a go