Skip to main content
rule CX Codex

behavior_analysis · jdarmy, stowaway — Claude Code rule: Stowaway profiling

behavior_analysis — a Claude Code rule that loads a structured behavioral profile of Stowaway into the agent context: CLI flags, protocol constants, build artifacts, and tiered detection indicators.

MIT ★ 336 updated 2026-04-09

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/behavior_analysis.md
Open on GitHub

What behavior_analysis does

The rule covers Stowaway v2.2, a Go-based multi-hop proxy and pivoting tool mapped to ATT&CK techniques T1090, T1090.001, and T1090.002. It captures the full CLI argument sets for both admin and agent modes — -l, -c, -s, --socks5-proxy, --reconnect, --tls-enable, and others — alongside the hardcoded protocol UUID constants (IAMADMINXD, IAMNEWHERE, THEREISNOROUTE) and binary paths for Linux, Windows, macOS, FreeBSD, and MIPS targets.

Detection indicators are split into three confidence tiers. High: the Author:ph4ntom ASCII banner string, those UUID constants, and the Stowaway/ Go module path embedded in the binary. Medium: binary names stowaway_admin/stowaway_agent, release/ build paths, and startup log messages. Transport uses TCP, HTTP, or WebSocket; encryption defaults to AES-256-GCM with optional TLS.

The Windows agent can be built with -H=windowsgui to suppress the console window. Port reuse on Linux goes through script/reuse.py via iptables; Windows and macOS use SO_REUSEPORT/SO_REUSEADDR. Without this profile in context, an agent correctly asks about those evasion details instead of guessing.

What it helps with

  • parse CLI arguments from a detected Stowaway process
  • match observed network UUIDs against known protocol constants
  • assign a confidence tier to a specific indicator of compromise
  • locate Stowaway build artifacts by their release/ path patterns
  • explain the hidden-console build technique used in the Windows agent

Example prompts for the agent

  • Which CLI flags indicate a Stowaway agent running in reconnect mode?
  • Compare the high- and medium-confidence detection indicators from the behavior_analysis profile
  • What Go module path is used to identify a Stowaway binary during forensic analysis?

How to install behavior_analysis

Manually: put the files in place

.claude/rules/behavior_analysis.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about behavior_analysis

How do I install behavior_analysis in Claude Code?

Place the rule file at .claude/rules/behavior_analysis.md in your project root. Claude Code picks it up automatically on the next agent session.

What does the behavior_analysis rule do?

It injects a structured Stowaway profile into the agent context: startup arguments, network patterns, crypto details, build artifacts, and detection indicators grouped by confidence level.

Which indicators are most reliable for detecting Stowaway?

The highest-confidence signals are the Author:ph4ntom string in the ASCII banner, the UUID constants IAMADMINXD, IAMNEWHERE, and THEREISNOROUTE, and the Stowaway/ module path inside the Go binary.

Source text

behavior_analysis.md · MIT
# Stowaway Behavior Analysis

## Tool Classification

| Category | Description |
|----------|-------------|
| Type | Multi-hop Proxy / Pivoting Tool |
| ATT&CK Techniques | T1090 (Proxy), T1090.001 (Internal Proxy), T1090.002 (External Proxy) |
| Use Case | Network pivoting, lateral movement, SOCKS proxy |

## Process Behavior

### Execution Indicators

| Indicator | Value | Location |
|-----------|-------|----------|
| Binary Names | `stowaway_admin`, `stowaway_agent` | Makefile output |
| Process Arguments | `-l`, `-c`, `-s`, `--socks5-proxy`, `--http-proxy`, `--reconnect`, `--up`, `--down`, `--tls-enable` | CLI parser |
| Console Window | Hidden with `-H=windowsgui` flag | Makefile (windows_nogui_agent) |

### CLI Argument Patterns

```
Admin mode:
  -l <port>                    Listen mode
  -c <ip:port>                 Connect mode
  -s <secret>                  Communication secret
  --socks5-proxy <ip:port>     SOCKS5 proxy
  --socks5-proxyu <user>       SOCKS5 username
  --socks5-proxyp <pass>       SOCKS5 password
  --http-proxy <ip:port>       HTTP proxy
  --down <raw|http|ws>         Downstream protocol
  --tls-enable                 Enable TLS
  --domain <domain>            TLS SNI domain
  --heartbeat                  Enable heartbeat

Agent mode (additional):
  --reconnect <seconds>        Reconnect interval
  --rehost <ip>                Port reuse host
  --report <port>              Port reuse port
  --up <raw|http|ws>           Upstream protocol
  --cs <utf-8|gbk>             Console charset
```

## Network Behavior

### Connection Patterns

