Local LLM for Security Work: Tested Models, Hardware and Privacy (2026)
Author
December 1, 2026
23 min read

Table of contents
21
By Salman Khan, OSCP+, Founder of XHack, SRT (Synack Red Team member)
Read this in 30 seconds: A local LLM keeps client data on your machine, which is why pentesters and analysts want one. But “local” does not mean silent or accurate. I watched the network, scored two local models on four defensive tasks with known answers, and found where a local setup quietly fails.
- Inference stayed on the machine, but the app did not. Across 160 network samples during the test, Ollama opened no outside connections, yet its macOS app checked ollama.com for updates 101 times in 36 days and downloaded 8 updates in the background.
- A too-small context window turned a hacked log into a clean one. A 23,631-token web log sent with a 16k window was cut to 8,194 tokens with no error, the instructions were lost, and both models found 0 of 12 planted attacks. With the window at 32k, the 30B model found 12 of 12.
- Local models find bugs but flag safe code too. Both flagged all 12 vulnerable snippets, but the 8B model also flagged all 4 safe ones and the 30B model flagged 3 of 4.
- The best job for a local LLM is a redaction gate. Regex alone leaked 12 of 24 planted secrets from a pentest finding. The 8B model leaked 5 and the 30B model leaked none.
- The real exposure is a changed bind address. SentinelOne and Censys counted about 175,000 Ollama servers reachable from the internet, and CVE-2026-7482 (CVSS 9.1) let unauthenticated attackers read server memory on versions before 0.17.1.
A local LLM is the obvious answer when a client contract says their data cannot touch a third-party AI service. You pull a model, point your tools at localhost and carry on. Most guides stop there, and they treat privacy as a property of the word “local”.
That assumption breaks in three places I could measure on my own Mac. The software around the model talks to the internet even when the model does not. The context window silently drops input, so a model can return a confident answer about data it never read. And a small model’s mistakes on security tasks are not random: some are false alarms on safe code, others are leaks of the exact data you were trying to protect.
So I tested it. Two installed models, four tasks with known answers, a network watcher on every Ollama process, and the app’s own logs. By the end you will know what a local LLM is good for in security work, what hardware it needs, and how to set one up so it does not leak or lie to you.

Why Security Teams Run a Local LLM (and What It Does Not Fix)
A local LLM solves a data-handling problem, not a quality problem. The model runs on hardware you control, so prompts, client logs, source code and findings never pass through a provider. For engagements under NDA, regulated data or air-gapped networks, that is often the only way AI is allowed at all.
It also changes the cost model. A hosted model bills per token, and security work burns tokens: a single 240-line web log in my test was 23,631 tokens. Locally, that costs electricity and time, so you can triage every log rather than a sample.
What a local LLM does not fix is judgement. A model that fits on a laptop is smaller than a frontier model, it has a shorter usable context, and it fails in ways that are easy to miss. The rest of this guide is about those failures, because they decide whether a local setup is safe to trust with client work.
Here is how the main options compare on the question that matters most for client data: where does it go?
| Option | Where prompts go | Who can see them | Typical use |
|---|---|---|---|
| Local LLM (Ollama, llama.cpp, LM Studio) | Stay on your machine | You | Client data, air-gapped work |
Ollama cloud models (:cloud tag) | Ollama’s servers | Ollama says it does not store or log them | Larger models without the hardware |
| Your own API key (BYOK) | The provider you chose | That provider, under its terms | Frontier quality, your contract |
| Hosted AI product | The vendor | Depends on the vendor’s policy | Convenience |
The second row catches people out. Ollama added cloud models that run on its servers, and you pick them from the same model list as local ones. If a model name ends in :cloud, your prompt leaves the machine.
What a Local LLM Sends Over the Network: I Watched
The local LLM stayed local, but the app around it did not. I ran a watcher that sampled every Ollama process with lsof twice a second during the whole benchmark. Across 160 samples, the only connections were between my script and Ollama on 127.0.0.1:11434. Inference did not open a single outside connection.
The desktop app is a different story. Its log files on my Mac cover 25 October to 30 November 2026, and in that window it called ollama.com/api/update 101 times, usually about once an hour while it was running. Each check sends your OS, chip architecture, Ollama version and an install ID. It also downloaded 8 new versions in the background, ready to install on the next restart, which works out to roughly one release a week.
None of that carries your prompts. But on an air-gapped or monitored network, a process that phones home every hour is exactly what a client’s security team will flag, and an install ID is a stable identifier. “Local” describes where the model runs, not whether the software is quiet.

