1. Explain the OSI model and where attacks occur
▼
OSI has 7 layers. Layer 1-2 (Physical/Data Link): packet sniffing, ARP spoofing. Layer 3-4 (Network/Transport): IP spoofing, SYN flood. Layer 5-6 (Session/Presentation): session hijacking, man-in-the-middle. Layer 7 (Application): XSS, SQL injection, DDoS. Different defenses apply at each layer - firewall at network layer, WAF at application layer.
2. What is the difference between IDS and IPS?
▼
IDS (Intrusion Detection System) detects suspicious traffic and alerts. IPS (Intrusion Prevention System) detects AND blocks traffic. IDS is passive (monitoring), IPS is active (blocking). IPS can cause legitimate traffic disruption if rules are wrong. Both use signature-based (known attacks) and anomaly-based (behavioral) detection. Examples: Snort, Suricata.
3. How does SQL injection work and how do you prevent it?
▼
SQL injection exploits unvalidated user input in SQL queries. Attacker inserts SQL commands (e.g., ' OR '1'='1) to bypass authentication or extract data. Prevention: (1) Use parameterized queries/prepared statements, (2) Input validation/whitelist, (3) ORM frameworks, (4) Least privilege database accounts, (5) WAF rules. Never concatenate user input into queries.
4. Walk me through incident response process
▼
NIST IR phases: (1) Preparation - tools ready, playbooks created, (2) Detection & Analysis - alert detected, triage severity, (3) Containment - isolate affected systems, block IOCs, (4) Eradication - remove malware, patch vulnerability, reset credentials, (5) Recovery - restore systems from clean backup, validate, (6) Post-incident - RCA, lessons learned, process improvement. Each phase has specific activities and success criteria.
5. Difference between symmetric and asymmetric encryption
▼
Symmetric: single shared key encrypts/decrypts (AES, 3DES). Fast, best for large data. Problem: key distribution. Asymmetric: public key encrypts, private key decrypts (RSA, ECC). Slow, best for key exchange. Solution to distribution problem. TLS uses both: asymmetric to exchange symmetric keys, then symmetric for data. Tradeoff: speed vs security/distribution ease.
6. Explain TLS handshake
▼
TLS handshake establishes secure connection: (1) ClientHello - TLS version, ciphers, random nonce, (2) ServerHello - chosen cipher, certificate, nonce, (3) Certificate validation - client verifies server's certificate chain, (4) Key exchange - ECDHE generates ephemeral key, both derive session key from shared secret, (5) ChangeCipherSpec - switch to encryption, (6) Finished - verify handshake integrity. Result: encrypted channel with forward secrecy (PFS).
7. What is a SIEM and how do you use it?
▼
SIEM (Security Information & Event Management) aggregates logs from all sources (firewalls, servers, apps). Features: correlation (find related events), normalization (parse different formats), alerting (rules trigger alerts on patterns), dashboarding, reporting. Use cases: detect brute force (multiple failed logins), lateral movement (explicit credential use), data exfiltration (large outbound transfers). Examples: Splunk, Elastic, IBM QRadar. Requires proper log parsing and tuning.
8. What is Zero Trust security?
▼
Zero Trust: "Never trust, always verify" - all users/devices/requests are untrusted by default. Core principles: verify identity (strong auth, MFA), validate device (posture check), least privilege access, microsegmentation (isolate network), assume breach (detect lateral movement), continuous monitoring. Works in hybrid/cloud better than perimeter security. Solves insider threat and advanced attacks. Implementation requires major architecture change.
9. How do you investigate a compromised server?
▼
(1) Preserve evidence - memory dump, disk image, copy logs, (2) Identify compromise - when/how entry occurred, check access logs, (3) Scope - what systems affected, lateral movement, (4) Find indicators - IOCs (hashes, IPs, domains), YARA rules for malware, (5) Remove threat - kill malicious processes, delete malware, patch exploit, reset credentials, (6) Validate clean - scan with clean tools, monitoring, (7) Document - timeline, findings, lessons learned. Use Volatility for memory analysis, dd for disk imaging.
10. What is privilege escalation?
▼
Privilege escalation: attacker gains higher-privilege access (user → root/admin). Vertical: lower privilege → higher privilege. Horizontal: same privilege on different account. Windows: kernel exploit, misconfigurations (sudo NOPASSWD), unquoted paths, registry write-ability. Linux: SUID bits, sudo abuse, kernel vulnerabilities. Prevention: least privilege, disable unnecessary services, keep kernel/OS patched, monitor privilege changes, restrict sudo, remove SUID bits on unnecessary binaries.
11. Explain CSRF and XSS differences
▼
CSRF (Cross-Site Request Forgery): Attacker tricks authenticated user into making unwanted request (e.g., transfer money) by putting malicious link on site. Browser sends user's cookies automatically. XSS (Cross-Site Scripting): Attacker injects malicious JavaScript into page, runs in user's browser, can steal cookies/data. CSRF is request forgery (wrong action), XSS is code injection (wrong data). Prevent CSRF: SameSite cookies, CSRF tokens. Prevent XSS: escape output, CSP header, input validation.
12. What are the phases of a penetration test?
▼
(1) Scoping & Rules of Engagement - define targets, timeline, legal authorization, (2) Reconnaissance - gather public info (passive), then active scanning (Nmap), (3) Scanning & Enumeration - port scan, service detection, version identification, (4) Vulnerability Analysis - identify CVEs, weak config, misconfigurations, (5) Exploitation - attempt to gain access, escalate privilege, lateral movement, (6) Post-Exploitation - maintain access, document findings, (7) Reporting - executive summary, technical findings, recommendations, remediation timeline.
13. How does ARP poisoning work?
▼
ARP (Address Resolution Protocol) maps IPs to MAC addresses. Attacker sends gratuitous ARP saying "I am 192.168.1.1 (gateway) at MAC xx:xx:xx:xx:xx:xx" (lies with attacker's MAC). All hosts update ARP cache believing gateway is attacker. All traffic meant for gateway flows through attacker (man-in-the-middle). Attacker can eavesdrop, modify packets, perform SSL stripping. Prevention: static ARP entries, ARP monitoring (alert on changes), DAI (Dynamic ARP Inspection), VLAN isolation, switch port security.
14. What is MITRE ATT&CK framework?
▼
MITRE ATT&CK is a knowledge base of adversary tactics and techniques based on real-world observations. 14 Tactics (high-level goals): Reconnaissance, Resource Development, Initial Access, Execution, Persistence, Privilege Escalation, Defense Evasion, Credential Access, Discovery, Lateral Movement, Collection, Command & Control, Exfiltration, Impact. Each Tactic has Techniques with Sub-techniques. Used for: threat hunting (search for technique IOCs), detection engineering (create alerts for techniques), incident response (identify attacker TTPs). Essential for defenders.
15. How do you perform threat hunting?
▼
Threat hunting is proactive search for undetected threats. Approach: (1) Hypothesis - "Attackers may create scheduled tasks for persistence", (2) Data collection - pull from SIEM, EDR, firewall logs, (3) Analysis - create queries to find IOCs/anomalies, (4) Investigation - determine if benign or malicious, (5) IOC extraction - collect indicators, (6) Reporting - find undetected compromise, improve detection rules. Tools: Splunk, Jupyter notebooks, EDR dashboards. Success metrics: confirmed breaches found, detection improvement, operational understanding.
16. Explain Nmap and its scanning techniques
▼
Nmap maps networks, discovers hosts/ports/services. Scan types: -sS (SYN, stealthy), -sT (TCP connect), -sU (UDP), -sA (ACK - firewall rule testing), -sP (ping sweep - hosts alive). -sV detects service versions, -O guesses OS, -A aggressive (all info). Port states: open (accept), closed (reject), filtered (firewall blocked). Output: -oN (normal), -oX (XML), -oG (grepable). Timing: -T2 (slow, evasive), -T5 (fast, noisy). Common: nmap -A -p- 192.168.1.1. Generates logs - detectable by IDS.
17. What is phishing and how do you defend?
▼
Phishing: social engineering attack using fraudulent emails to trick users into revealing credentials/sensitive data or clicking malicious links. Types: mass phishing (generic), spear phishing (targeted specific person), whaling (targets executives), smishing (SMS phishing). Defenses: (1) Email filtering - block known phishing domains, sandboxing suspicious links, (2) DMARC/SPF/DKIM - prevent spoofing, (3) User training - recognize phishing red flags, (4) MFA - even if credential stolen, still can't login, (5) Monitoring - unusual email activity, bulk sends from internal accounts, (6) Report button - employees report suspicious emails.
18. How do you analyze malware?
▼
Malware analysis: determine functionality, IOCs, detection patterns. Static analysis: examine binary (disassemble), no execution, safe (reverse engineer with IDA Pro, Ghidra). Dynamic analysis: run in sandbox (any.run, Cuckoo), watch behavior - network calls, file modifications, registry changes. Behavioral analysis: identify what malware does (C&C communication, data exfiltration, persistence mechanism). Tools: YARA to create detection rules. Report: hash, C&C IP/domain, file created/modified, registry changes, detected by scanners (VirusTotal). Useful for attribution, response, detection.
19. What is the kill chain model?
▼
Cyber kill chain (Lockheed Martin): Reconnaissance (OSINT), Weaponization (craft exploit), Delivery (send), Exploitation (execute), Installation (persistence), Command & Control (remote access), Actions on Objectives (steal/destroy). Defense disrupts each phase: block recon (OSINT monitoring), block delivery (email filtering), block execution (patching), detect installation (EDR), detect C2 (network monitoring), monitor objectives (DLP). Early disruption (detection) prevents later phases. Knowledge helps defenders create layered protection.
20. Explain CVSS scoring
▼
CVSS (Common Vulnerability Scoring System) quantifies vulnerability severity (0-10). Metrics: Base (intrinsic properties: complexity, privileges, attack vector), Temporal (current state: exploit availability, patch status), Environmental (org-specific: affected asset value). Severity: 9.0-10.0 Critical, 7.0-8.9 High, 4.0-6.9 Medium, 0.1-3.9 Low. Higher score = more urgent patching. CVSS 9+ get immediate action, Medium often low priority. Used to prioritize patching. Note: CVSS doesn't account for context (breach probability, compensating controls).
21. What is cloud security and key controls?
▼
Cloud security: shared responsibility between provider (infrastructure) and customer (data, access). Key controls: IAM (strong auth, MFA, least privilege, rotate keys), network security (security groups = firewall rules, VPC isolation), encryption (at-rest, in-transit), monitoring (CloudTrail logs all API calls), vulnerability scanning, incident response, compliance (check provider's cert). Risks: misconfiguration (overly permissive security groups), exposed credentials (hardcoded in code), no encryption, inadequate monitoring. CSP provides compliance reports (SOC 2, PCI-DSS) - verify before using.
22. How do you validate a certificate?
▼
Certificate validation checks: (1) Certificate chain - client verifies each cert from end-entity to trusted root CA, (2) Expiration - current date within validity period (notBefore to notAfter), (3) Revocation - check CRL or OCSP - is cert revoked? (4) Hostname match - certificate CN or SAN matches requested domain, (5) Signature verification - issuer's signature valid with public key, (6) Key usage - cert allowed for purpose (TLS, code signing, etc). Attacks: expired cert, self-signed (no chain), wrong hostname (man-in-the-middle), revoked. Modern: OCSP stapling (include revocation status in TLS handshake).
23. What is DNS security and DNSSEC?
▼
DNS translates domain names to IPs - critical infrastructure. Attacks: DNS spoofing (fake response), cache poisoning (inject false records), DNS tunneling (exfiltrate data via DNS), DNS flood (DDoS). DNSSEC adds cryptographic signatures to DNS records. Client verifies signature with public key. Prevents spoofing/poisoning. Deployment: complex chain of trust (root → TLD → domain), requires KSK (Key Signing Key) rotation. Adoption low (harder troubleshooting, NSEC enumeration risk). Defense-in-depth: validate domains, rate limiting, monitoring, RPZ (Response Policy Zones).
24. How does segmentation improve security?
▼
Network segmentation divides network into isolated zones (VLANs, subnets, security zones). Benefits: limits lateral movement (attacker can't jump to all systems), contains breach (isolate compromised zone), improves monitoring (traffic between zones visible), applies least privilege (only needed traffic allowed). Example: DMZ (external-facing web servers) isolated from internal database servers. Microsegmentation (zero trust): every conversation validated, not just zone-level. Tools: firewall rules, network ACLs, VLANs, software-defined networking. Requires planning, good network diagram, ongoing maintenance.
25. What is forensic analysis?
▼
Forensics: collect, preserve, analyze evidence of incident. Steps: (1) Preservation - isolate system, image disk (dd), dump memory (Volatility), preserve logs, maintain chain of custody, (2) Timeline creation - reconstruct when each event occurred (file creation, process execution, login), (3) File analysis - recover deleted files, identify hidden files/directories, check metadata, (4) Memory analysis - find malware, attacker activity, (5) Log analysis - identify attack vectors, lateral movement. Tools: EnCase, FTK, Volatility, forensic artifact parser. Produces timeline and root cause for incident response/legal action.
26. How do cryptographic attacks work?
▼
Birthday attack: hashing weakness (SHA-256 collision found faster than brute force). With n possible hashes, ~sqrt(n) inputs needed to find collision. Padding oracle: if server responds differently to valid/invalid padding, attacker can decrypt message without key. Hash extension: attacker appends data to message, recalculates hash - used if hash verifies integrity without HMAC. Meet-in-the-middle: 2^(n/2) complexity instead of 2^n. Prevents: use HMAC, salting (prevents rainbow tables), Argon2 (slow hashing), modern ciphers (AES-GCM authenticated encryption), strong key derivation (PBKDF2, bcrypt).
27. What is the Zero Trust architecture and how to implement?
▼
Zero Trust: assume breach, verify everything. Implementation layers: (1) Identity - strong auth (MFA), never trust based on network location, (2) Device - verify posture (patched, antivirus active), (3) Network - microsegmentation, block unless explicitly allowed, (4) Application - principle of least privilege, monitor all access, (5) Data - encryption at rest/transit, DLP. Key difference from perimeter security: old model trusts inside network, doesn't verify internal. Zero Trust requires: identity provider (Okta, Azure AD), device management, network ACLs, monitoring. Deployment: pilot with non-critical services, gradually expand. Modern cloud/remote work makes Zero Trust essential.
28. How do you handle security incidents with legal implications?
▼
Legal considerations during incident: (1) Preserve evidence - follow chain of custody, image disks, don't contaminate, (2) Notify - data breach notification law varies by state/country (72h GDPR), legal team involved, (3) Investigation - work with law enforcement if criminal, hire forensic firm if litigation likely, (4) Communication - carefully word notifications (avoid admissions of guilt), (5) Documentation - comprehensive record for court, (6) Compliance - report to regulators (FBI, financial regulators), (7) Privacy - remove PII from reports, (8) Remediation - fix without destroying evidence. Incident response plan must include legal team involvement from start.
29. What is insider threat and how to detect?
▼
Insider threat: employee/contractor abuses legitimate access for harm (theft of IP, sabotage, espionage). Detection: (1) User behavior analytics (UBA) - baseline normal activity, alert on deviations (accessing files outside job, after hours activity), (2) File activity - large downloads, unusual file access, printer usage (printing documents), (3) Email - mass forwarding to personal email, strange recipients, (4) Database - unusual queries, large data exports, (5) Privilege changes - unnecessary elevation, (6) Psychological signs - disgruntled, job termination notice, financial distress. Prevention: least privilege, job rotation, separation of duties, acceptable use policy, background checks, monitoring. Difficult - must balance monitoring with privacy/employee morale.
30. What is supply chain security?
▼
Supply chain security: securing vendors/dependencies/software you use. Risks: compromised vendor (attacker compromises 3rd party software → distributed to all customers - SolarWinds), vulnerable dependencies (npm packages with vulnerabilities), typosquatting (malicious package with similar name), software tampering, licensing violations. Defenses: (1) Vendor assessment - SOC 2 certification, security questionnaire, (2) Dependency scanning - know what versions used, check for CVEs (Dependabot, Snyk), (3) Code review - examine 3rd party code, (4) Signed releases - verify package signatures, (5) Sandboxing - run in isolated environment, (6) Monitoring - detect compromise detection, (7) Incident plan - how to respond if vendor compromised. Essential for cloud/open-source heavy environments.