The Hidden Security Cost of Self-Hosting Kimi, DeepSeek, and Qwen

Self-hosted LLM security is the practice of securing open-weight models that an enterprise runs on its own infrastructure: the model artifact, the inference runtime that loads it, and the agents, tools, and credentials wired to it. It differs from using a hosted AI service in one decisive way. The enterprise, not the provider, owns every layer beneath the prompt, including the guardrails.

July 30, 2026
July 30, 2026

0 min read

AI Security
LLM
The Hidden Security Cost of Self-Hosting Kimi, DeepSeek, and Qwen

Kimi, DeepSeek, and Qwen changed the economics of enterprise AI. Open Chinese models now run 60 to 90 percent cheaper than the leading US APIs, and the shift has already happened: Chinese open-weight models account for 46.4 percent of routed token usage on OpenRouter, ahead of US-origin models at 35.7 percent, up from just 4.5 percent a year earlier.

Teams can run reasoning, coding, and agentic workloads on their own laptops, GPU clusters, and private clouds. The appeal is obvious. Lower inference cost, deployment flexibility, and control over where data is processed.

Self-hosting an open-weight model does not remove risk. It transfers ownership of that risk to you. With a managed AI service, the model infrastructure sits behind the provider's security boundary. Once the model runs locally, the enterprise owns the model artifact, the inference runtime, authentication, network exposure, patching, guardrails, tools, credentials, and every agent connected to it.

The core risk is not that these models are Chinese. The risk is that powerful AI is being downloaded and operated as software infrastructure, usually outside the visibility of the security team. Kodem works on this layer directly: runtime intelligence built on user-space memory analysis, which reports what an application actually loaded and executed rather than what a manifest or a config file claims.

Local AI becomes shadow infrastructure within minutes

A developer can install Ollama, pull a model, and connect it to internal code or documents in minutes. A team can deploy vLLM on a cloud GPU instance without waiting for a central AI platform. A desktop agent can talk to a local MCP server without a single request crossing the corporate AI gateway.

This is not hypothetical. Cisco Talos scanned Shodan for ten minutes and found 1,139 publicly exposed Ollama endpoints. Of those, 214 answered model queries with no credentials at all, and 36.6 percent were located in the United States. Those are the deployments visible from the public internet. The ones inside the perimeter are harder to count and more numerous.

The resulting AI environment is frequently missing from inventory, outside approved network routes, weakly authenticated or unauthenticated, unpatched, connected to sensitive data, and running on a developer endpoint.

Finding the process is not enough. Security needs to know which model is loaded, which agent is calling it, what tools are connected, what data it can reach, and which controls are actually present.

The model supply chain is an execution path, not a file download

Self-hosted models are not always passive weight files. A deployment can load configuration, tokenizers, processors, custom Python modules, adapters, and secondary weights. Loading a model can mean loading executable software from an external repository.

CVE-2026-41523: a malicious model can execute code through vLLM

A 2026 vLLM advisory described an assert statement used as the only security check for activation-function loading. Under Python optimized mode (python -O or PYTHONOPTIMIZE=1), assertions are stripped and the check disappears. A malicious Hugging Face model could then trigger arbitrary code execution during initialization, with the privileges of the vLLM process. Fixed in 0.22.0. Details in CVE-2026-41523.

Model provenance is not only a governance question. It can become host compromise.

CVE-2026-47155: a pinned Kimi deployment can still load unpinned components

A second vLLM advisory showed that revision pins were not consistently applied to every artifact a model loads. The clearest example involved Kimi-Audio, where the primary model could be pinned to an audited revision while the Whisper config and weights in the same repository were loaded with no revision argument, always resolving from the default branch.

The advisory did not claim a confirmed compromise. It exposed the gap between intended and actual state. A deployment can look reviewed and pinned while its runtime behavior still depends on mutable artifacts. See CVE-2026-47155.

Configuration tells you what should be running. Security needs independent evidence of what actually loaded.

The inference runtime is a production attack surface

Local AI depends on fast-moving infrastructure: Ollama, vLLM, llama.cpp, model repositories, container images, plugins, and orchestration frameworks. These components now sit beside valuable data and powerful compute.

CVE-2024-37032: Ollama path traversal led to remote code execution

Wiz Research disclosed CVE-2024-37032, known as Probllama, in Ollama. A path traversal flaw in the model-pull flow allowed arbitrary file writes and could be escalated to remote code execution. Impact was most severe in exposed Docker installations running with elevated privileges.