Four other ways data leaves a local LLM setup
- Model downloads.
ollama pullfetches weights from the internet, which reveals which models you use. Pull on a connected machine and copy the files across for air-gapped work. - Cloud models and web search. On my install,
OLLAMA_NO_CLOUDwasfalse, the default. The Ollama FAQ says you can turn cloud features off withOLLAMA_NO_CLOUD=1or"disable_ollama_cloud": truein~/.ollama/server.json, after which the log showsOllama cloud disabled: true. - Prompt history on disk. The
ollama runcommand-line chat keeps a history file in~/.ollama/historyunlessOLLAMA_NOHISTORYis set. That is client data sitting in your home folder, outside any engagement folder you plan to wipe. - Your own tools. A browser extension, an IDE plugin or a notebook that calls the local API may also call a hosted model. Ollama’s default allowed origins on my machine included
localhost,file://andvscode-webview://, so pages served from your own machine, local files and VS Code webviews can all call it.
The Exposure Mistake: A Local LLM Listening on 0.0.0.0
Ollama is safe by default, and people undo it. It binds to 127.0.0.1:11434, which only your own machine can reach. To share one GPU box across a team, the FAQ shows how to set OLLAMA_HOST to 0.0.0.0, and from that moment anyone who can reach the port can use the API with no password.
Plenty of people have done exactly that. In January 2026, SecurityWeek reported research by SentinelOne and Censys that found about 175,000 exposed Ollama hosts in 130 countries, from 7.23 million observations over 293 days. Roughly half could run code or call APIs through tool use, and at least 201 ran prompt templates that removed safety guardrails.
An open API is a cost problem, but the bigger problem is the server’s own bugs. CVE-2026-7482, published on 4 May 2026, is a heap out-of-bounds read in Ollama’s GGUF model loader. Per the record, an unauthenticated attacker who can reach the API could read server memory, including environment variables, API keys and other users’ conversations. It affects versions before 0.17.1 and scores 9.1 under CVSS 3.1. It was not in CISA’s KEV catalogue when I checked on 30 November 2026.
For a security team, that turns a shared local LLM into a target that holds client conversations. The same reasoning sits behind scope and permission controls for AI agents: anything that can act on your behalf needs a fence around it. If several people need one model server, put it behind something that asks for credentials:
- Keep the default bind address of
127.0.0.1and reach the box through an SSH tunnel or a VPN. - If it must listen on the network, put a reverse proxy with authentication and TLS in front, and firewall the port to known addresses.
- Patch the server. The fix for CVE-2026-7482 shipped in 0.17.1, and the auto-update that annoys air-gapped users is what keeps desktop installs current.
- Check from outside. Scan your own address on port 11434 from another network. If the API answers, so will everyone else’s scanner.
I Tested a Local LLM on Four Security Tasks
Privacy only matters if the output is worth having. I scored the two models already installed on my Mac, qwen3:8b (a 5.2 GB general model) and qwen3-coder:30b (a 19 GB coding model that uses about 3B parameters per token), on four defensive tasks with known answers.
Method. Each local LLM ran on an Apple M5 Pro with 48 GB of memory, Ollama 0.40.16, temperature 0, a fixed seed and thinking turned off, so every run is repeatable. All data is synthetic: short insecure and secure code patterns of the kind taught in any secure-coding course, a generated web log, a fake pentest finding and a made-up nmap scan. Nothing here is a leaderboard. Sixteen snippets and one log are a smoke test that shows how each model fails, not a ranking of models.

