ra1nb0rn/search_vulns

GitHub: ra1nb0rn/search_vulns

一个模块化的多源漏洞与利用检索工具,支持自然语言查询、补丁状态分析及丰富的漏洞情报聚合。

Stars: 78 | Forks: 13

search_vulns logo

一个模块化工具,用于在各种数据源中搜索已知漏洞、exploit 及更多信息。

search_vulns release License PyPI downloads search-vulns.com up search_vulns contributors Python version

关于 · 快速链接 · 模块 · 安装 · 用法 · Wiki · 许可证


## 关于 *search_vulns* 可用于搜索软件中的已知漏洞。为此,它利用本地构建的数据库,该数据库包含关于产品、漏洞、exploit、软件新旧程度等多种数据源。由于 search_vulns 采用模块化设计,因此可以轻松集成新的数据源和扩展。[*模块*](#modules)部分提供了所有当前模块和包含数据源的完整列表。 您可以提供像 *Apache 2.4.39* 这样的产品标题,或者像 ``cpe:2.3:a:sudo_project:sudo:1.8.2:*:*:*:*:*:*:*`` 这样的 CPE 2.3 字符串作为输入。此外,您还可以通过使用逗号分隔的 ID 列表直接搜索像 ``CVE-2023-1234`` 或 ``GHSA-xx68-jfcg-xmmf`` 这样的漏洞。 *search_vulns* 既可以用作 CLI 工具,也可以通过 Web 服务器使用。建议在可能资源受限的自动化工作流中使用 CLI 工具。否则,建议使用 Web 服务器,因为它提供了更多的功能和灵活性。Web 服务器的公共实例可在此处访问:[https://search-vulns.com](https://search-vulns.com)。 ## 快速链接 * Web 服务器的公共实例:[https://search-vulns.com](https://search-vulns.com) * [Black Hat Arsenal 2025 录制演示](https://search-vulns.com/static/video/SearchVulnsBlackHatDemo.mp4) * [我们在 2025 年德国 OWASP Day 上的演讲](https://media.ccc.de/v/god2025-56473-the-surprising-complexity) * [查找已知漏洞的惊人复杂性](https://search-vulns.com/blog-post/1) - 一篇详述 search_vulns 背后挑战和动机的博客文章。 * [search_vulns:简化查找已知漏洞的惊人复杂性](https://search-vulns.com/blog-post/2) - 一篇介绍 search_vulns 并描述其功能的博客文章。 * [search_vulns:深入剖析其技术与方法](https://search-vulns.com/blog-post/3) - 一篇详述 search_vulns 技术层面工作原理(包括其新颖方法)的博客文章。 ## 模块 search_vulns 的搜索引擎采用模块化设计。因此,可以轻松集成新的数据源。当前可用的模块和数据源如下: | 模块 ID | 描述 | |----------|-------------| | [nvd.search_vulns_nvd](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/nvd/search_vulns_nvd.py) | 集成来自 [国家漏洞 (NVD) 数据库](https://nvd.nist.gov/) 的 CVE 信息和 exploit | | [vulncheck.search_vulns_nvdpp](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/vulncheck/search_vulns_nvdpp.py) | 通过 [VulnCheck 的 NVD++](https://www.vulncheck.com/nvd2) 集成对 CVE/NVD 数据的额外丰富信息 | | [ghsa.search_vulns_ghsa](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/ghsa/search_vulns_ghsa.py) | 集成来自 [GitHub 安全咨询 (GHSA) 数据库](https://github.com/github/advisory-database) 的 CVE 和非 CVE 漏洞 | | [exploit_db.search_vulns_edb](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/exploit_db/search_vulns_edb.py) | 集成来自 [Exploit-DB](https://www.exploit-db.com/) 的公开可用 exploit | | [poc_in_github.search_vulns_poc_in_github](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/poc_in_github/search_vulns_poc_in_github.py) | 集成来自 [PoC-in-GitHub](https://github.com/nomi-sec/PoC-in-GitHub) 的 exploit 信息 | | [msf_exploits.search_vulns_msf_exploits](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/msf_exploits/search_vulns_msf_exploits.py) | 集成关于 [Metasploit Framework](https://github.com/rapid7/metasploit-framework/) 中 exploit 的信息 | | [end_of_life_date.search_vulns_eold](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/end_of_life_date/search_vulns_eold.py) | 集成来自 [endoflife.date](https://endoflife.date/) 的软件生命周期信息 | | [epss.search_vulns_epss](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/epss/search_vulns_epss.py) | 集成 CVE 的 [FIRST EPSS 评分](https://www.first.org/epss/) | | [cpe_search.search_vulns_cpe_search](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/cpe_search/search_vulns_cpe_search.py) | 通过 [cpe_search](https://github.com/ra1nb0rn/cpe_search) 和 [NVD 官方词典](https://nvd.nist.gov/products/cpe),将用户的自然语言查询匹配到 CPE 字符串 | | [linux_distro_backpatches.debian.search_vulns_debian](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/linux_distro_backpatches/debian/search_vulns_debian.py) | 集成来自 [Debian 安全 Bug 跟踪器](https://security-tracker.debian.org/tracker/) 的反向移植 (backpatch) 信息 | | [linux_distro_backpatches.ubuntu.search_vulns_ubuntu](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/linux_distro_backpatches/ubuntu/search_vulns_ubuntu.py) | 通过 [*aquasecurity* 的仓库](https://github.com/aquasecurity/vuln-list) 集成来自 Ubuntu 安全 API 的反向移植信息 | | [linux_distro_backpatches.redhat.
search_vulns_redhat](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/linux_distro_backpatches/redhat/search_vulns_redhat.py) | 通过 [*aquasecurity* 的仓库](https://github.com/aquasecurity/vuln-list-redhat) 集成来自 Red Hat 安全数据 API 的反向移植信息 | | [product_specific.search_vulns_nginx](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/product_specific/search_vulns_nginx.py) | 集成产品/供应商特定的 [nginx 安全建议](https://nginx.org/en/security_advisories.html) | | [product_specific.search_vulns_mssql](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/product_specific/search_vulns_mssql.py) | 集成产品/供应商特定的 [Microsoft SQL Server 数据](https://sqlserverbuilds.blogspot.com/) | 正如本概览所示,模块可以帮助查找产品 ID、漏洞、关于漏洞的额外信息以及关于查询产品的额外信息。后两者的例子包括 exploit、CVSS 或 EPSS 评分,或软件生命周期信息。此外,如果模块存储并利用与查询相关的特殊信息,例如可以将识别出的漏洞分类为已修补。 请查看模板模块以开始编写您自己的模块:[``src/search_vulns/modules/template/search_vulns_template.py``](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/modules/template/search_vulns_template.py)。 ## 安装 *search_vulns* 的核心可以作为一个轻量级 Python 包安装,可选包含 Web 服务器组件。也可以执行扩展安装,使您能够自己构建本地数据库,而不是从 [GitHub 上的最新版本](https://github.com/ra1nb0rn/search_vulns/releases/latest) 拉取,并使用 MariaDB 作为数据库后端。目前,没有其他功能差异。 ### 轻量级 Python 包安装 要安装 search_vulns,您必须先安装 Python 和 pip。然后您可以像这样从 PyPI 安装 *search_vulns* Python 包: ``` pip install search_vulns ``` 请注意,您可能需要包含 ``--break-system-packages``,或者使用 virtualenv 或 [*pipx*](https://github.com/pypa/pipx)。 要安装可选 Web 服务器组件所需的包,您可以运行: ``` pip install search_vulns[web] ``` 您也可以克隆此仓库,自己构建 Python 包,并保持所有数据在克隆的仓库中可编辑(有利于开发目的): ``` git clone https://github.com/ra1nb0rn/search_vulns pip install -e . ``` 安装 *search_vulns* 后,您需要像这样从 GitHub 拉取预构建的数据库文件: ``` search_vulns -u ``` 最后,如果安装了 Web 依赖项,您可以运行 *search_vulns* 或启动 *search_vulns* Web 服务器: ``` $ search_vulns -q 'jquery 2.1.3' $ python3 -m search_vulns.web_server ``` ### search_vulns 的完整/完全安装 您可以像这样执行完整安装(有关 `pip` 安装的说明,请参见上文): ``` pip install search_vulns search_vulns --full-install ``` 请注意,这会安装一些必需的系统包,如代码中的 ``install.sh`` 文件所指定。 此后,您可以如上所示从 GitHub 下载数据库文件,或者自己构建数据库: ``` search_vulns --full-update ``` 但是请注意,您应该通过配置文件(例如 [`src/search_vulns/config.json`](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/config.json))或作为环境变量提供 API 密钥。所有当前使用的 API 密钥都是免费的,您只需要在 [NVD](https://nvd.nist.gov/developers/request-an-api-key) 或 [VulnCheck](https://www.vulncheck.com/) 注册即可。 ### Dockerfile 还有一个您可以使用的 ``Dockerfile``: ``` docker build -t search_vulns . docker run -p 127.0.0.1:5000:5000 -it search_vulns bash ``` 如果您不打算使用 Web 服务器组件,端口转发是可选的。如果使用,请确保相应地调整 [``src/search_vulns/web_server.py``](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/web_server.py) 末尾的监听套接字。 ## 用法 *search_vulns* 的用法信息如下所示: ``` usage: search_vulns [-h] [-u] [--full-update] [--full-update-module MODULE_ID [MODULE_ID ...]] [--full-install] [-a] [-f {json,txt}] [-o OUTPUT] [-q QUERY] [-c CONFIG] [-V] [--list-modules] [--cpe-search-threshold CPE_SEARCH_THRESHOLD] [--ignore-general-product-vulns] [--include-single-version-vulns] [--use-created-product-ids] [--include-patched] Search for known vulnerabilities in software -- Created by Dustin Born (ra1nb0rn) options: -h, --help show this help message and exit -u, --update Download the latest version of the the local vulnerability and software database from GitHub repo --full-update Fully (re)build the local vulnerability and software database --full-update-module MODULE_ID [MODULE_ID ...] Fully (re)build the local database for the given module(s) in-place --full-install Fully install search_vulns, including all dependencies (python packages, system packages etc.) -a, --artifacts Print JSON list of artifacts created during full update -f {json,txt}, --format {json,txt} Output format, either 'txt' or 'json' (default: 'txt') -o OUTPUT, --output OUTPUT File to write found vulnerabilities to -q QUERY, --query QUERY A query, either a software title like 'Apache 2.4.39', a product ID string (e.g. CPE 2.3) or a list of vuln IDs -c CONFIG, --config CONFIG A config file to use (default: config.json) -V, --version Print the version of search_vulns --list-modules Print all available modules --cpe-search-threshold CPE_SEARCH_THRESHOLD Similarity threshold used for retrieving a CPE via the cpe_search tool --ignore-general-product-vulns Ignore vulnerabilities that only affect a general product (i.e. without version) --include-single-version-vulns Include vulnerabilities that only affect one specific version of a product when querying a lower version --use-created-product-ids If no matching product ID exists in the software database, automatically use matching ones created by search_vulns --include-patched Include vulnerabilities reported as (back)patched, e.g. by Debian Security Tracker, in results ``` 请注意,当使用 ``-q`` 查询软件时,如果软件信息包含空格,则必须将其用引号括起来。此外,您可以多次使用 ``-q`` 一次进行多个查询。首先,查询可以是软件名称/标题,如 'Apache 2.4.39' 或 'Wordpress 5.7.2'。此外,查询也可以是 [CPE 2.3](https://csrc.nist.gov/projects/security-content-automation-protocol/specifications/cpe) 字符串。 以下是一些示例: * 查询 *Sudo 1.8.2* 的已知漏洞: $ search_vulns -q 'Sudo 1.8.2' [+] Sudo 1.8.2 (cpe:2.3:a:sudo_project:sudo:1.8.2:*:*:*:*:*:*:*/cpe:2.3:a:todd_miller:sudo:1.8.2:*:*:*:*:*:*:*) CVE-2019-14287 (CVSSv3.1/8.8): In Sudo before 1.8.28, an attacker with access to a Runas ALL sudoer account can bypass certain policy blacklists and session PAM modules, and can cause incorrect logging, by invoking sudo with a crafted user ID. For example, this allows bypass of !root configuration, and USER= logging, for a "sudo -u \#$((0xffffffff))" command. Exploits: https://www.exploit-db.com/exploits/47502 [...] Reference: https://nvd.nist.gov/vuln/detail/CVE-2019-14287, 2019-10-17 CVE-2017-1000368 (CVSSv3.0/8.2): Todd Miller's sudo version 1.8.20p1 and earlier is vulnerable to an input validation (embedded newlines) in the get_process_ttyname() function resulting in information disclosure and command execution. Reference: https://nvd.nist.gov/vuln/detail/CVE-2017-1000368, 2017-06-05 [...] * 查询 *Moodle 3.4.0* 的已知漏洞: $ search_vulns -q 'Moodle 3.4.0' [+] Moodle 3.4.0 (cpe:2.3:a:moodle:moodle:3.4.0:*:*:*:*:*:*:*) CVE-2018-14630 (CVSSv3.0/8.8): moodle before versions 3.5.2, 3.4.5, 3.3.8, 3.1.14 is vulnerable to an XML import of ddwtos could lead to intentional remote code execution. When importing legacy 'drag and drop into text' (ddwtos) type quiz questions, it was possible to inject and execute PHP code from within the imported questions, either intentionally or by importing questions from an untrusted source. Reference: https://nvd.nist.gov/vuln/detail/CVE-2018-14630, 2018-09-17 CVE-2018-1133 (CVSSv3.0/8.8): An issue was discovered in Moodle 3.x. A Teacher creating a Calculated question can intentionally cause remote code execution on the server, aka eval injection. Exploits: https://www.exploit-db.com/exploits/46551 Reference: https://nvd.nist.gov/vuln/detail/CVE-2018-1133, 2018-05-25 [...] * 显式检索关于 `CVE-2024-24824` 和 `GHSA-q9q2-3ppx-mwqf` 的信息: $ search_vulns -q 'CVE-2024-24824 GHSA-q9q2-3ppx-mwqf' [+] CVE-2024-24824 GHSA-q9q2-3ppx-mwqf () CVE-2024-24824 (CVSSv3.1/8.8): Graylog is a free and open log management platform. Starting in version 2.0.0 and prior to versions 5.1.11 and 5.2.4, arbitrary classes can be loaded and instantiated using a HTTP PUT request to the `/api/system/cluster_config/` endpoint. Graylog's cluster config system uses fully qualified names as config keys. To validate the existence of the requested class before using them, Graylog loads the class using the class loader. [...] Exploits: https://github.com/Graylog2/graylog2-server/security/advisories/GHSA-p6gg-5hf4-4rgj Reference: https://nvd.nist.gov/vuln/detail/CVE-2024-24824, 2024-02-07 GHSA-q9q2-3ppx-mwqf (CVSSv3.1/7.3): Graylog Allows Stored Cross-Site Scripting via Files Plugin and API Browser Reference: https://github.com/advisories/GHSA-q9q2-3ppx-mwqf, 2025-05-07 * 检索 `Debian 12` 上 `Squid 5.7-2` 的未修补漏洞: $ search_vulns -q 'Squid 5.7-2 Debian 12' [...] * 检索 `Ubuntu Plucky` 上 `Apache Tomcat 9.0.70-2` 的未修补漏洞 $ search_vulns -q 'Apache Tomcat 9.0.70-2 Ubuntu Plucky' [...] * 以 JSON 格式检索 `RHEL 9.2` 上 `Nginx 1.20.1-22` 的漏洞,包括已反向移植修补的: $ search_vulns -q 'Nginx 1.20.1-22 RHEL 9.2' -f json --include-patched [...] ## 运行 Web 服务器 也可以运行一个 Web 服务器,通过网络向客户端提供此工具的功能。[``src/search_vulns/web_server.py``](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/web_server.py) 包含一个使用 Flask 的工作示例。根据您的环境,您可能需要修改此文件末尾的服务器 IP 和端口。要运行一个简单的 Flask Web 服务器,只需运行: ``` python3 -m search_vulns.web_server ``` 此外,您可以使用 ``gunicorn`` 使 Web 服务器更具可扩展性;例如通过运行: ``` gunicorn --worker-class=gevent --worker-connections=50 --workers=3 --bind '0.0.0.0:8000' search_vulns.wsgi:app ``` 您可以在[这里](https://medium.com/building-the-system/gunicorn-3-means-of-concurrency-efbb547674b7)阅读更多关于为您的系统选择合适的 ``gunicorn`` 设置的信息。但是请注意,此工具非常占用 CPU,这意味着可扩展性在一定程度上受到限制。 最后,您也可以使用 Nginx 作为反向代理。[``web_server_files/nginx.conf.sample``](https://github.com/ra1nb0rn/search_vulns/blob/master/web_server_files/nginx.conf.sample) 中提供了一个示例配置文件。同样,您可能需要根据需要进行调整。使用 Nginx 时,请确保您的应用程序在配置的端点运行。例如,对于示例配置文件,您必须运行类似于以下的内容: ``` gunicorn --worker-class=gevent --worker-connections=50 --workers=3 --bind 'unix:/tmp/gunicorn.sock' search_vulns.wsgi:app ``` ## MariaDB 作为替代数据库选项 search_vulns 可以配置为使用 *MariaDB* 作为预配置 *SQLite* 机制的替代方案。[``src/search_vulns/config_mariadb.json``](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/config_mariadb.json) 中提供了 MariaDB 的示例配置文件。 请确保在配置文件中根据您的 MariaDB 部署调整 MariaDB 的值(*user*、*password*、*host* 和 *port*)。 要为 Web 服务器使用 MariaDB 而不是 *SQLite*,只需将 ``web_server.py`` 中的 ``CONFIG_FILE`` 变量更改为您的配置文件(例如 ``src/search_vulns/config_mariadb.json``)。 为了提高 search_vulns 在 MariaDB 下的性能,建议将以下设置添加到您的 MariaDB 配置文件(例如 ``/etc/mysql/my.cnf``): ``` [mariadb] query_cache_type = 1 query_cache_size = 192M innodb_buffer_pool_size = 8G thread_handling = pool-of-threads ``` ``innodb_buffer_pool_size`` 应设置为可用内存的大约 80%(参见 [MariaDB 官方文档](https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size))。 ## 许可证 *search_vulns* 根据 MIT 许可证授权,见[此处](https://github.com/ra1nb0rn/search_vulns/blob/master/LICENSE)。 查看包含数据源的许可证[请点击这里](https://github.com/ra1nb0rn/search_vulns/blob/master/src/search_vulns/resources/license_infos.md)。
标签:CVE, CVE搜索, ESC4, Exploit-DB, Kali工具, NVD, OSINT, POC搜索, RedTeam, XSS, 加密文件系统, 威胁情报, 密码管理, 开发者工具, 数字签名, 无线安全, 漏洞情报, 漏洞查询, 结构化查询, 网络安全, 网络安全审计, 自动化安全, 请求拦截, 逆向工具, 隐私保护