Back to skill

Security audit

DeepSeek Bridge · DeepSeek API 桥接

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it starts a local DeepSeek bridge with prompt logging and imports executable code from a hardcoded external path, which needs review before installation.

Review this before installing. Use only with prompts you are comfortable sending to DeepSeek and saving in a local SQLite database. Set your own DEEPSEEK_API_KEY, verify which db_shared.py is imported, avoid writable shared import paths, and disable broad auto-start or trigger behavior in sensitive environments.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T07 · Tool Hijacking and Spoofing

Error
Location
deepseek_bridge.py:10
Finding

External Import Path Enables Local Module Hijacking and Arbitrary Code Execution

Content
View full analysis

Vulnerability Details

File Location: deepseek_bridge.py, lines 10–11
Vulnerability Type: Python module search-path hijacking
Risk Level: High

Vulnerable Code

python
# Add openclaw-data to path for db_shared
sys.path.insert(0, r"D:\openclaw-data")
from db_shared import save_question, update_answer

Technical Analysis

The application prepends the fixed external directory D:\openclaw-data to sys.path and then imports db_shared. Because this directory is placed at index zero, Python searches it before the project directory and other normal module locations.

Although the project contains an audited db_shared.py, this code does not guarantee that the bundled file will be imported. If D:\openclaw-data\db_shared.py exists, Python can load that external module instead. Python executes top-level module code during import, so a malicious replacement can run arbitrary code as soon as the bridge starts.

Exploitation requires an attacker, compromised process, or lower-trust user to have write access to the external directory. The vulnerability crosses a trust boundary whenever that directory is writable by principals who should not be able to execute code under the bridge process's identity.

Attack Path

  1. An attacker obtains write access to D:\openclaw-data.
  2. The attacker creates or replaces D:\openclaw-data\db_shared.py.
  3. The malicious module defines the expected save_question and update_answer functions while including an attacker-controlled top-level payload.
  4. A user or agent starts deepseek_bridge.py.
  5. The bridge prepends the attacker-writable directory to sys.path.
  6. Python imports the malicious external module and immediately executes its top-level code.
  7. The payload runs with the bridge process's privileges and can access its environment, local data, filesystem permissions, and network connectivity.

Impact Assessment

Successful exploitation provides arbitrary Python code execution with ...[truncated 658 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the external search-path modification:
python
sys.path.insert(0, r"D:\openclaw-data")
  1. Import the bundled module through a normal or explicit package-relative import. For example, package the project and use:
python
from .db_shared import save_question, update_answer

For direct-script execution, use a package entry point rather than manipulating sys.path.

  1. If an external module is operationally unavoidable:

    • Store it in an administrator-controlled, read-only installation directory.
    • Restrict write permissions to trusted deployment identities.
    • Load it by an explicitly validated path rather than changing the global module search order.
    • Verify the file against a trusted cryptographic hash or signed manifest before loading.
    • Refuse startup if ownership, permissions, path resolution, or integrity validation fails.
  2. Run the bridge under a dedicated least-privilege account and expose only the minimum required environment variables, files, and network access.

  3. Add a startup test that verifies db_shared.__file__ resolves to the expected packaged path and fails closed otherwise.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (19)

Tainted flow: 'headers' from os.environ.get (line 43, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · deepseek_bridge.py (reported line 55)May include surrounding context.

python
}

    try:
        response = requests.post(DEEPSEEK_URL, json=payload, headers=headers, timeout=60)
        response.raise_for_status()
        answer = response.json()["choices"][0]["message"]["content"]
        # Update answer in shared DB

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 · README.md (reported line 10)May include surrounding context.

md
python D:\ollama-intel\deepseek_bridge.py

# 健康检查
curl http://127.0.0.1:8080/health

# 调用
curl -X POST http://127.0.0.1:8080/ask \

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill documents capabilities that use environment variables and network access, but it does not declare any tool scope or permissions boundaries. This weakens reviewability and enforcement, making it easier for an agent to invoke networked behavior or read secrets without clear operator approval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill forwards user questions to the DeepSeek API but does not clearly warn users that their inputs leave the local environment and are sent to a third party. This can expose confidential prompts, credentials, or proprietary data to an external provider without informed consent.

Content

No source excerpt is available for this finding.

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 36)May include surrounding context.

健康检查:

bash
curl http://127.0.0.1:8080/health
# {"status":"ok","model":"deepseek-chat"}

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill states that user questions and answers are stored persistently in SQLite, but it does not provide a clear privacy warning, retention policy, or consent guidance. This is dangerous because users may submit sensitive prompts assuming they are transient, while the bridge silently keeps a local history that could later be accessed or exfiltrated.

Content

No source excerpt is available for this finding.

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 132)May include surrounding context.

javascript
async function askDeepSeek(question) {
  const resp = await fetch('http://127.0.0.1:8080/ask', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ question })

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

javascript
async function askDeepSeek(question) {
  const resp = await fetch('http://127.0.0.1:8080/ask', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ question })

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad and ambiguous, including everyday language variants that could activate the skill unintentionally. In this context, accidental activation can cause unexpected external API calls and persistent logging of user content, increasing privacy and cost risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documentation contradicts itself by saying the API key is required with no default while also claiming a built-in key is used by default. A built-in credential in a shared skill is a serious secret-management risk because it may expose someone else's account, obscure billing ownership, and encourage unsafe reuse of embedded secrets.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module documentation omits a material data-handling behavior: persisting user questions and model answers to a shared database. This mismatch can mislead operators and users about where sensitive data goes, increasing the chance of unsafe deployment or use with confidential prompts.

Content

No source excerpt is available for this finding.

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 · deepseek_bridge.py (reported line 19)May include surrounding context.

python
app = Flask(__name__)

DEEPSEEK_API_KEY = os.environ.get("DEEPSEEK_API_KEY") or ""
DEEPSEEK_URL = "https://api.deepseek.com/v1/chat/completions"


@app.route('/health', methods=['GET'])

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The service stores raw user questions in a shared database without any notice, consent, or sensitivity controls. In this skill context, users may submit secrets, internal data, or personal information, so silent persistence materially increases privacy and data-exposure risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The application persistently stores both user questions and model answers in a shared database without any visible minimization, classification, or sensitivity filtering. This broad retention can accumulate secrets, personal data, or proprietary content, making the shared database a concentrated target and increasing blast radius if accessed improperly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The bridge forwards user questions to a third-party API without any user-facing warning or consent mechanism. Because prompts can contain sensitive information, undisclosed external transmission expands the trust boundary and can create compliance, privacy, and confidentiality issues.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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 · deepseek_bridge.py (reported line 55)May include surrounding context.

python
}

    try:
        response = requests.post(DEEPSEEK_URL, json=payload, headers=headers, timeout=60)
        response.raise_for_status()
        answer = response.json()["choices"][0]["message"]["content"]
        # Update answer in shared DB

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README content, headings, and example payload are presented only in Chinese, which can constitute a language/locale policy violation when no user opt-in or alternative language is offered. Nothing in the file explains that the skill is intentionally region-specific or provides bilingual guidance.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

Most user-facing natural-language content, examples, and trigger phrases are presented in Chinese, which effectively biases the skill toward a specific language context. The file does not state that Chinese is optional, nor does it offer multilingual alternatives or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The top-level natural-language description and usage text are written only in Chinese, which can function as a language policy constraint without any opt-in or alternative language offered. Under the policy rule, forcing a specific language without user choice is a reportable natural-language issue.

Content

No source excerpt is available for this finding.