Social Engineering, Phishing and Malware
Attacks that target people and their devices: phishing, spear phishing, business email compromise, smishing and vishing, pretexting; malware types and how ransomware works; recognising warning signs; and layered defences. Practise spotting suspicious URLs with a small Python analyser.
Hacking people is easier than hacking systems
Firewalls and patches do not stop someone who simply asks for access. Social engineering manipulates people into giving up information, money or access. It works because it exploits human traits that are usually good: helpfulness, respect for authority, fear of getting into trouble, curiosity and urgency. Most breaches begin with one convincing message.
Common techniques
| Technique | How it works |
|---|---|
| Phishing | Mass emails that imitate a trusted brand to steal credentials or deliver malware |
| Spear phishing | Targeted at a specific person using details from their job, social media or earlier breaches |
| Whaling | Spear phishing aimed at executives |
| Business email compromise (BEC) | Impersonating or taking over a business email account to redirect payments or request data; one of the costliest crimes |
| Smishing / vishing | The same trick by text message (SMS) or voice call |
| Pretexting | An invented scenario (“I’m from IT, I need to verify your account”) to extract information |
| Baiting | Leaving a tempting item (a USB stick, a free download) that carries malware |
| Tailgating / piggybacking | Following someone through a secure door |
| Quishing | Malicious QR codes that lead to credential-stealing pages |
| MFA fatigue | Spamming approval prompts until a user taps accept |
| Deepfakes | Cloned voice or video of a manager used to authorise a payment |
| Watering hole / SEO poisoning | Compromising or promoting pages that the target group visits |
Attackers use the same pressure tactics again and again:
- Urgency: “Your account will be closed in 24 hours.”
- Authority: “From the CEO / the tax office / the bank.”
- Fear or reward: a threat, or a prize.
- Familiarity: a name or detail you know, or a message that continues a real conversation (a hijacked thread).
- A small request first: build trust, then ask for the big thing.
Anatomy of a phishing email
Reading a URL
Most of the trick is in the host name, the part between // and the first /, read from right to left from the end of the domain:
https://login.microsoftonline.com/ → the registered domain is microsoftonline.com (real)
https://microsoft.com.secure-login.example.net/ → the registered domain is example.net (NOT Microsoft)
https://bank.com@evil.example/ → everything before @ is a username; the host is evil.example
https://xn--pple-43d.com/ → punycode: may display as a look-alike of apple.com
http://203.0.113.9/login → a raw IP address, rarely used by real services
Other tricks: typosquatting (gooogle.com), homographs (Cyrillic letters that look Latin), URL shorteners that hide the destination, open redirects on trusted sites, and HTTPS padlocks on fake sites (a padlock only means the connection is encrypted, not that the site is honest).
Business email compromise and payment fraud
BEC often contains no malware or links at all, only a persuasive request. Defences are process controls:
- Verify changes to bank details with a known phone number, not the one in the email.
- Two-person approval for payments above a threshold and for any change to payee data.
- Flag external senders and display-name impersonation in the mail client.
- Protect mailboxes with phishing-resistant MFA, and alert on suspicious inbox rules (an attacker often creates a rule that hides replies).
- Teach “slow down and verify” as a standard behaviour, and make it safe to question senior people.
Malware
Malware is software built to harm or to gain unauthorised access.
| Type | Behaviour |
|---|---|
| Virus / worm | Virus attaches to files; worms spread on their own across networks (WannaCry used a worm) |
| Trojan | Pretends to be legitimate software |
| Ransomware | Encrypts data and demands payment; often also steals data first (double extortion) |
| Spyware / infostealer | Steals passwords, browser cookies and files |
| Keylogger | Records keystrokes |
| Remote access trojan (RAT) / backdoor | Gives an attacker remote control |
| Rootkit | Hides deep in the operating system or firmware |
| Botnet agent | Joins the device to a network used for DDoS or spam |
| Cryptominer | Uses the victim’s CPU to mine cryptocurrency |
| Fileless malware | Runs in memory using built-in tools (PowerShell, WMI) and leaves little on disk |
| Adware / PUPs | Unwanted ads and bundled programs |
How ransomware typically happens
- Initial access: a phishing attachment, stolen or weak remote access credentials (RDP, VPN without MFA), or an unpatched internet-facing system.
- Foothold and discovery: the attacker explores the network and escalates privileges.
- Spread and preparation: they steal data, disable security tools, and delete or encrypt backups.
- Encryption and demand at a moment of maximum impact (often a weekend), with a threat to publish the stolen data.
Paying does not guarantee recovery or that stolen data is deleted, funds crime, and may carry legal obligations. The strongest defence is to make recovery boring: tested offline or immutable backups, segmentation, least privilege, MFA on remote access, fast patching, endpoint detection, and a practised response plan.
Defence in layers
No single control stops all of this, so combine them:
| Layer | Controls |
|---|---|
| People | Regular, short, realistic awareness training and phishing simulations; an easy “report phishing” button; a culture that thanks people for reporting |
| Email and web | Spam and malware filtering, SPF, DKIM and DMARC to stop spoofing of your domain, link rewriting and sandboxing of attachments, DNS and web filtering |
| Identity | MFA, phishing-resistant for admins, conditional access, least privilege (see the authentication lesson) |
| Endpoint | Patching, endpoint detection and response (EDR), application control, macro and script restrictions, disk encryption |
| Network | Segmentation, egress filtering, DNS logging, restricted remote access |
| Recovery | Backups, tested restores, incident response plan, contacts for legal and communications |
| Process | Verification procedures for payments and sensitive requests |
SPF, DKIM and DMARC are email authentication records in DNS: SPF lists servers allowed to send for your domain, DKIM signs messages, and DMARC tells receivers what to do when checks fail (p=reject eventually) and sends you reports. Together they make it much harder to send email that pretends to be from you.
If you clicked
- Do not panic, and do not hide it. Speed matters more than blame.
- Disconnect from the network if you opened an attachment or ran something.
- Report to the security team or help desk immediately (and tell them what you entered or opened).
- Change any password you typed (on a clean device) and revoke sessions; MFA codes entered on a fake site should be treated as compromised.
- The security team isolates and investigates, checks mailbox rules, sign-in logs and other recipients, and removes the message from all mailboxes.
Lab: inspect URLs for red flags
Write url_red_flags(url), a small analyser that returns the list of warning signs for a URL, in this order:
"not https": the scheme is nothttps."ip address": the host is a raw IPv4 address (four numbers separated by dots)."at sign": the address contains@before the host."punycode": the host containsxn--."many subdomains": the host has more than 4 dot-separated labels.
A safe URL returns an empty list. (Real tools use many more signals, such as domain age and reputation, but these simple checks catch common tricks.) Use urllib.parse.urlparse.
Your finance team receives an email, apparently from a supplier, saying their bank account has changed and asking for the next payment to go to a new account. The email address looks right. What should the team do?
Treat it as potential BEC fraud. Do not use any contact details in the email. Call the supplier on a number you already hold (from the contract or the vendor system), confirm the change with a known person, require a second approver for the change, and report the email to security. A correct-looking address proves little, because mailboxes can be compromised or domains spoofed.
Can You Explain It?
Close the lesson and answer these without looking back. The goal isn't the wording — it's whether you've formed a usable mental model.
- List four pressure tactics used in social engineering and give an example of each.
- Explain how to work out the real domain in a URL, using microsoft.com.secure-login.example.net as an example.
- Why does ransomware recovery depend on backups, and what makes a backup trustworthy?
🧪 Want to practise this on your own computer? See how to set up your lab →