📡 Scanning and Enumeration
Explain the TCP three-way handshake.
- SYN: Client sends SYN packet to server
- SYN-ACK: Server responds with SYN-ACK
- ACK: Client sends ACK to complete connection
This establishes a reliable connection before data transfer
What are the different types of port scanning techniques?
- TCP Connect Scan: Full three-way handshake, logged
- SYN Scan (Half-open): Only SYN packet sent, stealthier
- FIN Scan: Sends FIN packets, works on Unix
- XMAS Scan: Sets FIN, PSH, and URG flags
- NULL Scan: No flags set
- ACK Scan: Used to map firewall rules
- UDP Scan: For UDP services
- IDLE/Zombie Scan: Uses a zombie host for scanning
What is the difference between vulnerability scanning and port scanning?
- Port Scanning: Identifies open ports and services running
- Vulnerability Scanning: Goes deeper to identify specific vulnerabilities, misconfigurations, and security weaknesses in the discovered services
What are the main Nmap switches and their purposes?
-sS : SYN scan (stealth scan)
-sT : TCP connect scan
-sU : UDP scan
-sV : Version detection
-O : OS detection
-A : Aggressive scan (OS, version, scripts)
-p : Specify ports
-Pn : Skip host discovery
-T[0-5] : Timing templates
What is banner grabbing and how is it performed?
Banner grabbing captures service banners to identify versions and types. Methods:
Telnet: telnet target 80 then GET / HTTP/1.0
Netcat: nc -nv target 80
Nmap: nmap -sV target
- HTTP: Send HTTP requests and analyze headers
What information can be enumerated from NetBIOS?
- Computer names
- Domain names
- User accounts
- Group memberships
- Share information
- Password policies
- Running services
- Tools: enum4linux, nbtscan, net commands
What is SNMP enumeration and what are community strings?
SNMP (Simple Network Management Protocol) enumeration extracts information using:
- Community Strings: Passwords for SNMP access
- Public: Read-only access (default)
- Private: Read-write access (default)
- Information gathered: System info, network interfaces, routing tables, device configurations
🎯 Sniffing and Evasion
What is the difference between promiscuous and non-promiscuous mode?
- Promiscuous Mode: NIC captures all packets on the network segment, regardless of destination
- Non-Promiscuous Mode: NIC only captures packets destined for its MAC address
Explain ARP poisoning and how it works.
ARP poisoning involves sending fake ARP messages to associate the attacker's MAC with another host's IP:
- Attacker sends ARP replies to victim and gateway
- Both update their ARP tables with attacker's MAC
- Traffic flows through attacker (MITM position)
- Tools: Cain & Abel, Ettercap, arpspoof
What is MAC flooding and how does it work?
MAC flooding overwhelms a switch's CAM table:
- Attacker sends numerous packets with different source MACs
- CAM table fills up (limited size)
- Switch fails open, acting like a hub
- All traffic is broadcast to all ports
- Tool: macof
How can you detect if a network card is in promiscuous mode?
- Send ARP requests for non-existent IPs
- Check response times for packets not destined for the host
- Use tools like PromiscDetect or Promqry
- Check local system with ifconfig (Linux) or device manager (Windows)
What are some IDS evasion techniques?
- Fragmentation: Split packets into fragments
- Encryption: Encrypt malicious payloads
- Obfuscation: Encode attacks differently
- Session splicing: Split attacks across packets
- Decoy scans: Hide real source among decoys
- Timing attacks: Slow down attack pace
- Protocol-level evasion: Use uncommon protocols
💻 System Hacking
What are the main password attack types?
- Dictionary Attack: Using wordlists
- Brute Force: Trying all combinations
- Hybrid Attack: Dictionary + modifications
- Rainbow Tables: Pre-computed hashes
- Keylogging: Capturing keystrokes
- Social Engineering: Tricking users
- Shoulder Surfing: Physical observation
How does Windows store passwords and what are LM and NTLM hashes?
Passwords stored in SAM file (C:\Windows\System32\config)
- LM Hash:
- Converts to uppercase
- Pads to 14 characters
- Splits into 2x7 character parts
- Very weak, easily cracked
- NTLM Hash:
- MD4 hash of password
- Case-sensitive
- Stronger than LM but still vulnerable
What is pass-the-hash attack?
An attack where an attacker uses a password hash directly without cracking it:
- Captures hash from memory or network
- Uses hash to authenticate to other systems
- Works because Windows accepts hash for authentication
- Tools: Mimikatz, PTH-suite
Explain privilege escalation techniques.
- Vertical: User to administrator/root
- Horizontal: User to another user
Techniques:
- Exploit unpatched vulnerabilities
- Misconfigurations
- Weak permissions
- DLL hijacking
- Kernel exploits
- Social engineering
What is an alternate data stream (ADS) in NTFS?
ADS allows hiding data behind files:
- Feature of NTFS for compatibility with Mac HFS
- Syntax: file.txt:hidden.txt
Create: type secret.txt > file.txt:hidden.txt
Execute: start file.txt:hidden.exe
Detection: dir /r or specialized tools
How do you cover tracks after system compromise?
- Clear event logs (but don't delete entirely)
- Disable auditing
- Modify timestamps
- Hide files (ADS, hidden attributes)
- Use rootkits
- Clear command history
- Remove created accounts
- Clean Registry entries
🌐 Web Application Security
What is SQL injection and how does it work?
SQL injection inserts malicious SQL code into application queries:
- Basic test: Single quote (')
- Authentication bypass: ' OR 1=1--
Common payloads:
admin' --
' OR '1'='1
'; DROP TABLE users--
Prevention: Parameterized queries, input validation
Explain different types of SQL injection.
- Union-based: Uses UNION to combine results
- Error-based: Extracts data from error messages
- Blind SQLi: No visible output, uses true/false conditions
- Time-based Blind: Uses time delays to infer data
- Second-order: Payload executed later
What is Cross-Site Scripting (XSS)?
XSS injects malicious scripts into web pages:
- Reflected XSS: Payload in request, immediately reflected
- Stored XSS: Payload stored in database
- DOM-based XSS: Manipulates DOM environment
Example: <script>alert('XSS')</script>
Impact: Session theft, defacement, redirection
What is a buffer overflow attack?
Writing more data than allocated buffer space:
- Stack overflow: Overflows stack memory
- Heap overflow: Overflows heap memory
- NOP sled: Series of NOP instructions
- Exploits poor boundary checking
- Can execute arbitrary code
Explain directory traversal attacks.
Accessing files outside web root:
- Uses ../ (dot-dot-slash)
- Example: http://site.com/../../etc/passwd
- Unicode encoding: %2e%2e%2f
- Also called path traversal
- Prevention: Input validation, access controls
What is parameter tampering?
Modifying parameters in:
- URLs: ?price=100 changed to ?price=1
- Hidden fields in HTML
- Cookies
- HTTP headers
- Form fields
Prevention: Server-side validation
How do you identify and test for web vulnerabilities?
Manual testing:
- Input validation testing
- Authentication testing
- Session management testing
Automated tools:
- Burp Suite
- OWASP ZAP
- Nikto
- SQLmap
- Acunetix
📶 Wireless Security
What are the different wireless standards and their characteristics?
- 802.11a: 54 Mbps, 5 GHz
- 802.11b: 11 Mbps, 2.4 GHz
- 802.11g: 54 Mbps, 2.4 GHz
- 802.11n: 100+ Mbps, 2.4/5 GHz
- 802.11ac: 1+ Gbps, 5 GHz
Explain WEP and why it's insecure.
WEP (Wired Equivalent Privacy) weaknesses:
- 24-bit IV (Initialization Vector) too small
- IV reuse leads to key recovery
- No key management
- Weak integrity check
- Can be cracked in minutes
- Tools: Aircrack-ng, Cain & Abel
What is the difference between WPA, WPA2, and WPA3?
- WPA: TKIP encryption, stronger than WEP
- WPA2: AES encryption, current standard
- WPA3: Latest standard, SAE handshake, forward secrecy
- Enterprise versions use 802.1X authentication
What is a rogue access point?
Unauthorized AP on network:
- Evil Twin: Mimics legitimate AP
- Captures credentials
- MITM attacks
- Data theft
- Detection: Site surveys, WIDS
Explain the WEP cracking process.
- Start monitor mode:
airmon-ng start wlan0
- Capture packets:
airodump-ng mon0
- Generate traffic:
aireplay-ng -3 -b [BSSID] mon0
- Crack key:
aircrack-ng capture.cap
- Need 50,000+ packets for reliable cracking
What is war driving and war chalking?
- War Driving: Searching for wireless networks while moving
- War Chalking: Marking locations with symbols indicating:
- Open networks: )(
- Closed networks: )(—
- WEP networks: )(W
- SSID/password often included
What are Bluetooth attack types?
- Bluejacking: Sending unsolicited messages
- Bluesnarfing: Stealing information
- Bluebugging: Taking control of device
- BlueBorne: Spreading malware
- Bluesmacking: DoS attack
🦠 Malware and Trojans
What are the different types of viruses?
- Boot Sector: Infects boot sector
- File Infector: Attaches to executables
- Macro: Uses application macros
- Polymorphic: Changes code signature
- Metamorphic: Rewrites itself completely
- Multipartite: Multiple infection methods
- Stealth: Hides from detection
What is the difference between a virus, worm, and Trojan?
- Virus: Requires host file, user action to spread
- Worm: Self-replicating, spreads automatically
- Trojan: Appears legitimate, doesn't self-replicate
- Logic Bomb: Triggers on condition
- Rootkit: Hides presence, maintains access
What are common Trojan ports?
- Back Orifice: 31337, 31338
- NetBus: 12345, 12346
- Tini: 7777
- Deep Throat: 2140, 3150
- SubSeven: 27374
- Beast: 6666
How do you detect and prevent Trojans?
Detection:
- Monitor ports: netstat -an
- Check processes
- Registry monitoring
- File integrity checking
- Network traffic analysis
Prevention:
- Antivirus software
- Firewall rules
- User education
- Principle of least privilege
- Application whitelisting
What is a rootkit and what are its types?
Software that hides malicious presence:
- Application-level: Replaces executables
- Kernel-level: Modifies kernel
- Hardware/Firmware: BIOS/UEFI infection
- Bootkit: Infects MBR
- Library-level: Patches system libraries
Detection: GMER, RootkitRevealer
🛡️ Penetration Testing
What are the types of penetration testing?
By knowledge:
- Black Box: No prior knowledge
- White Box: Full knowledge
- Gray Box: Partial knowledge
By location:
- External: From outside network
- Internal: From inside network
By announcement:
- Announced: Staff aware
- Unannounced: Staff unaware
What are the phases of penetration testing?
- Pre-engagement: Scope, authorization, rules
- Intelligence Gathering: Reconnaissance
- Threat Modeling: Identify attack vectors
- Vulnerability Analysis: Scanning, enumeration
- Exploitation: Gaining access
- Post-Exploitation: Privilege escalation, persistence
- Reporting: Documentation, recommendations
What should a penetration test report contain?
- Executive summary
- Scope and methodology
- Risk ratings
- Detailed findings
- Evidence/screenshots
- Remediation recommendations
- Technical details
- Test dates and team
What is the difference between vulnerability assessment and penetration testing?
Vulnerability Assessment:
- Identifies vulnerabilities
- Doesn't exploit
- Broader coverage
- Automated tools
- Regular frequency
Penetration Testing:
- Exploits vulnerabilities
- Proves impact
- Focused approach
- Manual + automated
- Less frequent
🎭 Social Engineering
Human-based:
Computer-based:
Creating a fabricated scenario to gain trust and extract information: