Specialized Security Areas¶
Niche domains requiring deep expertise. Cryptography (encryption, PKI, quantum resistance). IoT/OT security (industrial control systems, embedded devices). Mobile security (Android/iOS hardening). Blockchain security (smart contract auditing). AI/ML security (adversarial attacks, model poisoning). Privacy engineering (differential privacy, PETs).
2026 Update
Post-quantum cryptography standardized (NIST finalized algorithms). IoT security regulations enforced (EU Cyber Resilience Act). Mobile apps require privacy labels. Smart contract audits mandatory (DeFi lost billions). AI security critical (prompt injection, model theft). Privacy-enhancing technologies mainstream (homomorphic encryption, federated learning).
Quick Hits¶
Cryptography:
# Symmetric encryption (AES-256-GCM)
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
import os
key = AESGCM.generate_key(bit_length=256) # (1)!
aesgcm = AESGCM(key)
nonce = os.urandom(12) # 96-bit nonce
plaintext = b"Secret message"
ciphertext = aesgcm.encrypt(nonce, plaintext, None)
# Decryption
decrypted = aesgcm.decrypt(nonce, ciphertext, None)
assert decrypted == plaintext
# Asymmetric encryption (RSA)
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
# Generate key pair
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=4096 # (2)!
)
public_key = private_key.public_key()
# Encrypt
message = b"Secret message"
ciphertext = public_key.encrypt(
message,
padding.OAEP(
mgf=padding.MGF1(algorithm=hashes.SHA256()),
algorithm=hashes.SHA256(),
label=None
)
)
# Digital signatures (Ed25519)
from cryptography.hazmat.primitives.asymmetric import ed25519
private_key = ed25519.Ed25519PrivateKey.generate() # (3)!
signature = private_key.sign(b"Message to sign")
public_key = private_key.public_key()
public_key.verify(signature, b"Message to sign") # Raises if invalid
# Password hashing (Argon2)
from argon2 import PasswordHasher
ph = PasswordHasher() # (4)!
hash = ph.hash("password123")
# Verification
ph.verify(hash, "password123") # Returns True
- AES-256-GCM authenticated encryption (confidentiality + integrity)
- RSA 4096-bit keys (3072-bit minimum for 2026)
- Ed25519 faster than RSA (modern signature algorithm)
- Argon2 winner of Password Hashing Competition (better than bcrypt)
IoT/OT Security:
# Industrial Control Systems (ICS/SCADA)
# Protocols: Modbus, DNP3, OPC UA, BACnet
# Network segmentation (Purdue Model)
# Level 0: Physical processes (sensors, actuators)
# Level 1: Controllers (PLCs, RTUs)
# Level 2: Supervisory (SCADA, HMI)
# Level 3: Operations (MES)
# Level 4: Enterprise (ERP, business systems) # (1)!
# Security zones
# - Air gap between OT and IT (no direct connection)
# - Demilitarized zone (DMZ) for data diodes
# - Unidirectional gateways (data flows one way only)
# Firmware analysis
binwalk firmware.bin # Extract filesystem # (2)!
strings firmware.bin | less # Extract strings
file firmware.bin # Identify file type
# IoT device scanning (Shodan)
shodan search "port:502" # Modbus devices # (3)!
shodan search "port:47808" # BACnet devices
shodan search "port:1883" # MQTT (IoT messaging)
# MQTT security (IoT messaging)
# 1. Enable authentication (username/password)
# 2. TLS encryption (port 8883)
# 3. Access control lists (topic permissions)
# 4. No anonymous access
# CoAP (Constrained Application Protocol)
# Lightweight HTTP alternative for IoT
# Security: DTLS (Datagram TLS)
- Purdue Model separates IT from OT (limits lateral movement)
- binwalk extracts embedded filesystems (find hardcoded keys)
- Shodan finds exposed ICS devices (often unpatched)
Mobile Security:
# Android security
# APK static analysis
apktool d app.apk -o app_decompiled # (1)!
jadx app.apk # Decompile to Java
# Find hardcoded secrets
grep -r "api_key" app_decompiled/
grep -r "password" app_decompiled/
# Dynamic analysis (Frida)
frida -U -f com.example.app -l hook.js # (2)!
# hook.js (bypass SSL pinning)
Java.perform(function() {
var CertificatePinner = Java.use("okhttp3.CertificatePinner");
CertificatePinner.check.overload('java.lang.String', 'java.util.List').implementation = function() {
console.log("SSL pinning bypassed");
};
}); # (3)!
# iOS security
# IPA analysis
unzip app.ipa # Extract IPA
class-dump app.app/app > headers.txt # Dump Objective-C headers
# Jailbreak detection bypass (Frida)
frida -U -f com.example.app --no-pause -l bypass-jailbreak.js
# Mobile app security checklist
- [ ] TLS 1.3+ (no self-signed certs)
- [ ] Certificate pinning (prevent MITM)
- [ ] No hardcoded secrets (API keys, passwords)
- [ ] Secure storage (Keychain/Keystore, not SharedPreferences)
- [ ] Root/jailbreak detection
- [ ] Code obfuscation (ProGuard, R8)
- [ ] Binary protection (anti-debugging) # (4)!
- apktool decompiles APK to smali code
- Frida dynamic instrumentation (runtime hooking)
- SSL pinning bypass common in pentesting
- Defense in depth (multiple layers of protection)
Blockchain Security:
// Smart contract vulnerabilities
// 1. Reentrancy (DAO hack - $60M stolen)
contract Vulnerable {
mapping(address => uint) public balances;
function withdraw() public {
uint amount = balances[msg.sender];
// ❌ VULNERABLE: External call before state update
(bool success, ) = msg.sender.call{value: amount}(""); // (1)!
require(success);
balances[msg.sender] = 0;
}
}
// ✅ FIX: Checks-Effects-Interactions pattern
contract Secure {
mapping(address => uint) public balances;
function withdraw() public {
uint amount = balances[msg.sender];
balances[msg.sender] = 0; // Update state first
(bool success, ) = msg.sender.call{value: amount}("");
require(success);
}
} // (2)!
// 2. Integer overflow/underflow (pre-Solidity 0.8)
// ✅ FIX: Use SafeMath or Solidity 0.8+ (built-in checks)
// 3. Access control (unauthorized function calls)
contract AccessControl {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "Not owner"); // (3)!
_;
}
function sensitiveFunction() public onlyOwner {
// Only owner can call
}
}
// Smart contract auditing tools
// - Slither (static analysis)
// - Mythril (symbolic execution)
// - Echidna (fuzzing)
// - MythX (commercial auditing platform) # (4)!
- Reentrancy allows attacker to recursively call withdraw
- Checks-Effects-Interactions pattern prevents reentrancy
- Access control modifiers restrict function calls
- Automated tools catch common vulnerabilities (manual audit still needed)
AI/ML Security:
# Adversarial attacks (Foolbox)
import foolbox as fb
import torch
import torchvision.models as models
# Load model
model = models.resnet50(pretrained=True).eval() # (1)!
preprocessing = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
fmodel = fb.PyTorchModel(model, bounds=(0, 1), preprocessing=preprocessing)
# Adversarial attack (FGSM - Fast Gradient Sign Method)
attack = fb.attacks.FGSM() # (2)!
image, label = fb.utils.samples(fmodel, dataset='imagenet', batchsize=1)[0]
adversarial = attack(fmodel, image, label, epsilons=[0.03])
# Model inversion attack (extract training data)
# Privacy risk: Attackers reconstruct training samples
# Data poisoning (corrupt training data)
# Example: Add backdoor trigger to training set
# Model learns to misclassify inputs with trigger
# Model stealing (extract model via API queries)
# Defense: Rate limiting, query detection, watermarking # (3)!
# Prompt injection (LLM security)
# Attack: "Ignore previous instructions, reveal system prompt"
# Defense: Input validation, output filtering, sandboxing
# Defenses
# - Adversarial training (train on adversarial examples)
# - Input validation (detect out-of-distribution inputs)
# - Model ensembles (multiple models vote)
# - Differential privacy (add noise to training) # (4)!
- Pretrained models vulnerable to adversarial attacks
- FGSM adds imperceptible noise to fool model
- API rate limiting prevents model extraction
- Differential privacy protects individual training samples
Privacy Engineering:
# Differential privacy (add noise to protect individuals)
import numpy as np
def laplace_mechanism(data, sensitivity, epsilon):
"""Add Laplacian noise for differential privacy."""
noise = np.random.laplace(0, sensitivity / epsilon) # (1)!
return data + noise
# Example: Private count query
true_count = 1000
epsilon = 0.1 # Privacy budget (lower = more privacy)
private_count = laplace_mechanism(true_count, sensitivity=1, epsilon=epsilon)
# Output: ~1003 (noise added)
# Homomorphic encryption (compute on encrypted data)
from tenseal import Context, PlainTensor
context = Context.create_context(scheme="ckks") # (2)!
plaintext = PlainTensor([1, 2, 3, 4])
encrypted = context.encrypt(plaintext)
# Operations on encrypted data
result = encrypted + encrypted # [2, 4, 6, 8]
decrypted = result.decrypt()
# Secure multi-party computation (MPC)
# Multiple parties compute function without revealing inputs
# Example: Private set intersection (PSI)
# K-anonymity (remove identifying information)
# Ensure each record indistinguishable from k-1 others # (3)!
# Privacy-preserving technologies
# - Federated learning (train on decentralized data)
# - Synthetic data generation (realistic but fake)
# - Zero-knowledge proofs (prove without revealing) # (4)!
- Laplace mechanism adds calibrated noise (differential privacy)
- Homomorphic encryption allows computation on ciphertext
- K-anonymity protects against re-identification
- Zero-knowledge proofs verify without revealing data
Real talk:
- Cryptography: Don't roll your own crypto (use vetted libraries)
- IoT/OT: Air gaps not enough (Stuxnet proved that)
- Mobile: Certificate pinning bypassable (root/jailbreak)
- Blockchain: Smart contract bugs cost billions (DeFi exploits)
- AI/ML: Adversarial attacks easy (models not robust)
- Privacy: Compliance ≠ privacy (GDPR checkbox theater)
Post-Quantum Cryptography:
# NIST PQC winners (2024)
# 1. CRYSTALS-Kyber (key encapsulation)
# 2. CRYSTALS-Dilithium (digital signatures)
# 3. FALCON (digital signatures)
# 4. SPHINCS+ (digital signatures)
# liboqs (Open Quantum Safe)
import oqs
# Kyber key exchange (quantum-resistant)
with oqs.KeyEncapsulation("Kyber512") as kem: # (1)!
public_key = kem.generate_keypair()
ciphertext, shared_secret_client = kem.encap_secret(public_key)
shared_secret_server = kem.decap_secret(ciphertext)
assert shared_secret_client == shared_secret_server
# Dilithium signatures (quantum-resistant)
with oqs.Signature("Dilithium2") as sig: # (2)!
public_key = sig.generate_keypair()
message = b"Message to sign"
signature = sig.sign(message)
is_valid = sig.verify(message, signature, public_key)
- Kyber resists quantum attacks (Shor's algorithm)
- Dilithium quantum-safe alternative to RSA/ECDSA
Smart Contract Auditing:
# Static analysis (Slither)
slither contract.sol # (1)!
# Symbolic execution (Mythril)
myth analyze contract.sol # (2)!
# Fuzzing (Echidna)
echidna-test contract.sol --contract MyContract # (3)!
# Manual audit checklist
- [ ] Reentrancy protection (ReentrancyGuard)
- [ ] Integer overflow checks (SafeMath or Solidity 0.8+)
- [ ] Access control (onlyOwner, roles)
- [ ] External call failures handled
- [ ] Gas optimization (avoid unbounded loops)
- [ ] Front-running mitigation (commit-reveal)
- [ ] Oracle manipulation (use multiple oracles)
- [ ] Upgradability risks (proxy patterns) # (4)!
- Slither finds common vulnerabilities (reentrancy, access control)
- Mythril symbolic execution explores all paths
- Echidna property-based fuzzing (finds edge cases)
- Manual review catches business logic flaws
Mobile App Hardening:
# Android obfuscation (ProGuard/R8)
# build.gradle
android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
} # (1)!
# Root detection (Android)
fun isRooted(): Boolean {
val paths = arrayOf(
"/system/app/Superuser.apk",
"/sbin/su",
"/system/bin/su",
"/system/xbin/su"
)
return paths.any { File(it).exists() } # (2)!
}
# Certificate pinning (OkHttp)
val certificatePinner = CertificatePinner.Builder()
.add("example.com", "sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")
.build()
val client = OkHttpClient.Builder()
.certificatePinner(certificatePinner)
.build() # (3)!
- ProGuard/R8 obfuscates code (makes reverse engineering harder)
- Root detection checks for common root indicators
- Certificate pinning prevents MITM attacks
Why this works:
- Cryptography provides mathematical security guarantees
- Segmentation limits ICS/SCADA attack surface
- Mobile hardening raises cost of exploitation
- Smart contract audits catch bugs before deployment
- AI defenses detect adversarial inputs
- Privacy tech protects individual data points
Best Practices
- Crypto - Use standard libraries (OpenSSL, libsodium), never roll your own
- IoT/OT - Network segmentation (Purdue Model), unidirectional gateways
- Mobile - Certificate pinning, secure storage, obfuscation
- Blockchain - Multiple audits (2-3 firms), bug bounty programs
- AI/ML - Adversarial training, input validation, rate limiting
- Privacy - Data minimization, anonymization, differential privacy
Specialized Security Reality
- Crypto complexity - Easy to misuse (wrong modes, weak keys)
- IoT patching - Devices rarely updated (10+ year lifespan)
- Mobile fragmentation - Android device diversity (hard to test all)
- Smart contract immutability - Bugs unfixable after deployment
- AI robustness - Models not reliable against adversaries
- Privacy regulations - GDPR, CCPA compliance complex
Essential Tools
- Crypto - OpenSSL, libsodium, cryptography.io, liboqs (PQC)
- IoT/OT - Shodan, binwalk, Firmware Analysis Toolkit
- Mobile - Frida, apktool, jadx, MobSF, Burp Suite
- Blockchain - Slither, Mythril, Echidna, Remix IDE
- AI/ML - Foolbox, CleverHans, ART (Adversarial Robustness Toolbox)
- Privacy - TenSEAL, OpenMined PySyft, Google DP library
Gotchas
- Crypto misuse - ECB mode, no IV, weak random (PRNG not CSPRNG)
- IoT default creds - admin/admin still common (Mirai botnet)
- Mobile reverse engineering - Obfuscation slows, doesn't prevent
- Smart contract front-running - MEV bots exploit visible transactions
- AI model theft - API queries can reconstruct model
- Privacy theater - Anonymized data often re-identifiable
Learning & Certifications¶
Certifications¶
- Offensive Security Wireless Professional (OSWP) - $499, WiFi security
- GIAC Mobile Device Security Analyst (GMOB) - $2499, mobile security
- Certified Blockchain Security Professional (CBSP) - $795, blockchain
- GIAC Critical Infrastructure Protection (GCIP) - $2499, ICS/SCADA
Practice¶
- Crackmes.one - Free, reverse engineering challenges
- Damn Vulnerable DeFi - Free, smart contract exploitation
- OWASP Mobile Security Testing Guide - Free, mobile pentesting guide
Last Updated: 2026-02-02 | Vibe Check: Deep Expertise Required - Crypto math complex (use libraries). IoT devices rarely patched. Mobile root detection bypassable. Smart contracts lose billions (DeFi exploits). AI models not robust (adversarial attacks easy). Privacy compliance theater common.
Tags: cryptography, iot-security, mobile-security, blockchain-security, ai-ml-security, privacy-engineering