Skip to content
paulnejaPublic

About

A lightweight, pure-bash bare-metal sandbox for safe execution and behavioral analysis of untrusted Linux binaries using namespaces, Cgroups v2, and Xephyr

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

SysCage

SysCage is a Linux malware-analysis sandbox written in Bash. It runs native Linux binaries and Windows PE executables inside a temporary, isolated root filesystem using Linux namespaces, pivot_root, privilege dropping, syscall tracing, and optional network interception.

The project is designed for disposable analysis environments. It is not a replacement for a hardened virtual machine when handling sophisticated or kernel-level malware.

Features

Temporary rootfs backed by a size-limited tmpfs
PID, mount, network, UTS, and IPC namespaces
Execution as UID/GID 1000 with no_new_privs and an empty capability bounding set
Recursive ELF dependency collection
strace capture for file, process, network, signal, and sleep activity
Anti-ptrace and sleep-bypass syscall injection
Configurable execution timeout with forced termination
Network-disabled mode with loopback disabled
Isolated veth mode with host firewall rules and optional PCAP capture
Nested graphical display through Xephyr
Automatic Windows PE execution through Wine
TTY recording, live memory dumping, and artifact quarantine
Behavioral analysis with threat scoring and MITRE ATT&CK-style findings
JSON and HTML reports
English and Spanish output
Built-in synthetic self-test

Requirements

SysCage requires:

Linux
Bash
Root privileges
Kernel namespace support
strace
util-linux (unshare, pivot_root, mount, umount, setpriv)
binutils
iproute2
iptables when using --net veth
file, findutils, and coreutils

Optional features use:

python3 for JSON and HTML behavioral reports
tcpdump for PCAP capture
gdb/gcore for memory dumping
script for TTY capture
busybox for the minimal userspace
Xephyr, xauth, and xhost for GUI isolation
Wine for Windows executables

Installation

Clone the repository and run the dependency installer:

git clone git@github.com:paulneja/Syscage.git
cd Syscage
chmod +x install.sh syscage.sh
./install.sh

The installer detects the available package manager, checks kernel support, explains missing dependencies, and verifies the installation afterward.

Useful installer options:

./install.sh --dry-run --lang=en
./install.sh --dry-run --lang=es
./install.sh --help

Usage

sudo ./syscage.sh /path/to/sample [options]

Options:

--gui                 Use an isolated Xephyr display
--net none|veth       Disable networking or create an intercepted veth network
--quarantine DIR      Save dropped files, PCAP, TTY logs, and memory dumps
--timeout SECS        Stop execution after the specified duration; 0 disables it
--memdump-at SECS     Capture process memory while the sample is running
--no-report           Keep the raw trace without generating behavioral reports
--selftest            Run the harmless synthetic validation probe
--esp                 Use Spanish output
-h, --help            Show command help

Examples:

sudo ./syscage.sh ./sample.elf --timeout 60 --quarantine ./cases/sample-01
sudo ./syscage.sh ./sample.exe --net veth --timeout 60 --quarantine ./cases/sample-02
sudo ./syscage.sh ./sample.exe --gui --net none --quarantine ./cases/sample-03
sudo ./syscage.sh --selftest

Network modes

--net none

This is the default and safest mode. SysCage creates a new network namespace, disables loopback, and removes routes.

--net veth

SysCage creates an isolated 10.0.0.0/24 virtual pair. The sample receives 10.0.0.2, while the host side uses 10.0.0.1. INPUT and FORWARD firewall rules block access to host services and forwarded networks. SysCage refuses to use this mode when the required firewall tooling is unavailable.

When tcpdump is installed, traffic attempts are recorded to a PCAP file even though forwarding is blocked.

Windows executables and Wine

SysCage detects PE32/PE32+ files and .exe filenames automatically. It copies the Wine launcher and required Linux libraries into the rootfs, creates an isolated WINEPREFIX under /home/malware/.wine, and traces Wine and its child processes.

64-bit Windows GUI executables work with a 64-bit Wine installation.
32-bit executables require Wine multilib/wine32 and the corresponding 32-bit host libraries.
Console executables can run headlessly.
Graphical executables require --gui and a working X11 or Xwayland session.
DirectX/OpenGL applications may use software rendering inside Xephyr and can be slower than normal desktop execution.

GUI mode

--gui starts a nested Xephyr server on display :100 and exposes only that X socket inside the sandbox. The host must have an active X11 or Xwayland display, and display :100 must be unused.

sudo ./syscage.sh ./program.exe --gui --timeout 60

The nested window is initially black until the analyzed application creates its own window. Keyboard-map warnings from xkbcomp are usually harmless. GPU-heavy programs may report EGL/DRI warnings because nested acceleration is not guaranteed.

Reports and artifacts

When Python is available, SysCage generates:

report.json for structured processing
report.html for interactive review
A raw strace audit log
A forensic manifest with hashes and metadata

With --quarantine, SysCage also extracts modified or dropped files, removes their executable bits, and saves available PCAP, TTY, and memory-dump artifacts.

Treat every generated artifact as potentially malicious.

Self-test

The self-test runs a harmless synthetic probe that deliberately exercises file access, dropped-file detection, privilege dropping, syscall capture, sleep bypass, and report generation.

sudo ./syscage.sh --selftest --timeout 20
sudo ./syscage.sh --selftest --net veth --timeout 20
sudo ./syscage.sh --selftest --gui --timeout 20

Current validation results:

Debian 12 container, network disabled: 7/7 checks passed
Debian 12 container, isolated veth: 8/8 checks passed
Arch/CachyOS dependency verification: passed
Wine 11.15 with a native 64-bit Windows GUI executable under Xephyr: passed

Security notes

Always use a dedicated analysis machine or disposable VM.
Prefer --net none unless packet capture is required.
Do not open quarantined files outside an isolated environment.
Do not run SysCage on a workstation containing sensitive data.
Keep the kernel, Wine, tracing tools, and firewall tooling updated.

License

See LICENSE.

About

A lightweight, pure-bash bare-metal sandbox for safe execution and behavioral analysis of untrusted Linux binaries using namespaces, Cgroups v2, and Xephyr

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages