WPScan WordPress 安全扫描器分析
WPScan WordPress 安全扫描器分析### 概述
WPScan 是一款专门为 WordPress 网站设计的安全扫描工具,用于辨认 WordPress 安装中的漏洞、配置错误和其他安全问题。该工具能够检测逾期的插件、主题和 WordPress 核心版本,同时还能摆列用户并对登录凭证进行暴力破解攻击。
### 系统架构
WPScan 使用 Ruby 编写,采用模块化架构。系统分为以下几个关键组件:
\1. 控制器(Controllers):处置惩罚不同类型扫描的逻辑(如插件摆列、主题检测、暗码攻击等)。
\2. 查找器(Finders):负责检测特定项目,如插件、主题、用户和漏洞。
\3. 模子(Models):表现被扫描的实体,如插件、主题、用户和漏洞。
\4. 数据库(DB):包罗已知漏洞、插件、主题和 WordPress 版本的元数据。
### 核心功能
\1. WordPress 版本检测:
- 检测目标站点上安装的 WordPress 版本。
- 使用多种方法,如 RSS 天生器标签、readme 文件和唯一指纹。
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
module WPScan module Finders module WpVersion class RSSGenerator < CMSScanner::Finders::Finder include Finder::WpVersion::SmartURLChecker def process_urls(urls, _opts = {}) found = Findings.new urls.each do |url| res = Browser.get_and_follow_location(url) res.html.xpath('//comment() | //generator').each do |node| node_text = node.text.to_s.strip next unless node_text =~ %r{\Ahttps?://wordpress\.(?:+)/\?v=(.*)\z}i || node_text =~ %r{\Agenerator="wordpress/([^"]+)"\z}i found << create_version( Regexp.last_match, found_by: found_by, entries: ["#{res.effective_url}, #{node.to_s.strip}"] ) end end found end end end end end
\2. 插件和主题摆列:
- 摆列已安装的插件和主题,包括它们的版本。
- 使用已知漏洞数据库检测易受攻击的插件和主题。
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
module WPScan module Finders module Plugins class KnownLocations < CMSScanner::Finders::Finder include CMSScanner::Finders::Finder::Enumerator def aggressive(opts = {}) found = [] enumerate(target_urls(opts), opts.merge(check_full_response: true)) do |res, slug| finding_opts = opts.merge(found_by: found_by, confidence: 80, interesting_entries: ["#{res.effective_url}, status: #{res.code}"]) found << Model::Plugin.new(slug, target, finding_opts) end found end end end end end
\3. 用户摆列:
- 使用多种技能(如作者 ID 暴力破解和登录错误消息)摆列 WordPress 站点上的用户。
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
module WPScan module Finders module Users class AuthorIdBruteForcing < CMSScanner::Finders::Finder include CMSScanner::Finders::Finder::Enumerator def aggressive(opts = {}) found = [] found_by_msg = 'Author Id Brute Forcing - %s (Aggressive Detection)' enumerate(target_urls(opts), opts.merge(check_full_response: true)) do |res, id| username, found_by, confidence = potential_username(res) next unless username found << Model::User.new( username, id: id, found_by: format(found_by_msg, found_by), confidence: confidence ) end found end end end end end
\4. 暗码攻击:
- 使用 XML-RPC 或 wp-login.php 对 WordPress 登录凭证进行暴力破解攻击。
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
module WPScan module Finders module Passwords class WpLogin < CMSScanner::Finders::Finder include CMSScanner::Finders::Finder::BreadthFirstDictionaryAttack def login_request(username, password) target.login_request(username, password) end def valid_credentials?(response) response.code == 302 && Array(response.headers['Set-Cookie'])&.any? { |cookie| cookie =~ /wordpress_logged_in_/i } end end end end end
\5. 漏洞检测:
- 检查 WordPress 核心、插件和主题中的已知漏洞。
- 联合当地数据库和 WPScan 漏洞数据库 API 进行检测。
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
module WPScan module Model class WpVersion < CMSScanner::Model::Version include Vulnerable def vulnerabilities return @vulnerabilities if @vulnerabilities @vulnerabilities = [] Array(db_data['vulnerabilities']).each do |json_vuln| @vulnerabilities << Vulnerability.load_from_json(json_vuln) end @vulnerabilities end end end end
### 关键技能
- Ruby:WPScan 主要使用 Ruby 编写。
- Typhoeus:一个用于发起 HTTP 请求的 Ruby 库,对于扫描 Web 应用步调至关重要。
- Nokogiri:一个用于解析 HTML 和 XML 的 Ruby gem,对于从网页中提取信息非常关键。
- CMSScanner:一个用于扫描内容管理系统的框架,WPScan 在此基础上扩展以专注于 WordPress。
### 应用场景
\1. 安全审计:安全专业职员可以使用 WPScan 对 WordPress 站点进行漏洞和配置错误的审计。
\2. 渗透测试:道德黑客可以使用 WPScan 辨认 WordPress 安装中的潜在攻击向量。
\3. 自动化监控:WPScan 可以集成到自动化监控系统中,定期检查 WordPress 站点的新漏洞。
\4. 合规性检查:构造可以使用 WPScan 确保其 WordPress 安装符合安全最佳实践和标准。
### 结论
WPScan 是一款强大的工具,用于保护 WordPress 网站的安全。其模块化架构与全面的漏洞数据库相联合,使其成为负责 WordPress 安装安全的任何人的必备工具。通过使用 WPScan,用户可以自动辨认并缓解安全风险,确保其 WordPress 站点免受潜在威胁。
最后
从期间发展的角度看,网络安全的知识是学不完的,而且以后要学的会更多,同砚们要摆正心态,既然选择入门网络安全,就不能仅仅只是入门程度而已,本领越强时机才越多。
由于入门学习阶段知识点比力杂,所以我讲得比力笼统,大家如果有不懂的地方可以找我咨询,我保证知无不言言无不尽,需要相关资料也可以找我要,我的网盘里一大堆资料都在吃灰呢。
干货主要有:
①1000+CTF历届题库(主流和经典的应该都有了)
②CTF技能文档(最全中文版)
③项目源码(四五十个有趣且经典的练手项目及源码)
④ CTF大赛、web安全、渗透测试方面的视频(适合小白学习)
⑤ 网络安全学习路线图(告别不入流的学习)
⑥ CTF/渗透测试工具镜像文件大全
⑦ 2023暗码学/隐身术/PWN技能手册大全
如果你对网络安全入门感爱好,那么你需要的话可以点击这里
页:
[1]