Thinking like an attacker
Before you can defend anything, you need to know what is worth protecting, who might come for it and how they would get in. This lesson teaches the basic language of security (assets, threats, vulnerabilities, risk and controls) by looking at Mangrove Market the way an attacker would, and turns what you find into a risk register you can act on.
By the end you can
- Explain confidentiality, integrity and availability with a real example for each
- Tell a threat, a vulnerability and a risk apart, and name the threat actors a company like Mangrove really faces
- Score risks as likelihood × impact on a 1 to 5 scale and keep them in a risk register
- Map an attack surface and ask the three questions every attacker asks
- Choose preventive, detective and corrective controls and layer them
The everyday picture
Picture a burglar walking down a quiet street one afternoon, checking each house for three things. Which house has something worth taking: a new motorbike by the gate, a parcel on the step? Which one is easiest to get into: a window left open, a side gate with no lock, a key under the mat? And which one is least likely to be noticed: no neighbours at home, no lights, no dog?
Now walk down the same street and look at your own home with the burglar's eyes. You would spot the open window at once, notice the laptop visible from the road, and realise that nobody would know about a break-in until you came back from your trip. So you close the window, move the laptop and ask a neighbour to keep an eye out. That is the whole of this lesson. Security people protect things by first looking at them the way an attacker does: what is worth taking, what is the cheapest way in, and who would notice.
What Mangrove has to protect
An asset is anything of value that could be harmed. At Mangrove Market that means about 2 million customer accounts, the payment flows (cards, cash on delivery, mobile wallets), about 400 checkout tills (the POS), the Partner app where 1,800 corner shops pay invoices, and the accounts of about 1,920 store staff, which are keys to many of the others.
Security teams describe harm to an asset with three words, often called the CIA triad:
- Confidentiality: only the right people can read it. A copied customer list breaks it.
- Integrity: it is correct, and changes only through the right people and steps. A price quietly edited on the tills breaks it.
- Availability: it works when people need it. Tills that freeze on a festival evening break it.
| Mangrove asset | Property most at risk | What the harm looks like |
|---|---|---|
| Customer data | Confidentiality | Addresses and phone numbers copied and sold, followed by scam calls to customers |
| Partner app invoices | Integrity | The bank account on an invoice is changed, and shops pay a criminal |
| POS tills | Availability | Tills stop during a festival rush and stores cannot sell |
| Payment flows | All three | Card data stolen, refunds created for fake orders, wallet payments down |
| Staff accounts | All three, indirectly | One stolen password opens every system above that the person can reach |
Ask all three questions about every asset, because the obvious one is not always the costly one. Ransomware sounds like a data problem, but at a grocery chain it is mostly an availability problem: the stock and price data is still there, encrypted, and the stores cannot use it. Many groups also copy the data first, which adds a confidentiality problem. And describe harm in the business's language: "every store could stop taking card payments for a day" gets a budget; "server 14 is exposed" does not.
Quick check
Someone using a sales rep's stolen account changes the bank account printed on 200 Partner app invoices. Which property is hurt first?
The harm comes from the invoice data being wrong, and shops trusting it. The break-in is how it happened, not the harm itself, and the invoices are still available; they just say the wrong thing.
Threats, vulnerabilities and risk
- A threat is something that could cause harm. Often it is a person or group, a threat actor. It can also be an event, such as a flood or a power cut.
- A vulnerability is a weakness a threat could use: a reused password, a server nobody patches, a process with no second check.
- A risk is the chance that a threat uses a vulnerability to harm an asset, combined with how bad the harm would be.
Risk needs all the pieces at once: a weakness no threat can reach is a small risk, and so is an attacker with no weakness to use. That is why a good risk statement names every link in one sentence: "Because staff can change bank details on Partner invoices without a second approval (vulnerability), a fraudster who takes over a sales rep's account (threat) could redirect partner payments (impact on the invoices)." If you cannot fill in every part, you do not understand the risk yet.
Who are the threat actors for a grocery chain? Mostly people who want money.
| Threat actor | What they want | How they would come at Mangrove |
|---|---|---|
| Organised criminal groups | Money at scale: ransom, card data, accounts to resell | Phishing staff, stolen passwords, unpatched servers, then ransomware |
| Opportunists | Whatever is easy | Automated tools that try every exposed system for weak passwords and known flaws |
| Insiders | Money or revenge, or nothing at all (a mistake) | Fake refunds at a till, copying customer lists, a file shared with "anyone with the link" |
| Fraudsters | Money, through the business's own processes | Promo abuse with fake accounts, false refund claims, changed bank details on invoices |
Notice what is missing: spies and movie villains. A grocery chain is far more likely to meet a criminal group phishing its 1,920 store staff than a government agency, so spend your effort on the actors who would actually come. Most attacks on a company Mangrove's size are run like a business: the attacker picks the cheapest route to a payout. Insiders are uncomfortable to list, but leaving them out leaves a blind spot, and most insider incidents are honest mistakes. The difference from a fraudster is access: the insider already has a legitimate account; the fraudster abuses a process anyone can use.
Quick check
The Partner app's sign-in page lets anyone try passwords as fast as they like, with no limit. In risk language, that is…
It is a weakness someone could use. The threat is the person running a password-guessing tool; the risk is the chance they succeed combined with the harm of taken-over shop accounts. Calling the weakness itself "a risk" is the most common mix-up, and it hides the question of who would use it.
Scoring risk: likelihood × impact
You will always find more risks than you can fix this quarter, so you need a way to order them. The simplest method rates each risk on two 1-to-5 scales and multiplies them. Likelihood is how likely it is to happen in the next year. Impact is how bad it would be if it did. The score runs from 1 to 25.
The scales only work if everyone means the same thing by each number, so write anchors down before anyone scores. These are example anchors for Mangrove; set your own with leadership.
| Level | Likelihood in the next year | Impact at Mangrove |
|---|---|---|
| 1 | Rare: hard to imagine this year | Under $1,000, no customer data, nobody outside notices |
| 2 | Unlikely: has happened to similar companies | Under $10,000, or a few stores affected for an hour |
| 3 | Possible: about once in a few years | Under $100,000, one system down for hours, or a few hundred customers' data |
| 4 | Likely: about once a year | Under $1 million, card payments down in all stores for hours, or thousands of customers' data |
| 5 | Almost certain: several times a year | Over $1 million, many stores closed for a day, or millions of customer records |
Then group scores into bands so people can talk about them quickly: 15 to 25 critical, 10 to 14 high, 5 to 9 medium, 1 to 4 low. The exact cut-offs matter less than writing them down and using them every time.
The scores live in a risk register: one row per risk with its statement, the asset, likelihood, impact, score, an owner (a named person, not a team), the treatment and a review date. There are four treatments. Reduce it with controls. Accept it, in writing, by someone with the authority to accept that loss. Transfer it, with insurance or a contract. Avoid it by stopping the risky activity: Mangrove avoids most card-data risk by letting its payment provider store card numbers instead of keeping them. What is left after the controls is the residual risk, and someone has to accept that too.
Two warnings. First, 5 × 2 and 2 × 5 both make 10, but a frequent small loss needs a process fix while a rare disaster needs a recovery plan, so always read the two numbers. Second, the numbers are labels, not measurements: a 12 is not "twice as bad" as a 6. Use the score to sort the conversation, then use judgement. You will come back to registers and frameworks such as NIST CSF in Risk, compliance and the first hour of an incident.
Quick check
A risk has likelihood 3 and impact 4. Using the bands above, what are its score and rating?
Multiply, don't add: 3 × 4 = 12, which falls in the 10 to 14 band, so it is high. Critical starts at 15. Adding the two numbers is a common slip, and it squashes the difference between big and small risks.
Mangrove's attack surface and the three questions
The attack surface is every place where an attacker could try to get in or get data out. At Mangrove it is much wider than the website:
- The Mangrove app and its APIs: about 2 million customer accounts.
- The Partner app: 1,800 shops ordering stock and paying invoices. It is built and run by an outside agency, Lagoon Digital, so their people and laptops are part of Mangrove's surface too.
- The POS: about 400 tills that handle card payments.
- Store Wi-Fi: a guest network for customers next to the network the tills and about 1,000 handheld scanners use.
- Staff accounts: about 1,920 store staff plus head office, each of whom can be phished or reuse a password.
- The back office and the build pipeline: dashboards, email, GitHub and the pipeline that ships code.
With the surface in front of you, ask the three questions the burglar asked:
- What would I want? Money (payments, refunds, invoices, a ransom), data to sell, or leverage (stopping the stores until someone pays). The answer tells you which assets to look at first.
- What is the cheapest way in? Attackers prefer logging in to breaking in. A password reused from another site's breach, a staff member who clicks a convincing email, an old test server nobody patches. Clever new techniques are rare; cheap old ones are everywhere.
- How would anyone notice? Which log records it, which alert fires, who reads the alert, and how fast. If the honest answer is "when a customer complains", you have found a gap.
Each answer becomes a defender's job: protect the thing worth taking, close or watch the cheap doors, and make noise where things are quiet. The next lesson, How breaches really happen, follows how real attacks chain these steps together, and Identity: passwords, MFA and passkeys deals with the cheapest door of all.
Think first: of Mangrove's six doors, which two would you watch most closely, and why?
Staff accounts and the outside agency. Both are entered with a password rather than a technical exploit, both are spread across people and laptops Mangrove does not fully control, and both reach a lot once inside. Each customer account, by contrast, reaches only one customer's data.
Controls and defence in depth
A control is anything that reduces a risk. It can be technical (multi-factor sign-in), a process (a second approval) or physical (a locked network cabinet). The most useful way to sort controls is by when they act:
- Preventive controls stop it happening: MFA on staff accounts, a second approval for bank-detail changes, a till network kept apart from guest Wi-Fi.
- Detective controls notice when it happens anyway: an alert on hundreds of failed sign-ins, a nightly comparison of till totals with bank deposits, a log of who changed which bank details.
- Corrective controls limit the damage and restore normal service: restoring from tested backups, forcing password resets, recalling a payment, patching the weakness that was used.
No control is perfect, so you layer them. Defence in depth means an attacker has to beat several independent controls. Follow a stolen staff password at Mangrove. MFA blocks most attempts to use it (preventive). If one gets through, the account can reach only what that job needs, a rule called least privilege (preventive again, limiting the reach). A sign-in from a new country at 3 am raises an alert (detective). The team locks the account and reverses any changes (corrective).
The commonest gap in a young risk register is a column full of preventive controls and no detective ones. Prevention fails eventually, and without detection you learn about it from a customer or the news. Every high or critical risk needs at least one control that would tell you it is happening.
Quick check
Mangrove adds a nightly job that compares each store's till totals with its bank deposits and flags any store more than $50 apart. What type of control is it?
The job does not stop anything and does not recover anything; it makes a problem visible the next morning. That is detection, and it is exactly the kind of control registers tend to miss. A control does not have to change the system it watches.
Build it
Build a starter risk register for one system, the Partner app, that you could hand to an engineering manager tomorrow.
List the assets and give each an owner
Rate how much each asset needs confidentiality (C), integrity (I) and availability (A). The owner is the person who would be called if it broke.
Markdown# Asset list: Partner app | Asset | Owner | C | I | A | Why it matters | |------------------------------------|--------------|------|------|--------|-------------------------------------| | Partner shop accounts (1,800) | Imran | High | High | Medium | Orders and invoice payments | | Invoices and bank details | Finance lead | Med | High | Medium | Shops pay what the invoice says | | Order and stock data | Imran | Low | High | High | Wrong data means wrong deliveries | | Agency access to production | Ken | High | High | High | One account can reach everything |Ask the three questions and write risk statements
For each asset: what would an attacker want, what is the cheapest way in, how would we notice? Turn every answer into one sentence in the same format, so nobody can skip a link.
MarkdownFormat: Because <vulnerability>, <threat actor> could <action>, leading to <impact on asset>. R2: Because staff can change bank details on invoices without a second approval, a fraudster who phishes a sales rep could redirect partner payments, leading to shops paying a criminal and Mangrove refunding them.Agree the scales before you score
Copy the anchors from this lesson, adjust the dollar amounts with your manager, and score together in one meeting, not alone.
OutputScore = likelihood (1-5) x impact (1-5) Bands: 15-25 critical | 10-14 high | 5-9 medium | 1-4 low Read both numbers: 2 x 5 (rare disaster) and 5 x 2 (frequent nuisance) need different plans.Keep the register in a table and sort it
A spreadsheet is fine to start. A table makes the rules explicit: scores must be 1 to 5, every risk has an owner and a review date.
SQLCREATE TABLE risk ( id int PRIMARY KEY, asset text NOT NULL, statement text NOT NULL, likelihood int NOT NULL CHECK (likelihood BETWEEN 1 AND 5), impact int NOT NULL CHECK (impact BETWEEN 1 AND 5), owner text NOT NULL, -- a named person, not a team treatment text NOT NULL CHECK (treatment IN ('reduce', 'accept', 'transfer', 'avoid')), review_on date NOT NULL ); INSERT INTO risk VALUES (1, 'Partner accounts', 'Reused passwords let outsiders take over shop accounts', 4, 3, 'Imran', 'reduce', '2027-01-15'), (2, 'Invoices', 'Bank details changed from a phished staff account', 3, 4, 'Finance lead', 'reduce', '2026-12-01'), (3, 'Agency access', 'Agency developer account used to reach production', 2, 5, 'Ken', 'reduce', '2026-12-01'); -- Highest score first; on a tie, the one due for review sooner SELECT id, asset, likelihood * impact AS score, owner, review_on FROM risk ORDER BY score DESC, review_on;Outputid | asset | score | owner | review_on ----+------------------+-------+--------------+------------ 2 | Invoices | 12 | Finance lead | 2026-12-01 1 | Partner accounts | 12 | Imran | 2027-01-15 3 | Agency access | 10 | Ken | 2026-12-01Choose controls by type for every high and critical risk
Give each one at least one preventive and one detective control, and say what you would do to recover. Write who does it and by when.
Markdown| Risk | Preventive | Detective | Corrective | Owner | By | |------|------------------------------------|-------------------------------------------|-------------------------------------|--------------|------------| | R2 | Second approval for bank changes | Alert to finance on every bank change | Call shop on known number; recall | Finance lead | 2026-12-01 | | R3 | Personal agency accounts, MFA, | Log and review agency sign-ins weekly | Revoke access in one step; rotate | Ken | 2026-12-01 | | | access that expires after 8 hours | | secrets the account could read | | |
Bring it to your team
Ask these the next time someone reviews a new feature or a supplier.
- If you were trying to make money from this system, what would you go after first?
- What is the cheapest way in: whose password, whose laptop, which old server?
- If someone did this tonight, which alert would fire, and who would read it?
- Does every high or critical risk have a named owner and a review date?
- Which outside companies can reach our data, and what happens if one of their accounts is stolen?
- For the risks we are accepting, who signed off, and do they know what they accepted?
Red flags
- "Nobody would bother attacking us." Opportunists and automated tools attack everyone.
- Risks owned by "IT" or "the team" instead of a person.
- A register with preventive controls only, and no way to tell if one fails.
- Agency or supplier accounts that are shared, never expire, or are not in any review.
- Scores changed in a meeting with no new facts, because a senior person disagreed.
Practice
Score and rate Mangrove's risk register
The table risk(id, name, likelihood, impact) holds eight Mangrove risks. Return every risk with its id, name, a score (likelihood × impact) and a rating: critical for 15 or more, high for 10 to 14, medium for 5 to 9 and low below 5. Order by score, highest first, and break ties by id.
CREATE TABLE risk (id int PRIMARY KEY, name text NOT NULL, likelihood int NOT NULL, impact int NOT NULL); INSERT INTO risk VALUES (1, 'Credential stuffing on customer accounts', 4, 3), (2, 'Ransomware on back-office servers', 3, 5), (3, 'Changed bank details on Partner invoices', 3, 4), (4, 'Till network reachable from guest Wi-Fi', 2, 5), (5, 'Refund fraud at tills', 4, 2), (6, 'Agency laptop stolen with saved access', 2, 3), (7, 'Shared admin password in the back office', 4, 4), (8, 'Defaced promo page', 2, 2);
-- Score and rate every risk, highest score first, ties by id
SELECT id, name, likelihood, impact
FROM risk;
[{"id": 7, "name": "Shared admin password in the back office", "score": 16, "rating": "critical"},
{"id": 2, "name": "Ransomware on back-office servers", "score": 15, "rating": "critical"},
{"id": 1, "name": "Credential stuffing on customer accounts", "score": 12, "rating": "high"},
{"id": 3, "name": "Changed bank details on Partner invoices", "score": 12, "rating": "high"},
{"id": 4, "name": "Till network reachable from guest Wi-Fi", "score": 10, "rating": "high"},
{"id": 5, "name": "Refund fraud at tills", "score": 8, "rating": "medium"},
{"id": 6, "name": "Agency laptop stolen with saved access", "score": 6, "rating": "medium"},
{"id": 8, "name": "Defaced promo page", "score": 4, "rating": "low"}]
Show a solution
SELECT id, name,
likelihood * impact AS score,
CASE
WHEN likelihood * impact >= 15 THEN 'critical'
WHEN likelihood * impact >= 10 THEN 'high'
WHEN likelihood * impact >= 5 THEN 'medium'
ELSE 'low'
END AS rating
FROM risk
ORDER BY score DESC, id;The CASE checks the highest band first, so a score of 16 stops at critical and never reaches the later branches. Two risks tie at 12; the id tiebreak keeps the order stable. Notice that the till network risk (2 × 5) and a frequent nuisance would both score 10, which is why you read both numbers.
Think like an attacker about store Wi-Fi
Every Mangrove store has two Wi-Fi networks: a guest network for customers and a staff network used by the tills and about three handheld scanners per store. In some stores both run on the same router, set up years ago by a local contractor. Answer the three attacker questions for this setup, write two risk statements in the lesson's format with likelihood and impact scores, and propose one preventive, one detective and one corrective control.
- Your "what would I want" answer names a real asset: card payments on the tills, customer data, or the ability to stop sales
- Your "cheapest way in" names a weakness in this setup, such as a guest network that can reach the till network, or a shared staff Wi-Fi password that never changes
- Both risk statements name a vulnerability, a threat actor and an impact, and the scores use the lesson's anchors
- Your controls include one of each type, and the detective control says who would see the alert
Show a model answer
What would I want? Access to the tills' network, to tamper with sales or to stop stores selling until someone pays. The cheapest way in? Join the guest Wi-Fi, which is open to anyone in the store, and see whether it can reach the till network on the same router; or learn the staff Wi-Fi password, which has not changed since the contractor set it up and is known to every former employee. How would anyone notice? Today, nobody would: the routers send no logs anywhere.
R1: Because the guest and till networks share a router with no separation, an opportunist on the guest Wi-Fi could reach the tills, leading to stopped sales or tampered prices in that store. Likelihood 2, impact 5, score 10 (high). R2: Because the staff Wi-Fi password never changes, a former employee could join the staff network, leading to unauthorised access to scanners and tills. Likelihood 3, impact 3, score 9 (medium).
Preventive: separate the guest network from the till network so that guest devices can only reach the internet, and test that from a guest device in each store. Detective: send router logs to the central team and alert the on-call engineer when a device the store does not own appears on the staff network. Corrective: a written procedure to change the staff Wi-Fi password in every store within a day when someone leaves or a leak is suspected, and to check the tills afterwards.
Check yourself
Two risks in Mangrove's register both score 10. Risk A is scanner crashes that lose a few stock counts (likelihood 5, impact 2). Risk B is ransomware on the back office that stops every store (likelihood 2, impact 5). What is the best way to handle them?
Equal scores can hide very different risks. A rare event with an impact of 5 can threaten the business, so it needs a plan even if it may never happen. Fixing only the likely one leaves the disaster unplanned, and a score of 10 is high on the lesson's bands, not medium.
A developer says: "Our customer database is encrypted on disk, so customer data is safe." Thinking like an attacker, what is the best reply?
Controls protect against specific paths, not against everything. Disk encryption blocks one path, the stolen disk, but attackers prefer logging in to breaking in. Encryption does not protect integrity or availability, it is not pointless, and no control brings a risk to zero.
Which change actually shrinks Mangrove's attack surface?
The attack surface is the set of places an attacker can try. Removing an unused system takes a door away completely. An alert is a detective control on an existing door, insurance transfers the financial impact, and training lowers the chance a person is fooled; all are useful, but none removes a way in.
Flashcards
Key takeaways
- Start from assets and describe harm as confidentiality, integrity or availability, in the business's own terms.
- A risk links a threat, a vulnerability, an asset and an impact. If you cannot write all four in one sentence, you do not understand it yet.
- Score likelihood × impact with written anchors, keep a register with named owners, and read both numbers, not just the score.
- Look at the whole attack surface and ask what an attacker would want, the cheapest way in and how anyone would notice.
- Layer preventive, detective and corrective controls; every serious risk needs at least one way to tell that it is happening.
Sources and further reading
- NIST SP 800-30 Rev. 1, Guide for Conducting Risk Assessments, NIST, 2012
- NIST Cybersecurity Framework (CSF) 2.0, NIST, 2024
- Threat Modeling Cheat Sheet, OWASP Cheat Sheet Series
- Threat Modeling, OWASP Community
- MITRE ATT&CK, a public knowledge base of real attacker techniques, MITRE