| Pattern | Description |
|---------|-------------|
| Protocol | TCP (raw), HTTP, WebSocket |
| Encryption | AES-256-GCM (default), TLS (optional) |
| Ports | User-defined |
| Direction | Bidirectional (admin↔agent) |

### Protocol Identifiers

| Identifier | Value | Location | Purpose |
|------------|-------|----------|---------|
| ADMIN_UUID | `IAMADMINXD` | protocol/protocol.go:69 | Admin identifier |
| TEMP_UUID | `IAMNEWHERE` | protocol/protocol.go:70 | New connection identifier |
| TEMP_ROUTE | `THEREISNOROUTE` | protocol/protocol.go:71 | Empty route marker |

### Message Types

From `protocol/protocol.go`:
- HI, UUID, CHILDUUIDREQ, CHILDUUIDRES
- MYINFO, MYMEMO
- SHELLREQ, SHELLRES, SHELLCOMMAND, SHELLRESULT, SHELLEXIT
- LISTENREQ, LISTENRES
- SSHREQ, SSHRES, SSHCOMMAND, SSHRESULT, SSHEXIT
- SSHTUNNELREQ, SSHTUNNELRES
- FILESTATREQ, FILESTATRES, FILEDATA, FILEERR, FILEDOWNREQ, FILEDOWNRES
- SOCKSSTART, SOCKSTCPDATA, SOCKSUDPDATA, UDPASSSTART, UDPASSRES, SOCKSTCPFIN, SOCKSREADY
- FORWARDTEST, FORWARDSTART, FORWARDREADY, FORWARDDATA, FORWARDFIN
- BACKWARDTEST, BACKWARDSTART, BACKWARDSEQ, BACKWARDREADY, BACKWARDDATA, BACKWARDFIN, BACKWARDSTOP, BACKWARDSTOPDONE
- CONNECTSTART, CONNECTDONE
- NODEOFFLINE, NODEREONLINE, UPSTREAMOFFLINE, UPSTREAMREONLINE
- SHUTDOWN, HEARTBEAT

## File Behavior

### Build Artifacts

| Artifact | Path Pattern |
|----------|--------------|
| Linux Admin | `release/linux_x86_admin`, `release/linux_x64_admin`, `release/linux_arm64_admin` |
| Linux Agent | `release/linux_x86_agent`, `release/linux_x64_agent`, `release/linux_arm64_agent` |
| Windows Admin | `release/windows_x86_admin.exe`, `release/windows_x64_admin.exe` |
| Windows Agent | `release/windows_x86_agent.exe`, `release/windows_x64_agent.exe` |
| macOS Admin | `release/macos_x64_admin`, `release/macos_arm64_admin` |
| macOS Agent | `release/macos_x64_agent`, `release/macos_arm64_agent` |
| MIPS Agent | `release/mipsel_agent` |
| ARM Agent | `release/arm_eabi5_agent` |
| FreeBSD | `release/freebsd_x86_admin`, `release/freebsd_arm_admin`, etc. |

### Script Files

| File | Purpose |
|------|---------|
| `script/reuse.py` | iptables port reuse script |

## String Constants

### Banner/Version

```
Location: admin/cli/cli.go:13
const STOWAWAY_VERSION = "v2.2"

Location: admin/cli/cli.go:17-28
ASCII art banner with "Author:ph4ntom"
```

### Log Messages

| Message | Location | Pattern |
|---------|----------|---------|
| `Starting agent node passively.Now listening on port` | agent/initial/parser.go:74 | Startup log |
| `Starting agent node actively.Connecting to` | agent/initial/parser.go:77 | Startup log |
| `Reconnecting every` | agent/initial/parser.go:80 | Startup log |
| `Starting admin node on port` | admin/initial/parser.go:77 | Startup log |
| `Trying to connect node actively` | admin/initial/parser.go:80 | Startup log |
| `Waiting for new connection` | admin/admin.go:46 | Startup log |

### Go Module Paths

```
Location: go.mod
module Stowaway

Import paths found in all source files:
- Stowaway/agent/
- Stowaway/admin/
- Stowaway/crypto/
- Stowaway/global/
- Stowaway/protocol/
- Stowaway/share/
```

## Crypto Behavior

| Feature | Implementation | Location |
|---------|---------------|----------|
| AES Encryption | AES-256-GCM | crypto/aes.go |
| GZIP Compression | gzip | crypto/gzip.go |
| TLS | Optional | share/transport/tls.go |
| Pre-auth Token | Generated from secret | share/preauth.go |

## Evasion Techniques

### Port Reuse

| Technique | Platform | Location |
|-----------|----------|----------|
| SO_REUSEPORT/SO_REUSEADDR | Windows, macOS, Linux | agent/initial/method.go |
| iptables | Linux only | agent/initial/method.go |

