Skip to main content

bx2trace (TraceBox)

Developed by FBX2

GitHub Repository: https://github.com/fareed1-ataf/Bxtracer

bx2trace is an advanced, high-performance behavioral analysis framework for Windows, specifically designed for cybersecurity analysts and malware researchers. It provides deep visibility into process behavior, live memory changes, and stealth debugging capabilities.

Overview

Unlike standard debuggers, bx2trace is built for automated analysis and stealth. It monitors process creation, DLL loading, and thread activity while simultaneously scanning live memory for indicators of compromise (IoCs), self-unpacking behavior, and encrypted payloads using YARA and entropy analysis.

Key Features

  • Stealth Engine: Automatically patches the PEB (Process Environment Block) to clear BeingDebugged and NtGlobalFlag, effectively evading many anti-debugging tricks used by modern malware.
  • Hardware Breakpoints (DR0-DR3): Monitor execution without modifying the target's code, making detection much harder for packers.
  • Dynamic Memory Scanner: Periodically scans committed memory regions to detect newly appeared strings and code decryption in real-time.
  • YARA Integration: Scan live memory against custom YARA rules to identify specific malware families or behaviors instantly.
  • Entropy Analysis: Detect packed or encrypted memory regions by calculating Shannon entropy at the page level.
  • Child Process Tracking: Automatically follows process trees to catch "Process Hollowing" and multi-stage execution.
  • SQLite Storage: All events are recorded in a structured database for post-mortem analysis and correlation.

Installation

pip install bx2trace

Important: bx2trace requires Administrator privileges to function correctly as it needs SeDebugPrivilege to monitor other processes.

Requirements

  • Windows 10/11 (x64)
  • Python 3.11+
  • Administrator rights

Usage Guide

The bx2trace package is a library. While it includes internal components to build complex analysis engines, most users will interact with the high-level components or build their own tools using the provided modules.

Python API Usage

Analysts can build their own custom analysis tools by leveraging the core components of bx2trace.

1. Basic Process Monitoring

from queue import Queue
from bx2trace.core.debug_thread import DebugThread
from bx2trace.core.models import TraceMode

# Event queue for collecting data
event_queue = Queue()

# Initialize and start the debugger thread
debug_thread = DebugThread(
    exe_path="malware.exe",
    mode=TraceMode.FULL_TRACE,
    raw_event_queue=event_queue
)
debug_thread.start()

try:
    while debug_thread.is_alive():
        event = event_queue.get()
        print(f"[{event.severity.value}] {event.category}/{event.action}: {event.payload}")
except KeyboardInterrupt:
    debug_thread.request_stop()

2. Advanced Memory Scanning with YARA

from queue import Queue
from bx2trace.core.debug_thread import DebugThread
from bx2trace.core.memory_scanner import MemoryScannerThread
from bx2trace.core.models import TraceMode

event_queue = Queue()

debug_thread = DebugThread("malware.exe", TraceMode.FULL_TRACE, event_queue)
debug_thread.start()
debug_thread.started_ok.wait()  # Wait for the process to launch

# Setup scanner to read tracked handles from DebugThread
scanner = MemoryScannerThread(
    get_tracked_handles=lambda: {p.pid: p.handle for p in debug_thread.tracked.values()},
    event_queue=event_queue,
    interval=2.0,
    yara_rules_path="rules.yar"
)
scanner.start()

Building Custom Detectors

You can extend the framework by creating custom detection logic that consumes events from the event_queue. This allows you to implement specialized behavioral rules (e.g., detecting specific API call sequences or network patterns).


Technical Assessment

Strengths

  1. Architecture: Decoupled design using a thread-safe event queue allows adding new detection modules (Detectors) without touching the core engine.
  2. Performance: Memory scanning is optimized with shared buffers and batch SQLite writes to ensure minimal impact on the host system.
  3. Accuracy: Correlating high-entropy memory regions with the appearance of new strings provides a high-confidence signal for self-unpacking.

Potential Weaknesses

  1. Polling Latency: Very fast fileless malware might execute between scan intervals. (Planned: Event-driven scanning via API hooks).
  2. Architecture Mismatch: Currently focused on x64 targets; 32-bit (WOW64) support is limited.

Disclaimer

This tool is intended for educational and research purposes only. The authors are not responsible for any misuse or damage caused by this software. Use it only on systems you own or have explicit permission to analyze.


Developed for Security Engineers who need precision and stealth.

Metadata

Release files for bx2trace 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bx2trace 1.0.0
File Size Uploaded Provenance Actions
bx2trace-1.0.0.tar.gz 26.9 kB Without provenance Details for bx2trace-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bx2trace 1.0.0
File Interpreter ABI Platform Actions
bx2trace-1.0.0-py3-none-any.whl Python 3 none any Details for bx2trace-1.0.0-py3-none-any.whl

Total release size: 58.7 kB

Release files / bx2trace-1.0.0.tar.gz

Download URL bx2trace-1.0.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9efa7f8cd042d179b18deb77344ebb8c24d75ea464024930005c09bb62cbc270
BLAKE2b-256 checksum
How to use checksums
b3c2b572fdb967bbd4b3f076bcf380732359d7ddeae3f11be1a63866b47652a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / bx2trace-1.0.0-py3-none-any.whl

Download URL bx2trace-1.0.0-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dbfc6d089645dd4c36ff1e300acffe2ca8723d08e72c3d612866aa12dc2fc34
BLAKE2b-256 checksum
How to use checksums
294ea8f200f6147cc3c5380cff391d50f27562862a820f9650bf26cb16dbd3b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for bx2trace 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page