Back to skill

Security audit

Zotero Manager

Security checks for vulnerabilities and agentic risk

Overview

This Zotero skill is mostly purpose-aligned, but it handles reusable API credentials in ways that could leak them if a user or agent is steered to an unsafe local API URL.

Install only if you are comfortable with the credential handling. Use a dedicated least-privilege Zotero key, restrict any saved key file to your user account, avoid putting tokens directly in shell history, and do not use --api-url with anything except a trusted local Zotero loopback address.

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
zotero_search.py:41
Finding

Arbitrary Local API Endpoint Can Receive Zotero Credentials

Content
View full analysis

Vulnerability Details

File Location: zotero_search.py:41-70, zotero_search.py:196-197, and zotero_search.py:215-216
Vulnerability Type: Credential disclosure through an unrestricted network destination
Risk Level: High

Vulnerable Code

python
def get_local_api_key():
    """From configuration file to get Zotero local API key"""
    config_path = Path.home() / '.config' / 'zotero' / 'local_api_key'
    if config_path.exists():
        with open(config_path, 'r', encoding='utf-8') as f:
            return f.read().strip()

    # Fall back to the general API key
    return get_api_key()


def search_local(query, limit=10, base_url='http://localhost:23119/api'):
    """Search using the Zotero local API"""
    search_url = f"{base_url}/3/items"
    params = {
        'q': query,
        'limit': limit,
        'format': 'json'
    }

    api_key = get_local_api_key()
    headers = {}
    if api_key:
        headers['Authorization'] = f'Bearer {api_key}'

    try:
        response = requests.get(
            search_url,
            params=params,
            headers=headers,
            timeout=5
        )
python
parser.add_argument(
    '--api-url',
    type=str,
    default='http://localhost:23119/api',
    help='Local API address'
)
python
if args.local:
    print(f"API address: {args.api_url}")
    items = search_local(args.query or '', args.limit, args.api_url)

Technical Analysis

The --api-url argument is accepted without validating its scheme, hostname, port, or resolved address. search_local() then constructs a request from that value and attaches a Zotero credential as an Authorization: Bearer header.