This is a familiar vulnerability class inside a rapidly deployed AI stack, and it is not isolated. The vLLM advisory history includes a separate critical RCE in multimodal inference, which we covered in CVE-2026-22778, and llama.cpp carries its own advisory in CVE-2026-34159. Three inference runtimes, the same pattern.

Inference servers are no longer experimental utilities. They are production services and should be secured as production services. Attackers have noticed, as we documented in how attackers are gaining access to LLM inference.

The real risk appears when a local model becomes an agent

A local model on its own is one component. The risk compounds when it is connected to agents, tools, credentials, data sources, and other agents.

Consider a local coding agent that can read source code, access cloud credentials, search internal documentation, invoke MCP tools, delegate work to a sub-agent, and run shell commands.

Each capability is defensible on its own. The exposure lives in the combination.

A model can receive untrusted content from logs, documents, repositories, or web results, then carry that context through a delegation path into a privileged action. The final shell command is local. The delegation happens in process. No gateway request ever exposes the full chain. This is the same reachability problem that runs through the whole AI application stack, and it is why local AI security cannot stop at model inventory or network inspection.

Gateways, DLP, and EDR each stop short of the local inference path

AI gateways, DLP, CASB, EDR, SIEM, and distributed tracing all produce useful evidence. Each also has a structural boundary, and a self-hosted model tends to fall outside it.

ControlWhat it seesWhere it stops for a local model
AI gatewayTraffic routed through itLocal inference never leaves the host, so there is no request to inspect
DLP and CASBData moving to sanctioned servicesIn-process context assembly and local file reads
TracingRich telemetry where the app is instrumentedCoverage ends where instrumentation ends, and shadow deployments are never instrumented
EDR and SIEMProcesses, files, network connectionsIdentifies ollama as a process, but not which model loaded or what it can reach
Config and CMDBApproved assets and intended controlsCannot prove what is loaded and reachable at runtime

The complete risk path fragments wherever registration, instrumentation, routing, or propagated context ends. A self-hosted model is precisely the case where all four end early.

Runtime evidence shows what a self-hosted model actually loaded

Every gap above has the same shape. The declared state and the loaded state diverge, and the tooling reports the declared one. Kodem's runtime intelligence reads the user-space memory of running processes, so it reports what a workload actually loaded and executed. For self-hosted AI, that is the difference between the deployment you reviewed and the deployment that is running.

Vulnerable inference runtimes, prioritized by what actually executes

What this delivers today on covered workloads and endpoints:

  • Vulnerable inference runtimes, prioritized by execution. Runtime-powered SCA identifies affected Ollama, vLLM, and llama.cpp components, then separates the instances where the vulnerable code is actually loaded and reachable from the ones where it is not. On CVE-2026-41523, that is the difference between every vLLM install and the vLLM installs running in optimized mode.
  • Exploitation signal at runtime. Path traversal and RCE against an inference server is behavioral, which is Application Detection and Response territory: anomalous subprocess activity, unexpected file writes, outbound connections a model server should never make.
  • Remediation verification. After a runtime is patched or replaced, Kodem re-inspects the running state to confirm the vulnerable component is no longer loaded. Not a ticket closed, evidence that the specific condition is gone.
  • Triage that reflects reality. The same evidence feeds vulnerability management, so a critical advisory in a runtime you do not actually load does not outrank one you do.

"When you self-host a model, the interesting target stops being the model and becomes the process that loaded it. Attackers do not care which lab trained the weights. They care that an inference server is running with elevated privileges, resolving artifacts from a mutable branch, and holding credentials for everything the agent can reach. None of that is visible in a config file."

Pavel Furman, Co-founder and CTO at Kodem

A guardrail you cannot see in the process is a claim, not a control

Self-hosting an open-weight model quietly removes a safety layer most teams never accounted for. A hosted API arrives with vendor-side filtering already in the request path. Kimi, DeepSeek, or Qwen on your own vLLM node arrives with exactly the guardrails your team wired, and frequently that is none.

The two places teams look for an answer both miss it. A framework config or a provider console records the guardrail that was intended. An AI gateway can only enforce policy on traffic that reaches it, and local inference never sends any. For a self-hosted model, the guardrail question has to be answered inside the process.

