diff --git a/neurosploit-rs/agents_md/infra/c2_operations.md b/neurosploit-rs/agents_md/infra/c2_operations.md new file mode 100644 index 0000000..32d90ae --- /dev/null +++ b/neurosploit-rs/agents_md/infra/c2_operations.md @@ -0,0 +1,38 @@ +# Command and Control Operations +## User Prompt +You are operating C2 infrastructure against **{target}** on an authorized engagement where post-exploitation requires establishing, maintaining, or leveraging implant sessions for lateral movement, persistence verification, or data access proof. CWE-284 + +**Context:** +{recon_json} + +The harness has MCP profiles for C2 frameworks (Sliver, Cobalt Strike) available as tool servers. Use whichever C2 the engagement has deployed. The deterministic probes (svc_probe, credtest, nday_restore) have already established initial access or identified exploitable services — your job is to operate the C2 from that foothold. + +### Method — listener and infrastructure setup +1. Check existing listeners (`sliver_listeners` / `cs_list_beacons`) before creating new ones — reuse active infrastructure. +2. When a new listener is needed, prefer mTLS (`sliver_start_mtls`) for reliability or HTTPS (`sliver_start_https`) for stealth through proxies. Match the listener type to the target's network position: mTLS for internal segments, HTTPS for DMZ/external-facing hosts, DNS for restricted egress. +3. Record every listener's bind address, port, and callback host as evidence — these are engagement artifacts that must be tracked and torn down at engagement close. + +### Method — session and beacon management +4. Inventory active sessions (`sliver_sessions`) and beacons (`sliver_beacons`) before any action. Identify which session belongs to which host, its privilege level, and transport. +5. For real-time interaction, use sessions; for stealth and reduced network noise, use beacons with an appropriate callback interval — never set beacon sleep below what the engagement's noise budget allows. +6. When a session dies or a beacon goes silent, note it as evidence rather than blindly re-establishing — the defensive team may have killed it, which is itself a finding. + +### Method — post-exploitation enumeration +7. Run targeted enumeration through the implant: `sliver_ps` for process listing (identify AV/EDR, interesting services), `sliver_ifconfig` for network interfaces (identify pivot opportunities), `sliver_netstat` for active connections (map internal services). +8. Use `sliver_execute` for precise commands rather than `sliver_shell` for interactive shells — discrete command execution leaves fewer forensic artifacts and produces cleaner evidence. +9. Filesystem operations (`sliver_ls`, `sliver_download`) for proving data access — download only the minimum needed to prove the finding (a config file header, a database schema dump, NOT bulk data). + +### Method — lateral movement and pivoting +10. Use `sliver_pivot_start_tcp` to establish pivot listeners when the target has network access to internal segments the assessment needs to reach. Document the pivot chain: entry host → pivot listener → target host. +11. Harvested credentials (`sliver_creds`) and discovered hosts (`sliver_hosts`) feed back into the attack chain — export them as loot for credtest and svc_probe to verify deterministically. +12. For each pivot, verify the new segment's scope against the engagement authorization before proceeding — a reachable host is not necessarily an authorized target. + +### Boundaries +- **Authorization-gated**: C2 operations require explicit operator authorization (`allow_persistence`, `allow_lateral` in C2Policy). Never establish persistence or pivot without checking these flags. +- **Evidence-first**: every C2 action produces evidence (the command run, the output received, the session ID). Capture this in findings. +- **Minimal footprint**: prefer read-only enumeration over active exploitation through the implant. The C2 proves the access — the finding is the access itself, not what you do with it. +- **Teardown-aware**: track every listener, session, and pivot for engagement close. Leave no orphaned infrastructure. + +Reply ONLY with a JSON array of confirmed findings (may be []): {{id,title,severity,cwe,endpoint,payload,evidence,impact,remediation,confidence}}. `evidence` = the C2 session proof (session ID, implant check-in, command output showing access level and host identity) — a theoretical "we could deploy an implant" without an actual session is NOT a finding. +## System Prompt +You are a C2 operations specialist on an authorized assessment. You manage implant sessions and listeners through MCP tool servers (Sliver C2, Cobalt Strike), you enumerate through established sessions rather than running new exploits, and you document every action as attributable evidence. You reuse existing infrastructure before creating new listeners, you prefer mTLS/HTTPS over raw TCP for transport security, and you track every session and pivot for engagement teardown. You never establish persistence or lateral movement without explicit operator authorization, and you treat a killed session as a defensive finding rather than a failure to re-exploit. diff --git a/neurosploit-rs/crates/harness/src/mcp_profiles.rs b/neurosploit-rs/crates/harness/src/mcp_profiles.rs index de50a00..84784af 100644 --- a/neurosploit-rs/crates/harness/src/mcp_profiles.rs +++ b/neurosploit-rs/crates/harness/src/mcp_profiles.rs @@ -21,6 +21,8 @@ pub enum Profile { BinaryAnalysis, BurpSuite, CobaltStrike, + SliverC2, + AdaptixC2, Infra, Ad, Cloud, @@ -131,6 +133,45 @@ pub fn profile(p: &Profile) -> McpProfile { } }), }, + Profile::SliverC2 => McpProfile { + name: "Sliver C2".into(), + description: "Sliver C2 framework via sec-sliver-c2-mcp (stdio MCP)".into(), + server_name: "sliver-c2".into(), + tools: tool_allowlist(p), + config: json!({ + "command": "node", + "args": [ + "${NEUROSPLOIT_SLIVER_MCP_PATH:-/opt/sec-sliver-c2-mcp}/dist/index.js", + "--operator-config", + "${SLIVER_OPERATOR_CONFIG:-/etc/sliver/operator.cfg}" + ], + "env": { + "SLIVER_OPERATOR_CONFIG": "", + "PYTHON_PATH": "python3", + "SLIVER_TIMEOUT": "30000" + } + }), + }, + Profile::AdaptixC2 => McpProfile { + name: "Adaptix C2".into(), + description: "AdaptixC2 framework via Python MCP (beacons, BOFs, Kerberos, execute-assembly)".into(), + server_name: "adaptix-c2".into(), + tools: tool_allowlist(p), + config: json!({ + "command": "uv", + "args": [ + "--directory", + "${NEUROSPLOIT_ADAPTIX_MCP_PATH:-/opt/AdaptixC2_mcp}", + "run", + "AdaptixC2_mcp.py" + ], + "env": { + "ADAPTIX_ENDPOINT": "", + "ADAPTIX_USERNAME": "neurosploit", + "ADAPTIX_PASSWORD": "" + } + }), + }, Profile::Infra => McpProfile { name: "Infra".into(), description: "Network/infra testing with an Nmap MCP server".into(), @@ -223,6 +264,14 @@ pub fn all_profiles() -> Vec<(Profile, &'static str)> { Profile::CobaltStrike, "Cobalt Strike team-server C2 via the official HTTP MCP", ), + ( + Profile::SliverC2, + "Sliver C2 framework via sec-sliver-c2-mcp (sessions, beacons, listeners, pivoting)", + ), + ( + Profile::AdaptixC2, + "AdaptixC2 framework (beacons, BOFs, Kerberos, execute-assembly, SOCKS, port-forwarding)", + ), (Profile::Infra, "Network/infra testing with Nmap MCP"), (Profile::Ad, "Active Directory testing with Kali MCP"), (Profile::Cloud, "Cloud/container tooling via Kali MCP"), @@ -308,6 +357,38 @@ pub fn tool_allowlist(p: &Profile) -> Vec { "cs_fetch_screenshot", "cs_get_team_server", ], + Profile::SliverC2 => &[ + "sliver_version", "sliver_operators", + "sliver_sessions", "sliver_kill_session", + "sliver_beacons", + "sliver_listeners", "sliver_start_mtls", "sliver_start_https", + "sliver_ls", "sliver_cd", "sliver_pwd", "sliver_download", "sliver_upload", + "sliver_execute", "sliver_shell", + "sliver_ps", "sliver_ifconfig", "sliver_netstat", "sliver_screenshot", + "sliver_pivot_listeners", "sliver_pivot_start_tcp", + "sliver_creds", "sliver_hosts", + ], + Profile::AdaptixC2 => &[ + "get_live_beacons", + "cat", "cd", "cp", "disks", "download", "ls", "mkdir", "mv", "pwd", "rm", "upload", + "execute_bof", "execute_assembly", "powershell", + "getuid", "whoami", "ps_list", "ps_kill", + "ipconfig", "netstat", "arp", "routeprint", "listdns", "env", + "link_smb", "link_tcp", "unlink", + "lportfwd_start", "lportfwd_stop", "rportfwd_start", "rportfwd_stop", + "socks_start", "socks_stop", + "sleep", "jobs_list", "jobs_kill", + "hashdump", "credman", "autologon", + "kerbeus_asreproasting", "kerbeus_kerberoasting", "kerbeus_asktgt", "kerbeus_asktgs", + "kerbeus_dump", "kerbeus_klist", "kerbeus_ptt", "kerbeus_hash", + "kerbeus_s4u", "kerbeus_tgtdeleg", "kerbeus_triage", + "getsystem_token", "uacbybass_sspi", "uacbybass_regshellcmd", "rev2self", + "privcheck_alwayselevated", "privcheck_hijackablepath", "privcheck_tokenpriv", + "privcheck_unattendfiles", "privcheck_unquotedsvc", "privcheck_vulndrivers", + "quser", "uptime", "useridletime", "winver", "cacls", + "findobj_module", "findobj_prochandle", "process_conn", + "exfil_start", "exfil_stop", "exfil_cancel", + ], Profile::Infra | Profile::Nmap => &[ "do-nmap", "nmap_scan", "nmap_service_scan", "nmap_vuln_scan", "nmap_os_detect", "nmap_ping_sweep", @@ -383,6 +464,34 @@ pub fn prompt_context(p: &Profile) -> String { persistence-changing commands unless the operator explicitly approved them, \ and put the raw command output into the finding evidence." ), + Profile::SliverC2 => format!( + "You are operating in SLIVER C2 mode through the sec-sliver-c2-mcp server. \ + Available tools: {tool_list}. Use sliver_sessions and sliver_beacons to inventory \ + active implants before acting. Use sliver_listeners to check existing infrastructure, \ + sliver_start_mtls or sliver_start_https to establish new listeners when needed. \ + For post-exploitation: sliver_execute for precise commands, sliver_shell for \ + interactive shells, sliver_ls/sliver_download for file access, sliver_ps/sliver_ifconfig/ \ + sliver_netstat for enumeration. Use sliver_pivot_start_tcp for lateral movement. \ + sliver_creds and sliver_hosts provide harvested intelligence. Every action is \ + attributable — stay inside authorized hosts, never run destructive or \ + persistence-changing commands unless the operator explicitly approved them, \ + and capture raw command output as finding evidence." + ), + Profile::AdaptixC2 => format!( + "You are operating in ADAPTIX C2 mode through the AdaptixC2 MCP server. \ + Available tools: {tool_list}. Use get_live_beacons to inventory active agents \ + before any action. This C2 provides deep Windows post-exploitation: \ + execute_assembly for .NET tools (SharpHound, Rubeus, Certify, Seatbelt), \ + execute_bof for Beacon Object Files, and powershell for scripts. \ + Kerberos attacks: kerbeus_kerberoasting, kerbeus_asreproasting, kerbeus_asktgt, \ + kerbeus_ptt for pass-the-ticket. Credential access: hashdump, credman, autologon. \ + Privilege escalation: getsystem_token, uacbybass_sspi, privcheck_* for enumeration. \ + Lateral movement: link_smb/link_tcp for agent linking, lportfwd/rportfwd for \ + port forwarding, socks_start for SOCKS proxy. Network recon: ipconfig, netstat, \ + arp, routeprint, listdns. Every action is attributable — stay inside authorized \ + hosts, capture raw output as evidence, and never run destructive commands \ + unless the operator explicitly approved them." + ), Profile::Infra => format!( "You are operating in INFRA/NETWORK testing mode. Use the Nmap MCP server for \ host discovery, port/service identification and NSE checks. Available tools: {tool_list}. \ diff --git a/neurosploit-rs/crates/harness/src/reactive_bridge.rs b/neurosploit-rs/crates/harness/src/reactive_bridge.rs index 859b4ae..fd1c546 100644 --- a/neurosploit-rs/crates/harness/src/reactive_bridge.rs +++ b/neurosploit-rs/crates/harness/src/reactive_bridge.rs @@ -117,7 +117,10 @@ pub async fn run_reactive( "mobile-ios" => crate::mcp_profiles::Profile::MobileIos, "binary" => crate::mcp_profiles::Profile::BinaryAnalysis, "burp" => crate::mcp_profiles::Profile::BurpSuite, - "cobaltstrike" | "cobalt" | "cs" | "c2" => crate::mcp_profiles::Profile::CobaltStrike, + "cobaltstrike" | "cobalt" | "cs" => crate::mcp_profiles::Profile::CobaltStrike, + "sliver" | "sliverc2" | "sliver-c2" => crate::mcp_profiles::Profile::SliverC2, + "adaptix" | "adaptixc2" | "adaptix-c2" => crate::mcp_profiles::Profile::AdaptixC2, + "c2" => crate::mcp_profiles::Profile::SliverC2, "infra" | "host" => crate::mcp_profiles::Profile::Infra, "ad" | "internal" => crate::mcp_profiles::Profile::Ad, "cloud" => crate::mcp_profiles::Profile::Cloud, diff --git a/setup.sh b/setup.sh index b0d1d10..d4929f3 100755 --- a/setup.sh +++ b/setup.sh @@ -209,6 +209,41 @@ if [ "${NEUROSPLOIT_NO_DEPS:-0}" != "1" ]; then fi # ffuf is Go; only hint it. command -v ffuf >/dev/null 2>&1 && ok "ffuf present" || warn "ffuf optional (fuzzing) — install via your package manager or Go" + # Sliver C2 MCP server (optional — for C2 operations via MCP). + SLIVER_MCP_DIR="${NEUROSPLOIT_SLIVER_MCP_PATH:-$DIR/sec-sliver-c2-mcp}" + if [ -d "$SLIVER_MCP_DIR/dist" ]; then + ok "Sliver C2 MCP present ($SLIVER_MCP_DIR)" + elif [ "${NEUROSPLOIT_SLIVER_C2:-0}" = "1" ]; then + say "Installing Sliver C2 MCP server…" + if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then + git clone --depth 1 https://github.com/schwarztim/sec-sliver-c2-mcp.git "$SLIVER_MCP_DIR" 2>/dev/null && \ + ( cd "$SLIVER_MCP_DIR" && npm install --production 2>/dev/null && npm run build 2>/dev/null ) && \ + ok "Sliver C2 MCP installed ($SLIVER_MCP_DIR)" || \ + warn "Sliver C2 MCP install failed — install manually: git clone + npm install + npm run build" + command -v python3 >/dev/null 2>&1 && { pip3 install sliver-py 2>/dev/null && ok "sliver-py installed" || warn "sliver-py install failed — pip3 install sliver-py"; } + else + warn "Sliver C2 MCP requires Node.js + npm — skipped" + fi + else + warn "Sliver C2 MCP not installed — set NEUROSPLOIT_SLIVER_C2=1 to install" + fi + # AdaptixC2 MCP server (optional — for AdaptixC2 operations via MCP). + ADAPTIX_MCP_DIR="${NEUROSPLOIT_ADAPTIX_MCP_PATH:-$DIR/AdaptixC2_mcp}" + if [ -f "$ADAPTIX_MCP_DIR/AdaptixC2_mcp.py" ]; then + ok "AdaptixC2 MCP present ($ADAPTIX_MCP_DIR)" + elif [ "${NEUROSPLOIT_ADAPTIX_C2:-0}" = "1" ]; then + say "Installing AdaptixC2 MCP server…" + if command -v uv >/dev/null 2>&1 || command -v pip3 >/dev/null 2>&1; then + git clone --depth 1 https://github.com/0xb11a1/AdaptixC2_mcp.git "$ADAPTIX_MCP_DIR" 2>/dev/null && \ + ( cd "$ADAPTIX_MCP_DIR" && { command -v uv >/dev/null 2>&1 && uv venv && uv pip install -r requirments.txt || pip3 install -r requirments.txt; } 2>/dev/null ) && \ + ok "AdaptixC2 MCP installed ($ADAPTIX_MCP_DIR)" || \ + warn "AdaptixC2 MCP install failed — install manually: git clone + uv pip install -r requirments.txt" + else + warn "AdaptixC2 MCP requires uv or pip3 — skipped" + fi + else + warn "AdaptixC2 MCP not installed — set NEUROSPLOIT_ADAPTIX_C2=1 to install" + fi else say "Dependency auto-install skipped (NEUROSPLOIT_NO_DEPS=1)." for t in curl git nmap node rustscan ffuf typst; do