GitHunt
KA

kalashnikxvxiii/StegVault

Secure password manager using steganography to embed encrypted credentials within images

StegVault

Secure password manager using steganography to embed encrypted credentials within images

Python
Version
License
Tests
Coverage

StegVault combines modern cryptography with steganography to create portable, zero-knowledge password backups. Store a single password or entire vault of credentials, all encrypted with XChaCha20-Poly1305 + Argon2id and hidden within ordinary PNG or JPEG images.

Latest Release (v0.7.11): Operative security: secure memory wiping for decrypted data (T6 mitigation), clearer error messages, CI fixes (Black 24.8.0, pytest 9, updater test mocks).


image

Features

Core Features

  • ๐Ÿ” Strong Encryption: XChaCha20-Poly1305 AEAD with Argon2id KDF
  • ๐Ÿ–ผ๏ธ Dual Steganography: PNG LSB + JPEG DCT coefficient modification
  • ๐ŸŽฏ Auto-Detection: Automatically detects image format (PNG/JPEG)
  • ๐Ÿ”’ Zero-Knowledge: All operations performed locally, no cloud dependencies
  • โœ… Authenticated: AEAD tag ensures data integrity
  • ๐Ÿงช Well-Tested: 1078 unit tests with 81% coverage (all passing)

Vault Mode

  • ๐Ÿ—„๏ธ Multiple Passwords: Store entire password vault in one image
  • ๐ŸŽฏ Key-Based Access: Retrieve specific passwords by key (e.g., "gmail", "github")
  • ๐Ÿ”‘ Password Generator: Cryptographically secure password generation
  • ๐Ÿ“‹ Rich Metadata: Username, URL, notes, tags, timestamps for each entry
  • ๐Ÿ• Password History: Track password changes with timestamps and reasons (v0.7.1)
  • ๐Ÿ” TOTP/2FA: Built-in authenticator with QR code support
  • ๐Ÿ” Search & Filter: Find entries by query or filter by tags/URL
  • ๐Ÿ–ผ๏ธ Multi-Vault Management: Organize multiple vault images
  • ๐Ÿ” Cross-Vault Search: Search across all vaults simultaneously
  • ๐Ÿท๏ธ Tagging System: Organize vaults with custom tags

Interfaces

  • ๐Ÿ–ฅ๏ธ Terminal UI (TUI): Full-featured visual interface with keyboard shortcuts (v0.7.0)
  • ๐Ÿค– Command Line (CLI): Scriptable commands for automation
  • ๐Ÿ“Š Headless Mode: JSON output for CI/CD pipelines (v0.6.0)

Auto-Update System (v0.7.6+)

  • ๐Ÿ”„ Update Checking: Check for new versions from PyPI
  • โšก Auto-Upgrade: Optionally install updates automatically (fixed WinError 32)
  • ๐Ÿ”ง Detached Update: Updates run after app closure to prevent file conflicts
  • ๐ŸŽฏ Dynamic UI: "Update Now" button appears when updates are available
  • โš™๏ธ Settings Screen: Configure auto-check and auto-upgrade toggles
  • ๐Ÿ“ Changelog Preview: View changes before upgrading
  • ๐Ÿ” Cache Sync: Automatic version cache synchronization

Advanced Settings (v0.7.9)

  • โš™๏ธ Argon2id Tuning: Configure cryptographic parameters (time cost, memory cost, parallelism)
  • โœ… Real-Time Validation: Instant feedback with security and performance warnings
  • ๐ŸŽฏ Smart Warnings: Color-coded alerts (red=critical, pink=security risk, yellow=compatibility)
  • ๐Ÿ”„ Reset to Defaults: One-click restoration of recommended secure values
  • ๐Ÿ›ก๏ธ Safety Features: Invalid configurations blocked, settings screen stays open for corrections
  • ๐Ÿ“Š Expert Control: Fine-tune security vs performance trade-offs

Quick Start

Installation

# Install from PyPI (recommended)
pip install stegvault

# Or install from source
git clone https://github.com/kalashnikxvxiii/stegvault.git
cd stegvault
pip install -e .

Updating

# Standard update
pip install --upgrade stegvault

# Built-in auto-update
stegvault updates check     # Check for updates
stegvault updates upgrade   # Install latest version

# TUI "Update Now" button
stegvault tui               # Launch TUI โ†’ Settings โ†’ "Update Now"
# Detached update runs after you close StegVault (fixes WinError 32)

# Enable auto-updates in TUI Settings
# Click โ”โ”โ” button (bottom-right) โ†’ Toggle "Auto-Check Updates"

See Installation Guide for detailed instructions including Windows portable packages.


Usage

StegVault offers three interfaces for managing your passwords:

Full-featured visual interface in your terminal.

# Launch TUI
stegvault tui

Keyboard Shortcuts:

  • o - Open vault | n - New vault | h - View password history
  • a - Add entry | e - Edit | d - Delete
  • c - Copy password | v - Toggle visibility
  • / - Search entries | f - Favorite folder | Ctrl+f - Quick access

See TUI User Guide for complete documentation.

2. Command Line (CLI)

Scriptable commands for automation.

Create Vault:

stegvault vault create -i cover.png -o vault.png -k gmail --generate

Add Entry:

