Skip to content

armgit / ARES

Public Imported from GitHub
0

ARES - authorized red-team engagement automation with dashboard, campaign scope, module orchestration, OPSEC controls, encrypted vault, and reporting.

feat(graph): cobalt strike pivot graph fidelity, privilege styling, zero-flicker css hover, and docs

Mafifrizi87f5159b902c
diff --git a/README.md b/README.md
index b9eebb1..eeb5d4e 100644
--- a/README.md
+++ b/README.md
@@ -189,26 +189,44 @@ The ARES Platform features a high-performance, responsive operator dashboard eng
---
-### 5. πŸ•ΈοΈ Multi-Vector Attack Graph & Objective Replay
+### 5. πŸ•ΈοΈ Multi-Vector Pivot Graph & Cobalt Strike Beacon Terminal Dock
-*Interactive directed acyclic graph (DAG) solver visualizing enterprise attack paths and privilege escalation chains.*
+*Interactive Cobalt Strike-styled hierarchical lateral pivot topology graph paired with a real-time multi-tabbed Beacon session terminal console.*
<div align="center">
-![ARES Multi-Vector Attack Graph & Objective Replay](docs/assets/screenshots/dashboard-graph.png)
+![ARES Multi-Vector Pivot Graph & Cobalt Strike Beacon Terminal Console](docs/assets/screenshots/dashboard-graph.png)
-*Multi-Vector Attack Graph with automated luminous white patch cables, left-to-right hierarchy (Domain Controller β†’ Findings β†’ Hosts), and real-time safe metadata inspection.*
+*Cobalt Strike Hierarchical Pivot Graph with organic curved Bezier routes, animated forward-flowing telemetry particles, persistent click-to-lock pathway tracking, and docked multi-tabbed Beacon session terminal.*
+
+<br>
+
+![ARES Cobalt Strike Beacon Session Terminal Console](docs/assets/screenshots/dashboard-beacon-terminal.png)
+
+*Docked Beacon Terminal Console β€” Authentic Java Swing dual-row tabs, real-time command dispatch (`whoami`, `hashdump`, `ps`, `ppid`), privilege telemetry status bar, and target host synchronization.*
</div>
-- **The Problem Solved**: Translates raw vulnerability data into actionable, visual compromise paths that executives and engineers can understand immediately.
+- **The Problem Solved**: Translates raw active directory vulnerabilities and compromised footholds into visual, navigable lateral pivot chains while providing offensive operators an immediate interactive command console without switching windows.
- **Key Capabilities**:
- - **Automated Cyber Patch Cable Routing**: Real-time rendering of automated luminous white cables (`#ffffff`) connecting Domain Controllers, security findings, and discovered hosts without manual dragging.
- - **Deterministic Left-to-Right Hierarchy**: Clean, collision-free column layout originating from the Domain Controller (`DC01`) on the left, through active security findings, to target member hosts.
- - **Shortest Path Algorithms**: Deterministically calculates the fewest hops required to compromise Domain Controllers or cloud root credentials.
- - **Native BloodHound / SharpHound Ingest**: Directly import BloodHound JSON archives into the ARES graph engine for unified analysis.
- - **Interactive Entity Inspection**: Explore relationships between users, groups, computers, ACLs, and active Kerberos sessions with fluid navigation and real-time safe detail inspector.
- - **Objective Replay**: Re-simulate historical attack chains to verify defensive patch efficacy.
+ - **Hierarchical Pivot Graph Visualization**: Positions network perimeters (Firewalls/Ingress) on the left, compromised pivot workstations in the center, and Domain Controllers/Crown Jewels on the right.
+ - **Organic Cubic Bezier Routing**: Eliminates overlapping 90-degree lines with smooth curvature, 22px vector directional arrowheads, and real-time animated glowing particles flowing downstream.
+ - **Persistent Click-to-Lock Pathway Tracking**: Click any node to freeze upstream ancestry and downstream lateral routes with glowing highlights and a tactical HUD banner (`β€’ PATHWAY LOCKED: [HOST] | N NODES | N HOPS`). Freely zoom and pan around the topology without losing context.
+ - **Integrated Multi-Row Beacon Terminal Dock**:
+ - **Dual-Row Metal Tabs**: Automatically synchronizes and focuses the active session tab when clicking hosts on the canvas.
+ - **Authentic Cobalt Strike Status Bar**: Displays target privilege context (`[HOST] SYSTEM *`) and real-time heartbeat latency (`last: 2s`).
+ - **Interactive Command Prompt (`beacon>`)**:
+ - `whoami`: Resolves integrity level and active user context (`TARGET\SYSTEM *`).
+ - `hashdump` / `creds`: Harvests and displays cached NTLM SAM/LSA hashes.
+ - `ps` / `process`: Enumerates active process trees and resolves parent PIDs.
+ - `ppid <pid>`: Tasks beacon to spoof parent process IDs for EDR evasion.
+ - `ssh <host> <user> <pass>`: Tasks interactive lateral SSH traversal.
+ - `net view` / `hosts` / `recon`: Lists discovered network scope and adjacent nodes.
+ - `clear`: Clears current session terminal scrollback buffer.
+ - `help`: Quick reference of supported beacon tasking commands.
+ - **Operational Modes**:
+ - `Mode: LIVE CAMPAIGN`: Renders live scoped engagement targets and findings discovered during reconnaissance. Use the `[Active Pivots Only]` filter to focus exclusively on active compromise routes.
+ - `Mode: DEMO SAMPLE`: Instant reference 9-node interconnected lateral pivot topology demonstrating enterprise multi-hop infiltration chains.
---
diff --git a/docs/assets/screenshots/dashboard-beacon-terminal.png b/docs/assets/screenshots/dashboard-beacon-terminal.png
new file mode 100644
index 0000000..d900bb9
Binary files /dev/null and b/docs/assets/screenshots/dashboard-beacon-terminal.png differ
diff --git a/docs/assets/screenshots/dashboard-graph.png b/docs/assets/screenshots/dashboard-graph.png
index 091ad1e..87731f8 100644
Binary files a/docs/assets/screenshots/dashboard-graph.png and b/docs/assets/screenshots/dashboard-graph.png differ
diff --git a/docs/dashboard-guide.md b/docs/dashboard-guide.md
index f28ba85..4fb27ac 100644
--- a/docs/dashboard-guide.md
+++ b/docs/dashboard-guide.md
@@ -73,7 +73,8 @@ keys, bearer tokens, or sensitive report URLs.
| Overview (Active Telemetry) | `docs/assets/screenshots/dashboard-overview.png` | Health, telemetry cards, confirmed findings, and campaign summary. |
| Campaigns | `docs/assets/screenshots/dashboard-campaigns.png` | Campaign creation, target/scope input, and management actions. |
| Modules | `docs/assets/screenshots/dashboard-modules-catalog.png` | Module catalog filters, OPSEC labels, campaign selection, and parameter forms. |
-| Graph | `docs/assets/screenshots/dashboard-graph.png` | Interactive attack graph DAG with automated white patch cables, left-to-right hierarchy, and top attack paths panel. |
+| Graph | `docs/assets/screenshots/dashboard-graph.png` | Cobalt Strike Hierarchical Pivot Graph with organic Bezier curves, animated telemetry particles, persistent pathway tracking, and Beacon session dock. |
+| Beacon Terminal | `docs/assets/screenshots/dashboard-beacon-terminal.png` | Authentic Cobalt Strike dual-row tabbed Beacon console dock with real-time command execution and status bar. |
| Graph Inspector | `docs/assets/screenshots/dashboard-graph-inspector.png` | Interactive Safe Detail slide-out drawer with asset telemetry, open ports, and compromise status. |
| Reports | `docs/assets/screenshots/dashboard-reports.png` | Campaign report generation and artifact list. |
@@ -330,27 +331,62 @@ artifact count without a full page reload. If deletion fails, the page keeps
the row and shows an error notice. When no reports remain, the Library shows
the clean empty state: `No reports generated for this campaign yet.`
-### Graph
+### Graph & Cobalt Strike Beacon Terminal Dock
-Purpose: understand relationships and attack paths.
+Purpose: understand lateral pivot relationships, trace multi-hop compromise routes, and interact with compromised hosts directly from a docked Beacon terminal console.
-![Attack graph visualization](assets/screenshots/dashboard-graph.png)
+![Cobalt Strike Hierarchical Pivot Graph](assets/screenshots/dashboard-graph.png)
-*Multi-Vector Attack Graph β€” Automated white patch cables connecting Domain Controllers, security findings, and discovered hosts with top attack paths.*
+*Cobalt Strike Hierarchical Pivot Graph β€” Organic curved Bezier cables with forward-flowing animated telemetry particles, persistent click-to-lock pathway tracking, and docked multi-tabbed Beacon session terminal.*
-![Attack graph node inspector](assets/screenshots/dashboard-graph-inspector.png)
+![Cobalt Strike Beacon Session Terminal Console](assets/screenshots/dashboard-beacon-terminal.png)
-*Safe Detail Node Inspector β€” Click any node on the canvas to open the slide-out drawer displaying live asset telemetry, open ports, and compromise status.*
+*Cobalt Strike Beacon Terminal Console Dock β€” Authentic Java Swing dual-row tabs, real-time command dispatch (`whoami`, `hashdump`, `ps`, `ppid`), privilege telemetry status bar, and target host synchronization.*
-Use it for:
+#### Graph Topology & Navigation
+
+- **Hierarchical Column Layout**:
+ - **Left**: Perimeter gateways and uncompromised target findings (assets and services identified during initial reconnaissance).
+ - **Center**: Active compromise footholds and intermediate pivot workstations (`10.10.10.198`, `DEVELOPER45`, etc.).
+ - **Right**: High-value internal infrastructure, Active Directory Domain Controllers (`DC01`), and Crown Jewels.
+- **Organic Bezier Connections & Particle Streams**: Replaces rigid 90-degree lines with fluid cubic curves, 22px vector directional arrowheads, and real-time streaming particle pulses indicating live C2/pivot communications.
+- **Persistent Click-to-Lock Pathway Tracking**:
+ - Clicking any host locks its upstream compromise lineage (how the host was reached) and downstream lateral reachability (what other hosts can be compromised from it).
+ - A top HUD banner displays: `β€’ PATHWAY LOCKED: [HOST] | N NODES | N HOPS` with quick pan/zoom persistence.
+ - To release the lock, click on the empty canvas, press `ESC`, or click the `[CLEAR TRACK [ESC]]` button on the banner.
+- **Operational Mode Toggle**:
+ - `Mode: LIVE CAMPAIGN`: Visualizes real-time scoped targets and discovered findings from the active engagement. Targets that have not yet been pivoted appear on the left with in-degree 0; active footholds with live pivot tunnels appear connected. Click `[Active Pivots Only]` on the toolbar to filter out unpivoted targets.
+ - `Mode: DEMO SAMPLE`: Loads the reference 9-node interconnected enterprise pivot topology showing multi-hop infiltration chains.
+
+#### Cobalt Strike Beacon Terminal Console (`CobaltSessionDock`)
-- Campaign graph review and entity relationship exploration.
-- Safe detail inspection (IP, hostname, open ports, DC flag, and ownership state).
-- Attack path review and shortest hop compromise analysis.
-- BloodHound JSON archive ingest.
+Located directly below the graph canvas, the Beacon Terminal Dock provides a full operator console synchronized with the graph:
-This is useful after enumeration modules discover Active Directory entities, computers, groups, and
-relationships.
+1. **Dual-Row Java Swing Session Tabs**:
+ - Organized in dual rows matching classic Cobalt Strike UI ergonomics.
+ - Clicking any host on the graph automatically switches to or spawns its dedicated Beacon session tab.
+ - Individual tabs can be closed via the `Γ—` button without terminating underlying backend state.
+2. **Real-Time Telemetry Logs**:
+ - `[+]` Green: Successful operations, credential harvests, and established pivot channels.
+ - `[*]` Cyan: Tasking status, transport information (Named Pipe `\pipe\browser`), and cryptographic verification (AES-256-GCM).
+ - `beacon>` White: Command prompt and execution history.
+ - `[!]` Yellow: Operational notices, help menus, and OPSEC warnings.
+3. **Status Bar**:
+ - Positioned directly above the command input.
+ - Displays current host privilege level (`[DC01] SYSTEM *` or `[HOST] operator`) and live heartbeat interval (`last: 2s`).
+4. **Supported Interactive Commands**:
+
+| Command | Syntax / Example | Description |
+| --- | --- | --- |
+| `whoami` | `whoami` | Resolves target host, user context, and token integrity (`High/System` vs `Medium`). |
+| `hashdump` | `hashdump` or `creds` | Dumps harvested NTLM SAM and LSA hashes from the target LSASS memory. |
+| `ps` | `ps` or `process` | Enumerates remote process trees and resolves parent process IDs (PPIDs). |
+| `ppid` | `ppid <pid>` | Tasks the beacon to spoof parent process IDs for defense evasion and telemetry blinding. |
+| `ssh` | `ssh <host> <user> <pass>` | Tasks beacon to establish an interactive lateral SSH session to an adjacent host. |
+| `net view` | `net view` or `hosts` | Enumerates discovered adjacent systems and active nodes within engagement scope. |
+| `clear` | `clear` | Clears the terminal scrollback history for the active session tab. |
+| `help` | `help` | Displays the quick reference of supported beacon tasking commands. |
+| `<custom>` | `shell <command>` | Tasks beacon to execute arbitrary commands with byte transmission telemetry (`sent 48 bytes`). |
### Templates
diff --git a/frontend/src/features/graph/CobaltStrikeNodes.tsx b/frontend/src/features/graph/CobaltStrikeNodes.tsx
index fe469cd..1a227a7 100644
--- a/frontend/src/features/graph/CobaltStrikeNodes.tsx
+++ b/frontend/src/features/graph/CobaltStrikeNodes.tsx
@@ -156,7 +156,8 @@ export const PivotComputerNode = memo(function PivotComputerNode({ data, selecte
const isMapped = privilege === "uncompromised";
let auraClass = "mapped";
- if (isElevated) auraClass = "elevated";
+ if (privilege === "system") auraClass = "elevated";
+ else if (privilege === "admin") auraClass = "admin";
else if (isActiveBeacon) auraClass = "active-beacon";
let screenContent: ReactNode;
@@ -164,16 +165,17 @@ export const PivotComputerNode = memo(function PivotComputerNode({ data, selecte
screenContent = <LinuxTuxEmblem />;
} else if (nodeData.os === "windows-server") {
screenContent = <WindowsServerEmblem />;
- } else if (isElevated) {
+ } else if (privilege === "system") {
screenContent = <Windows7WavingFlag />;
} else {
screenContent = <WindowsModernFlag />;
}
let privilegeText =
- isElevated ? "SYSTEM *" :
+ privilege === "system" ? "SYSTEM *" :
+ privilege === "admin" ? "ADMIN" :
privilege === "user" ? (nodeData.metadata?.user ? String(nodeData.metadata.user) : (nodeData.process || "BEACON")) :
- (nodeData.label || "TARGET");
+ "TARGET";
if (privilegeText.length > 26) {
privilegeText = privilegeText.slice(0, 24) + "…";
@@ -214,7 +216,7 @@ export const PivotComputerNode = memo(function PivotComputerNode({ data, selecte
{/* Under-Monitor Monospace Telemetry Badges */}
<div className="cobalt-node-caption">
- <span className={`cobalt-node-privilege ${isElevated ? "system" : isActiveBeacon ? "user" : "neutral"}`}>
+ <span className={`cobalt-node-privilege ${privilege === "system" ? "system" : privilege === "admin" ? "admin" : isActiveBeacon ? "user" : "neutral"}`}>
{privilegeText}
</span>
{subText && (
diff --git a/frontend/src/features/graph/GraphPage.tsx b/frontend/src/features/graph/GraphPage.tsx
index d3f9fb2..e00c2a2 100644
--- a/frontend/src/features/graph/GraphPage.tsx
+++ b/frontend/src/features/graph/GraphPage.tsx
@@ -170,24 +170,43 @@ function cobaltPivotLayout(
outgoingEdges.get(e.source)?.push(e.target);
});
- // 2. Identify roots: firewall / perimeter ingress or nodes with in-degree 0
+ // 2. Identify true roots of the attack progression:
+ // Firewalls/Perimeter Ingress and true initial foothold roots (nodes with in-degree 0 AND out-degree > 0)
const depthMap = new Map<string, number>();
const visited = new Set<string>();
const queue: string[] = [];
+ // Phase A: Firewalls / Perimeter Ingress are Stage 0
nodes.forEach((n) => {
- const isFw = n.type === "firewall" || n.id.includes("firewall") || n.id.includes("ingress");
- if (isFw || (inDegree.get(n.id) ?? 0) === 0) {
+ const isFw = n.type === "firewall" || n.id.includes("firewall") || n.id.includes("ingress") || n.label.toLowerCase().includes("ingress");
+ if (isFw) {
depthMap.set(n.id, 0);
visited.add(n.id);
queue.push(n.id);
}
});
+ // Phase B: True initial attack roots (nodes with in-degree 0 AND out-degree > 0)
+ // These are entry workstations/footholds that initiate subsequent lateral pivot edges
+ nodes.forEach((n) => {
+ if (!visited.has(n.id)) {
+ const inDeg = inDegree.get(n.id) ?? 0;
+ const outDeg = outgoingEdges.get(n.id)?.length ?? 0;
+ if (inDeg === 0 && outDeg > 0) {
+ const startingDepth = queue.length > 0 ? 1 : 0;
+ depthMap.set(n.id, startingDepth);
+ visited.add(n.id);
+ queue.push(n.id);
+ }
+ }
+ });
+
+ // Fallback: If no explicit roots found but nodes have edges, pick the first connected node
if (queue.length === 0 && nodes.length > 0) {
- depthMap.set(nodes[0].id, 0);
- visited.add(nodes[0].id);
- queue.push(nodes[0].id);
+ const firstConnected = nodes.find((n) => (outgoingEdges.get(n.id)?.length ?? 0) > 0 || (inDegree.get(n.id) ?? 0) > 0) || nodes[0];
+ depthMap.set(firstConnected.id, 0);
+ visited.add(firstConnected.id);
+ queue.push(firstConnected.id);
}
// 3. BFS traversal to calculate horizontal progression depth
@@ -217,7 +236,7 @@ function cobaltPivotLayout(
} else if (inf.status === "active") {
depthMap.set(n.id, 2); // Lateral Workstations
} else {
- depthMap.set(n.id, 1); // DMZ / Perimeter targets
+ depthMap.set(n.id, 1); // Scoped targets / Perimeter inventory
}
}
});
@@ -246,11 +265,11 @@ function cobaltPivotLayout(
// Vertical height is strictly capped at MAX_ROWS (3 rows) so nodes NEVER cascade downwards!
// Additional nodes in the same stage expand horizontally into sub-columns side-by-side.
const MAX_ROWS = 3;
- const COL_PITCH = 240; // Horizontal spacing between adjacent node centers
- const ROW_PITCH = 150; // Vertical pitch allowing room for monitor + stand + 2-line badge
- const STAGE_GAP = 55; // Visual breathing gap between major architectural stages
- const START_X = 50;
- const START_Y = 50;
+ const COL_PITCH = 280; // Generous horizontal spacing allowing ample room for Bezier curve arcs
+ const ROW_PITCH = 190; // Ample vertical pitch: 120px node + 70px breathing room so nodes never collide
+ const STAGE_GAP = 70; // Clear visual demarcation between major architectural compromise tiers
+ const START_X = 60;
+ const START_Y = 60;
let cursorX = START_X;
@@ -258,10 +277,17 @@ function cobaltPivotLayout(
const stageNodes = stageBuckets.get(d)!;
// Sort within stage for visual hierarchy and consistent lateral alignment:
- // Firewalls first, then SYSTEM/Admin elevations, then user beacons, then mapped targets
+ // Firewalls first, then nodes with active pivot connections, then by privilege level
stageNodes.sort((a, b) => {
if (a.type === "firewall") return -1;
if (b.type === "firewall") return 1;
+
+ // Connected nodes (with tracks) always sort before completely isolated nodes
+ const aConnected = (inDegree.get(a.id) ?? 0) > 0 || (outgoingEdges.get(a.id)?.length ?? 0) > 0;
+ const bConnected = (inDegree.get(b.id) ?? 0) > 0 || (outgoingEdges.get(b.id)?.length ?? 0) > 0;
+ if (aConnected && !bConnected) return -1;
+ if (!aConnected && bConnected) return 1;
+
const aInf = inferCobaltNodeData(a);
const bInf = inferCobaltNodeData(b);
const prio = (priv?: string) => (priv === "system" ? 3 : priv === "admin" ? 2 : priv === "user" ? 1 : 0);
@@ -487,7 +513,6 @@ function CobaltGraphInner({
}) {
const { zoomIn, zoomOut, fitView } = useReactFlow();
const controlsBound = useRef(false);
- const [hoveredNodeId, setHoveredNodeId] = useState<string | null>(null);
useEffect(() => {
if (bindControls && !controlsBound.current) {
@@ -500,9 +525,11 @@ function CobaltGraphInner({
}
}, [bindControls, zoomIn, zoomOut, fitView]);
- // Priority: Clicked Selected Node > Hovered Node (preview when nothing is selected)
+ // Pathway tracking is strictly locked on click selection.
+ // Hover effect is handled 100% via hardware-accelerated CSS (:hover) with zero React state updates,
+ // completely eliminating hover jitter, blinking loops, and node shifting.
const isLocked = selection?.kind === "node";
- const activeFocusNodeId = isLocked ? selection.value.id : hoveredNodeId;
+ const activeFocusNodeId = isLocked ? selection.value.id : null;
const trackedPathway = useMemo(() => {
if (!activeFocusNodeId) return null;
@@ -591,19 +618,6 @@ function CobaltGraphInner({
onPaneClick={() => {
if (selection) onSelect(null);
}}
- onPaneMouseEnter={() => {
- if (!isLocked) setHoveredNodeId(null);
- }}
- onNodeMouseEnter={(_event, node) => {
- if (!isLocked) {
- setHoveredNodeId((curr) => (curr === node.id ? curr : node.id));
- }
- }}
- onNodeMouseLeave={(_event, node) => {
- if (!isLocked) {
- setHoveredNodeId((curr) => (curr === node.id ? null : curr));
- }
- }}
onNodeClick={(_event, node) => {
const selectedNode = nodeById.get(node.id);
if (selectedNode) {
diff --git a/frontend/src/features/graph/graphCobalt.css b/frontend/src/features/graph/graphCobalt.css
index cabe63d..f441c4b 100644
--- a/frontend/src/features/graph/graphCobalt.css
+++ b/frontend/src/features/graph/graphCobalt.css
@@ -280,7 +280,7 @@
.cobalt-node-wrapper,
.cobalt-firewall-node {
- transition: opacity 0.18s ease, filter 0.18s ease;
+ transition: opacity 0.15s ease;
pointer-events: auto;
}
@@ -290,9 +290,14 @@
filter: grayscale(0.7) brightness(0.6);
}
+.cobalt-node-wrapper:hover {
+ z-index: 50 !important;
+}
+
.cobalt-node-wrapper:hover .cobalt-monitor-housing {
- box-shadow: 0 0 16px rgba(0, 212, 255, 0.65), inset 0 0 4px rgba(0, 212, 255, 0.3);
- border-color: #38bdf8;
+ box-shadow: 0 0 16px rgba(0, 212, 255, 0.75), inset 0 0 4px rgba(0, 212, 255, 0.4);
+ border-color: #38bdf8 !important;
+ cursor: pointer;
}
/* Halo & Aura Variations (Pure Crisp Vectors, No Blurry AI-Slop Glows) */
@@ -307,6 +312,13 @@
border-color: #00d4ff;
}
+/* Administrative / Server */
+.cobalt-node-wrapper.admin .cobalt-monitor-housing {
+ border-color: #f59e0b;
+ background: #27221b;
+ box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
+}
+
/* Mapped Target / Discovery */
.cobalt-node-wrapper.mapped .cobalt-monitor-housing {
border-color: #ff9900;
@@ -425,6 +437,11 @@
text-shadow: 0 0 6px rgba(255, 51, 51, 0.45);
}
+.cobalt-node-privilege.admin {
+ color: #fbbf24;
+ text-shadow: 0 0 6px rgba(251, 191, 36, 0.45);
+}
+
.cobalt-node-privilege.user {
color: #00d4ff;
text-shadow: 0 0 6px rgba(0, 212, 255, 0.35);
diff --git a/frontend/src/features/graph/graphModel.ts b/frontend/src/features/graph/graphModel.ts
index 840bb24..95c1e40 100644
--- a/frontend/src/features/graph/graphModel.ts
+++ b/frontend/src/features/graph/graphModel.ts
@@ -200,16 +200,33 @@ export function getPathHighlight(path: AttackPath | null | undefined, graph: Saf
export function filterGraph(graph: SafeGraph, filters: GraphFilters, highlight: GraphHighlight): SafeGraph {
const selectedTypes = new Set(filters.nodeTypes);
const hasTypeFilter = selectedTypes.size > 0;
+
+ // Track node degree to identify which nodes participate in active lateral movement/pivot edges
+ const connectedNodeIds = new Set<string>();
+ graph.edges.forEach((e) => {
+ connectedNodeIds.add(e.source);
+ connectedNodeIds.add(e.target);
+ });
+
const nodes = graph.nodes.filter((node) => {
if (hasTypeFilter && !selectedTypes.has(node.type)) return false;
if (filters.severity !== "all" && node.type === "finding" && node.severity !== filters.severity) return false;
- if (filters.activePathOnly && !highlight.nodeIds.has(node.id)) return false;
+ if (filters.activePathOnly) {
+ if (highlight.nodeIds.size > 0) {
+ if (!highlight.nodeIds.has(node.id)) return false;
+ } else {
+ // When Active Pivots Only is active without a pre-selected attack path,
+ // show exclusively nodes that participate in active pivot / lateral edges or perimeter firewalls
+ const isFw = node.type === "firewall" || node.id.includes("firewall") || node.id.includes("ingress");
+ if (!connectedNodeIds.has(node.id) && !isFw) return false;
+ }
+ }
return true;
});
const nodeIds = new Set(nodes.map((node) => node.id));
const edges = graph.edges.filter((edge) => {
if (!nodeIds.has(edge.source) || !nodeIds.has(edge.target)) return false;
- return !filters.activePathOnly || highlight.edgeIds.has(edge.id);
+ return !filters.activePathOnly || highlight.edgeIds.size === 0 || highlight.edgeIds.has(edge.id);
});
return { nodes, edges };
}
@@ -243,27 +260,81 @@ export function inferCobaltNodeData(node: SafeGraphNode): CobaltNodeInference {
const typeLower = (node.type || "").toLowerCase();
const meta = node.metadata || {};
+ // 1. Detect Operating System & Housing Form
let os: "windows" | "windows-server" | "linux" | "firewall" = "windows";
+ const osInfoLower = String(meta.os || meta.os_info || "").toLowerCase();
+
if (meta.os === "firewall" || meta.os === "windows-server" || meta.os === "windows" || meta.os === "linux") {
os = meta.os;
- } else if (typeLower.includes("firewall") || labelLower.includes("firewall") || labelLower.includes("gateway")) {
+ } else if (
+ typeLower.includes("firewall") ||
+ labelLower.includes("firewall") ||
+ labelLower.includes("ingress") ||
+ labelLower.includes("gateway") ||
+ labelLower.includes("k8s-ingress") ||
+ osInfoLower.includes("firewall")
+ ) {
os = "firewall";
- } else if (typeLower.includes("dc") || labelLower.includes("dc") || labelLower.includes("server") || typeLower.includes("domain")) {
+ } else if (
+ typeLower.includes("dc") ||
+ Boolean(meta.is_dc) ||
+ labelLower.includes("dc01") ||
+ labelLower.includes("domain controller") ||
+ labelLower.includes("server") ||
+ labelLower.includes("sql") ||
+ labelLower.includes("fs01") ||
+ osInfoLower.includes("server")
+ ) {
os = "windows-server";
- } else if (labelLower.includes("linux") || labelLower.includes("ubuntu") || labelLower.includes("kali")) {
+ } else if (
+ labelLower.includes("linux") ||
+ labelLower.includes("ubuntu") ||
+ labelLower.includes("kali") ||
+ labelLower.includes("aws") ||
+ labelLower.includes("imds") ||
+ osInfoLower.includes("linux") ||
+ osInfoLower.includes("ubuntu")
+ ) {
os = "linux";
}
+ // 2. Detect Accurate Privilege Tier (SYSTEM * vs ADMIN vs USER / BEACON vs TARGET)
let privilege: "system" | "admin" | "user" | "uncompromised" = "user";
+ const cLevel = String(meta.compromise_level || "").toLowerCase();
+ const isDc = typeLower.includes("dc") || Boolean(meta.is_dc) || labelLower.includes("dc01") || labelLower.includes("domain controller");
+ const isServer = os === "windows-server" || labelLower.includes("sql") || labelLower.includes("fs01");
+
if (meta.privilege === "system" || meta.privilege === "admin" || meta.privilege === "user" || meta.privilege === "uncompromised") {
privilege = meta.privilege;
- } else if (node.severity === "critical" || labelLower.includes("system") || labelLower.includes("admin") || labelLower.includes("root")) {
+ } else if (
+ isDc ||
+ cLevel === "system" ||
+ cLevel === "domain_admin" ||
+ labelLower.includes("system") ||
+ labelLower.includes("root") ||
+ node.severity === "critical"
+ ) {
+ // Tier-0 Domain Controller or root/system compromise -> Crimson SYSTEM *
privilege = "system";
- } else if (node.severity === "high") {
+ } else if (
+ isServer ||
+ cLevel === "local_admin" ||
+ cLevel === "admin" ||
+ labelLower.includes("admin") ||
+ node.severity === "high"
+ ) {
+ // High-value internal server (SQL, File Server) -> Amber ADMIN
privilege = "admin";
- } else if (typeLower === "finding" || typeLower === "host") {
+ } else if (
+ cLevel === "user" ||
+ Boolean(meta.owned || meta.is_owned) ||
+ meta.status === "active" ||
+ labelLower.includes("ws") ||
+ labelLower.includes("workstation")
+ ) {
+ // Foothold workstation or compromised user session -> Cyan BEACON
privilege = "user";
- } else if (typeLower === "domain" || typeLower === "group") {
+ } else if (cLevel === "none" || typeLower === "domain" || typeLower === "group") {
privilege = "uncompromised";
}
@@ -308,7 +379,33 @@ export function adaptApiGraphToCobalt(
campaign?: { name?: string; targets?: string[]; scope_cidrs?: string[] } | null
): SafeGraph {
if (apiGraph.nodes.length > 0) {
- const nodes: SafeGraphNode[] = apiGraph.nodes.map((n) => {
+ // 1. Identify which nodes participate in edges
+ const connectedNodeIds = new Set<string>();
+ apiGraph.edges.forEach((e) => {
+ connectedNodeIds.add(e.source);
+ connectedNodeIds.add(e.target);
+ });
+
+ // In Cobalt Strike Pivot Topology, the canvas strictly models network infrastructure
+ // (hosts, servers, domain controllers, firewalls, gateways, and active pivot channels).
+ // Findings (vulnerabilities like Kerberoastable SPN, Open Ports, PRT compromise) and
+ // user/group AD objects are attributes of hosts, NOT separate physical computer workstations!
+ // This prevents fake computer monitors from crowding the canvas and colliding with real hosts.
+ const candidateNodes = apiGraph.nodes.filter((n) => {
+ const typeLower = (n.type || "").toLowerCase();
+ if (
+ typeLower === "finding" ||
+ typeLower === "credential" ||
+ typeLower === "user" ||
+ typeLower === "group" ||
+ typeLower === "domain"
+ ) {
+ return false;
+ }
+ return true;
+ });
+
+ const nodes: SafeGraphNode[] = candidateNodes.map((n) => {
const inference = inferCobaltNodeData(n);
return {
...n,