Commit Graph
505 Commits
Author SHA1 Message Date
18b97faeff Grounded chat with scoped tools, and an address for every view (#136)
* feat(chat): tools through the toolbox, and citations the server checks

The chat read the engagement and answered from it. Three things were wrong
with that, and the first is mine.

Records went into the prompt unguarded. A finding's evidence is a copy of what
a TARGET sent us, so pasting it raw hands the target a turn at writing our
instructions. ARTEX fences its mention snapshots; we did not. Every record is
now fenced and prefaced as data, and every field is bounded, so neither a long
response body nor a crafted one steers the answer.

Nothing checked the answer. This harness has already produced a Critical whose
proof was `{"token":"eyJ..."}` — a placeholder, an attack described rather than
run. The model now cites [run:ID] and [finding:ID#N], and the server resolves
each citation against the files on disk before the answer is final. An
unresolved citation is reported with a reason, because two failures look alike
and are not: a record that exists but was not attached means the model is
reciting, and one that exists nowhere means it is inventing. Evidence carrying
placeholder tokens is flagged to the model as described, not demonstrated.

The chat could not act. It now runs real tools through agentic_tools, which
means through toolbox::run — so the scope built from the run's own target, the
operator's constraints, the sandbox and toolbox-audit.jsonl all apply. The
chat gets no path to the network an agent does not have. Tools need an
attached run because the run's target is the only thing that authorises a
packet; with none, it reads only.

Two defects found by running it against a live target rather than reasoning
about it: the catalog was missing, so the model invented tool ids (`http_get`,
`exec`) and burned the budget being told they do not exist — the same failure
visible in today's reactive run; and a loop that stopped early returned its raw
transcript as the answer. It now synthesises from what the tools actually
returned, and says plainly when they established nothing.

Verified against runs/ns-1787519539-testaspnet_vulnweb_com: 28 citations, all
resolved, validated and unvalidated findings correctly separated. A forced
answer citing one real-but-unattached run and one fictional run classified both
correctly. Against evidelo the loop held scope (evidelo.com.br), chose real
catalog tools, and — with the host missing the binaries — reported that it
could not fetch robots.txt rather than reciting paths it had in context.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(console): give every view an address

The console was one page that answered to one URL. Clicking Chat and clicking
Findings left you at `/`, so you could not bookmark a view, send a colleague
the findings list, reload without being thrown back to home, or use the back
button for anything but leaving the app.

Each view now has a real path (/dashboard, /chat, /findings, /assets/…), kept
in step with history: a click pushes, boot and openRun replace, and popstate
switches without writing back so the back button is not fought. The server
serves index.html for extensionless paths, and the app reads the path on boot
and opens that view. A request for a missing file still 404s — an extension
means an asset.

Separate pages would have given the same addresses and cost a refactor of an
11k-line app.js, plus a reconnect of the four SSE streams on every navigation,
which is the one thing this console must not drop. Splitting is worth doing
later as ES modules behind one page, not as separate pages.

Two things that would have broken on a nested route: the favicon was the only
relative asset path, so /assets/networks asked for /assets/logo.svg; and the
auth gate only covered '/', so the new fallback would have served the console
shell to an unauthenticated request for /chat. Both fixed here — the gate now
covers anything that resolves to the shell.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Joas A Santos <34966120+CyberSecurityUP@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-12-05 01:10:06 -03:00
d50209482d Fix the six defects behind a run that found nothing (#138)
* fix(select): cap a pinned set by recon fit, not by catalogue order

A run against a Cloudflare-fronted JS site pinned 232 agents with
--max-agents 3. The three that ran were a Java RCE detector, a PHP
webshell exploit and a cleartext check. Replaying that run's own recon
through the ranker puts them 223rd, 245th and 115th of 265.

Three defects, each of which alone was enough:

- `cap_pinned` truncated the pinned list, so the survivors were decided
  by position in the catalogue. Ranking by recon fit now decides, and
  the cap is still honoured. A pinned set that fits under the cap keeps
  the operator's exact order.

- `has_java` tested `recon.contains("java")`, which "javascript"
  satisfies. Every page with a script tag read as a JVM service, so the
  "no Java here" exclusion could never fire. `has_ai` had the same shape:
  a bare "ai" is inside "domain" and "mail".

- The run reported "intelligently selected N agent(s) matching recon" on
  the pinned path, which by design skips recon-based selection. It now
  names the decision that produced the list.

An agent the recon does not support still runs when pinned — the
operator named it — but is now called out, with what to change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(run): the five other defects the evidelo run exposed

One run produced 0 validated findings. Each of these contributed.

Provisioning was never reached. `provision` was gated on
NEUROSPLOIT_PROVISION alone, a flag the REPL does not pass, so a
sandboxed run announced "auto-installs tools" and then spent its rounds
discovering gau, subfinder and amass were missing — telling the operator
to "pass --provision" for an install it was free to perform inside a
throwaway container. A sandbox is now sufficient; the host still needs
the explicit flag.

Provisioning never checked its own work. Every install ended in
`2>/dev/null; true`, so "📦 provisioning Kali recon tools: …" was a
promise with no result. It now re-checks and reports what landed.

A reasoning-only reply lost the agent's turn. `cleartext_transmission`
spent its turn inside <thinking> and <thought> deciding to run curl and
stopped. That carries none of the markup `looks_like_tool_call` knows,
so the existing recovery never fired and the operator was told the model
"may have produced malformed JSON" — the wrong diagnosis. Such replies
now route to the same recovery, named correctly. The JSON scanner also
reads past reasoning blocks, and still finds JSON that only exists
inside one.

An unreadable verdict counted as a rejection. `vote()` returned
(confirmed, total), so a validator answering with prose and one reading
the evidence and saying no both arrived as `0/1`. With the one-model
panel this run had, that difference decides everything. The tally now
keeps the three answers apart and says "validator gave no verdict".

Pool health named providers the run never called. `FailoverChain::from_env`
walked a hand-kept list of eleven provider names that does not include
orcarouter — the provider this run used — so it reported anthropic,
deepseek and ollama all `[Closed] reqs=0` and nothing about the one
doing the work. It now walks the provider registry, which covers
console-registered providers too, and an untouched provider is listed as
unused instead of as pool health.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Joas A Santos <34966120+CyberSecurityUP@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
v4.6.1
2026-12-05 00:58:55 -03:00
Joas A Santos d0ea56d9fe Merge pull request #135 from JoasASantos/feat/chat
feat(chat): ask about the engagement, answered from its own records
2026-12-04 14:44:39 -03:00
Joas A SantosandClaude Opus 5 0076e8715e feat(chat): a chat view in the console, over the engagement's own records
Backend: conversations persist under .neurosploit/chats, /api/chat/:id/send
drives `neurosploit chat` and relays its JSON lines over SSE. The first
message names the conversation, because a list of "New conversation" stops
being usable at about two.

Frontend: conversation list, message stream, model picker over the providers
that actually have a key, and an @ picker.

The @ picker is the point. It offers runs, targets and a findings search, and
those resolve server-side out of runs/ before the model sees anything — so an
answer quotes a finding that exists rather than describing the class of thing
it might be. Verified: asked how many findings a run had and at what severity,
it answered "2 findings, both Low", which is what that run holds.

What the resolver could NOT resolve is rendered in the answer's footer. A
reference that silently vanishes reads as the model not knowing, when it was
never told — and that is the failure an operator would misread as the target
being clean.

Answers render through a small markdown pass that escapes first, so a
finding's evidence cannot inject markup into the console.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 14:44:30 -03:00
Joas A SantosandClaude Opus 5 6cf9ffd5ed feat(chat): ask about the engagement, with its own records as context
The REPL is a slash-command console and `run` is a whole engagement. Neither
answers "what did we find on this target, and what should I look at next" —
the question an operator asks most and currently answers by reading JSON out
of runs/.

Add `neurosploit chat`: a JSON request on stdin, JSON lines on stdout, so
neither side parses prose. It goes through ModelPool, so it inherits the
keystore, the custom provider profiles and the cost ledger rather than
speaking HTTP on its own.

References resolve from disk before the model sees anything. @run pulls a
run's findings, @finding searches titles and endpoints across every run,
@target lists the runs against one. The resolver emits what it resolved AND
what it could not, because a reference that silently vanishes reads as the
model simply not knowing — and a model with no records will answer from the
shape of the question instead of the engagement.

Verified against a real run: with the reference resolved it quotes the
findings' exact titles and the token in their evidence; with the reference
missing it says it has no records rather than describing what such a finding
usually looks like.

The system prompt drops the definitions and the authorization warnings. The
operator is running the engagement and scope is enforced elsewhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 14:41:09 -03:00
Joas A Santos 9c26b0b318 Merge pull request #134 from JoasASantos/feat/custom-provider-profiles
feat(providers): custom provider profiles, in the harness and the CLI
2026-12-04 14:35:55 -03:00
Joas A SantosandClaude Opus 5 c89725c013 feat(cli): neurosploit provider — register any endpoint without editing source
key add --base-url --name registers a plain OpenAI endpoint on a direct
connection. The profile added alongside it carries proxy, session header,
user agent, rate limits, context window and pricing, and none of that was
reachable from the CLI.

Add a provider subcommand: list, show, add, remove.

add merges rather than replaces, so changing one setting leaves the rest
alone — the same reason register merges. show prints what is set and what
falls back, including that pricing left unset means the cost ledger guesses
from the model name, which tells it nothing about a private gateway.

list marks each provider with whether its key is set, and whether it is
proxied, priced or rate-limited, so a misconfigured one is visible without
opening it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 14:35:48 -03:00
Joas A SantosandClaude Opus 5 a00c856960 feat(providers): full custom provider profiles, not just a base URL
The registry held {name: base_url}. That covers an endpoint speaking plain
OpenAI over a direct connection — most of them, and none of the awkward ones:
a gateway wanting its own session header, an endpoint only reachable through a
SOCKS proxy, a model whose price the cost ledger cannot guess from its name, a
tenant whose rate limit sits far below the provider's published one.

Add CustomProvider: base_url, wire format, model list, proxy, session header,
user agent, rps/rpm, context window, and four prices. Entries written as a
bare URL string still load, so an upgrade does not lose anyone's providers,
and `register` now merges rather than replaces — editing the URL from the CLI
no longer drops a proxy and pricing set elsewhere.

Every field changes behaviour; none is stored for display:

  proxy and user_agent    build a per-provider reqwest client, cached on the
                          settings so an edit takes effect without a restart
  session_header          carries a per-process id, for gateways that pin
                          prompt-cache routing on one
  models                  reaches the Provider, so pickers can offer them
  price_*                 overrides pricing_for, which otherwise guesses from
                          the model name — and a private gateway's model name
                          says nothing about what the operator is billed

A proxy that reqwest rejects does not fall back to a direct connection. It
points at a dead local port and says so, because silently leaving the proxy is
the one outcome an operator routing through one cannot afford. Malformed
proxies and unknown wire formats are refused at save time.

Seven tests, including that a bare-URL registry still loads and that
registering a URL keeps the rest of the profile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 14:31:10 -03:00
Joas A Santos 2a14ecf6d0 Merge pull request #133 from JoasASantos/fix/run-futures-not-send
fix(pipeline): keep the run futures Send so the binaries compile again
2026-12-04 14:18:52 -03:00
Joas A SantosandClaude Opus 5 90bd20f143 fix(pipeline): keep the run futures Send so the binaries compile again
Neither binary has compiled since traffic recording landed. The release
binary on disk was three weeks older than the source, which is why.

At the end of run(), traffic_record::store() returns a std::sync::MutexGuard
that stayed alive across the tx.send(...).await two lines below. A MutexGuard
is not Send, so the enclosing future is not Send, and both app/src/main.rs
and app/src/tui.rs hand these futures to tokio::spawn, which requires it.

The library kept building clean throughout: nothing in it spawns a run, so
cargo check -p neurosploit-harness never saw the problem. That is the whole
reason this went unnoticed — every check I ran this session was scoped to the
library.

Scope the guard so it drops before the await.

Add a Send assertion over all six run futures. Reverting the scope fix makes
it fail with "future cannot be sent between threads safely", so it catches
the real thing rather than restating it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 14:18:42 -03:00
Joas A Santos 73857f7866 Merge pull request #132 from JoasASantos/test/loop-progression
test(skills): drive the catalogue through several rounds, not one call
2026-12-04 13:09:56 -03:00
Joas A SantosandClaude Opus 5 bc0ee6ca27 test(skills): drive the catalogue through several rounds, not one call
Every test written for the exploration work so far checks a single call to
route. That proves a round can be selected; it does not prove the loop
advances, which is the thing the loop exists for and the thing that was
broken three separate ways this week.

Add a walk that drives the catalogue on disk the way exploration_loop does:
start at round 1, route, record what ran, feed findings back, go again under
the same budget and gates. On a typical web recon it reaches three rounds —

  round 1  no capabilities yet, recon-driven: sqli_error, idor, jwt_manipulation
  round 2  the SQLi minted admin_access, credential, internal_host, so
           sqli_union and sqli_blind arrive by declared chain while
           cloud_iam_privesc and container_escape arrive by capability alone
  round 3  privilege_escalation chains to exposed_admin_panel and
           account_takeover_chain; ssrf and auth_bypass by capability

Three tests: that it runs more than one round and no round repeats the one
before it, that rounds finding nothing wind the loop down rather than paying
for skills on stale recon, and that max_rounds holds under a productive run.

The findings are synthetic, so this proves the machinery advances and stops
where told. It does not show the selections pay off against a real target —
that still needs an engagement with API keys and something to point at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 13:09:47 -03:00
Joas A Santos 8aacc08447 Merge pull request #131 from JoasASantos/fix/capability-overmint
fix(skills): stop minting held capabilities from merely reported weaknesses
2026-12-04 12:36:54 -03:00
Joas A SantosandClaude Opus 5 1de3002d49 fix(skills): stop minting held capabilities from merely reported weaknesses
Seven of the nine capabilities assert the tester HOLDS something — a
credential, a shell, files read. capabilities_from minted them on a keyword
hit anywhere in a finding's title, impact or evidence, so "the cmd parameter
is vulnerable to command injection" minted rce exactly as a demonstrated
shell did. Downstream that sends privilege_escalation and container_escape
after a shell nobody has, and those skills burn a round each.

Gate the seven on a two-sided read. An explicit achievement verb — executed,
recovered, dumped, obtained — settles it; failing that, hedged phrasing
blocks. Both sides are needed because the two co-occur constantly: a confirmed
finding's impact paragraph is normally written in "an attacker could" terms,
so hedging alone would suppress real achievements. A finding already marked
validated passes however it reads.

internal_host and endpoint stay ungated. They state what was revealed rather
than what was seized, and a verbose error disclosing 10.42.7.19 discloses it
whether or not the finding hedges about what that enables.

Five tests covering both directions: that a reported weakness no longer mints
rce, that a demonstrated shell still does, that an achievement verb outweighs
hedged impact prose, that a validated finding is taken at its word, and that
disclosure capabilities are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 12:36:33 -03:00
Joas A Santos f55daf118e Merge pull request #130 from JoasASantos/feat/llm-capability-read
feat(skills): have a model read what findings yielded, alongside the keywords
2026-12-04 12:30:57 -03:00
Joas A SantosandClaude Opus 5 ec656c1ada feat(skills): have a model read what findings yielded, alongside the keywords
capabilities_from matches keywords over a finding's title, impact and
evidence. It misses a credential phrased in words the list does not carry, and
it mints rce from a finding that merely warns command injection is possible.

Add a second reader. capabilities_via_model shows a model the findings and the
nine-name vocabulary and asks what the tester can now do that they could not
before, with the distinction stated: a parameter reported vulnerable to
command injection is not rce, a command whose output is in the evidence is.

The two are unioned, never substituted. Only names from CAPABILITIES survive —
anything the model invents is dropped — and a failed or refused call leaves
the keyword result standing, so the read can only widen what was already
derived. Off with NEUROSPLOIT_CAPABILITY_READ=off, and skipped once the USD
budget is in wrap-up, since it is one call per round.

Fixes a latent bug the new tests surfaced: SkillMeta derived Default, giving
max_rounds 0, while the field's serde default is 2. The key-value frontmatter
parser starts from Default::default() and fills in only the keys a file names,
and route drops any skill that has reached its max_rounds — so a skill whose
frontmatter omitted the key loaded with 0 and was silently unroutable. No
shipped skill omits it, so nothing was broken in practice, but the next one
written would have been. Default is now written by hand to agree with serde.

Five tests: that only vocabulary names survive the filter, that an unusable
reply cannot narrow the keyword result, that route uses supplied capabilities
rather than re-deriving them, that frontmatter without max_rounds is still
routable, and that the two defaults cannot drift apart again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 12:30:31 -03:00
Joas A Santos 020dc2b079 Merge pull request #129 from JoasASantos/feat/capability-chaining
feat(skills): chain on what a finding yields, not only on declared edges
2026-12-04 12:23:45 -03:00
Joas A SantosandClaude Opus 5 5393464134 feat(skills): chain on what a finding yields, not only on declared edges
Chaining ran entirely off `chains:` — skill A names skill B. That is a fixed
graph, so it only carries escalation paths somebody wrote down in advance. A
credential recovered by a skill nobody thought to draw an edge from reached
nothing, and the loop stopped at the end of whatever path was drawn.

extract_intel already mined credentials, secrets, internal hosts and endpoints
out of findings, but only to append as text to the recon context, where it
fired a skill solely if one happened to carry a matching trigger. The CWE
match was worth 5, under the 15 gate, so it could never promote anything on
its own.

Add a `consumes` field over a closed vocabulary of nine capabilities, and
derive from each finding what it actually yielded. Derivation reads the
finding's own fields and prose, not its agent's name, so a credential counts
the same whether default_credentials or sqli_union turned it up. A match is
worth 20, enough to clear the gate alone, because the point is that an
unforeseen path can start a round by itself.

72 skills declare what they consume. On a UNION SQLi yielding credentials, admin
access and an internal host, round 2 now reaches cloud_iam_privesc,
container_escape and exposed_admin_panel — none of which sqli_union names.

Five tests, three on the catalogue on disk: that a credential from a skill
declaring no chains at all still reaches credential-consuming skills, that a
disclosed internal host does the same, that a capability match clears the
round gate, that an empty finding set mints nothing so the anti-flooding
guarantee holds, and that every declared capability is one the deriver can
actually produce.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 12:23:23 -03:00
Joas A Santos d82462a42d Merge pull request #128 from JoasASantos/feat/vulns-frontmatter-complete
feat(skills): frontmatter for the remaining vulns — 480 of 530
2026-12-04 12:10:31 -03:00
Joas A SantosandClaude Opus 5 d9f540fb37 feat(skills): frontmatter for the remaining vulns; 480 of 530 covered
173 more skills, 218 chain edges: API and GraphQL surface, auth and session,
client-side, request smuggling and caching, exposure and misconfiguration,
IIS and ASP.NET, supply chain, business logic and payments, Kubernetes and
container runtime, and the LLM skills under vulns/.

Cloud and Kubernetes skills take the modes that reach that surface rather than
web alone, so a host engagement that lands on a kubelet can follow it.

Some carry chains but no triggers: poc_developer, cve_poc_finder,
cve_exploit_scripter, cve_research_analyst, postgres_superuser_rce,
clickjacking_poc, csrf_poc. They elaborate a finding that already exists —
selecting them off recon would have them write a proof for a vulnerability
nobody confirmed, or attempt RCE with no injection in hand.

The generator's stoplist rejected five triggers too common to discriminate:
'header', 'log', 'file', 'error', 'model'. Replaced with terms that do.

meta/ (24) and chains/ (22) stay without frontmatter, and a test now pins
that: meta/ is orchestration roles and pipeline utilities, so triggers there
would have the exploration loop launch the reporter as an exploitation agent;
chains/ is recipes attack_chain consumes on its own path, so triggers would
fire the same recipe twice. A second test requires the mode-specific
categories to declare their modes, since a routable skill naming none fires in
every engagement.

The three ai/ copies of names that also live in vulns/ stay bare on purpose:
dedup keeps the copy carrying the metadata, and giving both frontmatter would
make that choice arbitrary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 12:10:08 -03:00
Joas A Santos dd14ed499d Merge pull request #127 from JoasASantos/feat/mobile-ai-skills
feat(skills): mobile, binary and AI frontmatter; dedupe colliding names
2026-12-04 12:05:47 -03:00
Joas A SantosandClaude Opus 5 5db5cffab5 feat(skills): mobile, binary and AI frontmatter; dedupe colliding names
Three skills ship under the same name in two category directories:
llm_system_prompt_leak, llm_jailbreak and llm_excessive_agency each exist in
vulns/ and ai/. Both copies reached the catalogue, so route could pick the
same skill twice, and by_name — built by collect — resolved to whichever came
last. For llm_system_prompt_leak that meant get() returned the bare ai/ copy
while chain_map had been built from the vulns/ copy carrying the frontmatter.

load_catalog now keeps one copy per name, preferring the one that declares
routing metadata and falling back to the higher priority.

Frontmatter for 64 more skills, 108 chain edges. The binary_* skills are
scoped to mobile, host and whitebox rather than mobile alone: they analyse any
compiled artefact, and a host engagement that harvests a Windows binary should
reach them.

The twelve redteam_* skills carry chains but no triggers. They are jailbreak
strategies rather than findings, so recon must not select them directly;
llm_jailbreak chains into them once there is a guardrail worth pushing on.

307 of 530 skills now carry frontmatter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 12:05:18 -03:00
Joas A Santos b7496ea8a6 Merge pull request #126 from JoasASantos/feat/mode-scoped-skills
feat(skills): scope skills by engagement mode, cover 152 more
2026-12-04 11:53:32 -03:00
Joas A SantosandClaude Opus 5 de6ba6d63d feat(skills): scope skills by engagement mode, cover 152 more
load_catalog loads all ten category directories whatever the engagement is,
and route never looked at a skill's category. So giving code_sqli the trigger
"sql" would have launched a source-review agent during a black-box web run
against a target with no source to read, and the AD skills would have fired on
any recon mentioning ldap or smb.

Add a `modes` field. A skill that names its modes runs only in those; one that
names none runs anywhere, which is what the 91 skills from the previous change
rely on. The mode comes from the same string each site already passes to the
coverage ledger.

Frontmatter for 152 more skills, 179 chain edges: recon discovery feeders,
container image scanning, Active Directory, Linux and Windows local privesc,
AWS, GCP and Azure, and the 84 source-review skills scoped to whitebox and
greybox. 243 of 530 now carry it.

Priority was being added unconditionally, so any skill at priority >= 30
scored 15 with nothing matching and cleared the gate on an empty recon. The
field documents itself as ordering skills that are "equally triggered" — a
tiebreaker — so it now applies only once a skill has matched. An anti-flooding
test on meaningless recon caught this.

Six tests on the catalogue on disk: that a web run never picks source-review
or host skills, that whitebox and host runs do reach theirs, that nothing
fires on meaningless recon in any mode, and that every chain edge resolves.
The generator refuses triggers under two characters or on a stoplist of terms
too common to discriminate, which rejected five on the first pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:52:58 -03:00
Joas A Santos cb5a079971 Merge pull request #125 from JoasASantos/fix/exploration-budget
fix(skills): opening selection must not spend the exploration budget
2026-12-04 11:22:05 -03:00
Joas A SantosandClaude Opus 5 5cea33740e fix(skills): stop the opening selection from spending the exploration budget
Two limits kept the exploration loop from running even once frontmatter made
its skills routable.

skills_ran is seeded with the agents the opening selection already ran, so it
serves two purposes at once: dedup, and the meter for max_total_skills. That
default is 20. Measured across 17 recorded engagements, 7 opened with 20 or
more agents — two with 232 — so next_round returned empty on its first call
and the loop broke before launching anything. Count the skills this loop
launched separately and budget against that; skills_ran keeps doing dedup.

The round guard was off by one. round starts at 1 and the guard read
`round >= max_rounds`, so max_rounds: 3 gave two rounds. Now `round >
max_rounds`, and 3 means 3.

Updates max_rounds_respected, which asserted at round 1 and so encoded the
off-by-one; it now asserts at round 2, keeping its intent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:21:35 -03:00
Joas A Santos 72f21ed13b Merge pull request #124 from JoasASantos/feat/skill-frontmatter
feat(skills): routing frontmatter so the exploration loop can run
2026-12-04 11:17:41 -03:00
Joas A SantosandClaude Opus 5 68c1f5d879 feat(skills): add routing frontmatter so the exploration loop can run
No shipped agent had frontmatter. Not five, as a `grep '^---'` suggests —
that matches horizontal rules in the body. Zero files begin with it.

That made the exploration loop dead code. `route` scores a skill as
10*(trigger hits) + 0.5*priority + 25 per chain edge from a finding, and
its no-metadata fallback is gated on `round == 0`. The loop starts at
`round = 1`. So every skill scored 0.0, was dropped by the `score > 0.0`
filter, `next_round` returned empty, and the loop hit `break` on its first
iteration — every run, in all six modes.

Add frontmatter to 91 core skills: 207 chain edges across injection, file
access, SSRF and cloud, auth and access control, client-side,
deserialisation, CMS, infra and LLM. Priority is >= 10 throughout, the floor
at which a single trigger hit clears the score >= 15 gate that `next_round`
applies past the first round.

Chains encode the escalation paths the harness is meant to walk on its own:
ssrf to cloud metadata to IAM privesc, sqli to postgres RCE, file_upload to
command_injection, sourcemap_exposure to js analysis to api_key_exposure,
jwt_manipulation to alg confusion to privilege_escalation.

Four tests, three of them against the shipped catalogue on disk: that it
routes at round 1, that a confirmed ssrf finding pulls cloud_metadata_exposure
in by chain, that no chain edge names a skill that does not exist, and a
regression pair pinning the round-1 behaviour that was broken.

439 skills still carry no frontmatter and reach only the round-0 sweep.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:17:08 -03:00
Joas A Santos f8856e6fe4 Merge pull request #123 from JoasASantos/feat/kali-native-console
feat(docker): run the console on the Kali toolbox image
2026-12-04 11:10:01 -03:00
Joas A SantosandClaude Opus 5 eaff7a7cf5 feat(docker): run the console on the Kali toolbox image, add .dockerignore
The console ran on debian-slim and reached tools by spawning a sibling Kali
container per command, through the mounted docker socket. Build the console
FROM the toolbox image instead: nmap, sqlmap, ffuf, nuclei, impacket, Ghidra
and the rest are on PATH in the same container the harness runs in. A run
set to sandbox "host" now executes tools in place; picking an image in the
UI still spawns an isolated sibling, so isolation stays available.

This makes build order load-bearing — the console image cannot resolve its
base until the toolbox image exists. install.sh builds kali-base first, then
neurosploit. Renamed the service from kali-worker to kali-base to say what it
is now: a base layer, not a worker pool.

Add .dockerignore. The build context was 19GB, 18GB of it neurosploit-rs/
target/, which the builder stage recompiles anyway; runs/ carried engagement
data into the context as well. agents_md/ is explicitly preserved.

Dropped NS_WORKER_IMAGE and NS_SANDBOX from the compose environment: neither
is read anywhere in the harness or the web server. The sandbox image comes
from the per-run --sandbox flag.

Also fixes install.sh printing a literal ${NS_PORT:-8787} in its closing
banner, and makes it wait for the console to answer before declaring success.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:09:31 -03:00
Joas A Santos 7ec16de34c Merge pull request #122 from JoasASantos/fix/dashboard-severity-fair
fix(web): severity counts, FAIR dedup/damping, PR modal markup
2026-12-04 10:48:46 -03:00
Joas A SantosandClaude Opus 5 7c255ada3e fix(web): severity counts from /api/issues, FAIR dedup and damping, modal markup
Severity cards read 0 for critical/high/medium/low: /api/db/stats is empty
without PostgreSQL and per-run `severities` is unpopulated. Count from
/api/issues, which carries the per-finding severity.

FAIR exposure read $400M most likely / $1.6B max. Two modelling errors:
the same finding reported by several agents was counted once per report,
and thirty criticals on one host were summed as thirty independent
breaches. Collapse duplicates on (title, target), then damp additional
findings per target harmonically — an attacker compromises a host once.
Lands at $89.2M / $362M on the same data.

PR review modal used classes that are not display:block, so labels and
inputs ran inline. Use the field-group / field-label / field-help pattern
the other modals use.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 10:48:22 -03:00
Joas A Santos bf4f3f74e2 Merge pull request #121 from JoasASantos/fix/frontend-polish
fix(web): frontend polish — stats, toolbox, PR review
2026-12-04 10:37:00 -03:00
Joas A SantosandClaude Opus 4.6 76ce3101cc fix(web): dashboard stats in pentests view, toolbox JSON parse, PR review modal
- Move dashboardStats into pentests view (was global, polluting all pages)
- Make stats cards reflect actual run data from file storage
- Fix toolbox JSON parsing: separate stdout/stderr in runCli, handle
  array JSON in toolsCall (was only matching object patterns)
- Add New PR Review modal with repo/PR input form
- Target table click now switches to pentests view
- Dashboard cards: severity-colored layout with CSS
- Strip redundant Storage card from stats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 10:36:29 -03:00
Joas A Santos 00b2458e14 Merge pull request #120 from JoasASantos/feat/v5-phase3-polish
feat(v5): Kali worker + user registration + login UI
2026-12-04 10:22:56 -03:00
Joas A SantosandClaude Opus 4.6 796447ab89 feat(v5): enhanced Kali worker, user registration, login UI overhaul
- Dockerfile.kali: add Ghidra 11.2.1 for headless RE analysis, evil-winrm,
  awscli, kubectl, mitmproxy, gdb/ltrace/strace, aircrack-ng, JDK 17
- server.js: add /api/auth/register endpoint (first user = admin),
  fix auth status response keys for login page consistency
- login.html: redesigned login with registration flow, improved
  glassmorphism styling, better error handling and animations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 10:22:34 -03:00
Joas A SantosandClaude Opus 4.6 eabfffe4c1 fix(web): pg pool dedup, DATABASE_URL support, login token key consistency
- Remove duplicate pgPool/pgQuery/pgSaveRun/pgCompleteRun/pgGetRuns/pgGetFindings
  declarations in server.js (caused SyntaxError at startup)
- Add DATABASE_URL connection string support alongside NS_PG_*/POSTGRES_* env vars
- Add connection test on startup with graceful fallback to file storage
- Fix login.html localStorage key mismatch: getItem('ns-token') → 'ns_token'
  to match the key used by setItem and app.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 10:15:57 -03:00
Joas A Santos 8ba2a710d2 Merge pull request #119 from JoasASantos/feat/v5-phase2-planner-re-pool
feat: v5 phase 2 — planner/worker, LLM failover, RE integration, traffic recording
2026-12-04 10:13:45 -03:00
Joas A SantosandClaude Opus 4.6 14cefda590 feat(v5): planner/worker architecture, RE integration, LLM failover, traffic recording
Phase 2 of the v5 autonomous refactoring:

- Planner/Worker loop (planner_loop.rs): intent-driven exploration with
  shared graph state, dependency tracking, parallel worker execution,
  budget-aware termination. Opt-in via NEUROSPLOIT_PLANNER=1. Wired
  into all 6 pipeline modes (web, host, whitebox, greybox, container,
  mobile).

- LLM failover pool (llm_pool.rs): per-provider circuit breakers with
  configurable threshold/recovery, rate limiting, noise profiles
  (quiet/balanced/aggressive), provider health tracking.

- Reverse engineering integration (re_integration.rs): Ghidra headless
  decompilation with fallback to objdump/readelf/strings. Binary triage,
  vuln pattern detection, attack surface scoring.

- Traffic recording (traffic_record.rs): full HTTP capture with WAF
  detection, search, HAR export, JSON persistence.

- Finding dedup (finding_dedup.rs): BM25-based similarity scoring.
- Hypothesis tracking (hypothesis.rs): open/closed investigation directions.
- Noise profiles (noise_profile.rs): quiet/balanced/aggressive pacing.
- Scope relaxation: auto_expand_discovered, follow_auth_redirects, expand_asn.
- PostgreSQL wiring with full schema.

Build: 0 errors, 0 warnings, 1150 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 10:13:21 -03:00
Joas A SantosandClaude Opus 4.6 2a3e13aeef feat(harness): v5 phase 2 — planner/worker, LLM failover, RE, traffic recording
Planner/Worker architecture:
- Intent-graph-driven exploration with LLM planner emitting ExplorationIntents
- Async workers claim and execute intents in parallel
- Plan → execute → harvest → replan loop until convergence
- Dependency-aware intent scheduling

LLM failover pool:
- Circuit breaker per provider (threshold + timeout recovery)
- Token bucket rate limiter per provider
- FailoverChain auto-detects providers from env API keys
- Health tracking: latency, error rate, total tokens
- complete_with_failover() wraps pool calls with health recording

Reverse engineering integration:
- Ghidra headless + radare2 binary analysis backends
- BinaryInfo, FunctionInfo, StringInfo, ImportInfo extraction
- VulnIndicator scoring (dangerous functions, format strings, crypto)
- Attack surface scoring algorithm
- format_for_llm() injects analysis into agent prompts
- re_pipeline() async entry point returning Finding vec

Traffic recording:
- Full HTTP request/response recording with HAR 1.2 export
- TrafficEntry with agent attribution, tags, finding linkage
- WAF detection from response patterns
- Global store with search, filter, stats
- JSON persistence + HAR export at run end

Finding dedup:
- BM25-based textual similarity deduplication
- Multi-signal scoring: vuln type, endpoint, parameter, token overlap
- Higher severity/evidence kept on merge

Hypothesis tracking:
- Investigation directions with Open/Confirmed/Disproved lifecycle
- Evidence accumulation (for/against)
- generate_from_recon() creates initial hypotheses
- Persistence across rounds via JSON save/load

Noise profiles:
- Quiet/Balanced/Aggressive scan pacing
- Tool-specific rate-limit flags injected into agent prompts
- nmap, nuclei, httpx, katana, ffuf, dalfox, sqlmap, gobuster, feroxbuster

Scope relaxation:
- auto_expand_discovered, follow_auth_redirects, expand_asn_ranges
- registrable_domain() helper for scope expansion

Build: 0 errors, 0 warnings, 1150 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 10:13:02 -03:00
Joas A Santos 508c36d562 Merge pull request #47 from JoasASantos/dependabot/cargo/neurosploit-rs/quinn-proto-0.11.19
chore(deps): bump quinn-proto from 0.11.14 to 0.11.19 in /neurosploit-rs
2026-12-04 01:38:25 -03:00
Joas A Santos bf9bac4d62 Merge pull request #48 from JoasASantos/dependabot/cargo/neurosploit-rs/rustls-0.23.46
chore(deps): bump rustls from 0.23.40 to 0.23.46 in /neurosploit-rs
2026-12-04 01:38:15 -03:00
Joas A Santos de6f9166b4 Merge pull request #118 from JoasASantos/feat/v5-autonomous-refactor
feat: NeuroSploit v5 — autonomous pentest agent refactor
2026-12-04 01:37:56 -03:00
Joas A SantosandClaude Opus 4.6 f5dcc3f459 feat(infra): Docker + PostgreSQL + Kali worker setup
- docker-compose.yml: PostgreSQL 16, neurosploit app, kali-worker
- Dockerfile: multi-stage Rust build + Node runtime
- Dockerfile.kali: kalilinux/kali-rolling with full pentest toolbox
- install.sh: auto-generate credentials, build images, start services
- db/schema.sql: PostgreSQL schema for runs, findings, auth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:37:20 -03:00
Joas A SantosandClaude Opus 4.6 1c7a0d0a9b feat(web): auth system, Morse provider, SSE exploration events
Auth middleware (zero external deps):
- JWT + scrypt authentication in server.js
- Auto-generated default credentials from env vars
- Rate-limited login (10/min), change-password, verify endpoints
- Glass-morphism login page with first-login detection

Morse provider:
- Added to server.js PROVIDERS array and .env.example
- Uncensored open-weight models with native tool calling

Frontend:
- Bearer token injection in api() calls
- 401 auto-redirect to login
- SSE exploration round events

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:37:14 -03:00
Joas A SantosandClaude Opus 4.6 36d6cb216a feat(harness): add USD budget tracking and cost enforcement
Hierarchical budget system inspired by ARTEX:
- BudgetLedger: thread-safe per-agent and total cost tracking
- ModelPricing: per-million-token pricing for all major providers
  (Anthropic, OpenAI, DeepSeek, Gemini, Qwen, Groq + fallback)
- NEUROSPLOIT_BUDGET_USD env var for max spend enforcement
- wrap_up_mode() at 95% (5% reserve for validation/reporting)
- Cost recording wired into all 4 LLM completion paths
- cost.json persistence to workdir
- Human-readable cost report with top-8 agent breakdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:37:07 -03:00
Joas A SantosandClaude Opus 4.6 53c547d4fb feat(harness): add coverage tracking ledger
Track tested endpoints × vulnerability classes to identify attack surface gaps:
- 55+ web vuln classes, 30+ infra, 17 cloud, 20 mobile, 17 binary
- CWE-to-class mapping for 40+ CWE IDs
- Agent name inference when CWE is missing
- Technology-aware filtering (e.g., GraphQL classes only when detected)
- Gap analysis with priority ranking
- Persistence to coverage.json for cross-run accumulation
- Integrated into exploration loop for all modes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:36:59 -03:00
Joas A SantosandClaude Opus 4.6 77aadf5ed1 feat(harness): exploration loop, sourcemap harvest, WAF adaptive bypass
Major pipeline enhancements:

1. Reusable exploration_loop() function wired into ALL modes:
   - run() (web), run_host(), run_greybox(), run_whitebox(),
     run_container(), run_mobile()
   - Skill-driven chained exploitation with FindingIntel extraction
   - Re-recon enrichment: discovered intel feeds back into agent context

2. Deterministic sourcemap harvest:
   - Scans JS bundles for .map files after CAG collect
   - Extracts secrets (AWS keys, API keys, GitHub PATs, passwords)
   - Discovers API endpoints from source code
   - Feeds intel into recon context for all agents

3. WAF adaptive bypass:
   - Vendor-specific bypass strategies based on probe detection
   - Covers Cloudflare, Akamai, AWS WAF, Imperva, ModSecurity,
     F5/BIG-IP, Sucuri, Fastly, Azure Front Door
   - Injected into shared_block for all exploit agents

4. attack_chain() wired into whitebox, container, mobile modes
   (previously only web and host had it)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:36:53 -03:00
Joas A SantosandClaude Opus 4.6 19d33f48bb feat(harness): add skill-based architecture with frontmatter metadata
Transform agent markdown files into skills with structured frontmatter:
- triggers: signal patterns that activate the skill
- chains_from: other skills whose findings trigger this one
- cwes: mapped CWE IDs for coverage tracking
- priority: base priority for skill routing
- max_rounds: execution budget per skill

New skill.rs module:
- SkillCatalog: loads and indexes all skill files
- SkillRouter: scores skills based on recon signals + findings
- FindingIntel: extracts credentials, endpoints, secrets from findings
- ExplorationBudget: configurable round/skill limits via env vars
- next_round(): selects next skills to run based on current findings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:36:42 -03:00
Joas A SantosandClaude Opus 4.6 9a087833a6 fix(harness): resolve 37 compilation warnings and 3 bugs
Bug fixes:
- attack_graph.rs: remove unreachable duplicate CWE match arms (915, 384, 770, 799)
- pipeline.rs: wire technology detection flags into agent negative scoring
- pipeline.rs: add Hermes/DeepSeek V2 format detection to looks_like_tool_call

Cleanup: remove 10 unused imports, prefix 7 unused vars, remove 2 unnecessary
mut qualifiers, mark 5 dead code items, remove 1 unnecessary parenthesis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-12-04 01:36:34 -03:00