Back to skill

Security audit

PDF 转 GetNotes

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly aligned with importing PDFs into GetNotes, but it ships live-looking GetNotes credentials and under-discloses remote document handling, so users should review it before installing.

Do not install this version until the exposed GetNotes credentials are revoked and removed from the package. Treat any processed PDF as uploaded to GetNotes/OSS and possibly sent to an AI model; use only documents you are willing to transmit to those services, and prefer a revised version with explicit consent, secure temp files, validated upload hosts, and accurate AI-summary behavior.

Vulnerability Patterns
  • 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
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
references/full_sop.md:182
Finding

Live GetNotes API Credentials Embedded in Documentation

Content
View full analysis

Vulnerability Details

File Location: references/full_sop.md, lines 182–183
Vulnerability Type: Hardcoded API credentials
Risk Level: High

Vulnerable Code

text
- API Key: [REDACTED LIVE-LOOKING gk_live CREDENTIAL]
- Client ID: cli_a1b2c3d4e5f6789012345678abcdef90

The API key has been redacted from this report to prevent further disclosure. The source file contains the complete value.

Technical Analysis

The documentation contains a complete live-looking GetNotes API key and client identifier. This directly contradicts the Skill's stated credential-handling design, under which credentials should only be read from ~/.openclaw/openclaw.json.

Documentation is normally distributed with the Skill and may be copied into package registries, source repositories, logs, backups, or model context. Therefore, embedding credentials in a reference file exposes them to every party that can obtain the Skill package.

The gk_live prefix indicates that the value may be intended for a live environment. Whether it remains active cannot be established through static analysis, but it must be treated as compromised.

Attack Path

  1. An attacker downloads or otherwise obtains the Skill package.
  2. The attacker opens references/full_sop.md and extracts the API key and client ID.
  3. The attacker submits authenticated requests to the GetNotes API using the exposed values.
  4. The attacker performs any image-upload, note-creation, knowledge-base, or other operations authorized by the credential.
  5. Unauthorized activity is attributed to the legitimate credential owner and may continue until the credential is revoked.

Impact Assessment

An attacker can obtain the same GetNotes API privileges granted to the exposed credential. The demonstrated code uses credentials for obtaining image-upload tokens, creating notes, and adding notes to knowledge bases. Additional scope depends on server-side authorizati ...[truncated 426 chars]

Remediation
View remediation

Remediation Suggestions

  1. Revoke and rotate the exposed API key and client ID immediately.
  2. Remove the credentials from the current file and all repository history, package releases, caches, and generated artifacts.
  3. Replace real values in documentation with unmistakably nonfunctional examples:
    text
    API Key: gk_live_REDACTED
    Client ID: cli_REDACTED
    
  4. Continue loading credentials from a protected runtime secret store or ~/.openclaw/openclaw.json, with file permissions restricted to the owning user.
  5. Add automated secret scanning to pre-commit and CI workflows.
  6. Review GetNotes audit logs for unauthorized use of the exposed credential.
  7. Apply server-side least privilege, expiration, rotation, and rate limits to replacement credentials.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_pdf_to_getnote.py:115
Finding

Predictable and Symlink-Susceptible Temporary File Handling

Content
View full analysis

Vulnerability Details

File Location: scripts/run_pdf_to_getnote.py, lines 115–151
Vulnerability Type: Unsafe temporary files and directories
Risk Level: Medium

Vulnerable Code

python
pdf_name = os.path.splitext(os.path.basename(pdf_path))[0]
title = custom_title or f"{pdf_name} - 完整摘要版"
output_dir = f"/tmp/pdf_pages/{pdf_name}"

print(f"📄 处理文件: {pdf_path}")

# Step 1: PDF -> PNG
print("\n[1/5] PDF -> PNG 转换...")
page_paths = pdf_to_images(pdf_path, output_dir)
python
with open(f"/tmp/{pdf_name}_urls.json", "w") as f:
    json.dump(page_urls, f)

The resulting paths are predictable and derived from a user-controlled PDF filename. The script does not use atomic secure creation, reject symbolic links, apply restrictive permissions, create a per-run random directory, or clean up the generated files.

Technical Analysis

Shared temporary directories such as /tmp must be treated as attacker-controlled. Another local user or process can predict output names from the source PDF filename and may pre-create corresponding files, directories, or symbolic links.

os.makedirs(output_dir, exist_ok=True) accepts an existing location, including a path involving symbolic links. Subsequent page rendering writes predictable names such as page_01.png. Likewise, open(path, "w") follows a symbolic link at the predictable URL metadata path.