| Task | qwen3:8b | qwen3-coder:30b |
|---|---|---|
| Vulnerable snippets flagged | 12 of 12 | 12 of 12 |
| Correct weakness (CWE) named | 8 of 12 | 11 of 12 |
| Safe snippets wrongly flagged | 4 of 4 | 3 of 4 |
| Log triage, 16k window | 0 of 12 found | 0 of 12 found |
| Log triage, 32k window | 10 of 12, 2 false | 12 of 12, 0 false |
| Log triage, 40-line chunks | 11 of 12, 5 false | 12 of 12, 0 false |
| Secrets leaked by redaction (of 24) | 5 | 0 |
| nmap ports extracted (of 14) | 14 | 14 |
Code review: every bug found, and false alarms on safe code
Both models flagged all 12 vulnerable snippets, which covered SQL injection, XSS, path traversal, command injection, SSRF, unsafe deserialization, weak password hashing, a hardcoded key, an open redirect, a missing ownership check, XXE and a JWT read without checking its signature.
The difference was in the detail. The 30B model named the right CWE 11 times out of 12, and it missed only the missing ownership check, which it called SQL injection. The 8B model got 8 right and gave vaguer or wrong labels for the rest, such as CWE-74, the generic injection category, instead of SQL injection.
The safe controls were the real test, and both models failed it. These were fixed versions of four of the snippets: a parameterised query, a ping that validates the IP address and avoids the shell, a download that sanitises the filename, and bcrypt hashing. The 8B model called all four vulnerable. The 30B model passed only the parameterised query.
Translation: a local LLM reviewing code is a lead generator, not a verdict. That matches what I found when ranking models for reverse engineering, where the best answers still needed a tool to confirm them. If you feed its output straight into a report or a ticket queue, you will file false findings, and developers stop reading those quickly.
Log triage: the window size decided the answer
The log was 240 lines of normal shop traffic with 12 planted probes, including SQL injection, a ../ traversal, a request for /.env and an SSRF attempt at the cloud metadata address. It also had decoys such as a search for “select running shoes” that trips keyword rules.
At first I gave each local LLM a 16k context window, which sounds generous for 240 lines. It was not. Log lines are dense, and the prompt came to 23,631 tokens. Ollama evaluated only 8,194 of them and raised no error. It kept the end of the prompt and dropped the start, which is where my instructions were.
Both models then answered a question nobody asked. The 8B model reprinted log lines as JSON and the 30B model summarised normal shopping traffic. A script reading the result would have recorded zero attacks in a log with twelve.
With the window raised to 32k, the 30B model found all 12 with no false positives. The 8B model found 10 and named the lines next to the other two, an off-by-one error that would send an analyst to the wrong request. Splitting the log into 40-line chunks inside the 16k window worked as well as the big window for the 30B model, and it was faster: 20.2 seconds against 37.2.
One more catch: Ollama’s FAQ still gives 4,096 tokens as the default window, but on this 48 GB Mac it picked 32,768 by itself. Do not trust either number. Read prompt_eval_count in the API response and compare it with what you sent.
Redaction: the job a local LLM does best
This is where a local LLM earns its place. I wrote a realistic pentest finding with 24 planted sensitive values: a client name, domains, internal hostnames, IP addresses, emails, people’s names, a service account and password, an AWS key, a session token, API keys, a phone number, a bank account, a card number and two reference numbers. Each model had to replace them with [REDACTED] and keep the technical text intact.