This is the layer Kodem's Runtime AI Security works on. Reading the running process surfaces guardrails as they exist at that moment: which agents have one, its category and level, the action it takes, and the direction it covers. Direction is the detail that decides whether a control is real. An input filter tuned for prompt injection does nothing for an egress path that carries internal data to an external destination, and no config file will tell you which edge you actually protected.

The useful findings are the negative ones:

  • Agents running with no guardrail at all. Including sub-agents created dynamically at runtime, which no code review ever saw and no inventory recorded. Unused or ungoverned AI capability is itself a finding.
  • A guardrail on the wrong edge. An agent can be filtered on input and completely open on output, which reads as protected in a console and is not.
  • A missing guardrail at the boundary where the risk should break. Untrusted content reaching a privileged tool, or sensitive data reaching an external destination through a delegation chain. The map is drawn from how the agent is wired, so it shows that the path exists and is reachable. It is not recorded traffic, and that is the point: the exposure is visible before it fires.
  • A model bound off the approved list. Compare the models actually loaded in memory against the list your governance process signed off on. For an environment where developers can pull new open weights in minutes, this is the simplest control that holds.

None of these are Kodem-invented categories. They map to the OWASP Top 10 for LLM applications: untrusted content reaching the model is LLM01, sensitive data reaching it is LLM02, and unbounded egress through an over-permissioned agent is LLM06.

To be precise about status: this agent-aware discovery is an emerging capability built on Kodem's runtime intelligence. It is advancing through active development with design partners and is not yet generally available. The current focus is discovery, evidence, and prioritization.

Where this goes next: agent-aware control

Discovery is the first half. The second is acting on it, and the reason that follows naturally from runtime evidence is identity. Most controls see one workload with one identity, even when several decision makers live inside it: an orchestrator, its sub-agents, deterministic code, and occasionally an agent nobody declared. The same action carries different risk depending on which one originated it. Reconstructing the agent hierarchy from memory is what makes it possible to attribute an action to its agent of origin and to the delegation chain behind it, which is the difference between a blunt control and a targeted one.

That points toward agent-aware policy, enforcement per agent and per delegation, and remediation verified by re-inspecting runtime state rather than waiting for the event to recur. This is the product direction and a later phase, not something shipping today.

The reason it belongs on runtime evidence is structural. A gateway can only reason about requests it receives. A code scanner can only reason about what was written. Agents are wired dynamically, tool surfaces expand at runtime through MCP and other agent frameworks, and a sub-agent that is loaded but has never fired is invisible to anything watching activity. Reading the running process is the only place that information exists.

Self-hosted AI is an infrastructure decision, so govern it like one

Kimi, DeepSeek, Qwen, and the open-weight models after them will keep spreading across enterprise infrastructure. The economics are too strong and the barrier to deployment is too low. Policy will not change that: open weights, once downloaded, run offline.

So the question is not whether enterprises will run local AI. The question is whether security can answer what is loaded, what it can reach, and whether the last fix held, before someone else asks.

Self-hosting is a reasonable decision. Self-hosting without evidence of what loaded is not. Cutting inference cost by 60 to 90 percent is worth doing. It is worth doing with an inventory that comes from the running process rather than a survey.

With Kodem, enterprises can adopt self-hosted AI without accepting unmanaged risk. One platform, built on runtime intelligence: it discovers the models and inference runtimes actually loaded, identifies vulnerable infrastructure and untrusted artifacts, prioritizes by what really executes, guides precise remediation, and re-inspects the running state to confirm the specific condition is gone. As Runtime AI Security matures, the same evidence extends that loop to the agents, tools, and loaded guardrails around a local model, so a guardrail is something you can verify rather than something you declared.

Frequently Asked Questions

Is self-hosting DeepSeek or Qwen more secure than using a hosted API?

It is different, not automatically safer. Self-hosting keeps prompts and outputs inside your network, which resolves a data-residency concern. In exchange you take ownership of the model artifact, the inference runtime, authentication, patching, guardrails, and every agent connected to the model. The data-residency win is real. The infrastructure it creates is the part teams underestimate.

What security risks come with running an open-weight model locally?

Four categories. Shadow infrastructure, where models run outside inventory and approved network routes. Model supply chain, where loading a model also loads executable code, as in CVE-2026-41523. Inference runtime vulnerabilities, as in CVE-2024-37032 in Ollama. And agent composition, where a model with tools, credentials, and delegation creates reachable paths no single component reveals.

Can an AI gateway see a locally hosted model?

