[資安工具] 003 SQLmap 介紹

飛飛 | 2023-05-02

SQLmap 是什麼?

SQLmap 是一個開源的滲透測試工具,可自動化檢測和利用 SQL 注入漏洞,並接管資料庫服務器。它具有強大的檢測引擎,許多特色功能,可供最終滲透測試人員使用,以及廣泛的開關範圍,從資料庫指紋識別,到從資料庫獲取資料,再到通過帶外連接存取底層檔案系統和在作業系統上執行命令。

為什麼使用SQLmap

在許多 Web 應用程式中,SQL 注入漏洞是常見的安全問題之一,因為它們使攻擊者可以通過操作資料庫中的資料進行損壞,甚至接管整個資料庫系統。SQLmap的主要目的是自動化檢測和利用這些漏洞,從而減輕滲透測試人員的工作負擔,節省時間和成本,並提高滲透測試的準確性和可靠性。

如何使用SQLmap?

SQLmap 可以在命令行中使用,根據需要添加不同的參數和選項。使用SQLmap的基本步驟如下:

a. 識別目標URL
b. 分析目標網站的漏洞和資料庫結構
c. 使用不同的技術和參數進行注入測試
d. 通過dumping和爆破等方式獲取目標資料庫中的資料
e. 利用out-of-band連接等方式進一步擴大攻擊面
f. 創建報告並整理測試結果。

SQLmap 參數 Usage 說明

英文 中文說明 中文敘述 英文原文敘述 較常使用的參數
Target 目標 至少必須提供其中一個選項來定義目標 At least one of these options has to be provided to define the target(s) -u
Request 請求 該選項可用於指定如何連接到目標URL These options can be used to specify how to connect to the target URL -r, -H, --data, --cookie
Optimization 優化 該選項可用於優化 sqlmap 的性能 These options can be used to optimize the performance of sqlmap -n, --batch, --threads, --eta, --timeout
Injection 注入 該選項可用於指定要測試的參數,提供自定義注入 payload 和可選的篡改腳本 These options can be used to specify which parameters to test for, provide custom injection payloads and optional tampering scripts -p, -D, -T, --level, --risk, --prefix, --suffix, --string, --hex
Detection 檢測 該選項可用於自定義檢測階段 These options can be used to customize the detection phase -f, --technique, --fresh-queries, --parse-errors
Techniques 技巧 該選項可用於微調特定 SQL 注入技巧的測試 These options can be used to tweak testing of specific SQL injection techniques --technique, --time-sec, --union-cols, --union-char, --udf-inject, --os-cmd, --os-shell, --tamper
Fingerprint 指紋 執行廣泛的 DBMS 版本指紋 Perform an extensive DBMS version fingerprint --fingerprint
Enumeration 列舉 該選項可用於列舉後端資料庫管理系統資訊,結構和包含在表中的資料 These options can be used to enumerate the back-end database management system information, structure and data contained in the tables -D, -T, -C, --exclude-sysdbs, --sql-query, --sql-shell, --sql-file
Brute force 暴力破解 該選項可用於運行暴力破解檢查 These options can be used to run brute force checks --common-tables, --common-columns, --common-file-read, --common-hashes, --privileges, --users, --passwords
User-defined function injection 自定義函數注入 該選項可用於創建自定義的用戶定義函數 These options can be used to create custom user-defined functions --udf-inject
File system access 檔案系統存取 該選項可用於存取後端資料庫管理系統底層檔案系統 These options can be used to access the back-end database management system underlying file system --file-read, --file-write, --file-dest, --file-filter, --file-dump
Operating system access 作業系統存取 該選項可用於存取後端資料庫管理系統底層作業系統 These options can be used to access the back-end database management system underlying operating system --os-shell, --os-pwn
Windows registry access Windows 註冊表存取 該選項可用於存取後端資料庫管理系統 Windows 註冊表 These options can be used to access the back-end database management system Windows registry --reg-read, --reg-write, --reg-del, --reg-key, --reg-value
General 一般設置 該選項可用於設置一些常規工作參數 These options can be used to set some general working parameters --batch, --time-sec, --delay, --level, --risk
Miscellaneous 其他 該選項不適用於任何其他類別 These options do not fit into any other category --update, --wizard, --alert, --beep, --tmp-dir

Options