stegvault vault add vault.png -k github -u myusername --generate

Retrieve Password:

stegvault vault get vault.png -k gmail
# Output:
# Key: gmail
# Password: X7k$mP2!qL5@wN
# Username: user@gmail.com

List Entries:

stegvault vault list vault.png
# Output: Vault contains 3 entries:
#   1. gmail (user@gmail.com)
#   2. github (myusername)
#   3. aws

Search & Filter:

stegvault vault search vault.png -q "github"
stegvault vault filter vault.png --tag work

See CLI Commands Reference for complete command documentation.

3. Headless Mode - Automation & CI/CD

Automation-friendly with JSON output and non-interactive authentication.

JSON Output:

stegvault vault get vault.png -k gmail --passphrase-file ~/.vault_pass --json
# {"status":"success","data":{"key":"gmail","password":"...","username":"..."}}

Passphrase Options:

# 1. Passphrase file (recommended)
echo "MyPassphrase" > ~/.vault_pass && chmod 600 ~/.vault_pass
stegvault vault get vault.png -k gmail --passphrase-file ~/.vault_pass

# 2. Environment variable
export STEGVAULT_PASSPHRASE="MyPassphrase"
stegvault vault get vault.png -k gmail --json

CI/CD Example (GitHub Actions):

- name: Retrieve database password
  run: |
    PASSWORD=$(stegvault vault get secrets.png \
      -k db_password \
      --passphrase-file <(echo "${{ secrets.VAULT_PASSPHRASE }}") \
      --json | jq -r '.data.password')
    echo "DB_PASSWORD=$PASSWORD" >> $GITHUB_ENV

See Headless Mode Guide for automation examples and best practices.


How It Works

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         User Input (CLI/TUI/Headless)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      1. Encryption (Argon2id + XChaCha20)       โ”‚
โ”‚         โ€ข Generate Salt (16B) & Nonce (24B)     โ”‚
โ”‚         โ€ข Derive Key from Passphrase            โ”‚
โ”‚         โ€ข Encrypt with AEAD Authentication      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      2. Payload Format (Binary Structure)       โ”‚
โ”‚         Magic: "SPW1" (4B)                      โ”‚
โ”‚         Salt: 16B | Nonce: 24B                  โ”‚
โ”‚         Length: 4B | Ciphertext: NB             โ”‚
โ”‚         AEAD Tag: 16B                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      3. Steganography (Auto-Detect Format)      โ”‚
โ”‚         PNG: LSB sequential embedding           โ”‚
โ”‚         JPEG: DCT coefficient modification      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      Output: Stego Image (vault.png/jpg)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Cryptographic Stack

Component Algorithm Parameters
AEAD Cipher XChaCha20-Poly1305 256-bit key, 192-bit nonce
KDF Argon2id 3 iterations, 64MB memory, 4 threads
Salt/Nonce CSPRNG 128-bit salt, 192-bit nonce
Auth Tag Poly1305 128 bits (16 bytes)

Steganography Techniques

  • PNG LSB: Sequential pixel embedding (~90KB capacity for 400x600 image)
  • JPEG DCT: Frequency domain coefficient modification (~18KB capacity for 400x600 Q85)

Security Philosophy: Cryptographic strength provides security, not the embedding method.

See Architecture Overview and Cryptography Details for technical details.


Documentation

Complete documentation is available on the Wiki:

Getting Started

User Guides

Technical Documentation

Development


Security Considerations

โœ… Strong Security Features

  • Modern Cryptography: XChaCha20-Poly1305 AEAD cipher
  • Strong KDF: Argon2id resistant to GPU/ASIC attacks
  • Authenticated Encryption: Poly1305 MAC prevents tampering
  • Fresh Nonces: New nonce for every encryption

โš ๏ธ Limitations & Warnings

  • Not Invisible: Advanced steganalysis may detect embedded data
  • Format-Specific: PNG (lossless) vs JPEG (more robust, lower capacity)
  • Both Required: Losing image OR passphrase = permanent data loss
  • Offline Attacks: Attacker with image can attempt brute-force (mitigated by Argon2id)

๐Ÿ”’ Best Practices

  1. Strong Passphrase: Use 16+ character passphrase with mixed case, numbers, symbols
  2. Multiple Backups: Store copies in different locations
  3. Verify Backups: Test restore process after creating backup
  4. Secure Storage: Protect image files as you would protect passwords

See Security Model and Threat Model for comprehensive security information.


Development

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=stegvault --cov-report=html

# Run specific module
pytest tests/unit/test_crypto.py -v

Code Quality

# Format code
black stegvault tests

# Type checking
mypy stegvault

See Developer Guide and Testing Guide for complete development documentation.


Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests
  4. Commit (git commit -m 'feat: add amazing feature')
  5. Push (git push origin feature/amazing-feature)
  6. Open Pull Request

License

This project is licensed under the MIT License - see LICENSE file for details.


Disclaimer

StegVault is provided "as-is" for educational and personal use. The authors are not responsible for any data loss or security breaches. Always maintain multiple backups of critical passwords.

Security Notice: While StegVault uses strong cryptography, no system is perfect. This tool is best used as a supplementary backup method alongside traditional password managers.


Acknowledgments


Made with โค๏ธ by Kalashnikxv