Skip to main content

Chương 3: Burp Suite

Khái niệm

Burp Suite là công cụ kiểm thử bảo mật ứng dụng web phổ biến nhất thế giới, được phát triển bởi PortSwigger. Nó hoạt động như một intercepting proxy (proxy chặn bắt) — đặt giữa browser và server để bắt, đọc, sửa đổi toàn bộ HTTP traffic.

Với DevOps Engineer, Burp Suite giúp:

  • Quan sát chính xác ứng dụng đang gửi/nhận gì
  • Replay và modify requests để test lỗ hổng
  • Tự động scan một số loại vulnerability
  • Phân tích authentication flow, API calls

Hai phiên bản:

  • Burp Suite Community: Miễn phí, đủ dùng cho học tập và bug bounty cơ bản
  • Burp Suite Professional: Trả phí (~449 USD/năm), có scanner, Collaborator, nhiều tính năng nâng cao

Cài đặt

Yêu cầu: Java 17+

# Ubuntu/Debian
sudo apt update && sudo apt install default-jdk

# Download Burp Suite Community từ portswigger.net/burp/communitydownload
# Sau đó chạy:
java -jar burpsuite_community_v*.jar

Hoặc dùng Docker (không khuyến khích vì cần GUI):

# Dùng Kali Linux với Burp sẵn có
docker run -it --rm kalilinux/kali-rolling /bin/bash
apt install burpsuite

Cấu hình ban đầu

Bước 1: Tạo Proxy Listener

Mặc định Burp Suite lắng nghe ở 127.0.0.1:8080.

Burp Suite → Proxy → Options → Proxy Listeners
└── 127.0.0.1:8080 (mặc định)

Bước 2: Cấu hình Browser

Cách 1: Cấu hình thủ công

  • Firefox: Settings → Network Settings → Manual proxy
  • HTTP Proxy: 127.0.0.1, Port: 8080
  • Cũng dùng cho HTTPS

Cách 2: Dùng FoxyProxy (khuyến nghị)

# Cài extension FoxyProxy Standard cho Firefox
# Add proxy: 127.0.0.1:8080
# Toggle on/off khi cần

Bước 3: Cài CA Certificate

Để intercept HTTPS, cần cài Burp CA certificate vào browser:

1. Truy cập http://burpsuite (khi proxy đang bật)
2. Download CA Certificate
3. Firefox: Settings → Privacy & Security → Certificates → Import
4. Trust for "Identify websites"

Các module chính

1. Proxy — Trái tim của Burp

Intercept tab:

Proxy → Intercept → Intercept is ON

Khi bật intercept, mọi request từ browser đều bị "hold" lại. Bạn có thể:

  • Forward: Cho request đi qua
  • Drop: Hủy request
  • Edit: Sửa request trước khi forward
GET /api/users?id=1 HTTP/1.1
Host: example.com
Cookie: session=abc123

Sửa id=1 thành id=2 ngay đây

HTTP History tab: Xem toàn bộ traffic đã qua Proxy, dù intercept tắt hay bật.

Chuột phải vào request → Send to Repeater / Send to Intruder / Send to Scanner

2. Repeater — Replay và Modify Requests

Repeater cho phép gửi lại request nhiều lần với các thay đổi khác nhau. Đây là tool dùng nhiều nhất khi test thủ công.

Proxy → HTTP History → [chọn request] → chuột phải → Send to Repeater

Workflow điển hình:

Request gốc:
GET /api/user?id=1337 HTTP/1.1

Thử 1: id=1337' → SQL error? → SQL injection
Thử 2: id=1 → Xem user khác → IDOR
Thử 3: id=0x539 → Hex encoding bypass
Thử 4: id=../../../etc/passwd → Path traversal

Keyboard shortcuts:

  • Ctrl+R: Send request
  • Ctrl+Z: Undo
  • Ctrl+Shift+[/]: Navigate giữa các tabs

3. Intruder — Tấn công tự động hóa

Intruder tự động hóa việc gửi nhiều request với payload khác nhau. Dùng để:

  • Brute force password
  • Fuzzing parameters
  • Enumerate IDs (IDOR testing)
  • Bypass rate limiting

Các Attack Type:

Sniper: [payload] cùng một vị trí, từng giá trị một
Battering Ram: [payload] tất cả vị trí cùng lúc, cùng giá trị
Pitchfork: [payload1][payload2] nhiều vị trí, đồng bộ theo hàng
Cluster Bomb: [payload1][payload2] mọi tổ hợp có thể

Ví dụ brute force login:

POST /login HTTP/1.1
Content-Type: application/json

{"username":"admin","password":"§password§"}

Đánh dấu vị trí inject payload
Payloads → Simple list → Load wordlist (rockyou.txt)
→ Start attack
→ Filter by response length hoặc status code khác nhau

Community Edition bị rate limit ở Intruder. Dùng Turbo Intruder extension cho tốc độ cao hơn.

4. Scanner (Pro only) — Tự động tìm lỗ hổng

Chuột phải vào request → Scan → Active Scan

Scanner tự động phát hiện:

  • SQL Injection
  • XSS
  • Path Traversal
  • XXE
  • Command Injection
  • ...và nhiều hơn nữa

Chỉ dùng trên hệ thống được phép. Active scan sẽ gửi payloads có thể gây hại.

5. Decoder — Encode/Decode dữ liệu

Burp → Decoder

