簡介
Xray
是長亭科技開發的一款漏掃工具。- 支持多種掃描方式和漏洞類型。
- 可自定義
POC
(Proof of Concept
)概念驗證,即漏洞驗證程序。
俺是在 烏雲安全 看到了這個工具的使用,作為一個
腳本小子初學者,這里做一下筆記。
使用
webscan
參數
參數 | 作用 |
---|---|
--list, -l | list plugins |
--plugins value, --plugin value, --plug value | specify the plugins to run, separated by ',' |
--poc value, -p value | specify the poc to run, separated by ',' |
--listen value | use proxy resource collector, value is proxy addr, (example: 127.0.0.1:1111) |
--basic-crawler value, --basic value | use a basic spider to crawl the target and scan the requests |
--browser-crawler value, --browser value | use a browser spider to crawl the target and scan the requests |
--url-file value, --uf value | read urls from a local file and scan these urls, one url per line |
--burp-file value, --bf value | read requests from burpsuite exported file as targets |
--url value, -u value | scan a single url |
--data value, -d value | data string to be sent through POST (e.g. 'username=admin') |
--raw-request FILE, --rr FILE | load http raw request from a FILE |
--force-ssl, --fs | force usage of SSL/HTTPS for raw-request |
--json-output FILE, --jo FILE | output xray results to FILE in json format |
--html-output FILE, --ho FILE | output xray result to FILE in HTML format |
--webhook-output value, --wo value | post xray result to url in json format |
主動掃描
- 使用
--basic-crawler
模塊實現爬蟲+掃描功能。
$ ./xray webscan --basic-crawler {target_ip} --html-output {target_html}
爬取並掃描
{target_ip}
並將結果輸出到{target_html}
中。
- 目標
html
報告會在當前目錄下生成。
被動代理
- 作為中間人進行處理報文信息。
此時代理能夠拿到完整的請求報文,如果使用
HTTPS
依然可以獲得明文信息。
- 提前安裝插件
switchyomega
並導入Xray
的證書。
./xray genca
上述命令生成證書后,自行導入到對應瀏覽器中。
- 啟動代理。
./xray webscan --listen {listen_socket} --html-output {target_html}
- 得到最后一行即啟動成功。
└─$ ./xray webscan --listen 127.0.0.1:7777 --html-output result.html
____ ___.________. ____. _____.___.
\ \/ /\_ __ \ / _ \ \__ | |
\ / | _ _/ / /_\ \ / | |
/ \ | | \/ | \ \____ |
\___/\ \ |____| /\____|_ / / _____/
\_/ \_/ \_/ \/
Version: 1.7.1/f725e41e/COMMUNITY
[INFO] 2021-04-11 10:42:03 [default:entry.go:198] Loading config file from config.yaml
[WARN] 2021-04-11 10:42:03 [default:webscan.go:222] disable these plugins as that's not an advanced version, [thinkphp struts fastjson shiro]
Enabled plugins: [crlf-injection path-traversal xxe brute-force cmd-injection dirscan ssrf phantasm jsonp redirect sqldet upload baseline xss]
[INFO] 2021-04-11 10:42:04 [phantasm:phantasm.go:170] 252 pocs have been loaded (debug level will show more details)
These plugins will be disabled as reverse server is not configured, check out the reference to fix this error.
Ref: https://docs.xray.cool/#/configration/reverse
Plugins:
poc-yaml-dlink-cve-2019-16920-rce
poc-yaml-jenkins-cve-2018-1000600
poc-yaml-jira-cve-2019-11581
poc-yaml-jira-ssrf-cve-2019-8451
poc-yaml-mongo-express-cve-2019-10758
poc-yaml-pandorafms-cve-2019-20224-rce
poc-yaml-ruijie-eg-rce
poc-yaml-saltstack-cve-2020-16846
poc-yaml-solr-cve-2017-12629-xxe
poc-yaml-supervisord-cve-2017-11610
poc-yaml-weblogic-cve-2017-10271
ssrf/ssrf/default
xxe/xxe/blind
[INFO] 2021-04-11 10:42:06 [collector:mitm.go:214] loading cert from ./ca.crt and ./ca.key
[INFO] 2021-04-11 10:42:06 [collector:mitm.go:269] starting mitm server at 127.0.0.1:7777
- 在
switchyomega
插件中配置好代理。
- 在瀏覽器中打開你想要掃描的網站,代理會自動進行掃描。
配置文件
域限制
- 為了防止對無用的域進行掃描,在
config.yaml
文件中可以配置黑白名單。
restriction: # 代理能夠訪問的資源限制, 以下各項為空表示不限制
hostname_allowed: [] # 允許訪問的 Hostname,支持格式如 t.com、*.t.com、1.1.1.1、1.1.1.1/24、1.1-4.1.1-8
hostname_disallowed: # 不允許訪問的 Hostname,支持格式如 t.com、*.t.com、1.1.1.1、1.1.1.1/24、1.1-4.1.1-8
- '*google*'
- '*github*'
- '*.gov.cn'
- '*.edu.cn'
- '*chaitin*'
- '*.xray.cool'
hostname_allowed
存放允許訪問的域名,hostname_disallowed
存放不允許訪問的域名(支持通配符)。
登錄代理
- 設置用戶登錄。
basic_auth: # 基礎認證的用戶名密碼
username: ""
password: ""
插件選擇
baseline:
enabled: true
detect_cors_header_config: true # 檢查 cors 相關配置
detect_server_error_page: true # 檢查服務器錯誤信息
detect_system_path_leak: false # 檢查響應是否包含系統路徑泄露
detect_outdated_ssl_version: false # 檢查 ssl 版本問題
detect_http_header_config: false # 檢查 http 安全相關 header 是否配置
detect_cookie_httponly: false # 檢查 set-cookie 時是否設置 http only
detect_china_id_card_number: false # 檢查響應是否存在身份證號
detect_china_phone_number: false # 檢查響應是否存在電話號碼
detect_china_bank_card: false # 檢查響應是否存在銀行卡號
detect_private_ip: false # 檢查響應是否包含內網 ip
brute-force:
enabled: true
username_dictionary: "" # 自定義用戶名字典, 為空將使用內置 TOP10, 配置后將與內置字典**合並**
password_dictionary: "" # 自定義密碼字典,為空將使用內置 TOP100, 配置后將與內置字典**合並**
cmd-injection:
enabled: true
crlf-injection:
enabled: true
dirscan:
enabled: true
depth: 1 # 檢測深度,定義 http://t.com/a/ 深度為 1, http://t.com/a 深度為 0
dictionary: "" # 自定義檢測字典, 配置后將與內置字典**合並**
fastjson:
enabled: true
jsonp:
enabled: true
path-traversal:
enabled: true
phantasm: # poc 插件
enabled: true
depth: 1
auto_load_poc: false # 除內置 poc 外,額外自動加載當前目錄以 "poc-" 為文件名前綴的POC文件,等同於在 include_poc 中增加 "./poc-*"
exclude_poc: [] # 排除哪些 poc, 支持 glob 語法, 如: "/home/poc/*thinkphp*" 或 "poc-yaml-weblogic*"
include_poc: [] # 只使用哪些內置 poc 以及 額外加載哪些本地 poc, 支持 glob 語法, 如:"*weblogic*" 或 "/home/poc/*"
# 也可使用 --poc 僅運行 指定的內置或本地 poc,進行測試。
# 例如,可使用如下命令,僅運行當前目錄下的 poc 且 不運行內置 poc 進行測試:
# webscan -poc ./poc-* -url http://example.com
通過
enable
開關,決定功能檢測是否開啟。
- 使用
--plugins
參數限制使用插件。
./xray webscan --listen 127.0.0.1:1111 --plugins xss,xxe,cmd_injection
雙重代理
- 一般可以結合
BurpSuite
使用。
http:
proxy: "http://127.0.0.1:8080"