sicario-red-team 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/sicario.js CHANGED
@@ -28,7 +28,7 @@ const program = new Command();
28
28
  program
29
29
  .name('sicario')
30
30
  .description('Autonomous Agentic Red-Teaming Swarm Protocol')
31
- .version('0.2.0');
31
+ .version('0.4.0');
32
32
 
33
33
  // Use a more robust way to import the command logic relative to this file
34
34
  const hitCommandPath = pathToFileURL(path.join(__dirname, '../src-cli/commands/hit.js')).href;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sicario-red-team",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Autonomous Agentic Red-Teaming Swarm Protocol",
5
5
  "type": "module",
6
6
  "files": [
@@ -6,7 +6,7 @@ import pc from 'picocolors';
6
6
  import 'dotenv/config';
7
7
  import { ConvexClient } from 'convex/browser';
8
8
  import { runScout } from '../nodes/scout.js';
9
- import { runBreacher } from '../nodes/breacher.js';
9
+ import { runBreacher, runCritic } from '../nodes/breacher.js';
10
10
  import { theme } from '../utils/theme.js';
11
11
 
12
12
  // Initialize Convex Client (will use CONVEX_URL from .env)
@@ -36,6 +36,14 @@ export async function hitCommand(target, options) {
36
36
  const CURRENT_TIER = (options.tier || 'SHADOW').toUpperCase();
37
37
  log.info(pc.magenta(`◈ LICENSE TIER: ${pc.bold(CURRENT_TIER)}`));
38
38
 
39
+ // 2. Bounded Autonomy Manifest (The 2026 Trust Layer)
40
+ console.log(pc.dim('\n┌ AGENT PERMISSIONS MANIFEST ─── (READ-ONLY) ──────╮'));
41
+ console.log(pc.dim('│ ✓ DOM Observation : AUTHORIZED │'));
42
+ console.log(pc.dim('│ ✓ GET / HEAD / OPTIONS : AUTHORIZED │'));
43
+ console.log(pc.dim('│ ⚠ POST / PUT (Dry-Run) : SIMULATED │'));
44
+ console.log(pc.dim('│ ✗ DB Write / Auth Mutate : DISABLED │'));
45
+ console.log(pc.dim('└──────────────────────────────────────────────────╯\n'));
46
+
39
47
  let missionId = null;
40
48
  let breachReport = { vulnerabilityFound: false };
41
49
 
@@ -88,7 +96,9 @@ export async function hitCommand(target, options) {
88
96
  const results = await Promise.all([
89
97
  runBreacher(elements, 'ACCOUNTANT'),
90
98
  runBreacher(elements, 'ADMIN'),
91
- runBreacher(elements, 'CHAOS_MONKEY')
99
+ runBreacher(elements, 'CHAOS_MONKEY'),
100
+ runBreacher(elements, 'ARCHITECT'),
101
+ runBreacher(elements, 'GHOST')
92
102
  ]);
93
103
  breachReports = results.filter(r => r.vulnerabilityFound);
94
104
  } else {
@@ -100,6 +110,16 @@ export async function hitCommand(target, options) {
100
110
  if (client && missionId) await client.mutation('handler:logMessage', { missionId, type: 'Breacher', message: `Analysis complete. Found ${breachReports.length} vectors.` });
101
111
 
102
112
  for (const breachReport of breachReports) {
113
+ // 5.1 [Critic] Verification (Internal Affairs)
114
+ log.step(`[Critic] : Verifying ${breachReport.title}...`);
115
+ const audit = await runCritic(breachReport, elements);
116
+ const isReal = audit.isReal;
117
+
118
+ if (!isReal) {
119
+ log.info(pc.yellow(`[System] : ${breachReport.title} debunked by Critic Node. Ignoring.`));
120
+ continue; // Skip false positive
121
+ }
122
+
103
123
  // 6. Sanitization Layer (The Anti-Crash Upgrade)
104
124
  const sanitize = (raw) => ({
105
125
  title: raw.title || "Unknown Logic Flaw",
@@ -107,15 +127,17 @@ export async function hitCommand(target, options) {
107
127
  severity: raw.severity || "MEDIUM",
108
128
  targetElement: raw.targetElement || raw.target || "General DOM Context",
109
129
  target: raw.target || raw.targetElement || "General DOM Context", // Double-mapping for safety
110
- mitigation: raw.mitigation || "Implement standard server-side validation guards.",
111
- thoughtProcess: raw.thoughtProcess || "Reasoning engine offline."
130
+ mitigation: audit.enhancedMitigation || raw.mitigation || "Implement standard server-side validation guards.",
131
+ thoughtProcess: audit.reasoning || raw.thoughtProcess || "Reasoning engine offline."
112
132
  });
113
133
 
114
134
  const clean = sanitize(breachReport);
115
135
 
116
136
  const nodeName = clean.thoughtProcess.includes("Accountant") ? "THE ACCOUNTANT" :
117
137
  clean.thoughtProcess.includes("Admin") ? "THE ADMIN" :
118
- clean.thoughtProcess.includes("Chaos") ? "THE CHAOS MONKEY" : "GENERAL BREACHER";
138
+ clean.thoughtProcess.includes("Chaos") ? "THE CHAOS MONKEY" :
139
+ clean.thoughtProcess.includes("Architect") ? "THE ARCHITECT" :
140
+ clean.thoughtProcess.includes("Ghost") ? "THE GHOST NODE" : "GENERAL BREACHER";
119
141
 
120
142
  console.log('\n' + pc.bold(pc.red(` ⚠ EXPLOIT SUCCESSFUL [${clean.title}]`)));
121
143
  console.log(pc.cyan(` ◇ AGENT IDENTIFIED: ${nodeName}`));
@@ -170,13 +192,23 @@ export async function hitCommand(target, options) {
170
192
  }
171
193
 
172
194
  if (breachReports.length === 0) {
195
+ const forms = elements.filter(e => e.tag === 'form').length;
196
+ const inputs = elements.filter(e => e.tag === 'input' || e.tag === 'textarea').length;
197
+ const actions = elements.filter(e => e.tag === 'button' || e.tag === 'a').length;
198
+
173
199
  log.info(theme.dim('No high-value business logic targets identified.'));
200
+
201
+ console.log(pc.cyan('\n◇ SWARM INTELLIGENCE REPORT ─────────────────────────────╮'));
202
+ console.log(pc.cyan(`│ Attack Surface: ${pc.bold(elements.length)} potential entry points mapped. │`));
203
+ console.log(pc.cyan(`│ Architecture: ${pc.bold(forms)} forms and ${pc.bold(inputs)} input vectors identified. │`));
204
+ console.log(pc.cyan(`│ Active Paths: ${pc.bold(actions)} state-changing actions logged. │`));
205
+ console.log(pc.cyan(`├────────────────────────────────────────────────────────╯`));
174
206
  }
175
207
 
176
208
  // 6. Mission Dossier
177
209
  const summaryLines = [
178
210
  `${theme.dim('Target')} ${theme.bold(finalTarget)}`,
179
- `${theme.dim('Nodes Recalled')} ${theme.bold(options.swarm ? '5 (Scout, Ghost, Accountant, Admin, Chaos)' : '3 (Scout, Ghost, Breacher)')}`,
211
+ `${theme.dim('Nodes Recalled')} ${theme.bold(options.swarm ? '7 (Scout, Ghost, Accountant, Admin, Chaos, Architect, Ghost)' : '3 (Scout, Ghost, Breacher)')}`,
180
212
  `${theme.dim('Breaches Found')} ${breachReports.length > 0 ? pc.red(pc.bold(breachReports.length)) : theme.bold('0')}`,
181
213
  `${theme.dim('Status')} ${theme.success('MISSION SUCCESSFUL')}`
182
214
  ];
@@ -13,6 +13,14 @@ const PERSONAS = {
13
13
  CHAOS_MONKEY: `
14
14
  You are 'The Chaos Monkey'. Your focus is on Input Resilience and Error Handling bypasses.
15
15
  Look for: Fields that lack character limits, unhandled edge-case inputs (emojis, 1GB strings), and state-manipulation vectors that could lead to crashes or unhandled server-side exceptions.
16
+ `,
17
+ ARCHITECT: `
18
+ You are 'The Architect'. Your focus is on Business Workflow and State Bypass.
19
+ Look for: Multi-step process vulnerabilities (e.g. Step 1 -> Step 3 bypass), "Verification" flag manipulation in the DOM, and logical "shortcuts" that allow users to reach success states without completing prerequisites (like payment or approval).
20
+ `,
21
+ GHOST: `
22
+ You are 'The Ghost' (Data Privacy Specialist). Your focus is on Data Leakage and PII.
23
+ Look for: Unmasked PII (emails, names, SSNs) in the DOM or secret metadata, raw API keys or tokens in data-attributes, and sensitive information leaked in hidden fields or commented-out source code meant for developers.
16
24
  `
17
25
  };
18
26
 
@@ -68,3 +76,47 @@ Return a VALID JSON object. DO NOT use "null".
68
76
  throw error;
69
77
  }
70
78
  }
79
+
80
+ /**
81
+ * Critic Node: Acts as 'Internal Affairs' to verify or debunk findings.
82
+ */
83
+ export async function runCritic(finding, elements) {
84
+ const client = new Cerebras({
85
+ apiKey: process.env.CEREBRAS_API_KEY,
86
+ });
87
+
88
+ const systemPrompt = `
89
+ You are the "Internal Affairs" auditor for the Sicario Swarm.
90
+ Your goal is to debunk high-value findings from the Breacher nodes.
91
+
92
+ SKEPTICAL AUDIT PROTOCOL:
93
+ 1. Is the vulnerability actually exploitable in a modern framework (NextJS, Nest, Rails)?
94
+ 2. Is the "Attack Vector" a hallucination or a real technical path?
95
+ 3. If you can't find a realistic path to exploitation, you MUST mark it as falsePositive.
96
+
97
+ RETURN VALID JSON:
98
+ {
99
+ "isReal": boolean,
100
+ "confidence": "0-100",
101
+ "reasoning": "Technical justification for your skepticism.",
102
+ "enhancedMitigation": "Granular, code-level fix if real."
103
+ }
104
+ `;
105
+
106
+ const userPrompt = `Finding: ${JSON.stringify(finding)}\nContext: ${JSON.stringify(elements)}`;
107
+
108
+ try {
109
+ const completion = await client.chat.completions.create({
110
+ messages: [
111
+ { role: 'system', content: systemPrompt },
112
+ { role: 'user', content: userPrompt }
113
+ ],
114
+ model: 'llama3.1-8b',
115
+ response_format: { type: 'json_object' }
116
+ });
117
+
118
+ return JSON.parse(completion.choices[0].message.content);
119
+ } catch (error) {
120
+ return { isReal: true, confidence: "50", reasoning: "Audit failed." }; // Fail-safe
121
+ }
122
+ }