AI pentesting guides / Free, open-source and AI pentesting

Private models

Local LLM pentesting: AI-driven testing with no data leaving the machine

Local LLM pentesting means running the language model that drives an AI pentester on your own hardware, through a server such as Ollama or LM Studio, so prompts, target data and findings never reach a cloud API and there is no per-token bill. The harness, the tools and the model all stay on one machine or network.

It is the right choice when confidentiality outweighs raw model capability, or when you want to experiment without a running cost. It comes with real trade-offs: smaller models make more mistakes, hardware limits what you can load, and not every model can drive tools. This page explains how to make those trade-offs sensibly.

Why run the model locally

  • Confidentiality: HTTP responses, credentials and vulnerability details are never sent to a model provider.
  • Cost: no per-token charges, so long or repeated runs cost only electricity and hardware.
  • Policy: some organisations have not approved any external AI provider for security data.
  • Availability: no rate limits, outages or account suspensions from a provider.

Choosing a model

The non-negotiable requirement is native tool or function calling: the agent must be able to emit structured tool calls, not just prose. Ollama labels models with tool support in its library. Beyond that, prefer the largest instruction-tuned model your hardware can run at a usable speed, and check its context length, because pentest transcripts are long. Open-weight families such as Qwen, Llama, GLM and DeepSeek all have tool-capable variants of different sizes.

Hardware and speed

Model size and quantisation determine how much GPU memory, or unified memory on Apple Silicon, you need. A small model will run on a laptop but will reason less reliably about multi-step exploits. A larger model on a workstation GPU is noticeably better but slower per step. Measure on a practice lab: if a run takes hours and still misses easy bugs, the model is the bottleneck, not the harness.

Getting good results from a local model

  • Raise the context length; Ollama, for example, lets you set it with the OLLAMA_CONTEXT_LENGTH variable.
  • Lean on deterministic playbooks, which run the same tool sequence whatever the model, and let the model interpret results.
  • Use non-LLM verification so a smaller model's mistaken claims do not become findings.
  • Benchmark on known-vulnerable labs so you know what your model misses before using it on real targets.
With Pentest-Swarm

Running Pentest-Swarm on a local LLM

Pentest-Swarm treats Ollama and LM Studio as first-class providers. No API key is needed, no data leaves the machine, and the spend cap shows 'no cost' because there is none.

  • Ollama: pentestswarm scan <target> --scope <target> --provider ollama --swarm.
  • LM Studio: load a model, enable its local server, then use --provider lmstudio.
  • Try it risk-free on a lab: pentestswarm scan --lab --lab-target vampi --provider ollama --swarm --tui.
  • Deterministic per-app playbooks for VAmPI, DVGA and NodeGoat run reliably regardless of the model driving the swarm.
  • Verification oracles (out-of-band, differential and timing, --verify, beta) confirm findings without trusting the model's word.

Where it falls short

A local model will usually be less capable than a frontier cloud model at long, multi-step exploitation, so expect more missed findings and more review. Pentest-Swarm requires a model with native tool calling; models without it will not work. If your priority is depth on a complex application and you can approve a cloud provider, Claude or another frontier model through Pentest-Swarm, or a managed service, will generally find more.

Questions

Can a local LLM really do pentesting?

Yes, when it drives a proper harness with real tools and verification. It will be weaker than a frontier model on complex chains, but it is effective on many common web and API flaws.

Which local model should I use?

Any instruction-tuned model with native tool calling that fits your hardware. Test two or three on the same practice lab and keep the one that finds the most verified issues.

Does anything leave my machine?

With Ollama or LM Studio as the provider, model traffic stays local. The only outbound traffic is the testing traffic to your in-scope target.

Sources

  1. Ollama models with tool support
  2. Ollama FAQ: context length
  3. LM Studio