Back to skill

Security audit

Linux Ollama

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Ollama fleet setup guide, but it needs review because it asks users to run mutable installers, create persistent system services, and open a network port without enough safety scoping.

Install only if you are comfortable auditing the Ollama and ollama-herd installers, pinning package versions, running services under a dedicated unprivileged account, and restricting port 11435 to trusted private hosts or a protected network. Do not expose the router or dashboard directly to the public internet without authentication and TLS.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:18
Finding

Unverified Remote Installation Script Executed Directly by Shell

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:18
Vulnerability Type: Remote payload retrieval and execution
Risk Level: Critical

bash
curl -fsSL https://ollama.ai/install.sh | sh

Technical Analysis

The command retrieves a mutable script from an external URL and immediately passes its contents to sh. The payload is not pinned to a version, saved for inspection, or verified using a cryptographic signature or fixed checksum. Consequently, the code that executes can differ from the code available when the Skill was audited.

HTTPS protects the connection in transit but does not mitigate compromise of the hosting service, its deployment pipeline, DNS or account credentials. It also does not protect users if the remote endpoint intentionally changes the script.

This installation behavior is related to the declared Ollama setup function, but direct pipe-to-shell execution is not necessary. A verified package or a separately downloaded and authenticated release artifact would provide the same functionality with lower risk.

Attack Path

  1. An attacker compromises the external installation endpoint, its publishing account, or its release pipeline.
  2. The attacker modifies install.sh to include arbitrary shell commands.
  3. A user follows the Skill instructions and runs the documented command.
  4. curl retrieves the attacker-controlled response and passes it directly to sh.
  5. The malicious commands execute with the privileges of the invoking user. If the script invokes sudo, is run from a privileged shell, or exploits local installation privileges, the impact can extend to the entire host.

Impact Assessment