No. An AI gateway inspects traffic that is routed through it. A model served on localhost or on an internal GPU node produces no such request, so the gateway has nothing to observe. The same limit applies to in-process delegation between agents. Gateways remain useful for the traffic they do see, but they cannot be the inventory for local inference.

Do guardrails protect a self-hosted open-weight model?

Only the ones you wired yourself, and only on the edges they actually cover. A hosted API ships with vendor-side filtering in the request path. An open-weight model on your own inference server has none of that by default. Gateway-based guardrails do not help either, because local inference never reaches the gateway. That leaves in-process guardrails, which means the only reliable check is what the running process has loaded: which agents have a guardrail, what action it takes, and whether it covers input, output, or both. An agent filtered on input and open on egress reads as protected in a console and is not.

How do you find shadow AI and undeclared local models in an enterprise?

Network scanning finds exposed inference endpoints, which is how Cisco Talos located 1,139 public Ollama servers, but it misses everything inside the perimeter and everything bound to localhost. Surveys and CMDB entries capture intent rather than reality. The reliable source is the running process itself: read what a workload has loaded into memory, and undeclared models and runtimes appear whether or not anyone registered them.

Does pinning a Hugging Face model revision guarantee what gets loaded?

Not on its own. CVE-2026-47155 showed vLLM applying revision pins inconsistently across the artifacts a model loads. With Kimi-Audio, the primary model honored the pin while the Whisper config and weights in the same repository loaded from the default branch. A pin describes intent. Verifying the loaded artifact set at runtime is what confirms it.

Is the security risk that the model is Chinese, or that it is self-hosted?

Mostly the second. Model origin is a legitimate procurement and governance input, and it is why open-weight adoption is under policy review. But the vulnerabilities that produce host compromise, CVE-2024-37032 in Ollama and CVE-2026-41523 in vLLM, live in the inference runtime, not in the weights, and they apply to any self-hosted model regardless of who trained it. Origin is a sourcing question. Self-hosting is a security architecture question.

References

  1. Cisco Talos: Detecting Exposed LLM Servers, a Shodan Case Study on Ollama
  2. Wiz Research: Probllama, Ollama Remote Code Execution Vulnerability
  3. vLLM Advisory: CVE-2026-41523
  4. vLLM Advisory: CVE-2026-47155
  5. llama.cpp Advisory: CVE-2026-34159
Table of contents

Related blogs

Application Security in the Post-Autonomous-Exploit Era

Application Security in the Post-Autonomous-Exploit Era

OpenAI's models escaped a sandbox and hacked Hugging Face mid-evaluation. What that means for how application security has to work next.

July 22, 2026

8

AI Code Works. It's Rarely Secure.

AI Code Works. It's Rarely Secure.

Syntax correctness passed 95%. Security pass rates are still stuck near 55%.

July 20, 2026

8

When the AI Edits Its Own Trust Boundary: Remote Code Execution Vulnerability in AWS's Agentic IDE

When the AI Edits Its Own Trust Boundary: Remote Code Execution Vulnerability in AWS's Agentic IDE

We found a vulnerability in Kiro, AWS's agentic IDE, that breaks this promise. By planting hidden instructions in a web page Kiro reads, an attacker can make Kiro rewrite its own MCP (Model Context Protocol) server configuration file and gain arbitrary code execution on the developer's machine.

July 19, 2026

14

Stop the waste.
Protect your environment with Kodem.

A Primer on Runtime Intelligence

See how Kodem's cutting-edge sensor technology revolutionizes application monitoring at the kernel level.

5.1k
Applications covered
1.1m
False positives eliminated
4.8k
Triage hours reduced

Platform Overview Video

Watch our short platform overview video to see how Kodem discovers real security risks in your code at runtime.

5.1k
Applications covered
1.1m
False positives eliminated
4.8k
Triage hours reduced

The State of the Application Security Workflow

This report aims to equip readers with actionable insights that can help future-proof their security programs. Kodem, the publisher of this report, purpose built a platform that bridges these gaps by unifying shift-left strategies with runtime monitoring and protection.

3D book mockup of Kodem's State of the Application Security Workflow 2025 report

Get real-time insights across the full stack…code, containers, OS, and memory

Watch how Kodem’s runtime security platform detects and blocks attacks before they cause damage. No guesswork. Just precise, automated protection.

Kodem issues list with a magnified view of insight icons: runtime, ingress, and exploitability
Combined author
Kodem Security Research Team
Publish date

0 min read

AI Security

LLM