PHP 버전 감사는 정기적으로 업데이트 된 CVE 익스플로잇 목록, 새로운 릴리스 및 수명 종료 날짜에 대해 주어진 PHP 버전을 쉽게 확인하는 편의 도구입니다.
PHP 버전 감사는 다음과 같습니다. 탐지/완화, 공급 업체 별 버전 추적, PHP 릴리스 및 보안 악용에 대한 정보를 유지하기위한 교체품.
- 특징
- 예
- 용법
- 도커
- 클리
- 직접 호출
- JSON 규칙
- 옵션
- 산출
- 프로젝트 목표
- 승인 및 라이센스
--fail-security 와 같은 CLI 플래그를 사용하여 실패 종료 코드를 설정하십시오. docker run --rm -t lightswitch05/php-version-audit:latest --version=8.0.12
{
"auditVersion": "8.0.12",
"hasVulnerabilities": true,
"hasSecuritySupport": true,
"hasActiveSupport": true,
"isLatestPatchVersion": false,
"isLatestMinorVersion": false,
"isLatestVersion": false,
"latestPatchVersion": "8.0.14",
"latestMinorVersion": "8.1.1",
"latestVersion": "8.1.1",
"activeSupportEndDate": "2022-11-26T00:00:00+0000",
"securitySupportEndDate": "2023-11-26T00:00:00+0000",
"rulesLastUpdatedDate": "2022-01-18T02:13:52+0000",
"vulnerabilities": {
"CVE-2021-21707": {
"id": "CVE-2021-21707",
"baseScore": 5.3,
"publishedDate": "2021-11-29T07:15:00+0000",
"lastModifiedDate": "2022-01-04T16:12:00+0000",
"description": "In PHP versions 7.3.x below 7.3.33, 7.4.x below 7.4.26 and 8.0.x below 8.0.13, certain XML parsing functions, like simplexml_load_file(), URL-decode the filename passed to them. If that filename contains URL-encoded NUL character, this may cause the function to interpret this as the end of the filename, thus interpreting the filename differently from what the user intended, which may lead it to reading a different file than intended."
}
}
}
Docker와 함께 실행하는 것은 PHP 버전 감사를 사용하는 가장 선호하고 가장 쉬운 방법입니다.
Docker를 사용하여 특정 버전의 PHP를 확인하십시오.
docker run --rm -t lightswitch05/php-version-audit:latest --version=8.1.1
Docker를 사용하여 호스트의 PHP 버전을 확인하십시오.
docker run --rm -t lightswitch05/php-version-audit:latest --version=$(php -r 'echo phpversion();')
HTTPS 프록시 뒤에 실행됩니다 (제한된 네트워크에서 사용). 신뢰할 수있는 인증서 (.CRT 확장)가있는 디렉토리의 볼륨 마운트가 필요합니다. 자세한 내용은 업데이트 CA 인증서를 참조하십시오.
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=8.1.1
Docker를 사용하지 않습니까? 문제가 아닙니다. 몇 단계가 더 있지만 직접 실행하기가 쉽습니다.
작곡가를 통해 패키지 설치 :
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 lightswitch05PhpVersionAuditApplication(phpversion(), false);
$phpVersionAudit->hasVulnerabilities(); #=> true
$phpVersionAudit->getLatestPatchVersion(); #=> '8.1.1'
PHP 버전 감사를 구동하는 데 사용되는 데이터는 정기적으로 자동으로 업데이트되며 GitHub 페이지에서 호스팅됩니다. 이것은 PHP 버전 감사의 실제 육류 및 포타토이며 다른 도구에 사용하기 위해 직접 소비 할 수 있습니다. 이를 선택한 경우 적절한 속성 통지를 제공하여 프로젝트 라이센스를 존중하십시오. 또한, 나는 구현에 lastUpdatedDate 읽고 (2 개 이상) 오래되지 않은 경우 실패하도록 요청합니다. 자동으로 업데이트되기 때문에 발생해서는 안됩니다. 그러나 우리는 모두 연약한 소프트웨어가 얼마나인지 알고 있습니다.
Curl 및 JQ를 사용하여 규칙에서 직접 최신 PHP 8.1 릴리스 버전을 얻으십시오.
curl -s https://www.github.developerdan.com/php-version-audit/rules-v1.json | jq '.latestVersions["8.1"]'
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.