Back to skill

Security audit

Google Scholar API

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-aligned for Google Scholar searches, but it gives unsafe API-key handling advice and downloads files with weak safeguards.

Review before installing. Use a disposable or tightly scoped SerpAPI key, do not print or store the key in plaintext files, avoid the documented backup command, run downloads only in a dedicated directory, and prefer search-only mode unless you have reviewed the PDF source and destination path. Pin dependencies before use in a shared or production environment.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:199
Finding

SerpAPI Credential Disclosure Through Debug Output

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 199-205
Vulnerability Type: Secret exposure through console and log output
Risk Level: High

python
try:
    results = client.search("test query")
except Exception as e:
    print(f"Error details: {e}")
    # Check environment variables
    print(f"API Key: {os.getenv('SERP_API_KEY')}")

Technical Analysis

The documented troubleshooting procedure prints the complete SERP_API_KEY environment variable. Because SKILL.md supplies operational instructions for an AI agent, this example may be followed during error diagnosis and is security-relevant even though it is not part of the primary Python executable.

Console output can be retained in agent transcripts, CI logs, shell histories, support bundles, monitoring systems, or screen recordings. Printing a credential therefore expands access from the process holding the environment variable to every person or system capable of reading those records.

Attack Path

  1. A search operation fails, or an attacker causes or alleges a failure.
  2. The user or agent follows the debugging instructions in SKILL.md.
  3. The process reads SERP_API_KEY from its environment.
  4. The complete API key is printed to the terminal or agent transcript.
  5. An attacker with access to the resulting logs or transcript recovers the credential.
  6. The attacker uses the key against SerpAPI until it is revoked or its quota is exhausted.

Impact Assessment

The exposed credential grants the same SerpAPI access and quota available to the legitimate user. It can be used to consume paid or limited API resources, conduct searches attributed to the victim, and disrupt legitimate operation through quota exhaustion. This does not directly grant operating-system privileges, but compromise extends to all SerpAPI capabilities authorized for the key.

Remediation
View remediation

Remediation Suggestions

  • Remove all output that displays the credential itself.
  • Report only whether the variable is configured:
    python
    configured = bool(os.getenv("SERP_API_KEY"))
    print(f"SERP_API_KEY configured: {configured}")
    
  • If identifying a key is operationally necessary, display only a short masked suffix.
  • Configure logging filters to redact secret-like environment variables.
  • Revoke and rotate any key that may already have appeared in logs or transcripts.
  • Add automated secret-output checks to documentation and code review.

T09 · Insecure Skill Coding Practices

Error
Location
INSTALL.md:290
Finding

Plaintext Persistent Backup of the SerpAPI Credential

Content
View full analysis

Vulnerability Details

File Location: INSTALL.md, lines 290-294
Vulnerability Type: Plaintext sensitive-data storage
Risk Level: High

bash
# Back up API key
echo "export SERP_API_KEY='$SERP_API_KEY'" > ~/.scholar_api_backup.sh

Technical Analysis

The maintenance instructions copy the complete SerpAPI key into a reusable plaintext shell file. No restrictive permissions are established, so access depends on the user's current umask and directory permissions. The resulting file can also be captured by home-directory backups, synchronization products, support archives, malware, or accidental file sharing.

The file contains executable shell syntax, increasing the chance that it will be sourced or copied between systems and persist beyond the intended lifetime of the credential.

Attack Path

  1. The user follows the documented backup command.
  2. The active API key is written to ~/.scholar_api_backup.sh.
  3. The file persists after the original shell session ends.
  4. Another local account, process, backup service, synchronization service, or malicious program obtains read access to the file.
  5. The plaintext credential is extracted and used against SerpAPI.

Impact Assessment

Successful exploitation exposes the user's SerpAPI account privileges and available quota. The vulnerability does not itself elevate operating-system privileges, but it creates a durable secret artifact that can remain usable across sessions and systems until the key is rotated.

Remediation
View remediation

Remediation Suggestions

  • Remove the plaintext backup instruction.
  • Store credentials in an operating-system keychain, dedicated secret manager, or protected CI secret facility.
  • If file storage is unavoidable, create the file with mode 0600 before writing and keep it outside synchronized or backed-up directories.
  • Never place exportable secrets in project directories or shell scripts intended for sharing.
  • Document credential rotation, revocation, and secure deletion procedures.
  • Add the relevant local secret-file patterns to .gitignore, while recognizing that .gitignore is not an access-control mechanism.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/google_scholar_search.py:216
Finding

Unrestricted URL Retrieval Enables SSRF and Unbounded Downloads

Content
View full analysis

Vulnerability Details

File Location: scripts/google_scholar_search.py, lines 216-235
Vulnerability Type: Server-side request forgery and resource exhaustion
Risk Level: High

python
def download_pdf(self, pdf_url: str, save_path: str) -> bool:
    """
    Download a PDF file from a URL.
    
    Args:
        pdf_url: URL of the PDF file
        save_path: Local path to save the PDF
        
    Returns:
        True if download successful, False otherwise
    """
    try:
        headers = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
        }
        
        response = requests.get(pdf_url, headers=headers, stream=True, timeout=30)
        response.raise_for_status()
        
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)

Technical Analysis

download_pdf accepts an arbitrary URL and passes it directly to requests.get. The implementation does not:

  • Restrict the URL to HTTPS.
  • Validate the destination hostname or resolved IP address.
  • Reject loopback, private, link-local, multicast, or reserved networks.
  • Validate redirect destinations; requests follows redirects by default.
  • Verify that the response is actually a PDF.
  • Enforce a maximum response size.
  • Check Content-Length before writing.
  • Stop streaming after a fixed byte limit.

PDF URLs can also originate from external SerpAPI response fields and are automatically passed to this method during search_and_download. A malicious or compromised result source could therefore supply an internal-network URL, a redirect to an internal service, a non-PDF payload, or an extremely large response.

The configured timeout does not provide a download-size limit and does not reliably prevent disk exhaustion while a server continues delivering data.

Attack Pat

...[truncated 1338 chars]

Remediation
View remediation

Remediation Suggestions

  • Permit only https URLs.
  • Resolve the hostname and reject loopback, private, link-local, multicast, unspecified, and reserved IP ranges.
  • Disable automatic redirects or validate every redirect destination using the same policy.
  • Prefer an explicit allowlist of trusted academic repositories.
  • Validate both the response Content-Type and the %PDF- file signature.
  • Reject responses whose declared Content-Length exceeds a configured maximum.
  • Count streamed bytes and abort once the maximum size is exceeded, even when Content-Length is absent or false.
  • Use separate connection and read timeouts.
  • Delete partial files after any validation or transfer failure.
  • Apply outbound network restrictions at the container or firewall level as defense in depth.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/google_scholar_search.py:216
Finding

Arbitrary File Overwrite Through Unvalidated Download Destination

Content
View full analysis

Vulnerability Details

File Location: scripts/google_scholar_search.py, lines 216-235
Vulnerability Type: Unrestricted file write and overwrite
Risk Level: Medium

python
def download_pdf(self, pdf_url: str, save_path: str) -> bool:
    """
    Download a PDF file from a URL.
    
    Args:
        pdf_url: URL of the PDF file
        save_path: Local path to save the PDF
        
    Returns:
        True if download successful, False otherwise
    """
    try:
        headers = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
        }
        
        response = requests.get(pdf_url, headers=headers, stream=True, timeout=30)
        response.raise_for_status()
        
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)

Technical Analysis

The public download_pdf method uses save_path directly with open(..., 'wb'). Write mode creates a new file or truncates an existing file. There is no canonicalization, allowed-root check, symlink protection, filename policy, or overwrite confirmation.

The CLI's automatically generated paper filenames receive some character filtering, but that does not protect direct library callers. The documentation explicitly presents download_pdf(pdf_url, "paper.pdf") as a public API. Any integration that derives save_path from untrusted input can therefore expose arbitrary writable paths.

Attack Path

  1. An application or agent exposes the public download method through a workflow.
  2. An attacker influences save_path, for example by supplying an absolute path or traversal sequence.
  3. The process successfully retrieves content from pdf_url.
  4. open(save_path, 'wb') creates or truncates the attacker-selected destination.
  5. Downloaded bytes replace the target file under the privileges of the s ...[truncated 498 chars]
Remediation
View remediation

Remediation Suggestions

  • Require a fixed, trusted download root.
  • Resolve both the root and destination with pathlib.Path.resolve() and verify that the destination remains beneath the root.
  • Reject absolute paths and parent-directory traversal from caller-controlled filenames.
  • Reject symlink destinations and guard against time-of-check/time-of-use races.
  • Use exclusive creation mode when overwriting is not explicitly requested.
  • Generate filenames internally rather than accepting unrestricted destination paths.
  • Run the skill as a minimally privileged account with access only to its download directory.
  • Write to a securely created temporary file, validate the content, and atomically move it into place.

T08 · Insecure Dependencies

Warning
Location
scripts/requirements.txt:1
Finding

Unpinned Third-Party Dependencies Create Supply-Chain Exposure

Content
View full analysis

Vulnerability Details

File Location: scripts/requirements.txt, lines 1-2
Vulnerability Type: Mutable and non-reproducible dependency resolution
Risk Level: Medium

text
google-search-results>=2.4.2
requests>=2.31.0

The same unsafe installation model is also documented in SKILL.md and INSTALL.md:

bash
pip install google-search-results requests