A regex pass, the usual approach, leaked 12 of the 24. Patterns catch IP addresses, emails and keys, but not a client’s name, a hostname, a password or a purchase order number. The 8B model leaked 5: the service account, the phone number, both reference numbers and the client’s domain, which survived inside a half-redacted email address. The 30B model leaked none, and both kept every technical phrase I checked, so the finding stayed usable.
That makes a practical pattern: a local LLM strips client data from a finding, then a stronger hosted model helps with the write-up or the analysis. Run the regex pass as well, since the two catch different things, and spot-check the output before anything leaves the machine.
Structured extraction: reliable on a small, clean input
Converting an nmap XML file into JSON was the easy win for a local LLM. Both models extracted all 14 open ports with the right services and correctly skipped closed ports and a host that was down. Tasks like this, short and structured with a clear answer, are where a small local LLM is dependable.
Hardware and Models for a Local LLM in 2026
Memory decides what you can run, and context uses as much of it as the model does. On the same Mac, an earlier test of mine found qwen3-coder:30b needed 19.3 GB with an 8k window and 31.7 GB with a 128k window. The download size on the model page is only the starting point.
These are current Ollama library entries that suit security work, with download sizes and maximum context as listed on 30 November 2026. I tested only the two marked models.
| Model | Download | Max context | Good for |
|---|---|---|---|
| qwen3:8b (tested) | 5.2 GB | 40K | Redaction drafts, extraction, 16 GB laptops |
| gpt-oss:20b | 14 GB | 128K | General reasoning on 32 GB machines |
| devstral | 14 GB | 128K | Agent-style coding with tools |
| gemma4:26b | 16 GB | 256K | General use with image input |
| qwen3.8 (27B) | 18 GB | 256K | Newer all-rounder for 32 GB or more |
| qwen3-coder:30b (tested) | 19 GB | 256K | Code review, log triage, redaction |
| deepseek-r1:70b | 43 GB | 128K | Slow, careful reasoning on 64 GB or more |
| gpt-oss:120b | 65 GB | 128K | Workstations with 96 GB or more |
A rough sizing rule, checked against my 30B measurements: take the download size, add a few gigabytes for every 32k of context you plan to use, and leave room for the operating system and your tools. The total memory column below assumes Apple unified memory. On a PC, the model and its context should fit in the GPU’s VRAM, or speed drops sharply.
| Machine memory | Comfortable local LLM | Context you can afford |
|---|---|---|
| 16 GB | 8B class | 16k to 32k |
| 32 GB | 14B to 20B, or a 30B model with a small window | 32k |
| 48 GB | 30B class (measured: 31.7 GB at 128k) | 128k |
| 64 GB and up | 70B class | 32k to 64k |
| 96 GB and up | gpt-oss:120b | 128k |
Mixture-of-experts models change the speed picture for a local LLM. The 30B coding model ran faster than the 8B model on my Mac because it only uses about 3B parameters per token, but it still needs memory for all 30B. Pick by memory first and speed second.
A Safe Local LLM Setup for Client Data
Most of the risks above come down to settings that nobody checks. This is the setup I would use before putting client data through a local LLM.
- Keep the server on loopback. Confirm with
lsof -nP -iTCP:11434 -sTCP:LISTENthat it shows127.0.0.1, not*or0.0.0.0. - Turn off cloud features with
OLLAMA_NO_CLOUD=1or theserver.jsonsetting, restart, and look forOllama cloud disabled: truein the log. - Decide on updates. On a connected machine, keep auto-update for security fixes. On an isolated one, block outbound traffic at the firewall and update by copying a vetted release across.
- Set the context window on purpose with
num_ctxfor every request, then checkprompt_eval_countin the response. If it is smaller than your input, the input was cut. - Chunk large inputs. Forty-line log chunks matched the big window on accuracy and finished faster.
- Redact before anything leaves. Use a local model plus a regex pass, then spot-check, before a finding goes to any hosted model.
- Verify every finding. Treat the model’s output as leads for deterministic tools and a human, never as the final answer.
- Clean up afterwards. Set
OLLAMA_NOHISTORY, keep engagement files in one folder and wipe it, along with any cached prompts, when the engagement ends.
Common Mistakes With a Local LLM
- Assuming local means offline. The model may be local while the app checks for updates hourly and a
:cloudmodel sits in the same menu. Measure it on your own machine. - Trusting a clean result. “No attacks found” from a local LLM can mean the prompt was cut. Check how many tokens were evaluated before you accept a negative.
- Sharing a GPU box on 0.0.0.0. It is the documented way to share Ollama and the main reason about 175,000 servers are reachable from the internet.
- Putting model output straight into reports. Both models flagged safe code as vulnerable. A finding needs proof from a tool or a person.
- Picking a model by benchmark headlines. A coding score says little about log triage or redaction. Build ten tasks from your own work with known answers and test before you trust.
- Choosing by download size. The context you need can add 50% or more to the memory the weights take.
How XHack Delivers Local LLM Security Work Differently
Here is the part where I talk about my own company, so read it with that in mind. XHack combines an AI pentesting agent, a security operations platform and human penetration testers. For local LLM work the agent is what matters, because a model on its own only answers questions, while the agent runs the tools that check its answers.
The XHack desktop Agent can run on a local model through Ollama. You install Ollama, pull a model, and pick it in the Agent’s model settings. There is nothing to type at a terminal. With a local model, nothing leaves your machine, which suits air-gapped and client-sensitive work. Our privacy page spells out what happens with each model choice. Local models also have no per-token cost, so you can keep a hosted frontier model for the hard problems and run the bulk work locally.

