Back to skill

Security audit

Duru Obsidian KB

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a genuine local knowledge-base tool, but it has unsafe review-worthy behavior around command execution from configuration, broad network fetching, and file writes outside intended paths.

Install only if you are comfortable reviewing and running local scripts. Use it with a dedicated KB directory, avoid untrusted .env files, avoid ingesting attacker-supplied URLs or repositories, and do not use file-back targets from untrusted input until the .env loading, URL validation, size limits, and target-concept path handling are fixed.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/kb_daily.sh:7
Finding

Arbitrary Shell Command Execution Through Executable .env Loading

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/kb_ingest.py:95
Finding

Server-Side Request Forgery Through Unrestricted URL Ingestion

Content
View full analysis
str: request = Request(source, headers={"User-Agent": USER_AGENT}) with urlopen(request, timeout=30) as response: charset = response.headers.get_content_charset() or "utf-8" return response.read().decode(charset, errors="replace") def download_binary(source: str) -> bytes: request = Request(source, headers={"User-Agent": USER_AGENT}) with urlopen(request, timeout=60) as response: return response.read() ``` The functions are invoked with user-controlled sources: ```python try: html = fetch_url(source) ``` ```python if "arxiv.org" in source and "/abs/" in source: abs_html = fetch_url(source) metadata = extract_arxiv_metadata(abs_html) if metadata.get("title"): title = metadata["title"] pdf_bytes = download_binary(paper_url) pdf_path.write_bytes(pdf_bytes) ``` ### Technical Analysis The ingestion interface accepts user-controlled HTTP and HTTPS URLs and retrieves them from the host running the Skill. It does not validate the resolved destination address or reject loopback, private, link-local, multicast, reserved, or cloud metadata addresses. The implementation also relies on `urlopen` redirect handling without revalidating each destination against a network allowlist. There is no response-size limit before the complete article or binary response is read into memory. Network retrieval is necessary for the declared article and paper ingestion features, but unrestricted access to arbitrary network destinations exceeds the minimum permissions required for public-source collection. ### Attack Path 1. An attacker supplies an ingestion URL that points directl ...[truncated 1108 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/kb_ask.py:224
Finding

Arbitrary File Write Through Unsanitized Target Concept Name

Content
View full analysis
Remediation
View remediation

T01 · Skill Instruction Hijacking

Warning
Location
scripts/kb_ingest.py:242
Finding

Detected Prompt-Injection Content Remains in Downstream Agent-Facing Artifacts

Content
View full analysis
= MAX_SEGMENTS: break reasons = [] score = segment_noise_score(segment) lower = segment.lower() if score >= 5: reasons.append("noise") if re.search(r"ignore previous instructions|system prompt|developer message|tool call|jailbreak", lower): reasons.append("prompt-like") if re.search(r"order of the unicorn|unicorn magic|cryptic scar|destiny", lower): reasons.append("fantasy/anomalous") if link_density(segment) > 0.12: reasons.append("link-heavy") if reasons: flagged.append({ "text": segment[:500], "severity": "MEDIUM" if "prompt-like" in reasons else "LOW", "action": "warn", "reasons": reasons, }) return flagged ``` However, the same extracted text is retained in previews and raw documents: ```python psl_result = run_prompt_shield(cleaned_markdown[:12000]) suspicious_segments.extend(detect_suspicious_segments(cleaned_markdown)) if len(cleaned_markdown) < MIN_CONTENT_LENGTH: raise ValueError("extracted markdown too short after cleaning") title = extracted_title body_preview = cleaned_markdown[:MAX_PREVIEW_LENGTH] if psl_result.get("action") == "block" or psl_result.get("severity") in {"HIGH", "CRITICAL"}: status = "suspi ...[truncated 3194 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (38)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 71)May include surrounding context.

md
See: <https://docs.astral.sh/uv/getting-started/installation/>

### 3.2 Configure .env (Optional)

From this repo root:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 77)May include surrounding context.

md
See: <https://docs.astral.sh/uv/getting-started/installation/>

### 3.2 Configure .env (Optional)

From this repo root:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 76)May include surrounding context.

From this repo root:

bash
cp .env.example .env
# then edit .env for your local paths

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/kb_ingest.py --root /path/to/kb --source "https://example.com/article"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/kb_ingest.py --root /path/to/kb --source "https://example.com/article"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/kb_ingest.py --root /path/to/kb --source "https://example.com/article"

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
Use `scripts/kb_lint.py`.

## Output rules

Prefer these output forms:

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The script automatically sources a .env file from the skill root into the current shell, which executes arbitrary shell syntax rather than merely loading key/value pairs. If an attacker can modify that file, running the wrapper will execute attacker-controlled commands with the user's privileges and expose any exported secrets to downstream subprocesses.

Content

Scanner excerpt · scripts/kb_daily.sh (reported line 7)May include surrounding context.

sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

if [[ -f "$SKILL_ROOT/.env" ]]; then
  set -a
  # shellcheck disable=SC1090
  source "$SKILL_ROOT/.env"

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

This finding is part of the same unsafe .env loading flow: the skill exports variables from a local .env into the process environment after sourcing it, increasing the blast radius of any malicious content and making credentials available to invoked Python scripts. In a knowledge-base skill that processes local files and repositories, this is more dangerous because the tool is expected to run routinely against user-controlled workspace content.

Content

Scanner excerpt · scripts/kb_daily.sh (reported line 10)May include surrounding context.

sh
if [[ -f "$SKILL_ROOT/.env" ]]; then
  set -a
  # shellcheck disable=SC1090
  source "$SKILL_ROOT/.env"
  set +a
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/kb_env.py (reported line 27)May include surrounding context.

python
def load_env() -> None:
    env_path = SKILL_ROOT / ".env"
    for k, v in _parse_env_file(env_path).items():
        os.environ.setdefault(k, v)

Instruction Override

High
Category
Prompt Injection
Confidence
80% confidence
Finding

This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 250)May include surrounding context.

python
lower = segment.lower()
        if score >= 5:
            reasons.append("noise")
        if re.search(r"ignore previous instructions|system prompt|developer message|tool call|jailbreak", lower):
            reasons.append("prompt-like")
        if re.search(r"order of the unicorn|unicorn magic|cryptic scar|destiny", lower):
            reasons.append("fantasy/anomalous")

YARA rule 'agent_skill_prompt_injection_hidden_instructions': Prompt injection or hidden instructions embedded in AI agent skill text [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 250)May include surrounding context.

python
d": True}


def detect_suspicious_segments(cleaned_markdown: str):
    segments = split_segments(cleaned_markdown)
    flagged = []
    for segment in segments:
        if len(flagged) >= MAX_SEGMENTS:
            break
        reasons = []
        score = segment_noise_score(segment)
        lower = segment.lower()
        if score >= 5:
            reasons.append("noise")
        if re.search(r"ignore previous instructions|system prompt|developer message|tool call|jailbreak", lower):
            reasons.append("prompt-like")
        if re.search(r"order of the unicorn|unicorn magic|cryptic scar|destiny", lower):
            reasons.append("fantasy/anomalous")
        if link_density(segment) > 0.12:
            reasons.append("link-heavy")
        if reasons:
            flagged.append({
                "text": segment[:500],
                "severity": "MEDIUM" if "prompt-like" in reasons else "LOW",
                "action": "warn",
                "reasons": reasons,
            }

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill clearly instructs use of filesystem, shell, and network-capable scripts, but it does not declare any explicit tool scope or permission boundaries. That creates an over-privileged operational model where an agent may perform writes, downloads, cloning, and local command execution without clear authorization constraints or user visibility.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The activation criteria are very broad: the skill can trigger for collecting sources, building notes, asking questions, exporting outputs, and health checks across many content types. Over-broad invocation boundaries increase the chance the agent applies this skill in contexts the user did not intend, leading to unnecessary file mutations, network fetches, repository cloning, or data ingestion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill directs the agent to ingest content, download papers, clone repositories, and generate many files in a local knowledge base, but it does not require a prominent user warning or confirmation before making those filesystem changes. This can lead to unexpected local persistence, storage growth, and writes into user workspaces from remote or local inputs.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_add.py (reported line 19)May include surrounding context.

python
def run_json(cmd):
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    if proc.returncode != 0:
        raise SystemExit(proc.stderr or proc.stdout or f'Command failed: {cmd}')
    return json.loads(proc.stdout)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_ask.py (reported line 80)May include surrounding context.

python
def run_json(cmd):
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    if proc.returncode != 0:
        raise SystemExit(proc.stderr or proc.stdout or f'Command failed: {cmd}')
    return json.loads(proc.stdout)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code resolves a target root, may initialize a repository, ingests content, and optionally runs build and summarization subprocesses that likely write files, but the script provides no confirmation prompt and no user-facing print/log disclosure before those actions occur. For a code file, file-modifying operations should have some visible warning unless clearly disclosed elsewhere, which is not evident in this file.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_healthcheck.py (reported line 14)May include surrounding context.

python
DEFAULT_CONFIG = KB_CONFIG_PATH

def run_lint(root: str):
    proc = subprocess.run([
        'python3', str(KB_LINT), '--root', root
    ], capture_output=True, text=True, check=False)
    if proc.returncode != 0:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 217)May include surrounding context.

python
def run_prompt_shield(text: str):
    if not PSL_SCRIPT.exists():
        return {"available": False, "action": "allow", "severity": "SAFE", "reasons": ["psl script missing"], "degraded": False}
    proc = subprocess.run(["bash", str(PSL_SCRIPT)], input=text, text=True, capture_output=True, check=False)
    output = (proc.stdout or proc.stderr or "").strip()
    if not output:
        return {"available": True, "action": "warn", "severity": "UNKNOWN", "reasons": ["empty PSL output"], "degraded": True}

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 291)May include surrounding context.

python
def import_check(module_name: str) -> bool:
    proc = subprocess.run([kb_python(), "-c", f"import importlib.util; print(importlib.util.find_spec('{module_name}') is not None)"], capture_output=True, text=True, check=False)
    return proc.stdout.strip() == "True"

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Repository ingestion performs full git clones of arbitrary URLs, which grants network and external tool execution capabilities beyond what is minimally necessary for a markdown KB entry. In this skill context, user-provided sources are untrusted, so cloning can be abused for internal network probing, oversized content downloads, or unsafe protocol handling through git.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
87% confidence
Finding

Cloning arbitrary user-supplied repository URLs causes the skill to fetch and store untrusted remote content and invoke an external program against attacker-controlled input. In a KB ingestion context this expands capability beyond simple note capture and can enable SSRF-like internal network access, ingestion of dangerous local git configurations/protocols, or resource exhaustion via large/malicious repositories.

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 412)May include surrounding context.

python
if repo_dir.exists() and any(repo_dir.iterdir()):
        return "existing"
    repo_dir.parent.mkdir(parents=True, exist_ok=True)
    subprocess.run(["git", "clone", "--depth", "1", repo_url, str(repo_dir)], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
    return "cloned"

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The paper ingestion path downloads arbitrary PDFs and processes them with external tools and parsers, including a system strings command. Because PDFs are attacker-controlled and historically parser-targeted, this creates unnecessary exposure for a KB ingestion skill and can lead to denial of service or exploitation of vulnerable parsing dependencies.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb_ingest.py (reported line 521)May include surrounding context.

python
parts.append(txt.strip())
print('\n\n'.join(parts))
"""
        proc = subprocess.run([kb_python(), "-c", script, str(pdf_path)], capture_output=True, text=True, check=False)
        text = (proc.stdout or "").strip()
        if len(text) > 400:
            return text

Static analysis

No suspicious patterns detected.