Skip to content

feat(netexec): emit file findings from spider_plus share spidering (#390) - #387

Open
Seb-MIGUEL wants to merge 2 commits into
mainfrom
feat/spider-plus-file-findings
Open

feat(netexec): emit file findings from spider_plus share spidering (#390)#387
Seb-MIGUEL wants to merge 2 commits into
mainfrom
feat/spider-plus-file-findings

Conversation

@Seb-MIGUEL

@Seb-MIGUEL Seb-MIGUEL commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #390

Emits structured file findings from the NetExec spider_plus module.

Why

spider_plus recursively enumerates files on readable SMB shares — exactly the attack step where a red team turns share access into loot (e.g. a secret.ps1 on SYSVOL holding a hard-coded password). Until now the module produced only generic text output, so those files never became findings and could not appear in the attack-path graph.

This unlocks the kill-chain: nmap → 445 → SMB → enum shares (share finding) → spider_plus (file findings on that share).

The catch, and how it's handled

spider_plus prints only aggregate stats to stdout; the per-file list is written to a JSON metadata file per target (<ip>.json) in its output folder. So this cannot go through the stdout parser:

  • The command builder forces a controlled OUTPUT_FOLDER for spider_plus (overriding any user-supplied one) so the injector knows where to read the metadata back from.
  • After execution, openaev_netexec reads every <ip>.json, merges the files into the structured outputs as files, then cleans the folder up.
  • spider_plus_parser flattens the {share: {path: meta}} metadata into file findings, keeping file_name (basename), path (directory), share and host as distinct fields — so a share-hosted file links back to its share finding, and local files (no share, e.g. FTP/NFS --ls later) stay distinguishable.

Tests

  • test_spider_plus_parser: basename/directory split, top-level vs nested files, same basename kept distinct per share, asset-id mapping, missing/malformed metadata.
  • test_netexec_command_builder: spider_plus forces the controlled OUTPUT_FOLDER and overrides a user-supplied one.
  • Full suite: 122 passed. black + isort + flake8 clean.

Dependency

Requires the file output type added in client-python (OpenAEV-Platform/client-python#322) — contract_outputs references ContractOutputType.File. Part of the attack-path file finding work (OpenAEV #6647).

The spider_plus module enumerates files on readable SMB shares, but it prints
only aggregate stats to stdout -- the per-file list is written to a JSON
metadata file per target. Read that metadata back into structured `file`
findings so the attack path can chain a discovered share to the files exposed
on it (e.g. a share holding a script with a hard-coded password).

- output_registry: map spider_plus to {text, file}.
- contract_outputs: declare the `files` output element (ContractOutputType.File).
- command builder: force a controlled OUTPUT_FOLDER for spider_plus (overriding
  any user-supplied one) so the injector knows where to read the metadata.
- openaev_netexec: read the metadata folder after execution, merge the files
  into the structured outputs, and clean the folder up.
- spider_plus_parser: flatten the {share: {path: meta}} metadata into file
  findings, keeping file_name (basename), path (directory), share and host as
  distinct fields so a share-hosted file links back to its share finding and
  local files (no share) stay distinguishable.

Requires the `file` output type from client-python. Part of the attack-path
file finding work (OpenAEV #6647).
@Filigran-Automation Filigran-Automation added the filigran team Item from the Filigran team. label Jul 28, 2026
@Filigran-Automation

Copy link
Copy Markdown
Contributor

🤖 [AI-generated]

Hey @Seb-MIGUEL! 👋 Thanks a lot for opening PR #387 — the spider_plus file-findings work looks really solid and the write-up of the parsing/output-folder handling is genuinely a pleasure to read! 🙏

I just had a quick look and there's one gap that could help reviewers and the release process: the PR doesn't seem to be linked to an issue in this repository (only a cross-repo reference to OpenAEV #6647 and client-python#322 are mentioned). I haven't changed anything in your description or title — just a gentle suggestion:

Area What could help Suggestion
PR title / description No (#issue) reference to an injectors-repo issue This repo's CONTRIBUTING.md states every PR must be linked to a GitHub issue and PR titles must end with (#issue) so the reference lands on main. If there's a tracking issue in this repo, could you add "Closes #123" (or similar) to the description so we can append the (#issue) suffix to the title? If there isn't one yet, opening a quick issue describing the motivation would do the trick.

💡 If helpful, the CONTRIBUTING.md conventions (section "Contributing" / commit & PR title format) walk through what to include: https://github.com/OpenAEV-Platform/injectors/blob/main/CONTRIBUTING.md

No rush at all — thanks again for contributing to the project! 🚀

@guzmud guzmud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Self-note: anticipate a refactor of the netexec codebase regarding the use of tempfile and of pathlib at some point

@Seb-MIGUEL Seb-MIGUEL changed the title feat(netexec): emit file findings from spider_plus share spidering feat(netexec): emit file findings from spider_plus share spidering (#390) Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(netexec): emit file findings from spider_plus share spidering

4 participants