In addition to write-redirection risks, rendered PDF pages and uploaded image URLs remain under /tmp after execution. Depending on the process umask and directory permissions, these artifacts may be readable by other local users. Reusing the same filename can also mix stale files or overwrite data from another execution.

Attack Path

  1. A local attacker learns or predicts the filename of a PDF that the victim will process.
  2. The attacker creates the corresponding /tmp/pdf_pages/{pdf_name} path or /tmp/{pdf_name}_urls.json as a symbolic l ...[truncated 1029 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create a unique per-run directory with tempfile.TemporaryDirectory():
    python
    import tempfile
    
    with tempfile.TemporaryDirectory(prefix="pdf-to-getnote-") as output_dir:
        page_paths = pdf_to_images(pdf_path, output_dir)
        # Upload and create the note within this context.
    
  2. Store URL metadata in memory unless persistence is strictly required.
  3. If metadata must be persisted, use tempfile.NamedTemporaryFile() with mode 0o600 and atomic creation.
  4. Never reuse raw filenames as security boundaries or temporary resource identifiers.
  5. Set restrictive permissions on temporary directories and files.
  6. Refuse symbolic links where persistent output is unavoidable, and use safe open flags such as O_CREAT | O_EXCL | O_NOFOLLOW where supported.
  7. Delete rendered pages and URL metadata in a finally block, including after failed uploads.
  8. Add limits on PDF page count, output dimensions, and total rendered size to reduce temporary-storage denial-of-service risk.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_pdf_to_getnote.py:48
Finding

Unvalidated Remote Upload Destination Can Exfiltrate PDF Contents

Content
View full analysis

Vulnerability Details

File Location: scripts/run_pdf_to_getnote.py, lines 48–63
Vulnerability Type: Untrusted upload destination and sensitive-data exfiltration
Risk Level: Medium

Vulnerable Code

python
def upload_to_oss(page_path, token_data):
    import subprocess
    d = token_data["data"]
    cmd = [
        "curl", "-s", "-X", "POST", d["host"],
        "-F", f"key={d['object_key']}",
        "-F", f"OSSAccessKeyId={d['accessid']}",
        "-F", f"policy={d['policy']}",
        "-F", f"signature={d['signature']}",
        "-F", f"callback={d['callback']}",
        "-F", f"Content-Type=image/png",
        "-F", f"file=@{page_path}"
    ]
    r = subprocess.run(cmd, capture_output=True, text=True)
    if r.returncode != 0:
        raise Exception(f"OSS upload failed: {r.stderr[:200]}")
    return d["access_url"]

Technical Analysis

The function trusts d["host"] from the upload-token API response and transmits a complete rendered PDF page to that destination. It does not verify the URL scheme, hostname, port, redirect behavior, or relationship between the destination and the expected OSS provider.

Passing arguments as a list without shell=True prevents ordinary shell metacharacter injection. However, it does not make the remote destination trustworthy. If the token endpoint, its response path, or the upstream service is compromised, an attacker can return an attacker-controlled host and receive both the document image and temporary signed upload fields.

The code also lacks explicit timeouts and robust HTTP-status validation. Curl's default behavior does not necessarily treat HTTP error responses as process failures, so the script may accept an upload as successful based only on a zero process return code.

Uploading PDF pages is necessary for the declared GetNotes functionality. The excess risk is not the upload itself, but accepting an unrestricted dynamic destin ...[truncated 1371 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the returned URL and require an HTTPS scheme.
  2. Enforce an allowlist of documented OSS hostnames or hostname suffixes after proper normalization:
    python
    from urllib.parse import urlparse
    
    parsed = urlparse(d["host"])
    if parsed.scheme != "https" or parsed.port not in (None, 443):
        raise ValueError("Invalid upload destination")
    if parsed.hostname not in EXPECTED_OSS_HOSTS:
        raise ValueError("Unapproved upload host")
    
  3. Reject URLs containing user-info components, unexpected ports, fragments, or malformed hostnames.
  4. Disable redirects or validate every redirect destination against the same allowlist.
  5. Use a native HTTP library with explicit TLS verification, connection and read timeouts, bounded responses, and status-code checks.
  6. Validate all required token-response fields and ensure access_url belongs to an approved domain before embedding it in a note.
  7. Configure signed upload policies with minimal object scope, short expiration, content-type restrictions, and maximum file size.
  8. Inform users before transmitting the complete document to third-party GetNotes/OSS infrastructure, especially for sensitive PDFs.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented behavior exceeds the user-facing description by reading local credentials, uploading content to remote storage, and optionally modifying a knowledge base. This mismatch undermines informed consent and can cause users to expose sensitive PDF contents or local secrets to external services they did not expect to be involved.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The SOP includes what appear to be real API credentials directly in documentation, which creates an immediate secret-exposure risk. Anyone with access to the skill file can reuse those credentials to upload content, create notes, or access related resources, and this risk is unrelated to the narrow user-facing task of converting a PDF into a note.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The document not only exposes credentials but also instructs their operational use without any secure-handling guidance, normalizing unsafe secret practices. This increases the likelihood of credential leakage, accidental reuse in logs or screenshots, and downstream compromise of the associated account or API resources.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes a full pipeline including 'AI 摘要生成', but this script explicitly states the AI summary is generated externally and fills the note with template placeholders instead. This is a direct semantic mismatch between the skill's claimed end-to-end behavior and the implemented code.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill documents file writes, network access, and shell execution but declares no explicit tool scope or permission boundary. In an agent setting, this increases the chance of over-broad execution and makes sensitive actions like local file access, subprocess execution, and remote uploads happen without clear user-reviewable constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill omits a clear warning that PDF contents, extracted text, and rendered page images are transmitted to external services and stored remotely. For potentially sensitive documents, this lack of disclosure can lead to accidental data exfiltration, privacy violations, and regulatory exposure.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The skill sends extracted PDF text to an external AI endpoint, which is an actual external transmission of potentially sensitive content. In the context of document-processing skills, this can be acceptable only with explicit disclosure, minimization, and user consent; otherwise it creates a real confidentiality risk.

Content

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

md
API_KEY = os.environ.get("MINIMAX_API_KEY")
resp = urllib.request.Post(
    "https://api.minimax.io/v1/text/chatcompletion_pro?GroupId=...",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"model": "MiniMax-M2", "messages": [...]}
)

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Invoking curl via a subprocess introduces an unnecessary shell-adjacent execution path for functionality that could be implemented directly in-process. Even though arguments are passed as a list, using subprocesses broadens the attack surface, complicates auditing, and increases the risk of unsafe expansion in later modifications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The workflow sends every PDF page to remote services for upload and note creation, and may also send extracted text to an AI summarization model, yet it provides no user-facing disclosure or consent flow about external transmission. In the context of a PDF-import skill, this is dangerous because PDFs often contain sensitive personal, financial, legal, or internal business data that users may assume is handled locally.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The stated purpose is PDF ingestion into GetNotes, and network upload itself is expected. However, invoking an external subprocess via curl adds command-execution capability beyond what this skill context requires, since the same upload can be performed with native HTTP libraries.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The SOP expands behavior from saving a note to also adding that note into a knowledge base, which is outside the described manifest scope. That scope drift matters because it can cause unintended persistence, broader distribution, or indexing of uploaded PDF content without clear user intent or consent.

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/run_pdf_to_getnote.py (reported line 60)May include surrounding context.

python
"-F", f"Content-Type=image/png",
        "-F", f"file=@{page_path}"
    ]
    r = subprocess.run(cmd, capture_output=True, text=True)
    if r.returncode != 0:
        raise Exception(f"OSS upload failed: {r.stderr[:200]}")
    return d["access_url"]

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file-level documentation presents the script as a one-click PDF-to-GetNotes workflow, while the inline comment explicitly says the AI summary must be produced by the caller outside this script. That documentation creates an intent mismatch because the advertised automated flow is not actually self-contained.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill name, description, trigger phrases, and user-facing content are all written as Chinese-only instructions, implying a fixed language/locale behavior. Under the policy, locale constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill reads API credentials from a local configuration file without disclosing that capability in the skill purpose. Accessing local secrets materially raises the trust requirement of the skill and creates a path for unintended secret use in conjunction with network operations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest description limits the skill to converting a PDF into images, generating an AI summary, and creating a single note in GetNotes. Step 6 adds an extra behavior—modifying a knowledge base by batch-adding the created note to a topic—which is not mentioned in the manifest's stated scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file is written entirely in Chinese and does not indicate that the user may choose another language or locale. Under the policy for natural-language violations, forcing a specific language without user opt-in can be a violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The SOP, prompts, headings, and output templates are all fixed in Chinese, which imposes a language choice on users. There is no indication that users can request another language or that the Chinese-only behavior is a documented regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file's description and CLI usage text are entirely in Chinese, and the runtime messages throughout the script also assume Chinese output. For a general-purpose utility, this is a natural-language locale constraint with no user opt-in or documented regional limitation.

Content

No source excerpt is available for this finding.