Technical Analysis

Both dependencies use minimum-version constraints without exact versions, upper bounds, or package hashes. A future installation can therefore resolve to versions that were not reviewed during this audit. The direct pip install instructions similarly retrieve the latest matching distributions from the configured package index.

No evidence of a currently malicious or typo-squatted dependency was found. The risk arises from automatically trusting mutable future releases and the user's package-index configuration. If an upstream account, release process, package index, or resolver configuration is compromised, unreviewed code can enter the environment.

Attack Path

  1. An upstream package release or package-index path is compromised, or a future release introduces malicious behavior.
  2. A user follows the documented installation command or installs from requirements.txt.
  3. The resolver selects the newer unreviewed version because it satisfies the >= constraint.
  4. Package installation, import, or runtime behavior executes the dependency code with the user's privileges.
  5. The compromised dependency can access files, environment variables, network resources, and API credentials available to the Python process.

Impact Assessment

A malicious dependency executes with the privileges of the account or environment performing installation and running the skill. It could access the SerpAPI key, modify project or user files, communicate over the network, or compromise other data available to that account. The findi ...[truncated 103 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin each dependency to an exact reviewed version.
  • Generate a lock file containing cryptographic hashes, such as with pip-tools.
  • Install with hash verification:
    bash
    pip install --require-hashes -r requirements.txt
    
  • Explicitly use the official trusted package index over TLS.
  • Perform dependency vulnerability and provenance scanning in CI.
  • Review and test dependency updates before changing the lock file.
  • Use an isolated virtual environment or container and avoid installation with elevated privileges.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file title and all user-facing instructions are presented in Chinese, and the example OpenClaw response is also written only in Chinese. There is no indication that users may choose another language or that the skill is intended solely for a Chinese-specific audience, which can violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes capabilities that require environment access, network access, and file writes, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, this can lead to over-broad execution privileges, making it easier for the skill to access secrets, write files, or perform network actions beyond what a user expects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file consistently presents user-facing instructions and examples in Chinese, which effectively imposes a specific language on users. Under the policy, forcing a language without offering a choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The debug example explicitly prints the full SERP_API_KEY from the environment, which can expose a live credential in logs, terminals, screenshots, or shared troubleshooting output. Because this skill already depends on an API secret and may be used in collaborative or hosted environments, the chance of accidental credential leakage is materially elevated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide shows examples of placing the SerpAPI key directly in code and passing it inline, but it does not warn against hardcoding secrets or committing them to source control. In practice, users often copy documentation verbatim, which can lead to credential leakage through repositories, logs, screenshots, or shared notebooks, enabling unauthorized API use and possible quota exhaustion or billing abuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The entire skill documentation is written in Chinese, including the title, safety guidance, examples, and incident response instructions, with no indication that users may choose another language or that the skill is intended only for a Chinese-speaking audience. This can violate a language/locale policy when a skill imposes a specific language without opt-in or clear regional justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

文件整体仅以中文编写,属于自然语言层面的语言/locale 约束,但文中没有说明这是面向特定中文用户群体的区域化文档,也未提供用户可选择其他语言的指引。根据规则,未说明理由的语言强制可视为语言/locale 政策问题。

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file includes a usage scenario that creates a download directory and downloads multiple PDFs to disk, but the surrounding description does not explicitly warn users that running it will write files locally. Because SQP-2 applies to markdown files when behaviors could affect user data or system integrity, the omission of a clear warning about automated downloads and saved paths is a valid quality/safety gap.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The search method hard-codes language: str = "en", which makes English the default locale for all searches unless the caller overrides it. This is a natural-language locale preference embedded in the skill and is not presented as an explicit user choice at the API level.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency is specified with a lower bound only, which allows future installs to resolve to different versions over time. This weakens reproducibility and can unintentionally introduce vulnerable or incompatible releases through normal dependency updates or supply-chain compromise.

Content

Scanner excerpt · scripts/requirements.txt (reported line 1)May include surrounding context.

text
google-search-results>=2.4.2
requests>=2.31.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

requests is also unpinned, so installations may resolve to varying versions, including versions later found vulnerable or affected by regressions. Because this skill interacts with external web services and likely handles API credentials, dependency drift in a core HTTP library increases the chance of security exposure.

Content

Scanner excerpt · scripts/requirements.txt (reported line 2)May include surrounding context.

text
google-search-results>=2.4.2
requests>=2.31.0

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The manifest does not pin a requests version, so there is no way to verify whether deployment will use a release affected by known advisories such as credential leakage and other historical issues. In this skill's context, which relies on outbound HTTP requests to SerpAPI and possibly downloads PDFs from third-party sources, an affected requests version could expose secrets or weaken transport security assumptions.

Content

No source excerpt is available for this finding.