參數 中文說明 英文原文 舉例
-h, --help 顯示基本幫助資訊並退出 Show basic help message and exit sqlmap -h
-hh 顯示進階幫助資訊並退出 Show advanced help message and exit sqlmap -hh
--version 顯示程式版本並退出 Show program's version number and exit sqlmap --version
-v VERBOSE 設定冗長度,0-6 級別 (預設為 1) Verbosity level: 0-6 (default 1) sqlmap -v 3

Target

參數 中文說明 英文原文 舉例
-u URL, --url=URL 指定目標 URL (例如 "https://feifei.tw/vuln.php?id=1") Target URL (e.g. "https://feifei.tw/vuln.php?id=1") sqlmap -u "https://feifei.tw/vuln.php?id=1"
-d DIRECT 指定直接連線至資料庫的連線字串 Connection string for direct database connection sqlmap -d "mysql://root:password@localhost/testdb"
-l LOGFILE 從 Burp 或 WebScarab proxy 的日誌檔解析目標 Parse target(s) from Burp or WebScarab proxy log file sqlmap -l /path/to/proxy.log
-m BULKFILE 從文字檔案中掃描多個目標 Scan multiple targets given in a textual file sqlmap -m /path/to/targets.txt
-r REQUESTFILE 從檔案中載入 HTTP 請求 Load HTTP request from a file sqlmap -r /path/to/request.txt
-g GOOGLEDORK 將 Google Dork 結果作為目標 URL 處理 Process Google dork results as target URLs sqlmap -g "inurl:php?id="
-c CONFIGFILE 從 INI 設定檔載入選項 Load options from a configuration INI file sqlmap -c /path/to/config.ini

Request

