exarch
Command-line utility for secure archive extraction and creation. Built on exarch-core, providing memory-safe archive handling with built-in protection against path traversal, zip bombs, and symlink escape attacks.
Features
- Secure by default - All security checks enabled out of the box
- Path traversal protection - Blocks
../escape attempts - Zip bomb detection - Configurable compression ratio limits
- Symlink/hardlink validation - Prevents symlink escape attacks
- Quota enforcement - File count, total size, and per-file limits
- Multiple formats - TAR (gz, bz2, xz, zstd) and ZIP support
- Multiple output modes - Human-readable and JSON output
Installation
From crates.io
From source
[!TIP] Use
cargo binstall exarch-clifor faster installation without compilation.
Download from GitHub Releases:
| Platform | Architecture | Download |
|---|---|---|
| Linux | x86_64 | exarch-x86_64-unknown-linux-gnu.tar.gz |
| Linux | aarch64 | exarch-aarch64-unknown-linux-gnu.tar.gz |
| macOS | x86_64 | exarch-x86_64-apple-darwin.tar.gz |
| macOS | aarch64 | exarch-aarch64-apple-darwin.tar.gz |
| Windows | x86_64 | exarch-x86_64-pc-windows-msvc.zip |
After downloading:
# Linux/macOS
# Windows - extract zip and add to PATH
[!IMPORTANT] Requires Rust 1.89.0 or later for building from source.
Usage
Commands
| Command | Description |
|---|---|
extract |
Extract archive contents |
create |
Create a new archive |
list |
List archive contents |
verify |
Verify archive integrity |
Global Options
| Option | Short | Description |
|---|---|---|
--verbose |
-v |
Enable verbose output |
--quiet |
-q |
Suppress non-error output |
--json |
-j |
Output results in JSON format |
--help |
-h |
Print help |
--version |
-V |
Print version |
Extract Command
Examples
# Extract archive to current directory
# Extract to specific directory
# Extract with JSON output for scripting
|
# Extract with verbose output
# Increase security limits for large archives
# Allow symlinks for trusted archives
Security Options
| Option | Default | Description |
|---|---|---|
--max-files |
10000 | Maximum number of files to extract |
--max-total-size |
- | Maximum total extracted size (supports K/M/G/T suffixes) |
--max-file-size |
- | Maximum single file size |
--max-compression-ratio |
100 | Maximum compression ratio (zip bomb protection) |
--allow-symlinks |
false | Allow symlinks (within extraction directory) |
--allow-hardlinks |
false | Allow hardlinks (within extraction directory) |
--preserve-permissions |
false | Preserve file permissions from archive |
--force |
false | Overwrite existing files |
[!CAUTION] Only use
--allow-symlinksand--allow-hardlinkswith archives from trusted sources. These options can be exploited by malicious archives.
Create Command
Create archives from files and directories:
Examples
# Create tar.gz from directory
# Create from multiple sources
# Create ZIP with maximum compression
# Exclude patterns
# Include hidden files
# Overwrite existing archive
Create Options
| Option | Short | Description |
|---|---|---|
--compression-level |
-l |
Compression level (1-9, default: 6) |
--follow-symlinks |
Follow symbolic links | |
--include-hidden |
Include hidden files | |
--exclude |
-x |
Exclude pattern (repeatable) |
--strip-prefix |
Strip path prefix | |
--force |
-f |
Overwrite existing file |
--quiet |
-q |
Suppress output |
--json |
Output JSON format |
[!TIP] Archive format is detected from the output file extension. Supported formats:
.tar,.tar.gz,.tar.bz2,.tar.xz,.tar.zst,.zip
Output Modes
Human-readable (default)
Extraction complete
Files extracted: 1,523
Directories: 87
Total size: 42.3 MB
JSON output (--json)
[!TIP] Use JSON output with
jqfor scripting:exarch extract --json archive.tar.gz | jq '.data.files_extracted'
Security
exarch is designed with security as a primary concern, protecting against common archive vulnerabilities:
| Vulnerability | Protection |
|---|---|
| Path traversal (CVE-2025-4517) | Blocks ../ and absolute paths by default |
| Symlink escape (CVE-2024-12905) | Validates symlink targets stay within extraction dir |
| Hardlink attacks (CVE-2025-48387) | Validates hardlink targets |
| Zip bombs (42.zip) | Configurable compression ratio limit (default: 100:1) |
| Resource exhaustion | File count and size quotas |
| Permission escalation | Permission sanitization by default |
[!NOTE] All security checks are enabled by default. Use
--allow-*flags only for trusted archives.
Supported Formats
| Format | Extension | Extraction | Creation |
|---|---|---|---|
| TAR | .tar |
Yes | Yes |
| TAR + gzip | .tar.gz, .tgz |
Yes | Yes |
| TAR + bzip2 | .tar.bz2, .tbz2 |
Yes | Yes |
| TAR + xz | .tar.xz, .txz |
Yes | Yes |
| TAR + zstd | .tar.zst, .tzst |
Yes | Yes |
| ZIP | .zip |
Yes | Yes |
Development
# Build
# Run tests
# Run CLI directly
# Check formatting and lints
Roadmap
- Phase 1: Foundation - CLI parsing, error handling, output formatting
- Phase 2: Archive creation functionality
- Phase 3: List and verify commands
- Phase 4: Progress bars, shell completions
- Phase 5: Distribution (Homebrew, apt, releases)
Related Crates
- exarch-core - Core extraction library
- exarch-python - Python bindings
- exarch-node - Node.js bindings
License
Licensed under MIT OR Apache-2.0 - see LICENSE-MIT or LICENSE-APACHE.