mirror of
https://github.com/CyberSecurityUP/NeuroSploit.git
synced 2026-12-05 18:44:48 +01:00
Model integration: - neurosploit key add/list/remove/detect: identify a provider from its key, list real callable models, save it — CLI, REPL and web console share one detector/keystore. - custom_providers.rs: register any OpenAI-compatible endpoint under its own name (mycorp:<model>) with no source change or rebuild; several can coexist. - Added deepseek-v4-1-flash-1017, Venice AI, vLLM and LM Studio providers. - Fixed --sandbox/--stealth/--neo4j/--engagement being silently dropped by mobile/container/host/network/ad/cloud/greybox/tui/aitest (only `run` wired them before). Recon depth: - codeindex.rs: whole-repo indexing for whitebox review (functions, routes, call graph, sources/sinks/sanitizers) with cross-file attack-flow tracing, replacing the old first-200-files slice. Multi-pass per-agent context within a budget, plus a variant/circumvention-review doctrine for every SAST agent. - kernel_recon.rs: deterministic Linux kernel facts over an authorized SSH session (version, modules, SUID surface, sysctls) for the LLM to reason from. - winbin_harvest.rs: pulls third-party Windows driver/service binaries off an authorized host over SMB and runs them through the same deep binary pass. - re_tools.rs: embedded read-only radare2/Ghidra/IDA/Frida helper scripts and headless drivers, shared by the mobile/binary and Windows-harvest pipelines. - 38 new mobile/iOS/Android/native-binary research agents (agents_md/mobile/ was empty before — `neurosploit mobile` ran zero agents). - artifact.rs: resolve a local path or URL, classify by magic bytes, hash. - profile.rs: network vs AD vs cloud:<provider> vs web agent-set restriction; `run` now defaults to web-only agents (--all-agents lifts it). Agentic capability / opsec: - agentic_tools.rs: a real iterative tool-calling loop (call a tool, read its actual output, decide the next one) replacing the one-shot batch picker; wired into the existing recon tool round. - noise_governor.rs: the per-host rate/jitter governor existed but was never called anywhere — wired it into the new tool-calling loop under --stealth. - credtest.rs: credentials surfaced by the attack-chain loop are now actually tested (SSH/SMB/WinRM/HTTP-basic) between rounds instead of left for the model to maybe act on; a verified one becomes a confirmed-foothold fact for the next round. - teamboard.rs: exploit agents in the same wave see each other's leads (credentials, endpoints) as they land, with IDs so a finding can cite the lead it was chained from (chains_from is now actually parsed and recorded). - poc_gate.rs: lints PoC scripts for known false-positive patterns (success printed in an error handler, unconditional success, self-injection, a script that reimplements the bug instead of exercising the target) and lowers confidence instead of trusting the script blindly. - taint.rs: detects and strips "poison the AI agent" decoy comments (the SpikeStrip pattern — a random hex key followed by a fabricated CVE/route) regardless of payload wording, by their structural fingerprint. - recon_compact.rs: semantic compaction of recon JSON (halves the largest array, keeps every key) instead of a hard character truncation that silently dropped the tail of the reply. 751 tests passing; release build clean.
71 lines
4.2 KiB
Java
71 lines
4.2 KiB
Java
// NeuroSploit Ghidra headless script: locate cryptographic constants and tables.
|
|
//
|
|
// Usage (headless): ... -postScript NsCryptoConstants.java <out.jsonl>
|
|
//
|
|
// Finds well-known algorithm constants in initialised memory (AES S-box, DES
|
|
// permutation, ChaCha/Salsa sigma, SHA-256 initial state, MD5 init, RC4-style
|
|
// identity tables). The point is not to list crypto but to tell which algorithm a
|
|
// routine implements, so the analyst can check the mode, key source and IV, and
|
|
// to spot custom or deprecated primitives (DES, RC4, MD5) in reachable code.
|
|
//
|
|
// @category NeuroSploit
|
|
|
|
import ghidra.app.script.GhidraScript;
|
|
import ghidra.program.model.address.Address;
|
|
import ghidra.program.model.listing.Function;
|
|
import ghidra.program.model.mem.MemoryBlock;
|
|
|
|
import java.io.File;
|
|
import java.io.FileWriter;
|
|
import java.io.PrintWriter;
|
|
|
|
public class NsCryptoConstants extends GhidraScript {
|
|
|
|
private static final Object[][] SIGNATURES = {
|
|
{ "AES (Rijndael S-box)", new byte[]{ 0x63, 0x7C, 0x77, 0x7B, (byte) 0xF2, 0x6B, 0x6F, (byte) 0xC5, 0x30, 0x01, 0x67, 0x2B, (byte) 0xFE, (byte) 0xD7, (byte) 0xAB, 0x76 }, "modern; check mode (ECB is unsafe), IV reuse and key source" },
|
|
{ "AES (inverse S-box)", new byte[]{ 0x52, 0x09, 0x6A, (byte) 0xD5, 0x30, 0x36, (byte) 0xA5, 0x38, (byte) 0xBF, 0x40, (byte) 0xA3, (byte) 0x9E, (byte) 0x81, (byte) 0xF3, (byte) 0xD7, (byte) 0xFB }, "decryption path of AES" },
|
|
{ "DES (initial permutation)", new byte[]{ 58, 50, 42, 34, 26, 18, 10, 2 }, "deprecated; 56-bit key" },
|
|
{ "ChaCha20/Salsa20 sigma", "expand 32-byte k".getBytes(), "modern stream cipher; check nonce uniqueness" },
|
|
{ "SHA-256 initial state", new byte[]{ 0x6A, 0x09, (byte) 0xE6, 0x67, (byte) 0xBB, 0x67, (byte) 0xAE, (byte) 0x85 }, "check it is not used for password hashing without a KDF" },
|
|
{ "MD5 initial state", new byte[]{ 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }, "broken for integrity/signatures" },
|
|
{ "SHA-1 initial state", new byte[]{ 0x67, 0x45, 0x23, 0x01, (byte) 0xEF, (byte) 0xCD, (byte) 0xAB, (byte) 0x89 }, "broken for signatures" },
|
|
{ "CRC32 table", new byte[]{ 0x00, 0x00, 0x00, 0x00, 0x77, 0x07, 0x30, (byte) 0x96 }, "not a security primitive; check it is not used as one" },
|
|
};
|
|
|
|
@Override
|
|
protected void run() throws Exception {
|
|
String[] args = getScriptArgs();
|
|
File out = new File(args.length > 0 ? args[0] : "ns_crypto_constants.jsonl");
|
|
int hits = 0;
|
|
try (PrintWriter pw = new PrintWriter(new FileWriter(out))) {
|
|
for (MemoryBlock block : currentProgram.getMemory().getBlocks()) {
|
|
if (!block.isInitialized() || monitor.isCancelled()) continue;
|
|
for (Object[] sig : SIGNATURES) {
|
|
byte[] pat = (byte[]) sig[1];
|
|
Address start = block.getStart();
|
|
Address cur = start;
|
|
int perBlock = 0;
|
|
while (cur != null && perBlock < 8) {
|
|
Address found = currentProgram.getMemory().findBytes(cur, block.getEnd(), pat, null, true, monitor);
|
|
if (found == null) break;
|
|
Function f = getFunctionContaining(found);
|
|
// The routine that reads the table is the one worth looking at.
|
|
String refFn = "";
|
|
for (ghidra.program.model.symbol.Reference r : getReferencesTo(found)) {
|
|
Function rf = getFunctionContaining(r.getFromAddress());
|
|
if (rf != null) { refFn = rf.getName(); break; }
|
|
}
|
|
pw.println("{\"algorithm\":\"" + sig[0] + "\",\"address\":\"" + found + "\",\"block\":\"" + block.getName()
|
|
+ "\",\"in_function\":\"" + (f == null ? "" : f.getName()) + "\",\"referenced_by\":\"" + refFn
|
|
+ "\",\"note\":\"" + sig[2] + "\"}");
|
|
hits++;
|
|
perBlock++;
|
|
cur = found.add(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println("[NeuroSploit] NsCryptoConstants: " + hits + " hit(s) -> " + out.getAbsolutePath());
|
|
}
|
|
}
|