php-archive-extract-audit

Trace PHP archive extraction calls to detect Zip Slip path traversal risks.

386|38|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/0xShe/PHP-Code-Audit-Skill --skill php-archive-extract-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-archive-extract-audit
Source: https://github.com/0xShe/PHP-Code-Audit-Skill/tree/main/php-archive-extract-audit
Command: npx skills add https://github.com/0xShe/PHP-Code-Audit-Skill --skill php-archive-extract-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

分析和審計 PHP 專案中解壓/提取歸檔時的路徑穿越風險(Zip Slip),識別 entry name 與 destination 的拼接、基礎目錄約束的落實與否,並輸出可觀測的等級與修復建議。

Core Features & Use Cases

  • 對 ZIP、PHAR、TAR 等歸檔解壓流程進行靜态/動态分析,識別可能的路徑穿越點與未經過濾的 entry name。
  • 跟踪解压调用点(如 extractTo/extract、PharData::extractTo 等),並驗證終點是否真正落在基礎目錄內,輸出證據鏈與修復指引。
  • 典型用例:在有用戶上傳的歸檔或可下載的歸檔中,判定解壓操作是否會寫入未授權目錄,並提供可觀測 PoC 與修復建議。

Quick Start

Run a PHP archive extraction audit to detect Zip Slip risks and produce remediation guidance.

Frequently Asked Questions about php-archive-extract-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit PHP archive extraction for Zip Slip vulnerabilities?

Audit PHP archive extraction by tracing extraction calls and final target paths to identify Zip Slip vulnerabilities. The audit tracks entry name sources, sanitization steps, and extract destinations to verify final target validation against the base directory.

What is a Zip Slip vulnerability in PHP archive unpacking?

A Zip Slip vulnerability occurs during PHP archive unpacking when unchecked entry names with path traversal sequences write files outside the base directory. It affects extraction via ZipArchive, PharData, or Archive_Tar when destination paths lack proper constraints.

How to check if ZipArchive extractTo is vulnerable to path traversal?

Check ZipArchive extractTo path traversal risks by tracing the extraction call site and verifying base directory constraints. The audit identifies entry name sources, sanitization steps, and validates the final target path against the base directory.

Does this PHP security audit support PharData and Archive_Tar extraction?

This PHP security audit supports PharData and Archive_Tar extraction alongside ZipArchive. It analyzes archive unpacking flows across these libraries to identify path traversal points and verify final target validation against the base directory.

Why does archive extraction write files to unauthorized directories in PHP?

Archive extraction writes files to unauthorized directories in PHP when entry names containing path traversal sequences are concatenated with the destination without sanitization. The audit traces these entry name sources and detects missing base directory constraints.

What is the best way to prevent path traversal in PHP archive extraction?

Prevent path traversal in PHP archive extraction by enforcing base directory constraints and sanitizing entry names before extraction. The audit provides evidence chains and remediation guidance to ensure final target paths stay within authorized boundaries.