Penetration Testing
Penetration Testing Pentest Ethical Hacking Reconnaissance Scanning Exploitation Post-exploitation Reporting Kali Linux nmap Burp Suite Metasploit OWASP
| ประเภท | ข้อมูลที่ได้ | ความยาก | ราคา | เหมาะกับ |
|---|---|---|---|---|
| Black Box | ไม่มี | สูง | สูง | Real-world Simulation |
| White Box | ทั้งหมด | ปานกลาง | ปานกลาง | Code Review + Pentest |
| Gray Box | บางส่วน | ปานกลาง | ปานกลาง | Insider Threat |
Pentest Methodology
# === Penetration Testing Steps ===
# Phase 1: Reconnaissance (Information Gathering)
# nmap -sn 192.168.1.0/24 # Host Discovery
# nmap -sV -sC -p- target.com # Full Port Scan + Version
# nmap -sU --top-ports 100 target.com # UDP Scan
# whois target.com # Domain Info
# dig target.com ANY # DNS Records
# subfinder -d target.com # Subdomain Enumeration
# httpx -l subdomains.txt -sc -title # HTTP Probe
# Phase 2: Scanning & Enumeration
# nikto -h https://target.com # Web Vulnerability Scan
# gobuster dir -u https://target.com -w /usr/share/wordlists/dirb/common.txt
# ffuf -u https://target.com/FUZZ -w wordlist.txt -mc 200,301,302
# nuclei -u https://target.com -t cves/ -severity critical, high
# wpscan --url https://target.com # WordPress Scan
# Phase 3: Exploitation
# msfconsole # Metasploit Framework
# use exploit/multi/http/apache_mod_cgi_bash_env_exec
# set RHOSTS target.com
# set TARGETURI /cgi-bin/vulnerable.cgi
# exploit
#
# sqlmap -u "https://target.com/page?id=1" --dbs --batch
# hydra -l admin -P rockyou.txt target.com ssh
# Phase 4: Post-exploitation
# whoami && id # Current User
# uname -a # System Info
# cat /etc/passwd # Users
# sudo -l # Sudo Privileges
# find / -perm -4000 2>/dev/null # SUID Binaries
# linpeas.sh # Linux Privilege Escalation
from dataclasses import dataclass
from typing import List
@dataclass
class PentestPhase:
phase: int
name: str
tools: str
duration: str
output: str
phases = [
PentestPhase(1, "Reconnaissance", "nmap, subfinder, whois, dig", "1-2 days", "Target Profile"),
PentestPhase(2, "Scanning", "Nessus, Nuclei, nikto, gobuster", "2-3 days", "Vulnerability List"),
PentestPhase(3, "Exploitation", "Metasploit, sqlmap, Burp Suite", "3-5 days", "Proof of Exploit"),
PentestPhase(4, "Post-exploitation", "linpeas, mimikatz, BloodHound", "1-2 days", "Privilege Escalation"),
PentestPhase(5, "Reporting", "Custom Template, Screenshots", "2-3 days", "Executive + Technical Report"),
]
print("=== Pentest Methodology ===")
for p in phases:
print(f" Phase {p.phase}: {p.name} ({p.duration})")
print(f" Tools: {p.tools}")
print(f" Output: {p.output}")
OWASP Top 10
# === OWASP Top 10 (2021) ===
@dataclass
class OWASPVuln:
rank: int
name: str
description: str
tool: str
example: str
owasp = [
OWASPVuln(1, "Broken Access Control", "เข้าถึงข้อมูลที่ไม่มีสิทธิ์", "Burp Suite", "IDOR /api/user/123"),
OWASPVuln(2, "Cryptographic Failures", "เข้ารหัสไม่ดี ข้อมูลรั่ว", "testssl.sh", "HTTP ไม่ใช้ HTTPS"),
OWASPVuln(3, "Injection", "SQL, XSS, Command Injection", "sqlmap", "' OR 1=1 --"),
OWASPVuln(4, "Insecure Design", "ออกแบบไม่ปลอดภัย", "Manual Review", "ไม่มี Rate Limit"),
OWASPVuln(5, "Security Misconfiguration", "ตั้งค่าไม่ถูก Default Password", "Nuclei", "Admin Panel เปิด"),
OWASPVuln(6, "Vulnerable Components", "ใช้ Library เก่ามีช่องโหว่", "Snyk, npm audit", "Log4Shell CVE"),
OWASPVuln(7, "Auth Failures", "Authentication ไม่ดี", "Hydra", "Brute Force Login"),
OWASPVuln(8, "Software Integrity", "Supply Chain Attack", "Sigstore", "Compromised Package"),
OWASPVuln(9, "Logging Failures", "ไม่มี Log หรือ Monitor", "ELK Stack", "ไม่รู้ว่าถูก Hack"),
OWASPVuln(10, "SSRF", "Server-Side Request Forgery", "Burp Suite", "เข้าถึง Internal API"),
]
print("\n=== OWASP Top 10 ===")
for v in owasp:
print(f" #{v.rank} {v.name}")
print(f" {v.description} | Tool: {v.tool}")
print(f" Example: {v.example}")
Learning Path
# === Pentest Learning Path ===
@dataclass
class Certification:
name: str
provider: str
level: str
cost: str
duration: str
certs = [
Certification("eJPT", "INE Security", "Beginner", "$249", "2-3 months"),
Certification("CEH", "EC-Council", "Intermediate", "$1,199", "3-4 months"),
Certification("OSCP", "OffSec", "Advanced", "$1,649", "6-12 months"),
Certification("OSWE", "OffSec", "Advanced (Web)", "$1,649", "6-12 months"),
Certification("CRTP", "Altered Security", "Advanced (AD)", "$249", "3-6 months"),
Certification("BSCP", "PortSwigger", "Advanced (Web)", "$99", "3-6 months"),
]
print("=== Certifications ===")
for c in certs:
print(f" [{c.level}] {c.name} ({c.provider})")
print(f" Cost: {c.cost} | Duration: {c.duration}")
# Practice Platforms
platforms = {
"TryHackMe": "Beginner-friendly, Guided rooms, Free tier",
"HackTheBox": "Intermediate-Advanced, Real-world machines",
"OverTheWire": "Free, Linux/Network basics (Bandit, Natas)",
"PortSwigger Academy": "Free, Web Security ดีมาก",
"PentesterLab": "Web App Pentest, Paid",
"VulnHub": "Free VMs download, Offline practice",
"HackerOne": "Bug Bounty, Real targets, Get paid",
}
print(f"\n\nPractice Platforms:")
for name, desc in platforms.items():
print(f" [{name}]: {desc}")
# Salary Range (Thailand)
salary = {
"Junior Pentester (0-2yr)": "30,000-50,000 THB/mo",
"Mid Pentester (2-5yr)": "50,000-80,000 THB/mo",
"Senior Pentester (5+yr)": "80,000-150,000 THB/mo",
"Pentest Lead/Manager": "100,000-200,000 THB/mo",
"Bug Bounty (Top)": "$50,000-500,000/yr",
}
print(f"\n\nSalary Range (Thailand):")
for role, pay in salary.items():
print(f" [{role}]: {pay}")
เคล็ดลับ
- Lab: ฝึกบน TryHackMe HackTheBox ทุกวัน
- OWASP: ศึกษา OWASP Top 10 ให้ครบ
- Tools: เรียนรู้ nmap Burp Suite Metasploit ให้คล่อง
- Report: เขียน Report ดี สำคัญเท่ากับการเจาะระบบ
- Legal: ทำ Pentest เฉพาะที่ได้รับอนุญาตเท่านั้น
แนวทางป้องกันภัยไซเบอร์สำหรับองค์กรไทย
ภัยคุกคามทางไซเบอร์ในปี 2026 มีความซับซ้อนมากขึ้น Ransomware ยังคงเป็นภัยอันดับหนึ่ง โดยผู้โจมตีใช้ AI ช่วยสร้าง Phishing Email ที่แนบเนียนขึ้น องค์กรควรมี Multi-Layered Security ตั้งแต่ Perimeter Defense ด้วย Next-Gen Firewall Endpoint Protection ด้วย EDR Solution และ Network Detection and Response
การฝึกอบรมพนักงานเป็นสิ่งสำคัญที่สุด เพราะ Human Error เป็นสาเหตุหลักของการรั่วไหลข้อมูล ควรจัด Security Awareness Training อย่างน้อยไตรมาสละครั้ง ทำ Phishing Simulation ทดสอบพนักงาน และมี Incident Response Plan ที่ชัดเจน ฝึกซ้อมเป็นประจำ
สำหรับกฎหมาย PDPA ของไทย องค์กรต้องมี Data Protection Officer แจ้งวัตถุประสงค์การเก็บข้อมูลอย่างชัดเจน ขอ Consent ก่อนใช้ข้อมูลส่วนบุคคล มีมาตรการรักษาความปลอดภัยที่เหมาะสม และแจ้งเหตุ Data Breach ภายใน 72 ชั่วโมง
เปรียบเทียบข้อดีและข้อเสีย
จากตารางเปรียบเทียบจะเห็นว่าข้อดีมีมากกว่าข้อเสียอย่างชัดเจน โดยเฉพาะในแง่ของประสิทธิภาพและความสามารถในการ Scale สำหรับข้อเสียส่วนใหญ่สามารถแก้ไขได้ด้วยการเรียนรู้อย่างเป็นระบบและวางแผนทรัพยากรให้เหมาะสม
Penetration Testing คืออะไร
ทดสอบเจาะระบบถูกกฎหมาย Reconnaissance Scanning Exploitation Post-exploitation Reporting Ethical Hacker Scope อนุญาต
Pentest มีกี่ประเภท
Black Box ไม่มีข้อมูล White Box ได้หมด Gray Box บางส่วน Network Web Mobile Wireless Social Engineering Physical 50,000-500,000 บาท
เครื่องมือ Pentest มีอะไรบ้าง
Kali Linux nmap Burp Suite Metasploit sqlmap John Wireshark Gobuster Hydra Nuclei Nessus Aircrack-ng ฟรี Open Source
เรียน Pentest เริ่มต้นอย่างไร
Network TCP/IP Linux CLI Kali TryHackMe HackTheBox OWASP Top 10 Python Bash eJPT CEH OSCP Bug Bounty HackerOne Writeup
สรุป
Penetration Testing Pentest Ethical Hacking OWASP Top 10 Kali Linux nmap Burp Suite Metasploit Exploitation Reconnaissance Scanning Reporting Certification TryHackMe OSCP
