การตรวจสอบเวอร์ชัน PHP เป็นเครื่องมือสะดวกซื้อในการตรวจสอบเวอร์ชัน PHP ที่กำหนดกับรายการการหาประโยชน์ CVE ที่ได้รับการปรับปรุงอย่างสม่ำเสมอการเปิดตัวใหม่และวันที่สิ้นสุดของชีวิต
การตรวจสอบเวอร์ชัน PHP ไม่ใช่: การใช้ประโยชน์จากการตรวจจับ/การบรรเทาการติดตามเวอร์ชันเฉพาะของผู้ขายการแทนที่การเข้ามารับข้อมูลเกี่ยวกับการวางจำหน่าย PHP และการหาประโยชน์ด้านความปลอดภัย
- คุณสมบัติ
- ตัวอย่าง
- การใช้งาน
- นักเทียบท่า
- CLI
- การเรียกโดยตรง
- กฎ JSON
- ตัวเลือก
- เอาท์พุท
- เป้าหมายโครงการ
- กิตติกรรมประกาศและใบอนุญาต
--fail-security ในการกำหนดรหัสออกจากความล้มเหลวหาก PHP เวอร์ชันที่กำหนดมี CVE ที่รู้จักหรือไม่ได้รับการอัปเดตความปลอดภัยอีกต่อไป 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
ตรวจสอบ PHP เวอร์ชันเฉพาะโดยใช้ Docker:
docker run --rm -t lightswitch05/php-version-audit:latest --version=8.1.1
ตรวจสอบเวอร์ชัน PHP ของโฮสต์โดยใช้ Docker:
docker run --rm -t lightswitch05/php-version-audit:latest --version=$(php -r 'echo phpversion();')
ทำงานด้านหลังพร็อกซี HTTPS (สำหรับใช้กับเครือข่ายที่ จำกัด ) ต้องใช้การติดตั้งไดเรกทอรีที่มีใบรับรองที่เชื่อถือได้ของคุณ (พร้อมส่วนขยาย
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
ไม่ได้ใช้นักเทียบท่า? ไม่ใช่ปัญหา มันเป็นอีกสองสามขั้นตอน แต่มันก็ง่ายที่จะทำงานโดยตรง
ติดตั้งแพ็คเกจผ่านนักแต่งเพลง:
composer require lightswitch05/php-version-audit:~1.0
ดำเนินการสคริปต์ PHP ตรวจสอบเวอร์ชัน Run-Time ของ 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+ สัปดาห์) สิ่งนี้ไม่ควรเกิดขึ้นเนื่องจากได้รับการปรับปรุงโดยอัตโนมัติ ... แต่เราทุกคนรู้ว่าซอฟต์แวร์ที่เปราะบางเป็นอย่างไร
รับเวอร์ชันรุ่น PHP 8.1 ล่าสุดโดยตรงจากกฎโดยใช้ CURL และ JQ:
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.