WPScan 是一款 WordPress 专用的免费安全扫描工具,可用于扫描任何基于 WordPress 的网站,可以检测如下所示的安全项目:
- 检查 WordPress 核心文件、插件和主题的漏洞;
- 检查弱密码、是否启用 HTTPS、Header 项;
- 检查 debug.log 文件、wp-config.php 备份文件、 XML-RPC 文件、代码存储库文件、默认密钥、导出的数据库文件。
但是,如要获得扫描结果,我们需要添加可免费生成的 WPscan API 密钥,每天可提供 25 次扫描。

此外,Wpscan 还可以作为插件直接安装在 WordPress 仪表盘,用户可以通过其图形管理后台进行操作。
在 Ubuntu 20.04/18.04 上安装 WPScan
要在 Ubuntu、Debian、Kali Linux、Linux Mint 或类似的其他操作系统上安装 WPscan ,可以按照下面的步骤进行操作。
第 1 步:运行系统更新
使用 apt
更新软件库索引:
sudo apt update
第 2 步:在 Ubuntu 20.04 上安装 Ruby
Wpscan 可以从 RubyGems 安装,因此我们先在 Ubuntu 上安装 Ruby 和其所需的依赖项:
sudo apt install ruby-full
第 3 步:在 Ubuntu 上安装 WPScan
然后,使用 Ruby 的 gem 命令在 Ubuntu 上下载和安装 WPscan 包。
sudo gem install wpscan
第 4 步:查看版本
安装完成后,我们检查一下 wpscan 的版本:
wpscan --version
第 5 步:WPscan 命令
要了解 Wpscan 的各种命令和参数,可以使用下面的命令查看:
wpscan -h
Usage: wpscan [options]
--url URL The URL of the blog to scan
Allowed Protocols: http, https
Default Protocol if none provided: http
This option is mandatory unless update or help or hh
or version is/are supplied
-h, --help Display the simple help and exit
--hh Display the full help and exit
--version Display the version and exit
-v, --verbose Verbose mode
--[no-]banner Whether or not to display the banner
Default: true
-o, --output FILE Output to FILE
-f, --format FORMAT Output results in the format supplied
Available choices: cli-no-colour, cli-no-color, json, cli
--detection-mode MODE Default: mixed
Available choices: mixed, passive, aggressive
--user-agent, --ua VALUE
--random-user-agent,--rua Use a random user-agent for each scan
--http-auth login:password
-t, --max-threads VALUE The max threads to use
Default: 5
--throttle MilliSeconds Milliseconds to wait before doing another
web request. If used, the max threads will be set to 1.
--request-timeout SECONDS The request timeout in seconds
Default: 60
--connect-timeout SECONDS The connection timeout in seconds
Default: 30
--disable-tls-checks Disables SSL/TLS certificate verification, and downgrade to TLS1.0+ (requires cURL 7.66 for the latter)
--proxy protocol://IP:port Supported protocols depend on the cURL installed
--proxy-auth login:password
--cookie-string COOKIE Cookie string to use in requests,
….more
第 6 步:扫描 WordPress 网站
现在,就可以使用 wpscan 的命令行工具扫描网站,来查找 WordPress 网站潜在的安全问题:
wpscan --url http://your-website.com
第 7 步:获取 WPScan Token API Key
默认情况下,wpscan 不会在结果中提供漏洞信息。如果想要得到详细的安全扫描结果,我们必须生成一个 API 密钥。可前往wpscan官方网站并选择免费计划进行注册。
然后,可以复制 API 密钥,并通过以下命令使用它:
wpscan --url your-website.com --api-token your-api-key
注意:将上述命令中的 your-api-key 替换为自己生成的文本。
第 8 步:检测方式
Wpscan 提供了三种检测模式,分别是被动模式、主动模式和混合模式。
在被动模式下,wpscan 将向服务器发送少量请求,仅扫描网站常见的安全问题。
在主动模式下,WPscan 运行的侵入式扫描功能非常强大,会向服务器发送大量的请求,以找出 WordPress 存在的漏洞。
WPScan 工具默认的是混合模式,是处于主动模式和被动模式中间的一种模式,可以以提供较为平衡的扫描。
示例:
wpscan --url your-website.com --detection-mode Aggressive --api-token your-api-key
第 9 步:列出所有已安装的插件和主题并扫描漏洞
要列出 WordPress 的所有插件和主题,可以使用下面给出的 -e
选项。
vp ----(Vulnerable plugins)
ap ----(All plugins)
p ----(Popular plugins)
vt ----(Vulnerable themes)
at ----(All themes)
t ----(Popular themes)
tt ----(Timthumbs)
cb ----(Config backups)
dbe ----(Db exports)
u ----(User IDs range. e.g: u1-5)
m ----(Media IDs range. e.g m1-15)
例如,要列出所有已知漏洞的插件,我们使用上面列表中给出的 vp 选项以及 -e 参数检测模式。
wpscan --url your-website.com -e vp --detection-mode mixed --api-token your-api-key
第 10 步:运行 WPscan 绕过 WAF
要在隐藏模式下运行扫描,以使防火墙无法检测到 Wpscan,可以尝试 --random-user-agent
和 --stealthy
选项。
作者:牛奇网,本站文章均为辛苦原创,在此严正声明,本站内容严禁采集转载,面斥不雅请好自为之,本文网址:https://www.niuqi360.com/wordpress/wpscan-wordpress-vulnerability-scanner/