|
审核您的PHP版本以获取已知的CVE和补丁时间:2020-12-19 PHP版本审核是一种便捷的工具,可以轻松地根据定期更新的CVE漏洞利用列表,新版本和寿命终止日期来检查给定的PHP版本。 PHP版本审核不是:漏洞检测/缓解,特定于供应商的版本跟踪,替代品,以随时了解PHP版本和安全漏洞。 特征:
例:docker run --rm -t lightswitch05/php-version-audit:latest --version=7.3.10 { "auditVersion": "7.3.10", "hasVulnerabilities": true, "hasSecuritySupport": true, "hasActiveSupport": true, "isLatestPatchVersion": false, "isLatestMinorVersion": false, "isLatestVersion": false, "latestPatchVersion": "7.3.12", "latestMinorVersion": "7.4.0", "latestVersion": "7.4.0", "activeSupportEndDate": "2020-12-06T00:00:00+0000", "securitySupportEndDate": "2021-12-06T00:00:00+0000", "rulesLastUpdatedDate": "2019-12-10T02:04:16+0000", "vulnerabilities": { "CVE-2019-11043": { "id": "CVE-2019-11043", "baseScore": 9.8, "publishedDate": "2019-10-28T15:15:00+0000", "lastModifiedDate": "2019-10-30T20:15:00+0000", "description": "In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it is possible to cause FPM module to write past allocated buffers into the space reserved for FCGI protocol data, thus opening the possibility of remote code execution." } } } 用法码头工人使用docker运行是使用PHP版本审核的首选和最简单的方法。 使用Docker检查特定版本的PHP: docker run --rm -t lightswitch05/php-version-audit:latest --version=7.3.12 使用Docker检查主机的PHP版本: docker run --rm -t lightswitch05/php-version-audit:latest --version=$(php -r 'echo phpversion();') 在HTTPS代理(在受限网络上使用)后面运行。需要使用受信任的证书(带有.crt扩展名)对目录进行卷挂载-有关更多详细信息,请参见update-ca-certificates。 docker run --rm -t -e https_proxy='https://your.proxy.server:port/' --volume /full/path/to/trusted/certs/directory:/usr/local/share/ca-certificates lightswitch05/php-version-audit:latest --version=7.4.1 命令行界面不使用docker?没问题 这是几个步骤,但直接运行同样容易。 通过composer安装软件包: composer require lightswitch05/php-version-audit:~1.0 执行PHP脚本,检查PHP的运行时版本: ./vendor/bin/php-version-audit 如果找到任何CVE,请生成退出代码: ./vendor/bin/php-version-audit --fail-security 直接调用是否要与PHP版本审核集成?当然有可能。请注意,这是一个非常早期的版本。我没有打破变化的任何计划,但是如果有新功能要实现,我也不会承诺保持界面不变。相对于直接调用,Docker / CLI当然是首选方法。 $phpVersionAudit = new lightswitch05\PhpVersionAudit\Application(phpversion(), false); $phpVersionAudit->hasVulnerabilities(); #=> true $phpVersionAudit->getLatestPatchVersion(); #=> '7.3.12' JSON规则用于驱动PHP版本审核的数据会定期自动更新,并托管在GitHub页面上。这是PHP Version Audit的真正要素,您可以直接使用它以供其他工具使用。如果您选择这样做,请通过提供适当的归属通知来遵守项目许可证。另外,我要求任何实现都阅读 使用curl和jq直接从规则中获取最新的PHP 7.3版本: curl -s https://www.github.developerdan.com/php-version-audit/rules-v1.json | jq '.latestVersions["7.3"]' 选件usage: php-version-audit [--help] [--version=PHP_VERSION] [--fail-security] [--fail-support] [--fail-patch] [--fail-latest] [--no-update] [--silent] [--v] optional arguments: --help show this help message and exit. --version set the PHP Version to run against. Defaults to the runtime version. This is required when running with docker. --fail-security generate a 10 exit code if any CVEs are found, or security support has ended. --fail-support generate a 20 exit code if the version of PHP no longer gets active (bug) support. --fail-patch generate a 30 exit code if there is a newer patch-level release. --fail-latest generate a 40 exit code if there is a newer release. --no-update do not download the latest rules. NOT RECOMMENDED! --silent do not write any error messages to STDERR. --v Set verbosity. v=warnings, vv=info, vvv=debug. Default is error. All logging writes to STDERR. 输出量
项目目标:
致谢和许可
原文链接:https://github.com/lightswitch05/php-version-audit |