Successful exploitation provides arbitrary command execution under the invoking account. Potential consequences include modification of user files, theft of accessible credentials or model data, installation of additional payloads, and compromise of later fleet operations. Execution ...[truncated 139 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not pipe a network response directly into a shell.
  • Pin installation to a specific, reviewed Ollama release.
  • Download the artifact to a local file before execution.
  • Verify a publisher signature or a hard-coded SHA-256 checksum obtained through an independent trusted channel.
  • Display or inspect the downloaded script before running it.
  • Prefer signed operating-system packages or other authenticated release artifacts.
  • Execute installation with ordinary user privileges wherever possible, elevating only narrowly scoped operations that require administrative access.

T08 · Insecure Dependencies

Error
Location
SKILL.md:24
Finding

Unpinned Python Package and Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:24
Vulnerability Type: Insecure third-party dependency installation
Risk Level: High

bash
pip install ollama-herd

Technical Analysis

The installation command does not pin an audited package version, verify package hashes, use a lock file, or specify an isolated environment. The effective package and transitive dependency set can therefore change after review. Python package installation may execute package build logic and installs executable entry points that are subsequently referenced by the documented systemd service.

No evidence establishes that the current package is malicious. The vulnerability is the unverified and mutable supply-chain trust relationship, especially when combined with the later execution of /usr/local/bin/herd as a persistent service.

Attack Path

  1. An attacker compromises the ollama-herd publisher account, package repository, or one of its unpinned dependencies.
  2. The attacker publishes a malicious release or dependency update.
  3. A user runs the unpinned pip install ollama-herd command.
  4. The package manager resolves and installs the attacker-controlled version.
  5. Malicious build or installation logic can execute during installation, or malicious entry points can execute when herd or herd-node is started.
  6. If the documented systemd integration is also enabled, the compromised executable can run repeatedly and survive reboots.

Impact Assessment

Exploitation can provide arbitrary code execution with the privileges used for installation or service execution. A user-level installation would expose that account's data and resources. A global or root installation, or subsequent root-owned service execution, could permit system-wide compromise. The persistent service configuration can amplify the scope by executing the installed package automatically after boot.

Remediation
View remediation

Remediation Suggestions

  • Pin ollama-herd and every transitive dependency to reviewed versions.
  • Provide a lock file containing cryptographic hashes and install with hash enforcement, such as pip --require-hashes.
  • Install into a dedicated virtual environment rather than the global Python environment.
  • Verify package provenance and publish reproducible release artifacts where possible.
  • Configure systemd to reference the exact versioned virtual-environment executable.
  • Review dependency updates before changing the pinned set.
  • Avoid performing package installation as root.

T06 · System Persistence

Error
Location
SKILL.md:47
Finding

Persistent System Service Runs Unpinned Package Code Without Hardening

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:47-64
Vulnerability Type: Cross-session service persistence
Risk Level: High

ini
# /etc/systemd/system/ollama-herd.service
[Unit]
Description=Linux Ollama Herd Router
After=network.target ollama.service

[Service]
Type=simple
ExecStart=/usr/local/bin/herd
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Technical Analysis

The instructions enable a system-level service at boot and configure it to restart continuously. Persistent operation is consistent with a fleet router, but the proposed unit does not specify a dedicated unprivileged User or Group and contains no systemd sandboxing or capability restrictions. A system service without a User directive normally executes as root.

The service points to /usr/local/bin/herd, which the preceding instructions obtain through an unpinned package installation. This combines mutable supply-chain code with privileged, cross-session execution. The node-agent example at lines 68-81 follows a similar unrestricted service pattern, although the shown commands only explicitly enable the router service.

Attack Path

  1. A malicious or compromised package places attacker-controlled code at /usr/local/bin/herd, or an attacker with sufficient local write access replaces that executable.
  2. The user creates the documented unit and enables it with sudo systemctl enable ollama-herd.
  3. systemd executes the binary when the service starts and on subsequent boots.
  4. Because no service user is specified, the process may run as root.
  5. Restart=always relaunches the process after termination or failure, preserving execution until the service is disabled and its unit and executable are removed.

Impact Assessment

If deployed exactly as shown, compromised service code may obtain root-lev ...[truncated 364 chars]

Remediation
View remediation

Remediation Suggestions

  • Make boot persistence optional and require explicit, informed user consent.
  • Create a dedicated system account with no interactive login and set User= and Group= in the unit.
  • Run a pinned, integrity-verified executable from a dedicated virtual environment rather than a mutable global path.
  • Ensure the executable and its parent directories are not writable by the service account.
  • Apply systemd hardening, including NoNewPrivileges=true, ProtectSystem=strict, ProtectHome=true, PrivateTmp=true, restricted writable paths, and an empty or minimal capability set.
  • Restrict network address families and outbound destinations to those required by fleet routing.
  • Use a bounded restart policy to avoid indefinite failure loops where appropriate.
  • Document how to stop, disable, and remove the service and its dedicated account.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:149
Finding

Unrestricted Firewall Rules Expose an Apparently Unauthenticated HTTP Service

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:149-158
Vulnerability Type: Excessively broad network exposure
Risk Level: Medium

bash
# UFW (Ubuntu/Debian)
sudo ufw allow 11435/tcp

# firewalld (RHEL/Fedora)
sudo firewall-cmd --add-port=11435/tcp --permanent
sudo firewall-cmd --reload

# iptables
sudo iptables -A INPUT -p tcp --dport 11435 -j ACCEPT

Technical Analysis

Each alternative firewall command permits inbound TCP connections to port 11435 without restricting source addresses or trusted interfaces. Fleet routing legitimately requires communication between selected machines, but permitting every reachable source exceeds the minimum access needed.

The Skill documents plain HTTP endpoints and an OpenAI client configured with api_key="not-needed". It does not document authentication, TLS, source allowlisting, or a secure binding address. If the router listens on a non-loopback interface, the firewall instructions can make inference, health, fleet-status, model, or dashboard endpoints reachable by untrusted hosts.

Attack Path

  1. A user starts the router on a network-reachable interface.
  2. The user applies the firewall command for the host's firewall implementation.
  3. Port 11435 becomes reachable from any source allowed by upstream networking.
  4. An attacker scans the host or otherwise learns its address and port.
  5. The attacker sends requests to the documented HTTP API or dashboard without meaningful API authentication.
  6. Depending on the exposed server implementation, the attacker can consume inference resources and access operational endpoints.

Impact Assessment

Confirmed exposure includes the possibility of unauthorized access to documented router APIs when the service is network-bound. Likely consequences include inference-resource abuse, denial of service through expensive requests, and disclosure of fleet health, active models, or operational status. The docu ...[truncated 115 chars]

Remediation
View remediation

Remediation Suggestions

  • Bind the service to localhost by default when remote fleet access is unnecessary.
  • For fleet deployments, bind only to a dedicated private interface.
  • Restrict firewall access to explicitly trusted node IP addresses or private subnets.
  • Require authenticated requests for inference, dashboard, health, and fleet-management endpoints.
  • Use TLS, preferably mutual TLS between router and nodes, for traffic crossing machine boundaries.
  • Warn users not to expose port 11435 directly to the public Internet.
  • Provide firewall removal commands and verification steps so users can confirm the effective exposure.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (20)

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

Piping a remotely fetched script directly into sh executes unreviewed code from the network with no integrity verification or inspection step. If the install endpoint, DNS/TLS path, or hosting account is compromised, users may execute arbitrary code immediately on their Linux system.

Content

Scanner excerpt · SKILL.md (reported line 18)May include surrounding context.

Step 1: Install Ollama on Linux

bash
curl -fsSL https://ollama.ai/install.sh | sh

Step 2: Install Linux Ollama Herd

Chaining Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

The | sh construct is a classic dangerous command-chaining pattern because it converts network data directly into shell commands without review. In installation docs this is often normalized, but it materially increases the blast radius of any upstream compromise or content tampering.

Content

Scanner excerpt · SKILL.md (reported line 18)May include surrounding context.

Step 1: Install Ollama on Linux

bash
curl -fsSL https://ollama.ai/install.sh | sh

Step 2: Install Linux Ollama Herd

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · SKILL.md (reported line 130)May include surrounding context.

t": "Explain Linux process scheduling"}], "stream": false }'

text

## Linux Ollama environment setup

```bash
# Optimize Linux Ollama performance via systemd
sudo systemctl edit ollama
# Add under [Service]:
#   Environment="OLLAMA_KEEP_ALIVE=-1"
#   Environment="OLLAMA_MAX_LOADED_MODELS=-1"
#   Environment="OLLAMA_NUM_PARALLEL=2"
sudo systemctl restart ollama

Or via shell profile:

bash
echo 'export OLLAMA_KEEP_ALIVE=-1' >> ~/.bashrc
echo 'export OLLAMA_MAX_LOADED_MODELS=-1' >> ~/.bashrc
source ~/.bashrc

Linux Ollama GPU support

Linux GPUvRAMBest Linux Ollama models
NVIDIA RTX 409024GBllama3.3:70b, qwen3.5:32b
NVIDIA A10040/80GBdeepseek-v3, qwen3.5:72b
NVIDIA L40S48GBllama3.3:70b (full precision)
AMD ROCm (experimental)variesOllama ROCm support on Linux
CPU onlysystem RAMphi4-mini, gemma3:1b — slower but works

Linux Ollama supports NVIDIA CUDA

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 165)May include surrounding context.

bash
# Linux Ollama fleet status
curl -s http://localhost:11435/fleet/status | python3 -m json.tool

# Linux Ollama health — 15 automated checks
curl -s http://localhost:11435/dashboard/api/health | python3 -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 168)May include surrounding context.

md
curl -s http://localhost:11435/fleet/status | python3 -m json.tool

# Linux Ollama health — 15 automated checks
curl -s http://localhost:11435/dashboard/api/health | python3 -m json.tool

# Models on Linux Ollama nodes
curl -s http://localhost:11435/api/ps | python3 -m json.tool

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 171)May include surrounding context.

curl -s http://localhost:11435/dashboard/api/health | python3 -m json.tool

Models on Linux Ollama nodes

curl -s http://localhost:11435/api/ps | python3 -m json.tool

text

Dashboard at `http://localhost:11435/dashboard` — live Linux Ollama monitoring.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

text

```bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 64)May include surrounding context.

text

```bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 119)May include surrounding context.