參數 中文說明 英文原文 舉例
-A, --user-agent=AGENT 指定 HTTP User-Agent 標頭值 HTTP User-Agent header value --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0"
-H, --header=HEADER 指定額外的標頭 (例如 "X-Forwarded-For: 127.0.0.1") Extra header (e.g. "X-Forwarded-For: 127.0.0.1") --header="X-Forwarded-For: 127.0.0.1"
--method=METHOD 強制使用指定的 HTTP 方法 (例如 PUT) Force usage of given HTTP method (e.g. PUT) --method=PUT
--data=DATA 設定要通過 POST 送出的資料字串 (例如 "id=1") Data string to be sent through POST (e.g. "id=1") --data="id=1 and 1=1"
--param-del=PARAM_DELIM 指定用於分割參數值的字元 (例如 &) Character used for splitting parameter values (e.g. &) --param-del='&'
--cookie=COOKIE 指定 HTTP Cookie 標頭值 (例如 "PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a") HTTP Cookie header value (e.g. "PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a") --cookie="PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a"
--cookie-del=COOKIE_DELIM 指定用於分割 Cookie 值的字元 (例如 ; ) Character used for splitting cookie values (e.g. ; ) --cookie-del=';'
--live-cookies=LIVE_COOKIES 指定用於載入最新 Cookie 值的 Live cookies 檔案 Live cookies file used for loading up-to-date values --live-cookies=/path/to/live_cookies.txt
--load-cookies=LOAD_COOKIES 從 Netscape/wget 格式的檔案載入 Cookie File containing cookies in Netscape/wget format --load-cookies=/path/to/cookies.txt
--drop-set-cookie 忽略回應中的 Set-Cookie 標頭 Ignore Set-Cookie header from response --drop-set-cookie
--mobile 模擬智慧型手機的 HTTP User-Agent 標頭 Imitate smartphone through HTTP User-Agent header --mobile
--random-agent 隨機選擇 HTTP User-Agent 標頭值 Use randomly selected HTTP User-Agent header value --random-agent
--host=HOST 指定 HTTP Host 標頭值 HTTP Host header value --host=www.feifei.tw
--referer=REFERER 指定 HTTP Referer 標頭值 HTTP Referer header value --referer=https://www.google.com/
--headers=HEADERS 指定額外的標頭 (例如 "Accept-Language: fr\nETag: 123") Extra headers (e.g. "Accept-Language: fr\nETag: 123") --headers="Accept-Language: fr\nETag: 123"
--auth-type=AUTH_TYPE 指定 HTTP 驗證類型 (Basic、Digest、NTLM 或 PKI) HTTP authentication type (Basic, Digest, NTLM or PKI) --auth-type=Digest
--auth-cred=AUTH_CRED 指定 HTTP 認證類型 (Basic、Digest、NTLM 或 PKI) HTTP authentication type (Basic, Digest, NTLM or PKI) --auth-cred=Digest
--auth-cred=AUTH_CRED HTTP 認證帳號密碼 (帳號:密碼) HTTP authentication credentials (name:password) --auth-cred=admin:password
--auth-file=AUTH_FILE HTTP 認證 PEM 憑證/私鑰檔案 HTTP authentication PEM cert/private key file --auth-file=/path/to/auth.pem
--ignore-code=IGNORE_CODE 忽略 (有問題的) HTTP 錯誤碼 (例如 401) Ignore (problematic) HTTP error code (e.g. 401) --ignore-code=401
--ignore-proxy 忽略系統預設代理伺服器設定 Ignore system default proxy settings --ignore-proxy
--ignore-redirects 忽略重新導向嘗試 Ignore redirection attempts --ignore-redirects
--ignore-timeouts 忽略連線逾時 Ignore connection timeouts --ignore-timeouts
--proxy=PROXY 使用代理伺服器連線到目標 URL Use a proxy to connect to the target URL --proxy=https://localhost:8080
--proxy-cred=PROXY_CRED 代理伺服器認證帳號密碼 (帳號:密碼) Proxy authentication credentials (name:password) --proxy-cred=username:password
--proxy-file=PROXY_FILE 從檔案載入代理伺服器清單 Load proxy list from a file --proxy-file=proxies.txt
--proxy-freq=PROXY_FREQ 從指定清單中更改代理伺服器的間隔請求次數 Requests between change of proxy from a given list --proxy-freq=10
--tor 使用 Tor 匿名網路 Use Tor anonymity network --tor
--tor-port=TOR_PORT 設定 Tor 代理伺服器連接埠,非預設值 Set Tor proxy port other than default --tor-port=9050
--tor-type=TOR_TYPE 設定 Tor 代理伺服器類型 (HTTP、SOCKS4 或 SOCKS5 (預設值)) Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default)) --tor-type=SOCKS5
--check-tor 檢查是否正確使用 Tor Check to see if Tor is used properly --check-tor
--delay=DELAY 每個 HTTP 請求之間的延遲秒數 Delay in seconds between each HTTP request --delay=5
--timeout=TIMEOUT 等待連接超時的秒數 (預設為 30 秒) Seconds to wait before timeout connection (default 30) --timeout=60
--retries=RETRIES 連線逾時時的重試次數 (預設為 3 次) Retries when the connection timeouts (default 3) --retries=5
--randomize=RPARAM 隨機變更指定參數的值 Randomly change value for given parameter(s) --randomize=param1,param2
--safe-url=SAFEURL 在測試期間經常存取的 URL 地址 URL address to visit frequently during testing --safe-url=https://www.feifei.tw
--safe-post=SAFE_POST_DATA 發送到安全 URL 的 POST 資料 POST data to send to a safe URL --safe-post='username=admin&password=password123'
--safe-req=SAFE_REQUEST_FILE 從檔中加載安全 HTTP 請求 Load safe HTTP request from a file --safe-req=/path/to/safe_request.txt
--safe-freq=SAFE_REQUEST_INTERVAL 存取安全 URL 之間的常規請求 Regular requests between visits to a safe URL --safe-freq=10
--skip-urlencode 跳過有效 payload 資料的 URL 編碼 Skip URL encoding of payload data --skip-urlencode
--csrf-token=CSRFPARAM 用於保存防 CSRF 權杖(token)的參數 Parameter used to hold anti-CSRF token --csrf-token=csrf_token
--csrf-url=CSRFURL 用於提取防 CSRF 權杖(token)的 URL 地址 URL address to visit for extraction of anti-CSRF token --csrf-url=https://www.feifei.tw/csrf
--csrf-method=CSRFPARAM 防 CSRF 權杖(token)頁面存取時使用的 HTTP 方法 HTTP method to use during anti-CSRF token page visit --csrf-method=POST
--csrf-retries=CSRFRETRIES 擷取防 CSRF 權杖(token)時的重試次數 (預設為 0 次) Retries for anti-CSRF token retrieval (default 0) --csrf-retries=3
--force-ssl 強制使用 SSL/HTTPS Force usage of SSL/HTTPS --force-ssl
--chunked 使用 HTTP 分塊傳輸編碼 (POST) 請求 Use HTTP chunked transfer encoded (POST) requests --chunked
--hpp 使用 HTTP 參數污染方法 Use HTTP parameter pollution method --hpp
--eval=EVALCODE 在請求之前評估提供的 Python 程式碼 (例如 "import hashlib;id2=hashlib.md5(id).hexdigest()") Evaluate provided Python code before the request (e.g. "import hashlib;id2=hashlib.md5(id).hexdigest()") --eval="import hashlib;id2=hashlib.md5(id).hexdigest()"