The credential selection increases the exposure: if a dedicated local API key does not exist, get_local_api_key() falls back to the remote Zotero API key. Consequently, a command presented as a local sea ...[truncated 1653 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict local API destinations to explicit loopback addresses:
    • localhost
    • 127.0.0.1
    • [::1]
  2. Resolve the hostname and verify that every resolved address is loopback before sending credentials.
  3. Allow only plain HTTP to a verified loopback destination, unless a separately trusted local TLS configuration is implemented.
  4. Disable automatic redirects or revalidate every redirect destination before forwarding credentials:
    python
    requests.get(..., allow_redirects=False)
    
  5. Never fall back from the local API key to the remote Zotero API key.
  6. Do not attach authentication unless a dedicated local token was explicitly configured.
  7. If custom ports are required, permit a validated numeric port while keeping the hostname fixed to loopback.
  8. Add tests confirming that external, private-network, malformed, and redirecting URLs are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
zotero_import.py:32
Finding

Zotero API Keys Are Embedded in URL Paths and Query Strings

Content
View full analysis

Vulnerability Details

File Location: zotero_import.py:32-35, zotero_import.py:96-100, zotero_search.py:103-106, zotero_search.py:113-123, zotero_search.py:132-137, and zotero_search.py:155-157
Additional Documentation Location: ZOTERO_LOCAL_API.md:51-76
Vulnerability Type: Sensitive credentials exposed through request URLs
Risk Level: Medium

Vulnerable Code

python
def get_user_id(api_key):
    """Get Zotero UserID"""
    url = "https://api.zotero.org/api/checkkeys/" + api_key
    response = requests.get(url)
python
def get_collection_key(collection_name, api_key, user_id):
    """Get the collection key"""
    url = f"https://api.zotero.org/users/{user_id}/collections"
    params = {'key': api_key}
    response = requests.get(url, params=params)
python
def get_user_id(api_key):
    """Get Zotero UserID"""
    url = "https://api.zotero.org/keys/" + api_key
    response = requests.get(
        url,
        headers={'Zotero-API-Key': api_key}
    )
python
def search_library(query, api_key, user_id, limit=10):
    """Search the remote Zotero library"""
    base_url = f"https://api.zotero.org/users/{user_id}/items"
    params = {
        'q': query,
        'limit': limit,
        'format': 'json',
        'key': api_key
    }

    response = requests.get(base_url, params=params)
python
def search_collection(collection_name, api_key, user_id, limit=10):
    collections_url = f"https://api.zotero.org/users/{user_id}/collections"
    params = {'key': api_key}
    response = requests.get(collections_url, params=params)

    items_url = (
        f"https://api.zotero.org/users/{user_id}/collections/"
        f"{collection_id}/items"
    )
    params = {'limit': limit, 'key': api_key}
    response = requests.get(items_url, params=params)

The local API documentation also demonstrates a URL co ...[truncated 2038 chars]

Remediation
View remediation

Remediation Suggestions

  1. Send credentials only through the Zotero-API-Key request header:
    python
    headers = {'Zotero-API-Key': api_key}
    response = requests.get(url, headers=headers, timeout=10)
    
  2. Remove key from all query parameter dictionaries.
  3. Avoid key-validation endpoints that require the credential in the URL path when a header-authenticated endpoint is available.
  4. Remove documentation examples containing ?key=....
  5. Ensure request URLs and exception messages are sanitized before logging.
  6. Configure proxies and telemetry systems to redact sensitive query parameters as defense in depth.
  7. Add explicit timeouts to all remote HTTP requests.
  8. Rotate any token that may already have appeared in URL, proxy, or browser logs.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:42
Finding

Setup Instructions Store API Tokens in Plaintext Without Restrictive Permissions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:42-44
Additional Locations: README.md:38-40, LOCAL_API_SETUP.md:38-40, GET_API_KEY.md:25-27, GET_API_KEY.md:84-86, ZOTERO8_SETUP.md:39-43, VERSION_ISSUE.md:41-45, and ZOTERO_LOCAL_API.md:93-94
Vulnerability Type: Insecure local credential storage
Risk Level: Medium

Vulnerable Instructions

bash
mkdir -p ~/.config/zotero
echo "your_api_key" > ~/.config/zotero/api_key

Other project guides provide equivalent commands for local and remote API tokens, including:

bash
echo "your_api_key" > ~/.config/zotero/api_key
bash
echo "your_local_api_key" > D:\Personal\OpenClaw\.config\zotero\local_api_key

Technical Analysis

The recommended commands place reusable API credentials in plaintext files without explicitly setting restrictive permissions. The resulting access mode depends on the user's operating system, shell, filesystem, and umask. On systems with a common 022 umask, a newly created file may be readable by other local users.

Entering a literal token in an echo command can also preserve the credential in shell history, terminal logs, process auditing, or session-recording systems.

Plaintext configuration may be necessary for this implementation to read the token, but secure file permissions and non-echo input methods are the minimum required safeguards.

Attack Path

  1. A user follows the setup documentation and enters the API key directly in an echo command.
  2. The command is retained in shell history or session auditing.
  3. The output file is created using default filesystem permissions.
  4. Another local user or process reads the token from the configuration file or command history.
  5. The recovered key is reused against the local or remote Zotero API.

Exploitation requires access to the same host, the user's command history, a backup containing the file, or another process running ...[truncated 479 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer the operating system's credential manager or keychain instead of a plaintext file.
  2. If a file is required, create it with owner-only permissions before writing:
    bash
    mkdir -p ~/.config/zotero
    chmod 700 ~/.config/zotero
    install -m 600 /dev/null ~/.config/zotero/api_key
    
  3. Prompt for the token without echoing it or embedding it in command history:
    bash
    read -rsp "Zotero API key: " ZOTERO_KEY
    printf '%s' "$ZOTERO_KEY" > ~/.config/zotero/api_key
    unset ZOTERO_KEY
    
  4. On Windows, use Credential Manager or apply an ACL granting access only to the current user.
  5. Validate token-file ownership and permissions in get_api_key() before reading it.
  6. Keep separate local and remote credentials; never reuse one as a fallback for the other.
  7. Document token rotation and revocation procedures.
  8. Correct the documentation's read-only claim: DOI import performs an authenticated POST and therefore requires narrowly scoped write permission for import operations.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (40)

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The local search function accepts a user-controlled --api-url and will send the local API bearer token in the Authorization header to whatever URL the caller provides. That creates an SSRF-style credential disclosure risk: a user or integrating agent could be tricked into targeting a non-local host and leaking the Zotero local API key to an attacker-controlled server.

Content

Scanner excerpt · zotero_search.py (reported line 70)May include surrounding context.

python
headers['Authorization'] = f'Bearer {api_key}'
    
    try:
        response = requests.get(search_url, params=params, headers=headers, timeout=5)
        if response.status_code == 200:
            return response.json()
        elif response.status_code == 403:

Tainted flow: 'url' from os.environ.get (line 105, credential/environment) → requests.get (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 · zotero_search.py (reported line 106)May include surrounding context.

python
def get_user_id(api_key):
    """获取 Zotero UserID"""
    url = "https://api.zotero.org/keys/" + api_key
    response = requests.get(url, headers={'Zotero-API-Key': api_key})
    if response.status_code == 200:
        data = response.json()
        return data.get('userID')

Tainted flow: 'params' from os.environ.get (line 156, credential/environment) → requests.get (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 · zotero_search.py (reported line 123)May include surrounding context.

python
'key': api_key
    }
    
    response = requests.get(base_url, params=params)
    if response.status_code == 200:
        return response.json()
    else:

Tainted flow: 'params' from os.environ.get (line 156, credential/environment) → requests.get (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 · zotero_search.py (reported line 137)May include surrounding context.

python
# 先获取分类 ID
    collections_url = f"https://api.zotero.org/users/{user_id}/collections"
    params = {'key': api_key}
    response = requests.get(collections_url, params=params)
    
    if response.status_code != 200:
        print(f"获取分类失败:{response.status_code}")

Tainted flow: 'params' from os.environ.get (line 156, credential/environment) → requests.get (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 · zotero_search.py (reported line 157)May include surrounding context.

python
# 搜索该分类下的文献
    items_url = f"https://api.zotero.org/users/{user_id}/collections/{collection_id}/items"
    params = {'limit': limit, 'key': api_key}
    response = requests.get(items_url, params=params)
    
    if response.status_code == 200:
        return response.json()

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
**鍓嶆彁锛?* 闇€瑕?Zotero API Key

1. 鑾峰彇 API Key: https://www.zotero.org/settings/keys
2. 鐐瑰嚮 "Create a new personal access token"
3. 鍕鹃€夋潈闄愶細**Read Library**
4. 閰嶇疆 API Key锛?```bash
mkdir -p D:\Personal\OpenClaw\.config\zotero

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
**鍓嶆彁锛?* 闇€瑕?Zotero API Key

1. 鑾峰彇 API Key: https://www.zotero.org/settings/keys
2. 鐐瑰嚮 "Create a new personal access token"
3. 鍕鹃€夋潈闄愶細**Read Library**
4. 閰嶇疆 API Key锛?```bash
mkdir -p D:\Personal\OpenClaw\.config\zotero

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · VERSION_ISSUE.md (reported line 38)May include surrounding context.

md
**鍓嶆彁锛?* 闇€瑕?Zotero API Key

1. 鑾峰彇 API Key: https://www.zotero.org/settings/keys
2. 鐐瑰嚮 "Create a new personal access token"
3. 鍕鹃€夋潈闄愶細**Read Library**
4. 閰嶇疆 API Key锛?```bash
mkdir -p D:\Personal\OpenClaw\.config\zotero

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The content instructs the user to create a personal access token and copy it for local use, which is credential-handling behavior. In context this is not outright credential theft, but it is still dangerous because it encourages the generation and storage of reusable authentication material without secure handling controls.

Content

Scanner excerpt · ZOTERO8_SETUP.md (reported line 36)May include surrounding context.

md
**鏈€绠€鍗曘€佹渶绋冲畾锛?*

1. 璁块棶锛歨ttps://www.zotero.org/settings/keys
2. 鐐瑰嚮 **"Create a new personal access token"**
3. 鍕鹃€夛細**Read Library**
4. 澶嶅埗 API Key
5. 淇濆瓨锛?   ```bash

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · GET_API_KEY.md (reported line 1)May include surrounding context.

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · LOCAL_API_SETUP.md (reported line 1)May include surrounding context.

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

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

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · VERSION_ISSUE.md (reported line 1)May include surrounding context.

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · ZOTERO8_SETUP.md (reported line 1)May include surrounding context.

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · ZOTERO_LOCAL_API.md (reported line 1)May include surrounding context.

md
# Zotero 鏈湴 API 閰嶇疆鎸囧崡

**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**Zotero 鐗堟湰锛?* 7.x

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document instructs the user to write a Zotero local API key directly to a predictable path on disk using shell redirection, but does not warn that the key is a credential or discuss filesystem permission controls. This increases the chance the secret will be stored insecurely, exposed to other local users/processes, committed to backups or repositories, or left readable in shell history and logs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document instructs users to retrieve a Zotero local API token from configuration and persist it in a plaintext file under a project-related path, but provides no warning about secret sensitivity, file permissions, or exclusion from source control. This creates a realistic risk of credential leakage through local compromise, backups, logs, accidental commits, or broad filesystem access, especially because the token grants access to the user's local Zotero API.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README instructs users to store a Zotero API key in a plaintext local file, but does not warn about filesystem exposure, backups, syncing, or local multi-user access. Even if the token is intended to be read-only, writing credentials to disk without guidance on permissions or safer secret storage increases the chance of credential leakage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file’s user-facing description, usage guidance, configuration steps, and safety notes are entirely in Chinese. Under the policy, forcing a specific language without user opt-in or a documented regional justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
76% confidence
Finding

This duplicate finding points to the same behavior: storing a persistent personal access token in a plaintext config file. Persistent secrets stored this way can be unintentionally disclosed through local account compromise, shell history/workstation forensics, or insecure sync/backup tooling.

Content

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

md
**获取 API Key:**
1. 访问 https://www.zotero.org/settings/keys
2. 点击 "Create a new personal access token"
3. 勾选权限:Read Library

**存储凭据:**

Session Persistence

Medium
Category
Rogue Agent
Confidence
76% confidence
Finding

This duplicate finding points to the same behavior: storing a persistent personal access token in a plaintext config file. Persistent secrets stored this way can be unintentionally disclosed through local account compromise, shell history/workstation forensics, or insecure sync/backup tooling.

Content

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

md
**获取 API Key:**
1. 访问 https://www.zotero.org/settings/keys
2. 点击 "Create a new personal access token"
3. 勾选权限:Read Library

**存储凭据:**

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document instructs the user to create a personal access token and write it directly to a predictable local file path, but it does not warn that the token is sensitive or discuss file permissions, storage hardening, or exposure risks. This can lead to credential leakage through backups, local malware, shared accounts, shell history, or accidental disclosure of the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The guide tells users to create a Zotero personal access token and write it directly to a local file, but provides no warning that the token is a credential or guidance on restricting file access, rotation, or avoiding accidental disclosure. This creates a realistic risk of credential leakage through backups, shared directories, logs, screenshots, or source control, especially because the instructions normalize plaintext storage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code accesses a sensitive credential by reading a local API key file and falling back to the ZOTERO_API_KEY environment variable. Although the function has an internal docstring, there is no user-facing warning in the CLI output about credential access, which matches the missing-warning criterion for sensitive environment variables or credentials.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This request embeds the API key directly in the URL: https://api.zotero.org/api/checkkeys/<api_key>. URL-based secret transmission is dangerous because the full URL may be exposed through logs, error traces, reverse proxies, analytics, or other infrastructure, leading to credential compromise and subsequent unauthorized access to the user's Zotero account.

Content

Scanner excerpt · zotero_import.py (reported line 34)May include surrounding context.

python
def get_user_id(api_key):
    """获取 Zotero UserID"""
    url = "https://api.zotero.org/api/checkkeys/" + api_key
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()