### Hidden Execution

Windows agent can be built with hidden console:
```makefile
BUILD_ENV = CGO_ENABLED=0
OPTIONS = -trimpath -ldflags "-w -s"
windows_nogui_agent:
    go build -ldflags="-H=windowsgui" ...
```

## Detection Opportunities

### High-Confidence Indicators

1. **Banner String**: `Author:ph4ntom` in ASCII art
2. **UUID Constants**: `IAMADMINXD`, `IAMNEWHERE`, `THEREISNOROUTE`
3. **Module Path**: `Stowaway/` in Go binary
4. **CLI Args**: `--socks5-proxy`, `--socks5-proxyu`, `--socks5-proxyp` combination

### Medium-Confidence Indicators

1. **Binary Names**: `stowaway_admin`, `stowaway_agent`
2. **Build Paths**: `release/windows_x64_admin.exe`, etc.
3. **Script Path**: `/script/reuse.py`
4. **Log Messages**: Startup messages with "agent node", "admin node"

### Low-Confidence Indicators

1. **Port reuse messages**: `start/stop iptables port reuse`
2. **SOCKS5 proxy arguments**: Common in legitimate tools
3. **TLS connection patterns**: Generic encrypted traffic

© JDArmy · MIT · JDArmy/Evasion-SubAgents

Similar IDE rules

All IDE rules for Security →

behavior_analysis by other authors comes first.

behavior_analysis JDArmy behavior_analysis — a rule file that tables how SharpHound gives itself away and what the doc suggests changing in the build, the flags and the output files. CX Codex +1 ★ 336repo stars tunneling-and-pivoting yaklang A tunneling and pivoting playbook that equips agents with exact commands for SSH forwarding, Chisel, Ligolo-ng, socat relays, and multi-layer pivots. CX Codex +1 3,900installs linux-lateral-movement yaklang A Linux lateral movement playbook: SSH agent hijacking, key and credential harvesting, tunnels, D-Bus abuse and sudo session reuse. CX Codex +1 3,900installs lateral-movement 0xSteph Plans post-foothold lateral movement paths for authorized engagements. Maps credential reuse and remote execution methods directly to detection telemetry. CX Codex ★ 2,482repo stars secops-investigate official Google LLC The secops-investigate skill supports deep incident and entity investigations in Google SecOps. Use it for UDM searches, asset and user timelines, and lateral movement analysis. CX Codex +1 1,900installs competition-identity-windows zhaoxuya520 competition-identity-windows — a skill for Claude Code and Codex that examines Active Directory attacks, Windows host artifacts, and CTF pivot chains. It runs after routing by $ctf-sandbox-orchestrator. CX Codex +1 109installs analyzing-network-traffic-of-malware mahipal analyzing-network-traffic-of-malware walks through a malware PCAP to find C2 protocols, exfiltration channels and payload downloads. Useful for sandbox runs and live incident response. CX Codex +1 428installs

From the same set22

The whole set →
hex_analysis hex_analysis — a rule file that explains YARA hex signatures for AdaptixC2: which instruction produced each one and which compiler flag moves those bytes. CX Codex +1 ★ 336repo stars lesson_learned The lesson_learned rule explains why string constants must match fixed-width protocol fields. Use it when changing Go code that reads message headers into fixed-size buffers. CX Codex +1 ★ 336repo stars behavior_analysis behavior_analysis — a rule file that tables how SharpHound gives itself away and what the doc suggests changing in the build, the flags and the output files. CX Codex +1 ★ 336repo stars modifications_summary modifications_summary keeps a record of the AdaptixC2 YARA-evasion edits in front of Claude: beacon build flags, renamed Go functions and the commands that verify them. Useful when you pick the repo back up. CX Codex +1 ★ 336repo stars modifications_summary modifications_summary — a Claude rule that fixes the shape of a change log for tool modifications: build metadata, log strings, filenames, and which detections still fire. CX Codex +1 ★ 336repo stars c2-evasion-agent c2-evasion-agent — a subagent that hunts down YARA and Sigma rules written for a C2 framework, then edits the implant source so those signatures stop matching. CX Codex ★ 336repo stars modifications_summary The modifications_summary rule documents all code modifications in your project: module renames, import updates, log changes. Use it to maintain a structured record of what changed and why without manually reviewing diffs. CX Codex +1 ★ 336repo stars tools-evasion-agent tools-evasion-agent is a subagent for Claude Code, Codex, and Cursor that analyzes pentest tools and detection signatures in authorized security research and red team exercises. CX Codex ★ 336repo stars

Project sponsors

Companies that keep this analytics open