Social Engineering & Phishing
Social engineering attacks people rather than machines: it manipulates someone into revealing information, clicking something or doing something they shouldn't. It works because it exploits normal, helpful human behaviour, and it is involved in a large share of breaches. Phishing (fraudulent messages) is its most common form.
Why it works: psychological levers
| Lever | Example message |
|---|---|
| Urgency | "Your account will be closed in 2 hours" |
| Authority | "This is the CEO, I need this payment done now" |
| Fear | "Unusual sign-in detected, verify immediately" |
| Curiosity / greed | "You have a parcel waiting", "Claim your bonus" |
| Helpfulness | "I'm from IT, I just need your code to fix your mailbox" |
| Familiarity | Look-alike logos, a colleague's name, a real ongoing project |
When a message pushes you to act fast and skip normal checks, that pressure itself is the strongest warning sign.
Forms of social engineering
- Phishing: mass emails imitating banks, delivery services or IT.
- Spear phishing: targeted at one person or team, using researched details.
- Business email compromise (BEC): fake or hijacked executive or supplier emails requesting payments or bank-detail changes. Very costly.
- Smishing / vishing: phishing by SMS or voice call; AI voice cloning makes vishing more convincing.
- MFA fatigue: repeated push prompts until the victim taps "approve".
- Pretexting: a made-up scenario ("I'm the new auditor") to justify a request.
- Tailgating: following someone through a secure door.
- Baiting: an infected USB stick labelled "Salaries 2026".
Checking a link for red flags
Many phishing emails lead to a fake login page. The domain is the most important thing to check, and it's read from the right: in paypal.com.secure-login.example, the registered domain is secure-login.example, not PayPal. The checker below looks for common warning signs in a URL. It is a training aid, not a perfect filter: real filters also use reputation data and page analysis.
import ipaddress
from urllib.parse import urlsplit
TRUSTED = ["tadshop.example", "bank.example"]
SUSPICIOUS_WORDS = ["login", "verify", "secure", "account", "update", "password"]
def registered_domain(host):
return ".".join(host.split(".")[-2:]) # simplified: ignores co.uk-style suffixes
def red_flags(url):
parts = urlsplit(url)
host = (parts.hostname or "").lower()
flags = []
if parts.scheme != "https":
flags.append("not HTTPS")
try:
ipaddress.ip_address(host)
flags.append("raw IP address instead of a name")
except ValueError:
pass
if "@" in parts.netloc:
flags.append("'@' in address hides the real host")
if host.startswith("xn--") or ".xn--" in host:
flags.append("punycode (possible look-alike characters)")
reg = registered_domain(host)
for brand in TRUSTED:
name = brand.split(".")[0]
if name in host and reg != brand:
flags.append(f"mentions '{name}' but the domain is {reg}")
if host.count(".") >= 4:
flags.append("many subdomains")
if reg not in TRUSTED and any(w in url.lower() for w in SUSPICIOUS_WORDS):
flags.append("credential-related words on an unknown domain")
return flags
urls = [
"https://www.tadshop.example/account/orders",
"http://tadshop.example.account-verify.example/login",
"https://bank.example@198.51.100.23/secure",
"https://xn--bnk-6ka.example/login",
"https://login.secure.update.bank.example.evil.example/",
]
for url in urls:
flags = red_flags(url)
print(url)
print(" ", "; ".join(flags) if flags else "no red flags found")https://www.tadshop.example/account/orders
no red flags found
http://tadshop.example.account-verify.example/login
not HTTPS; mentions 'tadshop' but the domain is account-verify.example; credential-related words on an unknown domain
https://bank.example@198.51.100.23/secure
raw IP address instead of a name; '@' in address hides the real host; credential-related words on an unknown domain
https://xn--bnk-6ka.example/login
punycode (possible look-alike characters); credential-related words on an unknown domain
https://login.secure.update.bank.example.evil.example/
mentions 'bank' but the domain is evil.example; many subdomains; credential-related words on an unknown domain
The first link is genuine. The others show classic tricks: the brand name as a subdomain of someone else's domain, the @ trick (everything before @ is just a "username", the real host is the IP), punycode look-alikes (xn--… encodes non-ASCII letters such as ä that resemble a), and long chains of reassuring words.
Checking an email's authentication results
Mail servers add an Authentication-Results header recording whether the sender passed SPF (was it sent from a server the domain allows?), DKIM (is it signed by the domain?) and DMARC (do those align with the visible From domain?). A defender can read these to help judge a reported email:
import re
header = ("mx.corp.example; spf=pass smtp.mailfrom=mailer.example; "
"dkim=pass header.d=mailer.example; dmarc=fail header.from=bank.example")
results = dict(re.findall(r"(spf|dkim|dmarc)=(\w+)", header))
from_domain = re.search(r"header\.from=([^\s;]+)", header).group(1)
dkim_domain = re.search(r"header\.d=([^\s;]+)", header).group(1)
print(results)
print("visible From domain:", from_domain)
print("signed by: ", dkim_domain)
if results.get("dmarc") != "pass":
print("WARNING: message claims to be from", from_domain, "but fails DMARC"){'spf': 'pass', 'dkim': 'pass', 'dmarc': 'fail'}
visible From domain: bank.example
signed by: mailer.example
WARNING: message claims to be from bank.example but fails DMARC
SPF and DKIM passed, but for a different domain (mailer.example). DMARC failing means the message is not authorised by bank.example, despite what the From line shows. Domain owners should publish a DMARC policy of p=reject so receivers drop such mail.
Defences
Technical: email filtering, link rewriting and sandboxing, SPF/DKIM/DMARC on your own domains, phishing-resistant MFA (passkeys) so stolen passwords are useless, number matching for push MFA, and warning banners on external email.
Process: verify payment or bank-detail changes through a known phone number (never one from the email), require two people for large transfers, and make it normal to double-check unusual requests, even from executives.
People: short, regular training and simulated phishing exercises, and above all an easy "report phishing" button with a friendly response. Someone who reports a mistake quickly is helping; blame makes people hide incidents.
Go further: Phishing and Social Engineering adds lookalike-domain checks and how phishing is detected and prevented at scale.
Test yourself
In the URL https://bank.example.secure-login.example/, what is the registered domain?
- bank.example
- secure-login.example
- login.example
- https
An email from your 'CEO' urgently asks you to change a supplier's bank details. What is the best response?
- Do it quickly; the CEO is busy
- Reply to the email to confirm
- Verify through a known phone number or established channel before acting
- Forward it to the supplier
An email passes SPF and DKIM for mailer.example but fails DMARC for its From domain bank.example. What does that suggest?
- The email is genuinely from bank.example
- It was sent by another domain and is not authorised by bank.example
- DKIM is broken
- The mail server is down