From 60f6b40fc944434c82979e8a111fce41a8e03763 Mon Sep 17 00:00:00 2001 From: CyberSecurityUP Date: Wed, 2 Dec 2026 13:15:59 -0300 Subject: [PATCH] feat(web): surface auto-config defaults in the wizard - PoC re-validation and OPSEC evasion default on; sandbox defaults to Auto (Kali if available) - unchecking a default or picking "This host" sends the matching NEUROSPLOIT_NO_* opt-out so the front-end choice wins - wire --evasion into run/session args; drop the duplicate More options toggle --- .../crates/harness/src/autoconfig.rs | 2 +- web/public/app.js | 9 ++++---- web/public/index.html | 6 +++-- web/server.js | 23 +++++++++++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/neurosploit-rs/crates/harness/src/autoconfig.rs b/neurosploit-rs/crates/harness/src/autoconfig.rs index 978d7b7..451e430 100644 --- a/neurosploit-rs/crates/harness/src/autoconfig.rs +++ b/neurosploit-rs/crates/harness/src/autoconfig.rs @@ -233,7 +233,7 @@ pub fn apply(cfg: &mut RunConfig, mcp: &mut bool, reactive_default: bool) { "OPSEC evasion enabled — scan header dropped (disable: NEUROSPLOIT_NO_EVASION=1)", ); } - if cfg.sandbox.is_none() { + if cfg.sandbox.is_none() && !env_present("NEUROSPLOIT_NO_SANDBOX") { if let Some(rt) = sandbox_ready() { cfg.sandbox = Some(String::new()); eprintln!(" [auto] sandbox enabled ({rt}: kalilinux/kali-rolling already present)"); diff --git a/web/public/app.js b/web/public/app.js index 8fa7034..a183e7b 100644 --- a/web/public/app.js +++ b/web/public/app.js @@ -873,8 +873,9 @@ function renderReview() { { k: 'Out-of-band', v: state.authz.oobDomain ? `*.${state.authz.oobDomain}` : 'none — blind classes stay leads' }, { k: 'Hard scope', v: (() => { const sc = collectScope(); return sc ? `${sc.hard.length} host rule(s) · ${sc.rateLimit || '∞'} req/min${sc.allowDestructive ? ' · writes allowed' : ''}` : 'Target only'; })() }, { k: 'Intercept', v: $('#fieldIntercept').value === 'off' ? 'direct' : $('#fieldIntercept').value }, - { k: 'Sandbox', v: $('#fieldSandbox').value ? 'Kali container' : 'host' }, + { k: 'Sandbox', v: (() => { const v = $('#fieldSandbox').value; return v === 'auto' ? 'auto (Kali if available)' : v === 'default' ? 'Kali container' : 'this host'; })() }, { k: 'PoC re-validation', v: $('#fieldRevalidatePoc').checked ? 'on' : 'off' }, + { k: 'OPSEC evasion', v: $('#fieldEvasion')?.checked ? 'on' : 'off' }, { k: 'C2 / post-exploitation', v: $('#fieldC2')?.checked ? `on${$('#fieldC2Persistence')?.checked ? ' · persistence' : ''}${$('#fieldC2Lateral')?.checked ? ' · lateral' : ''}` : 'off' }, { k: 'TypeSafe', v: $('#fieldTypesafe') ? $('#fieldTypesafe').value : 'auto' }, { k: 'Compliance', v: (['fieldCompPci', 'fieldCompHipaa', 'fieldCompSoc2', 'fieldCompGdpr'].map((id) => $(`#${id}`).checked && $(`#${id}`).value).filter(Boolean).join(', ')) || 'none' }, @@ -933,8 +934,9 @@ async function startExploitation() { // the same full run it was before this control existed. budget: $('#fieldBudget').value, intercept: $('#fieldIntercept').value, - sandbox: $('#fieldSandbox').value || undefined, + sandbox: $('#fieldSandbox').value, revalidatePoc: $('#fieldRevalidatePoc').checked, + evasion: $('#fieldEvasion')?.checked ?? true, typesafe: $('#fieldTypesafe') ? $('#fieldTypesafe').value : undefined, compliance: ['fieldCompPci', 'fieldCompHipaa', 'fieldCompSoc2', 'fieldCompGdpr'].map((id) => $(`#${id}`).checked && $(`#${id}`).value).filter(Boolean), tokenLimit: Number($('#fieldTokenLimit').value) || undefined, @@ -9790,7 +9792,6 @@ const EXTRA_UI = [ { key: 'agentTools', label: 'Agents can request tools', help: 'API-model agents may call catalog tools in a bounded loop.' }, { key: 'workerTools', label: 'Worker tool loop', help: 'Reactive engine: each worker plans, runs real tools and observes.', needs: 'reactive' }, { key: 'provision', label: 'Install missing tools', help: 'Allow apt / pipx / go installs for tools that are not present.' }, - { key: 'evasion', label: 'OPSEC / evasion', help: 'Drop the X-NeuroSploit-Scan header to reduce attribution (authorized stealth).' }, { key: '_mcpLink', type: 'link' }, ] }, { group: 'Agents & models', items: [ @@ -9851,7 +9852,7 @@ function renderExtraOptions() { ${active && repl ? '
With these options on, the run starts without live input (you cannot type to it mid-run).
' : ''}
${EXTRA_UI.map((g) => { const items = g.items.map(field).join(''); return items ? `
${esc(g.group)}
${items}
` : ''; }).join('')}
`; $('#btnFullPower', sec)?.addEventListener('click', () => { - state.extra = { ...state.extra, tools: true, agentTools: true, workerTools: true, provision: true, economy: true, evasion: true, checkpoints: 'record' }; + state.extra = { ...state.extra, tools: true, agentTools: true, workerTools: true, provision: true, economy: true, checkpoints: 'record' }; renderExtraOptions(); if (typeof toast === 'function') toast('Full power enabled — review scope and authorization before launching.', 'info'); }); diff --git a/web/public/index.html b/web/public/index.html index 54a04ee..bda90a0 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -853,7 +853,8 @@
@@ -865,7 +866,8 @@ -
+
+
diff --git a/web/server.js b/web/server.js index c7fdbf4..cc15d57 100644 --- a/web/server.js +++ b/web/server.js @@ -657,6 +657,17 @@ function envOverrides() { return env; } +// The backend auto-enables revalidation / evasion / an already-present sandbox. +// When the operator explicitly turns one off in the wizard, translate that into +// the matching NEUROSPLOIT_NO_* opt-out for the child run. +function autoOptOutEnv(body) { + const env = {}; + if (body.revalidatePoc === false) env.NEUROSPLOIT_NO_REVALIDATE = '1'; + if (body.evasion === false) env.NEUROSPLOIT_NO_EVASION = '1'; + if (body.sandbox === 'host') env.NEUROSPLOIT_NO_SANDBOX = '1'; + return env; +} + async function cloudEnvOverrides(cloudProvider) { if (!cloudProvider) return {}; const integs = await readConfig('integrations'); @@ -2216,8 +2227,10 @@ function buildArgs(body) { if (body.sms) args.push('--sms', body.sms); if (body.typesafe) args.push('--typesafe', body.typesafe); if (body.intercept && body.intercept !== 'off') args.push('--intercept', body.intercept); - if (body.sandbox) args.push('--sandbox', body.sandbox === 'default' ? '' : body.sandbox); + if (body.sandbox === 'default') args.push('--sandbox', ''); + else if (body.sandbox && !['auto', 'host'].includes(body.sandbox)) args.push('--sandbox', body.sandbox); if (runOnly && body.revalidatePoc) args.push('--revalidate-poc'); + if (body.evasion) args.push('--evasion'); if (runOnly) for (const fw of body.compliance || []) args.push('--compliance', fw); // Authorization: the signed grant caps the scope, the extra in-scope entries // can only narrow within it, and the environment scales every risk score. @@ -2266,7 +2279,7 @@ async function startJob(body) { jobs.set(id, job); const cloudEnv = cloudProv ? await cloudEnvOverrides(cloudProv) : {}; - const child = spawn(BIN, args, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...cloudEnv } }); + const child = spawn(BIN, args, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...cloudEnv, ...autoOptOutEnv(body) } }); job.child = child; let buf = ''; const onData = (chunk) => { @@ -2324,7 +2337,9 @@ function authArgs(body) { if (body.typesafe) args.push('--typesafe', body.typesafe); if (body.decisionBackend) args.push('--decision-backend', body.decisionBackend); if (body.intercept && body.intercept !== 'off') args.push('--intercept', body.intercept); - if (body.sandbox) args.push('--sandbox', body.sandbox === 'default' ? '' : body.sandbox); + if (body.sandbox === 'default') args.push('--sandbox', ''); + else if (body.sandbox && !['auto', 'host'].includes(body.sandbox)) args.push('--sandbox', body.sandbox); + if (body.evasion) args.push('--evasion'); // C2 is global (launcher-level), like the authorization ceiling. if (body.c2) { if (body.c2Authorization) args.push('--c2-authorization', body.c2Authorization); @@ -2434,7 +2449,7 @@ async function startJobViaRepl(body) { // The REPL session inherits the engagement's authorization from argv, so the // ceiling is set before the first command is scripted into it. - const child = spawn(BIN, auth, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...(body.allAgents ? { NEUROSPLOIT_ALL_AGENTS: '1' } : {}) } }); + const child = spawn(BIN, auth, { cwd: ROOT, env: { ...process.env, ...envOverrides(), ...(body.allAgents ? { NEUROSPLOIT_ALL_AGENTS: '1' } : {}), ...autoOptOutEnv(body) } }); job.child = child; let buf = ''; const onData = (chunk) => {