The context trap from my test is built into the controls. The Agent has an effort setting of Low, Medium or High, and higher effort goes deeper and gives the model a bigger context window. You make the trade between speed and depth in a dropdown, instead of discovering it from a wrong answer.
The agent also does what a bare local LLM cannot. It runs up to 12 sub-agents by default and works through three browsers, so a suspected bug is tested against the target instead of reported on a guess. Each chat has a permission mode (Manual, Allow Edits, Auto or Plan), and destructive commands such as wiping disks or dropping databases are blocked in every mode.
To be honest about the trade-off: a 30B local model is weaker than a frontier hosted model on long, multi-step work. Local is the right choice when the data cannot leave, not when you want the best possible reasoning.
Privacy holds with the hosted model too. XHack does not store your data, and your agent chats and session data stay on your own computer, where you can delete them whenever you want.
Individual plans cost $20, $49 and $150 a month. There is a 7-day free trial, nothing is charged for the trial period itself, and what you need to start depends on our current requirements, with one trial per person. If you want people to test your systems instead, managed engagements start from $2,500. If you need a chatbot that answers without checking anything, we are not the right fit. Prefer to talk it through first? Book a free consultation, even if it turns out not to be us.
FAQ: Local LLM Questions Answered
Is a local LLM private enough for client data?
A local LLM is private enough for client data when you control the whole setup. In my test, Ollama’s inference opened no outside connections across 160 samples. The app still checked for updates hourly, cloud models were enabled by default, and the command-line chat kept a history file. Bind to 127.0.0.1, turn off cloud features and check your contract before using it on an engagement.
What is the best local LLM for security work?
In my tests the best local LLM for security work was qwen3-coder:30b. It named the right weakness in 11 of 12 vulnerable snippets, found all 12 planted log attacks with a large enough window and leaked none of 24 secrets in a redaction test. It still flagged 3 of 4 safe snippets, so test any model on your own tasks before relying on it.
How much RAM do I need to run a local LLM?
You need about 16 GB for an 8B model and 48 GB to run a 30B model with a long context. On an M5 Pro, qwen3-coder:30b used 19.3 GB with an 8k window and 31.7 GB with a 128k window, so the context you choose matters as much as the model. On a PC, the model and context should fit in GPU memory.
Does Ollama send my prompts to the internet?
Ollama does not send prompts for local models; its FAQ says it does not see your prompts when you run locally, and my network watch agreed. Models tagged :cloud do run on Ollama’s servers. The macOS and Windows apps also check for updates and download them automatically, sending your OS, version and an install ID, but not your prompts.
Why did my local LLM miss things in a long file?
Your local LLM probably never read the whole file. When a prompt is longer than the context window, Ollama cuts it without an error. In my test, a 23,631-token log in a 16k window was cut to 8,194 tokens, the instructions were lost and both models found nothing. Check prompt_eval_count, raise num_ctx or split the input into chunks.
Can a local LLM replace a pentester or a hosted model?
No, a local LLM is best as a fast assistant for narrow tasks such as redaction, log triage and parsing tool output. Both tested models flagged safe code as vulnerable, and small models struggle with long, multi-step work. Use it to prepare and filter data, keep a stronger model or a person for judgement, and verify every finding with a tool.
Local LLM: What to Do Next
A local LLM is the right tool when the data cannot leave the room, and the wrong tool to trust blindly. My tests point the same way: it is excellent at narrow, checkable jobs such as stripping secrets from a finding or parsing scan output, it is unreliable as a final judge of code, and it can go silently blind when the input outgrows its window.
The fixes are mostly settings. Keep the server on loopback, turn off cloud features, set the context window on purpose and check how much was read, chunk big inputs, and put a human or a tool between the model and the report. Then measure your own machine the way I measured mine: watch the network for an hour and score ten tasks with answers you already know.
If you want the local LLM to sit inside a workflow that tests its own leads, try the XHack Agent with a local model, or read how to run one for offline malware analysis.
Categories
Related articles


