Security
Attack & Defense
A comprehensive field guide to security fundamentals — how attacks work, the mindset behind them, real-world case studies including Uber, XZ backdoor, Scattered Spider, and how AI reshapes both offense and defense. Built for engineers who want to understand the full picture.
What Is Security?
Security is the practice of protecting systems, data, and people from unauthorized access, damage, or disruption. It is not a product you buy — it is a continuous process. The moment you think you are "secure," you have already lost. Attackers need to succeed only once; defenders need to succeed every time.
Only authorized parties can read the data. Implemented via encryption, access controls, and data classification. Violated by: data breaches, eavesdropping, credential theft.
Data has not been tampered with. Implemented via hashing, digital signatures, and audit logs. Violated by: MITM attacks, SQL injection, unauthorized modifications.
Systems are accessible when needed. Implemented via redundancy, DDoS protection, backups. Violated by: ransomware, DDoS, hardware failure, sabotage.
The Security Terminology You Must Know
| Term | Definition | Example |
|---|---|---|
| Vulnerability | A weakness in a system that could be exploited | Unpatched Log4Shell in a Java app |
| Exploit | Code or technique that takes advantage of a vulnerability | Python script triggering Log4Shell RCE |
| Threat | Any potential danger that could exploit a vulnerability | Nation-state APT group targeting your sector |
| Risk | Probability × Impact of a threat exploiting a vulnerability | Critical CVE on internet-facing server = High Risk |
| IOC | Indicator of Compromise — evidence a breach occurred | Suspicious IP in logs, malware hash, odd registry key |
| TTP | Tactics, Techniques, Procedures — how attackers operate | Phishing → credential harvest → lateral move → data exfil |
| CVE | Common Vulnerabilities and Exposures — standardized vuln ID | CVE-2024-3094 (XZ Utils backdoor, CVSS 10.0) |
| CVSS | Score 0–10 measuring vulnerability severity | 9.8 = critical, 0–3.9 = low |
| APT | Advanced Persistent Threat — sophisticated, long-term attacker | Lazarus Group (North Korea), Cozy Bear (Russia) |
| Zero-Day | Unknown vulnerability with no patch available | Vendor doesn't know it exists yet — weaponized in the wild |
The Attacker Mindset
The most important shift in security thinking is to understand how attackers see your systems. They do not see your architecture diagram — they see an attack surface. They are patient, creative, and motivated. Understanding their incentives, methods, and economics is the foundation of effective defense.
Attacker Motivations
- Ransomware — encrypt data, demand payment
- Business Email Compromise (BEC) — wire fraud
- Credential theft for account takeover
- Cryptojacking — steal compute for crypto mining
- Data theft for resale on dark web
- Intellectual property theft (trade secrets, R&D)
- Government/military intelligence gathering
- Pre-positioning for future disruption
- Influencing elections via disinformation
- Long dwell time — months or years undetected
- Website defacement for political messaging
- DDoS to disrupt services of opposing org
- Leaking internal documents (e.g. Anonymous)
- Targeting specific companies for ethical reasons
- Critical infrastructure attacks (power, water)
- Wiper malware (destroy, not encrypt)
- NotPetya — caused $10B in damage
- Russian attacks on Ukraine infrastructure
How Attackers Think: The OODA Loop
Attackers observe your environment — scanning IPs, browsing job postings (which reveal your tech stack), searching GitHub for leaked secrets, reading your documentation. They orient based on what they find — identifying the weakest link. They decide on an attack vector and act. Then they loop — persistence, lateral movement, exfiltration.
Attacker Economics
Phishing kit: $20–200. Ransomware-as-a-Service subscription: $100–300/month. Exploit broker for zero-day: $50K–$2M. State-sponsored: unlimited budget. The barrier to entry for basic attacks is near-zero.
Average ransomware payment (2024): $2.73M. BEC fraud (2024): $2.9B lost. Dark web credential dumps: $0.50–$100 per account. Stolen CC data: $5–$50 per card. This is a multi-billion dollar criminal industry.
If a target is too hard, attackers move to the next. Security ROI: being harder to breach than your peers is often enough. Attackers are economically rational — they go for low-hanging fruit first.
The Attack Lifecycle
Every cyberattack follows a recognizable pattern. The Cyber Kill Chain (Lockheed Martin) and MITRE ATT&CK framework both model this lifecycle. Understanding it allows defenders to detect and interrupt attacks at any stage — not just at the perimeter.
MITRE ATT&CK — The Attacker's Playbook
MITRE ATT&CK is a globally accessible knowledge base of adversary tactics and techniques based on real-world observations. It is used to map detections, identify coverage gaps, and build threat models. Every mature SOC aligns detections to ATT&CK technique IDs.
| MITRE Tactic | What Attackers Do | Example Techniques | Detection Opportunity |
|---|---|---|---|
| Reconnaissance | Research target before attacking | DNS recon, LinkedIn scraping, Shodan scanning | Honeypots, exposed-service monitoring |
| Initial Access | First foothold in environment | Phishing, valid accounts, supply chain, zero-day | Email gateway, auth anomaly detection |
| Execution | Run malicious code | PowerShell, WMI, macro documents | Process creation events (Sysmon/EDR) |
| Persistence | Maintain access after reboot | Registry run keys, scheduled tasks, backdoors | Registry/cron monitoring, new service detection |
| Privilege Escalation | Get admin/root access | Kernel exploits, token impersonation, sudo abuse | Privilege use anomalies, EDR telemetry |
| Defense Evasion | Hide from security tools | Log clearing, process injection, LOLBAS | Log deletion events, unsigned binary execution |
| Credential Access | Steal passwords and tokens | Mimikatz, Kerberoasting, LSASS dump | LSASS access alerts, DCSync detection |
| Lateral Movement | Spread through the network | PtH, PtT, RDP, SMB, WMI | East-west traffic analysis, micro-segmentation |
| Exfiltration | Steal data | DNS tunneling, HTTPS to C2, USB, cloud storage | DLP, unusual egress volume, DNS anomalies |
| Impact | Achieve final objective | Ransomware, wiper, BEC wire fraud, defacement | File encryption alerts, bulk-delete events |
Network Attacks
Network attacks target the infrastructure over which data travels — intercepting, disrupting, or rerouting traffic. While encryption has mitigated many classical network attacks, misconfigurations, legacy protocols, and new attack surfaces keep this category highly relevant.
Attacker positions between two communicating parties, secretly intercepting and potentially modifying traffic. Enabled by: ARP poisoning, DNS spoofing, rogue WiFi, SSL stripping.
Defence: TLS everywhere, HSTS preloading, certificate pinning, DNSSEC, avoid public WiFi without VPN.
Flood a target with traffic to make it unavailable. Modern DDoS leverages botnets (IoT devices), amplification (DNS, NTP, SSDP — small request → giant response), and application-layer attacks (HTTP flood).
Record: Google mitigated a 398 Tbps DDoS in 2023. UNFI food supply chain disrupted by DDoS in June 2025.
Using tools like nmap, Shodan, or Masscan to enumerate open ports and services. Every internet-exposed service that shouldn't be public is a vulnerability waiting to be exploited.
Shodan query: product:"Microsoft IIS" country:"IN" — attackers find your exposed services before you do.
Hijacking: Redirect DNS queries to attacker-controlled servers — users go to fake sites even with correct URL. Tunneling: Encode data in DNS queries to exfiltrate data bypassing firewalls (DNS is usually allowed outbound).
Network Scanning Demo (Defense Perspective)
Web Application Attacks
Web applications are the most common attack surface. Nearly every business runs web services, and many expose sensitive data via poorly secured APIs. The OWASP Top 10 defines the most critical categories — not because they are the only threats, but because they are the most frequently exploited.
User input is unsanitized and included directly in a database query. Attacker crafts input that changes the query logic.
Attacker injects malicious JavaScript into a web page that executes in victims' browsers. Used to steal session cookies, redirect users, or perform actions on their behalf.
Application exposes direct references to internal objects without checking authorization. The #1 vulnerability category (OWASP A01 — Broken Access Control).
Attacker tricks the server into making HTTP requests on their behalf — often to internal services or cloud metadata endpoints not accessible from outside.
Malware & Ransomware
Malware (malicious software) is code designed to damage, disrupt, or gain unauthorized access to computer systems. Ransomware — malware that encrypts data and demands payment — has become the dominant threat to organizations, with average payments exceeding $2.7M in 2024 and 44% of all breaches now involving ransomware.
| Type | What It Does | Famous Example | Defense |
|---|---|---|---|
| Ransomware | Encrypts files, demands payment for decryption key | LockBit, Cl0p, ALPHV/BlackCat | Air-gapped backups, EDR, network segmentation |
| Wiper | Permanently destroys data — no decryption option | NotPetya (2017), Industroyer (Ukraine) | Immutable backups, network segmentation |
| Trojan | Disguised as legitimate software, installs backdoor | DarkComet, Cobalt Strike (misused) | Application allowlisting, EDR |
| RAT | Remote Access Trojan — gives attacker full control | AsyncRAT, Quasar, njRAT | Network monitoring, process anomaly detection |
| Rootkit | Hides deep in OS, survives reboots and evades AV | Necurs, Sony rootkit | Secure boot, integrity monitoring, reimaging |
| Cryptojacker | Silently mines cryptocurrency using your compute | XMRig deployed via Log4Shell | Anomalous CPU/GPU monitoring, container security |
| Infostealer | Silently harvests passwords, cookies, crypto wallets | RedLine, Vidar, Lumma Stealer | EDR, browser extension controls, phishing filters |
Ransomware-as-a-Service (RaaS) Model
Supply Chain Attacks
Supply chain attacks compromise software or hardware before it reaches the victim, abusing the implicit trust organizations place in third-party vendors. They are among the most impactful and hardest to detect attacks because the malicious code arrives via a trusted channel.
- SolarWinds (2020): Russians embedded backdoor in Orion updates — 18,000 orgs affected including US Treasury
- XZ Utils (2024): State-sponsored actor spent 2+ years building maintainer trust, then added SSH backdoor
- Codecov (2021): Bash uploader script compromised — exfiltrated CI environment variables from 29,000 clients
- npm typosquatting: Malicious packages with names similar to popular ones (e.g.
lo-dashvslodash)
- MOVEit (2023): Zero-day in file transfer software — Cl0p ransomware exfiltrated data from 2,000+ orgs
- Target (2013): Attackers got into Target's network via an HVAC vendor's credentials
- Salesforce/Gainsight (2025): OAuth integration exploited to access data from 200+ companies
- 30% of all breaches in 2025 involved third-party or supply chain failures
Defending Against Supply Chain Attacks
Credential Attacks
Credentials are the single most targeted asset in cyberattacks. Stolen or weak credentials were involved in 81% of breaches (Verizon DBIR 2024). Attackers don't "hack in" — they log in. With 16 billion leaked credentials circulating on dark web markets in 2025, credential-based attacks are at an all-time high.
- Brute force: Try every possible combination (automated, fast)
- Dictionary attack: Try common words and known passwords
- Password spraying: Try one common password against many accounts (evades lockout)
- Credential stuffing: Use breached username/password combos from other sites
- Rainbow tables: Pre-computed hash tables to reverse unsalted hashes
- Mimikatz: Dumps plaintext passwords from Windows LSASS memory
- Pass-the-Hash (PtH): Use captured NTLM hash without cracking
- Pass-the-Ticket (PtT): Use stolen Kerberos tickets
- Kerberoasting: Request service tickets and crack them offline
- DCSync: Pretend to be a DC and replicate all password hashes
Insider Threats
Insider threats come from people who already have authorized access — employees, contractors, partners. They are the hardest to detect because their initial access is legitimate. Insider threats cost 3× more on average than external breaches ($15.38M per incident, Ponemon 2022).
Intentionally steals data, sabotages systems, or sells access. Often motivated by financial gain, grudge, or recruitment by competitors/foreign actors.
Example: Coupang breach (Dec 2025) — former employee suspected of selling 33.7M customer records.
Causes breaches through carelessness — clicking phishing links, misconfiguring S3 buckets, using weak passwords, sharing credentials. Not malicious, but costly.
Example: Samsung employees pasting source code into ChatGPT in 2023, leaking confidential code.
Legitimate account taken over by an external attacker via phishing, credential theft, or malware. Attacker operates under the victim's identity and privileges.
Most common: Phished VPN credentials → attacker logs in as employee → accesses internal systems.
Case Study: Uber (2022)
The 2022 Uber breach is a masterclass in social engineering combined with MFA fatigue. A teenager-level attacker with no zero-days achieved full admin access to Uber's internal systems in hours, demonstrating that technical controls mean nothing if human factors are ignored.
- Simple push MFA — vulnerable to fatigue attacks
- Admin credentials in plaintext on network share
- VPN access = too much lateral movement possible
- Contractor had access far beyond their role
- No detection of credential-stuffing login attempts
- Mandate FIDO2/Passkeys for all employees (phishing-resistant)
- Enable number matching on push MFA as minimum
- Never store credentials in code, scripts, or shared drives
- Use ZTNA — per-app access, not broad VPN access
- Quarterly access reviews — remove excessive privileges
Case Study: XZ Utils Backdoor (2024)
The XZ Utils backdoor (CVE-2024-3094, CVSS 10.0) is arguably the most sophisticated software supply chain attack ever discovered. A threat actor (believed to be state-sponsored) spent over two years slowly building trust in the XZ open-source project, then inserted a backdoor that would have given them remote code execution on millions of Linux systems via OpenSSH.
Case Study: Scattered Spider 2025
Scattered Spider (also known as UNC3944 or Octo Tempest) is a threat group known for aggressive social engineering. In Easter 2025, they compromised Marks & Spencer, the Co-op, and Harrods in a coordinated campaign — causing over £300M in business impact for M&S alone and weeks of online retail disruption.
- Called IT helpdesk impersonating employees
- Used personal information found on LinkedIn/social media to answer security questions
- Convinced helpdesk to reset MFA on accounts
- Gained access to identity provider (Okta/Azure AD)
- From IdP — accessed everything: email, files, internal systems
- Deployed ransomware after establishing persistence
- M&S: Online shopping disabled for 3+ weeks
- Estimated £300M+ lost revenue for M&S
- Co-op: Data stolen on 6.5 million members
- Harrods: Systems disrupted during sale period
- DragonForce ransomware deployed
- No technical zero-days used — pure social engineering
Case Study: ByBit Crypto Heist (2025)
In February 2025, North Korea's Lazarus Group stole approximately $1.5 billion in Ethereum from ByBit exchange — the largest cryptocurrency theft in history. The attack exploited a vulnerability in a third-party wallet software provider, demonstrating the devastating reach of supply chain attacks into the financial sector.
Lazarus compromised Safe (a multisig wallet software provider used by ByBit). They injected malicious JavaScript into Safe's signing interface. When ByBit's signers approved what appeared to be a legitimate transaction, the malicious code in the UI altered the destination address to Lazarus-controlled wallets.
The signers saw a legitimate transaction. The blockchain received a different one.
- $1.5 billion Ethereum — largest crypto theft ever
- Funds laundered through 5+ mixing services
- Split into 50+ wallets within hours
- Converted through decentralized exchanges (DEX)
- Used to fund North Korea's weapons program
- Lazarus attributed by FBI, Elliptic, and blockchain analytics
AI as the Attacker's Biggest Tool
Generative AI has fundamentally changed the economics and scale of cyberattacks. Tasks that previously required skilled, experienced attackers can now be automated, personalized at scale, and executed by anyone with a subscription. AI is not creating new attack categories — it is making existing attacks faster, cheaper, more convincing, and more accessible.
AI-Powered Attack Techniques
LLMs analyze LinkedIn, Twitter, company websites, and GitHub to generate highly personalized spear-phishing emails. Previously required hours per target; now: seconds per thousand targets. Quality dramatically higher than template-based phishing.
Example: AI-crafted email referencing your actual recent project, manager's name, and company's upcoming conference. Near-impossible to distinguish from legitimate email.
Voice cloning from 3-second audio samples. Video deepfakes of executives "approving" wire transfers. In 2024, a Hong Kong firm lost $25M when a finance employee was tricked by a deepfake video call impersonating the CFO. Vishing attacks powered by real-time voice cloning.
Tool: ElevenLabs, HeyGen, Synthesia (legitimate tools misused).
AI helps write polymorphic malware that changes its signature to evade AV. Automates vulnerability discovery in open-source code. Generates exploit code from CVE descriptions. Translates attack techniques between programming languages. Debugs malware when it fails.
Reality: WormGPT and other uncensored LLMs specifically designed for cybercrime are sold on dark web forums.
AI models trained on CVEs, exploit databases, and source code can identify vulnerability patterns at scale. Google DeepMind's Project Zero uses AI for vuln research — and so do APT groups. AI can analyze millions of lines of code for injection points, logic flaws, and crypto weaknesses faster than human researchers.
AI in Defense
The same capabilities that power AI attacks are being deployed defensively. AI enables defenders to process telemetry at machine scale, detect anomalies that humans would miss in the noise, automate response, and identify vulnerabilities before attackers do.
ML models baseline "normal" behavior (user login times, data access patterns, network flows) and flag deviations. Detect: impossible travel, credential stuffing, data staging, lateral movement — in real time across millions of events per second.
Products: Microsoft Copilot for Security, Darktrace, CrowdStrike Charlotte AI, SentinelOne Purple AI, Google SecOps.
Security analysts query their SIEM in natural language: "Show me all users who accessed sensitive data from a new IP in the last 7 days and had a failed MFA attempt first." AI translates to complex KQL/SPL, runs the query, and summarizes findings.
Shrinks required expertise: Tier-1 analysts can run Tier-3 investigations.
Google's Project Zero uses AI to find vulnerabilities in OSS at scale. OSS-Fuzz with ML guidance discovers memory-safety bugs. AI code review tools (Snyk DeepCode, GitHub Advanced Security) catch security flaws in PRs before merge.
In 2024: Google's Big Sleep AI agent discovered a stack buffer underflow in SQLite — before any human.
Security Orchestration, Automation, and Response (SOAR) platforms now use LLMs to generate incident summaries, suggest next steps, draft remediation runbooks, and even write correlation rules from natural language descriptions. Reduces analyst mean-time-to-respond.
Defender's Toolkit
The security tooling landscape is vast. Below is a curated set organized by function — covering what attackers use to probe your systems, and what defenders use to protect, detect, and respond.
Red Team / Offensive (Know Your Enemy's Tools)
| Tool | Purpose | Use Case |
|---|---|---|
nmap | Network scanner | Port scanning, service enumeration, OS detection |
Burp Suite | Web app proxy | Intercept, modify HTTP traffic; find web vulns |
Metasploit | Exploit framework | Run exploits, generate payloads, post-exploitation |
Mimikatz | Windows credential dumper | Extract NTLM hashes, Kerberos tickets from memory |
BloodHound | AD attack path visualizer | Find shortest path to Domain Admin in Active Directory |
Impacket | Python network protocols | SMB relay, Kerberoasting, DCSync, secretsdump |
Shodan | Internet-facing asset search | Discover exposed services before attackers do |
Evilginx3 | AiTM phishing framework | Bypass MFA via reverse proxy phishing |
SQLmap | SQL injection automation | Detect and exploit SQL injection vulnerabilities |
Nikto | Web server scanner | Find server misconfigurations and known vulns |
Blue Team / Defensive
| Tool | Category | What It Does |
|---|---|---|
Wireshark | Network Analysis | Deep packet inspection, protocol analysis, traffic forensics |
Sysmon | Endpoint Telemetry | Windows process creation, network, registry events for SIEM |
Zeek | Network Monitor | Protocol analysis, IDS, connection logging, threat hunting |
Snort / Suricata | IDS/IPS | Signature-based intrusion detection and prevention |
YARA | Malware Detection | Pattern-match rules to identify malware families |
Velociraptor | DFIR | Remote forensics, endpoint monitoring, rapid IR collection |
Trivy | Container/Code Scanning | CVE scanning for containers, IaC, code repositories |
gitleaks | Secrets Detection | Scan git history and staged files for leaked secrets |
Semgrep | SAST | Static analysis to find security bugs in code |
CyberChef | Data Analysis | Encode/decode, analyze, transform data — "the analyst's Swiss Army knife" |
MISP | Threat Intel | Share and consume threat intelligence (IOCs, TTPs) |
TheHive | IR Platform | Collaborative incident response case management |
Live CVE & Threat Intelligence
Staying current on vulnerabilities and threat intelligence is a daily discipline. Attackers exploit new CVEs within hours of publication. Subscribe to these feeds and configure automated alerts for your asset types.
CVE Severity Reference
| Severity | CVSS Range | Patch SLA | Example |
|---|---|---|---|
| CRITICAL | 9.0 – 10.0 | 24 hours — isolate if can't patch | CVE-2024-3094 (XZ, 10.0), Log4Shell (10.0) |
| HIGH | 7.0 – 8.9 | 7 days | CVE-2023-44487 (HTTP/2 Rapid Reset, 7.5) |
| MEDIUM | 4.0 – 6.9 | 30 days | Typical XSS, auth bypass in internal tools |
| LOW | 0.1 – 3.9 | 90 days | Information disclosure, hardening recommendations |
Learning Resources
Security is a field where continuous learning is not optional — it is the job. Attackers innovate constantly. Here are the highest-quality resources to build and maintain expertise, from absolute beginner to threat intelligence analyst.
Social Engineering
Social engineering is the art of manipulating humans rather than machines. It bypasses technical controls entirely. No firewall blocks a phone call. No IDS detects a convincing email. The most sophisticated technical infrastructure can be undone by a single employee clicking a link or reading a password over the phone. 81% of breaches involve human error or stolen credentials (Verizon DBIR 2024).
How: Attacker crafts a convincing email impersonating a trusted entity (bank, IT department, CEO, DocuSign). Contains a link to a fake login page or a malware attachment.
Variants:
How: Attacker creates a fabricated scenario (pretext) to manipulate the target. Examples: impersonating IT support to get credentials, pretending to be a vendor to get building access, posing as an auditor to gain document access.
Real example: Scattered Spider (2025) called Marks & Spencer's IT helpdesk, impersonated employees, and convinced support staff to bypass security controls — leading to a £300M+ business disruption.
How: Attacker compromises or spoofs an executive's email account and instructs finance to wire funds. $2.9B lost to BEC in 2023 (FBI IC3). No malware involved — just a convincing email.
Key signal: Urgent wire transfer request from "CEO" with slightly different email domain.
How AiTM Phishing Actually Works (Technical)