Optimization

參數 中文說明 英文原文 舉例
-o 啟用所有優化開關 Turn on all optimization switches -o
--predict-output 預測常見的查詢輸出 Predict common queries output --predict-output
--keep-alive 使用持久化的 HTTP(s) 連線 Use persistent HTTP(s) connections --keep-alive
--null-connection 不回傳實際 HTTP 回應體的頁面長度 Retrieve page length without actual HTTP response body --null-connection
--threads=THREADS 最大同時執行的 HTTP(s) 請求數 (預設為 1) Max number of concurrent HTTP(s) requests (default 1) --threads=10

Injection

參數 中文說明 英文原文 舉例
-p TESTPARAMETER 指定測試的參數 Testable parameter(s) -p id
--skip=SKIP 跳過指定的參數 Skip testing for given parameter(s) --skip=password
--skip-static 跳過看起來不是動態的參數 Skip testing parameters that not appear to be dynamic --skip-static
--param-exclude=REGEX 排除不測試的參數的正則表達式 Regexp to exclude parameters from testing (e.g. "ses") --param-exclude="(PHPSESSID|JSESSIONID)"
--param-filter=PARAMETER_FILTER 選擇測試的參數類型 (GET, POST, COOKIE 等) Select testable parameter(s) by place (e.g. "POST") --param-filter=GET
--dbms=DBMS 強制指定後端資料庫管理系統 Force back-end DBMS to provided value --dbms=mysql
--dbms-cred=DBMS_CREDENTIALS 資料庫管理系統認證憑證 (使用者:密碼) DBMS authentication credentials (user:password) --dbms-cred=root:toor
--os=OS 強制指定後端資料庫管理系統的作業系統 Force back-end DBMS operating system to provided value --os=Linux
--invalid-bignum 使用大數字來無效化值 Use big numbers for invalidating values --invalid-bignum
--invalid-logical 使用邏輯運算來無效化值 Use logical operations for invalidating values --invalid-logical
--invalid-string 使用隨機字串來無效化值 Use random strings for invalidating values --invalid-string
--no-cast 關閉有效 payload 資料轉換機制 Turn off payload casting mechanism --no-cast
--no-escape 關閉字串轉義機制 Turn off string escaping mechanism --no-escape
--prefix=PREFIX 注入有效 payload 的前綴字串 Injection payload prefix string --prefix="'
--suffix=SUFFIX 注入有效 payload 的後綴字串 Injection payload suffix string --suffix=#
--tamper=TAMPER 在注入資料前使用指定的 Python 程式碼 Use given script(s) for tampering injection data --tamper=apostrophemask.py
--technique=TECHNIQUES 要使用的 SQL 注入技術 (預設為 "BEUSTQ") SQL injection techniques to use (default "BEUSTQ") --technique=BEUST
--time-sec=TIMESEC 延遲 DBMS 回應的秒數 (預設為 5 秒) Seconds to delay the DBMS response (default 5) --time-sec=10
--union-cols=UCOLS 要測試 UNION 查詢 SQL 注入的欄位範圍 Range of columns to test for UNION query SQL injection --union-cols=1-5
--union-char=UCHAR 用於猜解欄位元數的字元 Character to use for bruteforcing number of columns `--

Detection

參數 中文說明 英文原文 舉例
--level=LEVEL 指定測試級別 (1-5, 預設為 1) Level of tests to perform (1-5, default 1) --level=5
--risk=RISK 指定測試風險等級 (1-3, 預設為 1) Risk of tests to perform (1-3, default 1) --risk=2
--string=STRING 當 SQL 語句執行結果為真時,要匹配的字串 String to match when query is evaluated to True --string="Welcome admin"
--not-string=NOTSTRING 當 SQL 語句執行結果為假時,要匹配的字串 String to match when query is evaluated to False --not-string="Access denied"
--regexp=REGEXP 當 SQL 語句執行結果為真時,要匹配的正則表達式 Regexp to match when query is evaluated to True --regexp="(true|1)"
--code=CODE 當 SQL 語句執行結果為真時,要匹配的 HTTP 狀態碼 HTTP code to match when query is evaluated to True --code=200
--smart 只在存在正向啟發時執行徹底的測試 Perform thorough tests only if positive heuristic(s) --smart
--text-only 僅基於文字內容比較頁面 Compare pages based only on the textual content --text-only
--titles 僅比較頁面標題 Compare pages based only on their titles --titles

Techniques

參數 中文說明 英文原文 舉例
--technique=TECH 指定使用的 SQL 注入技術(預設為 "BEUSTQ") SQL injection techniques to use (default "BEUSTQ") --technique=U
--time-sec=TIMESEC 設定 DBMS 回應延遲的秒數(預設為 5 秒) Seconds to delay the DBMS response (default 5) --time-sec=10
--union-cols=UCOLS 設定在 UNION 查詢中測試的欄位範圍 Range of columns to test for UNION query SQL injection --union-cols=1-5
--union-char=UCHAR 設定用於測試欄位數的字元 Character to use for bruteforcing number of columns --union-char=^
--union-from=UFROM 設定在 UNION 查詢中使用的表格名稱 Table to use in FROM part of UNION query SQL injection --union-from=users
--dns-domain=DNS 設定在 DNS 洩漏攻擊中使用的功能變數名稱 Domain name used for DNS exfiltration attack --dns-domain=attacker.com
--second-url=SECURL 設定在二次注入攻擊中搜索的結果頁面 URL Resulting page URL searched for second-order response --second-url=https://feifei.tw/dashboard.php
--second-req=SECREQ 從檔案載入二次注入攻擊的 HTTP 請求 Load second-order HTTP request from file --second-req=second-order-request.txt

Enumeration

參數 中文說明 英文原文 舉例
-a, --all 擷取所有資料 Retrieve everything -a
-b, --banner 擷取 DBMS 標語 Retrieve DBMS banner -b
--current-user 擷取目前使用者 Retrieve DBMS current user --current-user
--current-db 擷取目前資料庫 Retrieve DBMS current database --current-db
--hostname 擷取 DBMS 主機名稱 Retrieve DBMS server hostname --hostname
--is-dba 檢測目前使用者是否為 DBA Detect if the DBMS current user is DBA --is-dba
--users 列舉 DBMS 使用者 Enumerate DBMS users --users
--passwords 列舉 DBMS 使用者密碼雜湊 Enumerate DBMS users password hashes --passwords
--privileges 列舉 DBMS 使用者權限 Enumerate DBMS users privileges --privileges
--roles 列舉 DBMS 使用者角色 Enumerate DBMS users roles --roles
--dbs 列舉 DBMS 資料庫 Enumerate DBMS databases --dbs
--tables 列舉 DBMS 資料庫表格 Enumerate DBMS database tables --tables
--columns 列舉 DBMS 資料庫表格欄位元 Enumerate DBMS database table columns --columns
--schema 列舉 DBMS schema Enumerate DBMS schema --schema
--count 擷取表格中的資料筆數 Retrieve number of entries for table(s) --count
--dump 列出 DBMS 資料庫表格內容 Dump DBMS database table entries --dump
--dump-all 列出所有 DBMS 資料庫表格內容 Dump all DBMS databases tables entries --dump-all
--search 搜尋欄位元、表格或資料庫名稱 Search column(s), table(s) and/or database name(s) --search
--comments 列舉資料庫註解 Check for DBMS comments during enumeration --comments
--statements 擷取 DBMS 所執行的 SQL 陳述式 Retrieve SQL statements being run on DBMS --statements
-D DB 指定 DBMS 要枚舉的資料庫 DBMS database to enumerate -D database_name
-T TBL 指定要枚舉的資料表 DBMS database table(s) to enumerate -T table_name
-C COL 指定要枚舉的資料表欄位 DBMS database table column(s) to enumerate -C column_name
-X EXCLUDE 指定不要枚舉的資料庫標識符 DBMS database identifier(s) to not enumerate -X database_identifier
-U USER 指定要枚舉的使用者 DBMS user to enumerate -U user_name
--exclude-sysdbs 枚舉資料表時排除 DBMS 系統資料庫 Exclude DBMS system databases when enumerating tables --exclude-sysdbs
--pivot-column=PNAME 指定當進行資料表樞紐分析時要使用的欄位 Pivot column name --pivot-column=column_name
--where=DUMPWHERE 在列出資料表時使用 WHERE 條件式 Use WHERE condition while table dumping --where="column_name='value'"
--start=LIMITSTART 設定要列出的第一個資料表項目 First dump table entry to retrieve --start=10
--stop=LIMITSTOP 設定要列出的最後一個資料表項目 Last dump table entry to retrieve --stop=20
--first=FIRSTCHAR 設定要列出的查詢輸出的第一個單詞的字元 First query output word character to retrieve --first=1
--last=LASTCHAR 設定要列出的查詢輸出的最後一個單詞的字元 Last query output word character to retrieve --last=10
--sql-query=SQLQUERY 指定要執行的 SQL 查詢語句 SQL statement to be executed --sql-query="SELECT * FROM table_name"
--sql-shell 使用互動式 SQL shell Prompt for an interactive SQL shell --sql-shell
--sql-file=SQLFILE 從指定的檔執行 SQL 查詢語句 Execute SQL statements from given file(s) --sql-file=query_file.sql

Brute force

參數 中文說明 英文原文 舉例
--common-tables 檢查常見的資料表是否存在 Check existence of common tables --common-tables
--common-columns 檢查常見的欄位是否存在 Check existence of common columns --common-columns
--common-files 檢查常見的檔案是否存在 Check existence of common files --common-files

User-defined function injection

參數 中文說明 英文原文 舉例
--udf-inject 注入自訂的使用者定義函數 Inject custom user-defined functions --udf-inject=udf_lib.so
--shared-lib=SHLIB 載入共用庫文件 Local path of the shared library --shared-lib=/tmp/udf_lib.so

File system acces

參數 中文說明 英文原文 舉例
--file-read=FILEPATH 從資料庫檔案系統中讀取文件 Read a file from the back-end DBMS file system --file-read=/etc/passwd
--file-write=FILEPATH 將本地檔寫入資料庫檔系統中 Write a local file on the back-end DBMS file system --file-write=local_file.txt
--file-dest=FILEPATH 設定在資料庫檔系統中寫入檔的目標位置 Back-end DBMS absolute filepath to write to --file-dest=/var/www/html/shell.php

Operating system access

參數 中文說明 英文原文 舉例
--os-cmd=COMMAND 在資料庫伺服器上執行系統命令 Execute an operating system command --os-cmd="ls -la"
--os-shell 在資料庫伺服器上啟動一個互動式 shell Prompt for an interactive operating system shell --os-shell
--os-pwn 啟動一個 Out-Of-Band (OOB) shell 或 Meterpreter Prompt for an OOB shell, Meterpreter or VNC --os-pwn
--os-smbrelay 啟動一個 Out-Of-Band (OOB) shell 或 Meterpreter,並透過 SMB Relay One click prompt for an OOB shell, Meterpreter or VNC --os-smbrelay
--os-bof 將資料庫上的 Stored Procedure Buffer Overflow 漏洞利用 Stored procedure buffer overflow exploitation --os-bof
--priv-esc 提升資料庫進程的使用者權限 Database process user privilege escalation --priv-esc
--msf-path=MSFPATH 指定 Metasploit 框架的路徑 Local path where Metasploit Framework is installed --msf-path=/opt/metasploit
--tmp-path=TMPPATH 指定遠端系統的臨時檔目錄 Remote absolute path of temporary files directory --tmp-path=/var/tmp/

Windows registry access

參數 中文說明 英文原文 舉例
--reg-read 讀取 Windows 註冊表鍵值 Read a Windows registry key value --reg-read
--reg-add 寫入 Windows 註冊表鍵值資料 Write a Windows registry key value data --reg-add
--reg-del 刪除 Windows 註冊表鍵值 Delete a Windows registry key value --reg-del
--reg-key=REGKEY Windows 註冊表鍵 Windows registry key --reg-key="HKLM\SOFTWARE\Microsoft"
--reg-value=REGVAL Windows 註冊表鍵值 Windows registry key value --reg-value=Version
--reg-data=REGDATA Windows 註冊表鍵值資料 Windows registry key value data --reg-data=12
--reg-type=REGTYPE Windows 註冊表鍵值類型 Windows registry key value type --reg-type=REG_DWORD

General

參數 中文說明 英文原文 舉例
-s SESSIONFILE 從已存的 (.sqlite) 檔案載入 session Load session from a stored (.sqlite) file -s session.sqlite
-t TRAFFICFILE 將所有 HTTP 流量記錄到文字檔案 Log all HTTP traffic into a textual file -t traffic.txt
--answers=ANSWERS 設定預先定義的回答 (e.g. "quit=N,follow=N") Set predefined answers (e.g. "quit=N,follow=N") --answers=quit=N,follow=Y
--base64=BASE64PARAMETER 包含 Base64 編碼資料的參數 Parameter(s) containing Base64 encoded data --base64=auth=bG9naW46cGFzc3dvcmQ=
--base64-safe 使用 URL 和檔案名稱安全的 Base64 字母表 (RFC 4648) Use URL and filename safe Base64 alphabet (RFC 4648) --base64-safe
--batch 永遠不要詢問使用者輸入,使用預設行為 Never ask for user input, use the default behavior --batch
--binary-fields=BINARYFIELDS 有二進位值的結果欄位 (e.g. "digest") Result fields having binary values (e.g. "digest") --binary-fields=digest,cookie
--check-internet 評估目標之前,檢查網路連線 Check Internet connection before assessing the target --check-internet
--cleanup 從資料庫中刪除 sqlmap 特定的 UDF 和表格 Clean up the DBMS from sqlmap specific UDF and tables --cleanup
--crawl=CRAWLDEPTH 從目標 URL 開始爬網站 Crawl the website starting from the target URL --crawl=3
--crawl-exclude=CRAWLEXCLUDE 排除某些網頁不要爬 Regexp to exclude pages from crawling (e.g. "logout") --crawl-exclude=logout
--csv-del=CSVDEL CSV 輸出時使用的分隔符號號 (預設為 ",") Delimiting character used in CSV output (default ",") --csv-del=";"
--charset=CHARSET Blind SQL injection 字元集 (e.g. "0123456789abcdef") Blind SQL injection charset (e.g. "0123456789abcdef") --charset=utf8
--dump-format=DUMPFORMAT 列出資料的格式 (CSV (預設), HTML 或 SQLITE) Format of dumped data (CSV (default), HTML or SQLITE) --dump-format=HTML
--encoding=ENCODING 取回資料時使用的字元編碼 (e.g. GBK) Character encoding used for data retrieval (e.g. GBK
--eta 每個輸出顯示預計到達時間 Display for each output the estimated time of arrival --eta
--flush-session 刷新當前目標的 session 文件 Flush session files for current target --flush-session
--forms 解析和測試目標 URL 上的表單 Parse and test forms on target URL --forms
--fresh-queries 忽略已儲存在會話文件中的查詢結果 Ignore query results stored in session file --fresh-queries
--gpage=GOOGLEPAGE 從指定頁面使用 Google dork 結果 Use Google dork results from specified page number --gpage=2
--har=HARFILE 將所有 HTTP 流量記錄到 HAR 檔中 Log all HTTP traffic into a HAR file --har=/path/to/file.har
--hex 使用 16 進制轉換來檢索資料 Use hex conversion during data retrieval --hex
--output-dir=OUTPUT_DIR 自定義輸出目錄路徑 Custom output directory path --output-dir=/path/to/directory
--parse-errors 解析並顯示來自回應的 DBMS 錯誤消息 Parse and display DBMS error messages from responses --parse-errors
--preprocess=PREPROCESS 使用給定的腳本進行預處理(請求) Use given script(s) for preprocessing (request) --preprocess=/path/to/script
--postprocess=POSTPROCESS 使用給定的腳本進行後處理(回應) Use given script(s) for postprocessing (response) --postprocess=/path/to/script
--repair 重新 dump 具有未知字元標記(?)的條目 Redump entries having unknown character marker (?) --repair
--save=SAVECONFIG 將選項保存到配置 INI 檔 Save options to a configuration INI file --save=/path/to/file.ini
--scope=SCOPE 正則表達式篩選目標 Regexp for filtering targets --scope=https://feifei.tw
--skip-heuristics 跳過啟發式偵測 SQLi/XSS 漏洞 Skip heuristic detection of SQLi/XSS vulnerabilities --skip-heuristics
--skip-waf 跳過啟發式偵測 WAF/IPS 保護 Skip heuristic detection of WAF/IPS protection --skip-waf
--table-prefix=TABLE_PREFIX 設置暫存表的前綴 Prefix used for temporary tables (default: "sqlmap") --table-prefix=myapp_
--test-filter=TEST_FILTER 通過 payload 和/或標題選擇測試 Select tests by payloads and/or titles (e.g. ROW) --test-filter="AND(SELECT 1 FROM DBMS_RANDOM)='"
--test-skip=TEST_SKIP 通過 payload 和/或標題跳過測試 Skip tests by payloads and/or titles (e.g. BENCHMARK) --test-skip="AND (SELECT * FROM mytable)='"
--web-root=WEB_ROOT 設置網站根目錄 Web server document root directory (e.g. "/var/www") --web-root=/var/www/html/

Miscellaneous

參數 中文說明 英文原文 舉例
-z MNEMONICS 使用短記憶體技巧 (e.g. "flu,bat,ban,tec=EU") Use short mnemonics (e.g. "flu,bat,ban,tec=EU") -z flu,bat,ban,tec=EU
--alert=ALERT 在發現 SQL 注入時執行主機 OS 命令 Run host OS command(s) when SQL injection is found --alert="ls -la"
--beep 當發現 SQLi/XSS/FI 時發出嗶聲 Beep on question and/or when SQLi/XSS/FI is found --beep
--dependencies 檢查是否缺少 (選用的) sqlmap 依賴項 Check for missing (optional) sqlmap dependencies --dependencies
--disable-coloring 禁用控制台輸出顏色 Disable console output coloring --disable-coloring
--list-tampers 顯示可用的篡改腳本列表 Display list of available tamper scripts --list-tampers
--offline 在離線模式下工作 (僅使用會話資料) Work in offline mode (only use session data) --offline
--purge 安全地從 sqlmap 資料目錄中刪除所有內容 Safely remove all content from sqlmap data directory --purge
--results-file=RESULTS_FILE CSV 結果檔在多目標模式下的位置 Location of CSV results file in multiple targets mode --results-file=/path/to/results.csv
--shell 提示進入互動式 sqlmap shell Prompt for an interactive sqlmap shell --shell
--tmp-dir=TMPDIR 儲存臨時檔的本地目錄 Local directory for storing temporary files --tmp-dir=/path/to/tmpdir
--unstable 調整不穩定連接的選項 Adjust options for unstable connections --unstable
--update 更新 sqlmap Update sqlmap --update
--wizard 簡單的向導介面供初學者使用 Simple wizard interface for beginner users --wizard

[資安工具] 002 弱點掃描工具 Nessus

飛飛 | 2023-03-10

如何進行漏洞評估,有什麼工具可以協助我們,在第一篇介紹弱點掃描常用的工具與軟體,透過弱點掃描工具可以協助我們辨識漏洞與進行漏洞評估。

要注意弱點掃瞄工具輸出的結果,不一定正確,因此要透過驗證的方式,驗證漏洞是否存在,以下是我們常用的弱點掃描工具:

類型 名稱 說明
網路 Nessus 商業軟體,Nessus Professional 試用版本 七天
網路 Open VAS 開源
網站 Acunetix Web Vulnerability Scanner(AWVS) 付費軟體試用期14天
網站 OWASP ZAP 開源
  • Tenable Nessus 官方網站
    • Nessus 業界常用的弱點掃描工具
    • 特性
      1. 有許多插件可以使用
      2. 更新速度弱點特徵碼的速度很快
      3. 有自己的弱點資料庫
      4. 可以針對多主機、網段進行掃描
    • 缺點
      • 弱點掃描缺點: 只能測試已知漏洞
      • 會受到掃描環境的網路影響

[資安工具] 001 proxychains4

飛飛 | 2022-04-30

Kali 內建工具 proxychains4 ,可以在連線時,透過 proxy 再連到指定的伺服器。

(閱讀全文...)