What is Pentesting?
Authorized security testing to find vulnerabilities in systems, applications, and networks.
Legal Requirements
⚠️ Always get written permission before testing
// Authorization letter must include:
- Scope (what to test)
- Duration
- Allowed techniques
- Contact information
- Liability protectionReconnaissance
Passive Recon
bash
# Whois lookup
whois example.com
# DNS enumeration
nslookup example.com
dig example.com ANY
# Search engines
Google dorks: site:example.com filetype:pdf
# Shodan (IoT search)
shodan search example.comActive Recon
bash
# Port scanning
nmap -sS -sV -O example.com
# Service detection
nmap -sV -p- example.com
# Vulnerability scan
nmap --script vuln example.comWeb Application Testing
SQL Injection
sql
-- Test for SQL injection
' OR '1'='1
' UNION SELECT NULL,NULL,NULL--
' OR 1=1--
-- Automated tools
sqlmap -u "http://example.com/page?id=1"XSS (Cross-Site Scripting)
javascript
// Test for XSS
<script>alert('XSS')</script>
<img src=x onerror=alert('XSS')>
<svg onload=alert('XSS')>
// Automated
xsstrike -u http://example.com/search?q=testAuthentication Testing
bash
# Default credentials
admin:admin
admin:password
root:root
# Brute force (authorized only)
hydra -l admin -P wordlist.txt example.com http-post-form
# Session hijacking
# Check for weak tokens
# Test for session fixationNetwork Testing
bash
# Network mapping
nmap -sC -sV -oA output 192.168.1.0/24
# Vulnerability scanning
nessus scan example.com
# Exploit testing
metasploit framework (authorized testing only)Tools
Kali Linux Tools
bash
# Information gathering
- Maltego
- theHarvester
- Recon-ng
# Web testing
- Burp Suite
- OWASP ZAP
- sqlmap
# Network testing
- Nmap
- Wireshark
- MetasploitOWASP Top 10
- 1Broken Access Control: Unauthorized access
- 2Cryptographic Failures: Sensitive data exposure
- 3Injection: SQL, NoSQL, OS command injection
- 4Insecure Design: Flawed architecture
- 5Security Misconfiguration: Default configs, open S3 buckets
- 6Vulnerable Components: Outdated libraries
- 7Authentication Failures: Weak passwords, session management
- 8Software & Data Integrity: CI/CD pipeline attacks
- 9Logging & Monitoring: Insufficient logging
- 10SSRF: Server-Side Request Forgery
Reporting
markdown
# Penetration Test Report
## Executive Summary
- High-level findings
- Risk ratings
- Recommendations
## Technical Details
- Vulnerability description
- Proof of concept
- Impact analysis
- Remediation steps
## Appendices
- Tools used
- Scope
- MethodologyBest Practices
- 1Document everything: Screenshots, logs, evidence
- 2Verify findings: False positives waste time
- 3Prioritize: Critical > High > Medium > Low
- 4Remediation: Provide actionable fixes
- 5Retest: Verify fixes work
Certification Paths
- CEH: Certified Ethical Hacker
- OSCP: Offensive Security Certified Professional
- CISSP: Certified Information Systems Security Professional
Ethical hacking makes everyone safer!