Burp Suite Repeater 手動測試技巧

Burp Suite Repeater Manual Testing Techniques

Repeater 概述

Burp Suite Repeater 是 Burp Suite 中最常用的工具之一,專門用於手動操作和重送 HTTP/HTTPS 請求。透過 Repeater,滲透測試人員可以精確地修改請求的各個部分,並即時觀察伺服器的回應變化,這對於發現和驗證安全漏洞至關重要。

Repeater 的主要功能

  • 手動修改請求:可自由編輯請求的任何部分,包括方法、路徑、標頭和內容
  • 即時發送請求:一鍵發送修改後的請求並查看回應
  • 多標籤管理:同時處理多個不同的請求
  • 請求歷史記錄:追蹤所有發送過的請求版本
  • 回應分析:支援多種檢視格式,方便分析回應內容

基本操作流程

將請求發送到 Repeater

  1. 在 Proxy 的 HTTP history 中找到目標請求
  2. 右鍵點擊該請求,選擇 Send to Repeater(快捷鍵:Ctrl+R)
  3. 切換到 Repeater 標籤頁查看請求

Repeater 介面說明

Repeater 介面主要分為兩個區塊:

區塊說明
左側 Request 區顯示和編輯 HTTP 請求
右側 Response 區顯示伺服器回應結果

發送請求

編輯完請求後,點擊 Send 按鈕(或按 Ctrl+Enter)即可發送請求。回應會顯示在右側面板中。

修改請求參數

修改 URL 參數

1
2
GET /api/user?id=1 HTTP/1.1
Host: example.com

id=1 改為其他值來測試:

  • id=2 - 測試越權存取
  • id=-1 - 測試負數處理
  • id=admin - 測試類型混淆
  • id=1 OR 1=1 - 測試 SQL 注入

修改 POST 請求體

1
2
3
4
5
POST /api/login HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded

username=test&password=123456

可嘗試修改:

  • 添加額外參數:username=test&password=123456&admin=true
  • 修改參數順序
  • 重複參數:username=test&username=admin

修改 JSON 請求體

1
2
3
4
5
6
7
8
POST /api/user HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "username": "test",
  "role": "user"
}

測試時可嘗試將 "role": "user" 改為 "role": "admin"

測試不同 HTTP 方法

方法切換測試

將請求方法從 GET 切換到其他方法,觀察回應差異:

1
2
3
4
5
6
7
8
# 原始請求
GET /api/users/1 HTTP/1.1

# 嘗試其他方法
DELETE /api/users/1 HTTP/1.1
PUT /api/users/1 HTTP/1.1
PATCH /api/users/1 HTTP/1.1
OPTIONS /api/users/1 HTTP/1.1

HTTP 方法覆蓋

某些框架支援透過標頭覆蓋 HTTP 方法:

1
2
POST /api/users/1 HTTP/1.1
X-HTTP-Method-Override: DELETE

或使用其他常見的覆蓋標頭:

  • X-Method-Override
  • X-HTTP-Method
  • _method 參數

Header 操作技巧

常見測試標頭

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 繞過 IP 限制
X-Forwarded-For: 127.0.0.1
X-Real-IP: 127.0.0.1
X-Originating-IP: 127.0.0.1
X-Client-IP: 127.0.0.1

# 修改 Host 標頭
Host: internal-api.example.com

# 修改 User-Agent
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1)

# 修改 Referer
Referer: https://admin.example.com/

自訂標頭測試

添加自訂標頭來測試應用程式行為:

1
2
3
X-Custom-Header: test
X-Debug: true
X-Admin: true

編碼與解碼

Inspector 功能

Repeater 內建的 Inspector 面板可以幫助處理編碼:

  1. 選取要編碼/解碼的文字
  2. 在 Inspector 面板中查看各種編碼形式
  3. 直接編輯編碼後的值

常用編碼類型

編碼類型範例
URL 編碼%3Cscript%3E
Base64PHNjcmlwdD4=
HTML 實體<script>
Unicode\u003cscript\u003e

手動編碼技巧

使用 Decoder 工具進行複雜的編碼轉換:

  1. 選取文字,右鍵選擇 Send to Decoder
  2. 在 Decoder 中選擇編碼方式
  3. 複製結果回 Repeater

比較回應差異

使用 Comparer 工具

  1. 在 Repeater 中發送第一個請求
  2. 右鍵回應,選擇 Send to Comparer
  3. 修改請求並重新發送
  4. 將第二個回應也發送到 Comparer
  5. 在 Comparer 中選擇兩個項目進行比較

快速比較技巧

注意以下回應差異:

  • 狀態碼變化:200 vs 403 vs 500
  • 回應長度變化:可能表示資料洩露
  • 回應時間變化:可能表示時間型盲注入
  • 錯誤訊息差異:可能洩露系統資訊

與其他工具整合

與 Intruder 整合

當需要自動化測試時:

  1. 在 Repeater 中確認請求格式正確
  2. 右鍵選擇 Send to Intruder
  3. 在 Intruder 中設定 payload 位置和字典

與 Scanner 整合

對特定請求進行主動掃描:

  1. 右鍵請求選擇 Do active scan
  2. 或選擇 Do passive scan 進行被動分析

與 Logger 整合

使用 Logger++ 擴充功能記錄所有請求:

  • 方便後續分析和報告撰寫
  • 可匯出請求記錄

常見測試場景

場景一:身份驗證繞過測試

1
2
3
4
5
# 修改 Cookie 中的使用者識別碼
Cookie: session=abc123; user_id=1

# 嘗試修改為其他使用者
Cookie: session=abc123; user_id=2

場景二:越權存取測試

1
2
3
4
5
6
7
# 原始請求存取自己的資源
GET /api/orders/100 HTTP/1.1
Authorization: Bearer user_token

# 嘗試存取其他使用者的資源
GET /api/orders/101 HTTP/1.1
Authorization: Bearer user_token

場景三:SQL 注入測試

1
2
3
4
5
# 測試各種 SQL 注入 payload
GET /api/product?id=1' HTTP/1.1
GET /api/product?id=1 AND 1=1 HTTP/1.1
GET /api/product?id=1 AND 1=2 HTTP/1.1
GET /api/product?id=1 UNION SELECT null-- HTTP/1.1

場景四:XSS 測試

1
2
3
4
5
6
POST /api/comment HTTP/1.1
Content-Type: application/json

{
  "content": "<script>alert('XSS')</script>"
}

場景五:SSRF 測試

1
2
3
4
5
6
POST /api/fetch HTTP/1.1
Content-Type: application/json

{
  "url": "http://169.254.169.254/latest/meta-data/"
}

實用小技巧

  1. 使用標籤重新命名:右鍵標籤可重新命名,方便管理多個請求
  2. 複製請求:使用 Ctrl+D 複製當前請求到新標籤
  3. 快速切換檢視:使用底部按鈕切換 Raw/Pretty/Hex 檢視
  4. 自動更新 Content-Length:Burp 會自動計算並更新 Content-Length 標頭
  5. 跟隨重導向:點擊 Follow redirection 自動追蹤重導向

參考資料

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy