Skip to content

PentHertz/Z-Attack-ng

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Z-Attack-NG

Z-Attack-NG

Next Generation Z-Wave Security Testing Framework

Python 3.8+ License: GPL v3 Platform

Professional Z-Wave packet interception, analysis, and injection tool with full S2 security support

Features β€’ Installation β€’ Quick Start β€’ Documentation β€’ Credits


πŸ“‹ Overview

Z-Attack-NG is an interactive security research framework for Z-Wave protocol analysis and testing. Born from the original Z-Attack by Advens (2015), this next-generation version has been completely rewritten with modern Python 3, featuring a professional ImGui interface, modular architecture, and Z-Wave S2 security support in beta for the moment.

Z-Attack-NG

What's New in NG?

  • 🎨 Modern ImGui Interface - Responsive GUI with real-time visualization replacing the old Tk one
  • πŸ—οΈ Modular Architecture - "Clean" separation of concerns (GUI, Core, Hardware, S2)
  • πŸ” S2 Support - ECDH key exchange capture and AES-CCM decryption
  • ⚑ Z-Wave Plus - Enhanced command class support (more classes to come)
  • πŸ“Š Advanced Analytics - Session management, nonce tracking, and export capabilities
  • πŸ› οΈ New CLI - argparse-based command-line interface
  • 🧩 Plugin-Ready - Extensible architecture for custom modules

✨ Features

πŸ” Packet Analysis

  • Real-time Interception - Live capture of Z-Wave traffic
  • Protocol Decoding - Automatic parsing of implemented command classes
  • Smart Filtering - Focus on specific networks, nodes, or command classes
  • Hex Dump Viewer - Raw packet inspection with detailed breakdowns

πŸ” Security Testing

S0 (Security 0) - βœ… Full Support

  • βœ… Complete encryption/decryption
  • βœ… Nonce capture and management
  • βœ… AES-128 OFB mode
  • βœ… Frame injection with encryption
  • βœ… Network key management

S2 (Security 2) - βœ… Beta Support

  • βœ… ECDH Curve25519 key exchange capture
  • βœ… AES-CCM authenticated encryption/decryption
  • βœ… All security classes (Unauthenticated, Authenticated, Access Control)
  • βœ… DSK-based device pairing
  • βœ… Perfect Forward Secrecy support
  • βœ… SPAN replay protection
  • βœ… Session management with export capabilities

πŸ—ΊοΈ Network Visualization

  • Interactive Topology Map - Real-time network visualization
  • Node Discovery - Automatic device identification
  • Relationship Mapping - Controller-to-device connections
  • Export Options - Generate static graphs (PNG/SVG)

πŸ’‰ Packet Injection

  • Advanced Mode - Full control over frame construction
  • Easy Mode - Pre-configured common commands
  • Secure Injection - Support for S0-encrypted frames
  • Template Library - Reusable command templates

πŸ“Š Logging & Export

  • Timestamped Logs - Detailed packet history
  • CSV Export - Analysis-ready data format
  • Nonce Database - S0 nonce tracking and export
  • S2 Session Export - Save key material and session data
  • Copy-Paste - Right-click context menus

πŸš€ Quick Start

Prerequisites

Hardware Requirements:

  • RfCat compatible device (recommended), OR
  • Texas Instruments CC1110/CC1111 development kit
  • TODO: Evil Crow RF V2, and maybe others? (soon)
  • TODO: Software-Defined Radio to implement (soon)

Software Requirements:

  • Python 3.8 or higher
  • Git

Installation

πŸš€ Installation

Using Poetry (Recommended)

# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -

# Clone repository
git clone https://github.com/penthertz/Z-Attack-ng.git
cd Z-Attack-ng

# Install dependencies
poetry install

# Run Z-Attack-NG
poetry run python ZAttackNG

Using pip (Traditional)

# Clone the repository
git clone https://github.com/penthertz/Z-Attack-ng.git
cd Z-Attack-ng

# Install Python dependencies
pip install -r requirements.txt [--break-install]

# (Optional) Install Graphviz for network graph export
# Ubuntu/Debian:
sudo apt-get install graphviz

# macOS:
brew install graphviz

# Windows: Download from https://graphviz.org/download/

First Run

# Using RfCat (default)
python ZAttackNG

# With debug mode
python ZAttackNG -d

# Using TI RF Kit
python ZAttackNG --serial -lcom /dev/ttyUSB0 -scom /dev/ttyUSB1