Hỗ trợ:

  • Base64 encode/decode
  • URL encode/decode
  • HTML encode/decode
  • Hex
  • Gzip
  • Hashing (MD5, SHA1, SHA256)

Ví dụ: Decode JWT token:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
→ Decode as Base64 →
{"alg":"HS256","typ":"JWT"}

6. Comparer — So sánh responses

Dùng để so sánh hai responses để tìm sự khác biệt nhỏ — hữu ích trong blind injection testing.

HTTP History → chọn 2 responses → chuột phải → Send to Comparer

7. Logger — Ghi log toàn bộ traffic

Khác với HTTP History của Proxy, Logger ghi lại traffic từ tất cả modules. Hữu ích khi debug.

8. Collaborator (Pro only) — Out-of-band testing

Burp Collaborator là server public của PortSwigger dùng để detect out-of-band interactions — khi payload trigger DNS lookup hoặc HTTP request ra ngoài.

Dùng trong:
- Blind SSRF
- Blind Command Injection
- Blind XXE
- Blind SQL Injection (DNS-based)

Extensions quan trọng

Cài qua BApp Store (Burp → Extensions → BApp Store):

ExtensionMục đích
Param MinerTìm hidden parameters, unkeyed cache inputs
Turbo IntruderBrute force tốc độ cao, race condition testing
Active Scan++Nâng cao scanner (Pro)
JWT EditorEdit và resign JWT tokens
Logger++Advanced logging
AutorizeTest access control (mỗi request chạy với nhiều user)
HackvertorTransform payloads để bypass WAF
403 BypasserBypass 403 Forbidden

Workflow thực tế: Test một API endpoint

1. Cấu hình Burp proxy
2. Bật intercept
3. Thực hiện thao tác trên app (login, browse, etc.)
4. HTTP History → xem các request
5. Tìm request thú vị (có parameters, auth headers, v.v.)
6. Send to Repeater
7. Thử các modifications:
- Thay đổi ID values (IDOR test)
- Remove auth header (access control test)
- Inject SQL/XSS payloads
- Thêm/sửa headers
8. Phân tích response (status code, length, content)
9. Nếu tìm ra pattern → Send to Intruder để automate

Burp với Docker/Kubernetes

Khi test ứng dụng trong Docker/K8s, cần cấu hình network:

# Test app chạy trong Docker
# Tìm IP của container
docker inspect <container> | grep IPAddress

# Cấu hình Burp target scope
# Proxy → Options → Add scope: 172.17.0.0/16

# Hoặc expose app ra localhost
docker run -p 8000:8000 myapp
# → Burp intercept traffic đến localhost:8000

Lưu ý: Với HTTPS trong container, cần cài Burp CA vào container hoặc tắt TLS verification khi test nội bộ.


Kịch bản tấn công: Brute force login với Intruder

1. Intercept POST /login request
2. Send to Intruder
3. Clear tất cả auto-marked positions
4. Mark §password§:
{"username":"admin","password":"§password§"}
5. Payloads → Load: /usr/share/wordlists/rockyou.txt
6. Options → Grep Match: "Invalid password"
(để phân biệt success/failure)
7. Start Attack
8. Sort by Response Length — request thành công có length khác

Cách phát hiện: Burp giúp nhận biết gì

Dùng Burp để phát hiện dấu hiệu lỗ hổng:

✓ Response có stack trace/error message → thông tin lộ
✓ Response time khác nhau khi thay payload → blind injection
✓ Response length thay đổi khi modify parameter → IDOR/access control
✓ Set-Cookie thiếu HttpOnly/Secure → session security issue
✓ Thiếu security headers trong response → misconfiguration
✓ Content-Type: text/html nhưng trả về JSON → MIME confusion

Góc nhìn DevOps

Testing trong staging environment:

# Dùng Burp như một proxy chạy headless với Burp REST API (Pro)
# Hoặc dùng ZAP (miễn phí) trong CI/CD pipeline

# OWASP ZAP thay thế miễn phí cho CI/CD:
docker run -t owasp/zap2docker-stable zap-baseline.py \
-t https://staging.example.com \
-r zap-report.html

Ghi log traffic cho audit:

Burp → Logger → Enable logging → Export logs
→ Phân tích với ELK Stack để detect attack patterns

Tóm tắt

  • Burp Suite là intercepting proxy — đặt giữa browser và server để bắt và sửa HTTP traffic.
  • Proxy: bắt và forward/drop/edit request.
  • Repeater: replay request với sửa đổi — dùng nhiều nhất khi test thủ công.
  • Intruder: tự động hóa với nhiều payloads — brute force, fuzzing, enumeration.
  • Decoder: encode/decode base64, URL, HTML, hex.
  • Cần cài CA certificate để intercept HTTPS.
  • Extensions như Param Miner, JWT Editor, Autorize rất hữu ích.
  • Community Edition miễn phí đủ dùng cho learning và bug bounty.

Câu hỏi ôn tập

  1. Tại sao cần cài CA certificate của Burp Suite vào browser? Điều gì xảy ra nếu không cài?
  2. Sự khác nhau giữa Proxy Intercept và HTTP History là gì?
  3. Intruder Attack Type "Sniper" khác "Cluster Bomb" như thế nào? Khi nào dùng loại nào?
  4. Extension "Autorize" trong Burp Suite dùng để test loại lỗ hổng nào?
  5. Làm thế nào để dùng Burp Suite để test API của ứng dụng chạy trong Docker container?