text

```bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 124)May include surrounding context.

text

```bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

text

```bash
sudo systemctl enable ollama-herd
sudo systemctl start ollama-herd

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 97)May include surrounding context.

md
response = client.chat.completions.create(
    model="llama3.3:70b",
    messages=[{"role": "user", "content": "Write a systemd service file for a Python API"}],
    stream=True,
)
for chunk in response:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 104)May include surrounding context.

print(chunk.choices[0].delta.content or "", end="")

text

### curl (Ollama format)

```bash
# Linux Ollama inference

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill includes commands to open TCP port 11435 via UFW, firewalld, and iptables without warning that this exposes the Ollama router to the network. In the context of a fleet router and dashboard, this can unintentionally make inference, status, or monitoring endpoints reachable from untrusted hosts if users copy-paste the commands as-is.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

The sudo firewall command changes host network policy and opens a listening service to inbound connections. In this skill's context, that increases attack surface because the router/dashboard may become reachable from untrusted systems if users do not further restrict access.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

bash
# UFW (Ubuntu/Debian)
sudo ufw allow 11435/tcp

# firewalld (RHEL/Fedora)
sudo firewall-cmd --add-port=11435/tcp --permanent

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

Using sudo with firewalld to permanently open port 11435 makes a network-facing service accessible beyond localhost. Because the skill promotes multi-node routing and monitoring, users may expose administrative or inference endpoints without understanding the security consequences.

Content

Scanner excerpt · SKILL.md (reported line 154)May include surrounding context.

md
sudo ufw allow 11435/tcp

# firewalld (RHEL/Fedora)
sudo firewall-cmd --add-port=11435/tcp --permanent
sudo firewall-cmd --reload

# iptables

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

Reloading firewalld applies the newly opened port, operationalizing the exposure. The danger is contextual rather than inherently malicious: it finalizes a network policy change that may unintentionally publish the service.

Content

Scanner excerpt · SKILL.md (reported line 155)May include surrounding context.

md
# firewalld (RHEL/Fedora)
sudo firewall-cmd --add-port=11435/tcp --permanent
sudo firewall-cmd --reload

# iptables
sudo iptables -A INPUT -p tcp --dport 11435 -j ACCEPT

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
90% confidence
Finding

The iptables command explicitly permits inbound traffic to port 11435, increasing exposure of the fleet router. Without source restrictions or authentication guidance, this can broaden the reachable attack surface of the service and dashboard.

Content

Scanner excerpt · SKILL.md (reported line 158)May include surrounding context.

sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p tcp --dport 11435 -j ACCEPT

text

## Monitor Linux Ollama

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 190)May include surrounding context.

Image generation

bash
curl http://localhost:11435/api/generate-image \
  -d '{"model": "z-image-turbo", "prompt": "Linux penguin in cyberspace", "width": 1024, "height": 1024}'

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The description line mixes English, Chinese, and Spanish marketing text, which imposes language choices in the skill metadata without explaining locale intent or offering opt-in. This can conflict with organizational language/locale policy when users expect a single requested language or explicit localization behavior.

Content

No source excerpt is available for this finding.