# Show all options
python ZAttackNG --help

πŸ” S2 Decryption Guide

Want to decrypt Z-Wave S2 traffic? Follow these simple steps:

Step 1: Get the DSK

The Device Specific Key (DSK) is printed on your device label or QR code.

Format: 12345-67890-12345-67890-12345-67890-12345-67890

Step 2: Start Z-Attack-NG

python ZAttackNG

Step 3: Add DSK

  1. Click Menu β†’ Add S2 DSK
  2. Enter Node ID (e.g., 02)
  3. Enter DSK from device label
  4. Click Add DSK

Step 4: Capture Key Exchange

Initiate device pairing. Z-Attack-NG will automatically:

  • Capture the ECDH public keys
  • Compute the shared secret
  • Derive all encryption keys

Step 5: Decrypt!

All subsequent S2 messages from this device will be automatically decrypted! πŸŽ‰

Monitor progress: Check the console output for [S2] βœ“βœ“βœ“ DECRYPTED βœ“βœ“βœ“ messages.


πŸ“– Documentation

Command Line Options

usage: ZAttackNG [-h] [-1 | -2] [-lcom PORT] [-scom PORT] [-d] [-csv] [--no-csv]
               [-k KEY] [-v]

Z-Attack-NG 1.0 - Z-Wave Security Testing Tool

Options:
  -h, --help            Show this help message and exit
  -1, --rfcat           Use RfCat device (default)
  -2, --serial          Use TI RF KIT (serial device)
  -lcom PORT, --listen-port PORT
                        Listening COM port for TI RF KIT
  -scom PORT, --send-port PORT
                        Sending COM port for TI RF KIT
  -d, --debug           Enable debug mode (verbose output)
  -csv, --csv-output    Enable CSV output to file (default: enabled)
  --no-csv              Disable CSV output
  -k KEY, --key KEY     Network key for S0 decryption (hex string)
  -v, --version         Show program version and exit

Supported Command Classes

Z-Attack-NG supports:

Click to expand full list

Security:

  • Security S0 (0x98) - Legacy encryption
  • Security S2 (0x9F) - Modern encryption with ECDH

Control:

  • Basic (0x20)
  • Switch Binary (0x25)
  • Switch Multilevel (0x26)
  • Switch All (0x27)
  • Scene Activation (0x2B)
  • Central Scene (0x5B)

Sensors:

  • Sensor Binary (0x30)
  • Sensor Multilevel (0x31)
  • Meter (0x32)
  • Alarm/Notification (0x71)

Configuration:

  • Configuration (0x70)
  • Association (0x85)
  • Multi Channel Association (0x8E)
  • Wake Up (0x84)
  • Battery (0x80)

Advanced:

  • Multi Channel (0x60)
  • Color Control (0x33)
  • Door Lock (0x62)
  • User Code (0x63)
  • Barrier Operator (0x66)
  • Thermostat Mode (0x40)
  • Thermostat Setpoint (0x43)

Device Info:

  • Version (0x86)
  • Manufacturer Specific (0x72)
  • Z-Wave Plus Info (0x5E)
  • Device Reset Locally (0x5A)

...and many more!


πŸ—οΈ Architecture

Z-Attack-ng/
β”œβ”€β”€ main.py                 # Entry point with modern argument parsing
β”œβ”€β”€ config.py               # Global configuration and settings
β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚
β”œβ”€β”€ core/                   # Core Z-Wave protocol handling
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ protocol.py        # Frame parsing and construction
β”‚   β”œβ”€β”€ crypto.py          # S0 encryption/decryption
β”‚   └── network.py         # Network topology management
β”‚
β”œβ”€β”€ s2/                    # S2 Security module
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ s2_crypto.py       # ECDH, AES-CCM, key derivation
β”‚   └── s2_manager.py      # Session management, KEX handling
β”‚
β”œβ”€β”€ hardware/              # Hardware abstraction layer
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ rfcat_device.py    # RfCat interface
β”‚   └── serial_device.py   # TI RF Kit interface
β”‚
β”œβ”€β”€ gui/                   # ImGui-based interface
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main_window.py     # Main application window
β”‚   β”œβ”€β”€ windows.py         # Popup windows (send, nonce, etc.)
β”‚   β”œβ”€β”€ s2_window.py       # S2 management windows
β”‚   └── utils.py           # GUI utilities (logging, textures)
β”‚
β”œβ”€β”€ data/                  # Data files and parsers
β”‚   β”œβ”€β”€ zwClasses.py       # Command class definitions
β”‚   β”œβ”€β”€ sendData.py        # Pre-configured commands
β”‚   └── manufacturer_specific.xml
β”‚
└── images/                # GUI assets
    β”œβ”€β”€ zattack.png
    └── penthertz.png

πŸ› οΈ Hardware Support

RfCat (Recommended)

  • Compatibility: YardStick One, RfCat dongle
  • Frequency: 868.4 MHz (EU) / 908.4 MHz (US)
  • Setup: Automatic configuration
  • Status: βœ… Fully supported

Texas Instruments RF Kit

  • Compatibility: CC1110, CC1111 development boards
  • Interface: Dual UART (listen + send)
  • Setup: Manual port configuration
  • Status: βœ… Fully supported

🎯 Use Cases

Security Research

  • Analyze Z-Wave network security posture
  • Test device encryption implementations
  • Discover protocol vulnerabilities
  • Validate security configurations

Smart Home Auditing

  • Map home automation networks
  • Identify unsecured devices
  • Test access control policies
  • Verify encryption standards

Protocol Analysis

  • Reverse engineer device behavior
  • Document command implementations
  • Create device fingerprints
  • Study protocol compliance

Penetration Testing

  • Include in IoT security assessments
  • Demonstrate Z-Wave vulnerabilities
  • Test network segmentation
  • Validate incident response

πŸ“Š Screenshots

Main Interface

Real-time packet interception with dual-log display:

  • Reception log (top) - Intercepted traffic
  • Send/Response log (bottom) - Your injections and ACKs

Network Discovery

Interactive topology map with:

  • Visual node relationships
  • Live connection status
  • Controller identification
  • Export to static images

S2 Security Manager

Comprehensive session management:

  • Active session monitoring
  • DSK configuration
  • Public key capture
  • Nonce tracking

(Screenshots coming soon)


πŸ”¬ Research & Publications

This tool has been used in various security research projects:

  • Z-Wave Security Analysis - Penthertz Research (2025)
  • Smart Home Security Testing - Advens (2015)

🀝 Contributing

We welcome contributions! Here's how you can help:

Ways to Contribute

  • πŸ› Report bugs - Open an issue with detailed reproduction steps
  • πŸ’‘ Suggest features - Share your ideas for improvements
  • πŸ“ Improve docs - Help us make the documentation better
  • πŸ”§ Submit PRs - Fix bugs or add features

Development Setup

# Fork and clone
git clone https://github.com/PentHertz/Z-Attack-ng.git
cd Z-Attack-ng

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and test
python ZAttackNG -d

# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature

# Open Pull Request

πŸ“œ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Z-Attack-NG - Next Generation Z-Wave Security Testing Framework
Copyright (C) 2025 Penthertz

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

πŸ™ Credits

Original Author

Advens Security Research Team (2015)
Website: advens.fr
Original project: github.com/Advens/Z-Attack

Refactored & Enhanced By

Penthertz (2025)
Website: penthertz.com
Twitter: @penthertz

Special Thanks

  • The RfCat project for excellent RF tools
  • Z-Wave Alliance for protocol documentation
  • The open-source security community

πŸ“ˆ Changelog

[1.0] - 2025-01-19

Added

  • Complete Python 3 rewrite with modern architecture
  • ImGui-based professional interface
  • Full S2 (Security 2) decryption support
    • ECDH Curve25519 key exchange
    • AES-CCM authenticated encryption
    • DSK-based device pairing
    • Session management
  • Modular architecture (core, gui, s2, hardware)
  • Modern argparse CLI
  • 60+ command class parsers
  • Interactive network topology visualization
  • Enhanced logging and export capabilities

Changed

  • Migrated from Python 2 to Python 3.8+
  • Replaced Tkinter with ImGui for better UX
  • Restructured codebase for maintainability
  • Updated all dependencies to modern versions

New Z-Attack-NG

[0.1] - 2015

  • Initial release by Advens
  • Basic Z-Wave packet interception
  • Injection capabilities
  • RfCat and TI Kit support
  • S0 decryption

Z-Attack v0.1

About

Z-Wave Packet Interception & Injection Tool (Reloaded 2025 - Python 3, S2 Support and with a modern GUI powered by Dear ImGUI)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%