Back to skill

Security audit

MIT 48h Learning Method

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent NotebookLM learning skill, but it needs review because its helper script has a local code-execution bug and performs automatic account and generation actions.

Install only if you expect this skill to use your Google/NotebookLM account, upload selected files or URLs to NotebookLM, and create generated audio/video. Avoid untrusted file:// inputs until the decoding bug is fixed, and review the automatic login plus auto-confirm generation behavior before use.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/mit-learn.sh:62
Finding

Python Code Injection Through a Crafted file:// Path

Content
View full analysis

Vulnerability Details

File Location: scripts/mit-learn.sh, lines 62–70
Vulnerability Type: Python code injection caused by unsafe interpolation into dynamically constructed source code
Risk Level: High

Vulnerable Code

bash
convert_file_url() {
  local input="$1"
  if [[ "$input" =~ ^file:// ]]; then
    # Remove the file:// prefix and URL-decode the value
    local path="${input#file://}"
    # URL decoding, such as %20 to a space
    path=$(python3 -c "import urllib.parse; print(urllib.parse.unquote('${path}'))" 2>/dev/null || echo "${path}")
    echo "$path"
  else
    echo "$input"
  fi
}

Technical Analysis

The path variable is derived from a user-supplied file:// argument and inserted directly into Python source passed to python3 -c.

Although the shell variable expansion occurs inside shell double quotes, the expanded value is placed inside a single-quoted Python string:

python
urllib.parse.unquote('${path}')

Shell quoting does not escape the value for the Python grammar. A path containing a single quote can terminate the Python string, after which additional Python expressions or statements may be injected. The resulting code is executed locally by python3 with the permissions of the user running the Skill.

The vulnerable function is reachable from both the URL-processing and file-processing paths in cmd_add. Subsequent file-existence validation does not mitigate the issue because the injected Python code runs during URL decoding, before that validation occurs.

Attack Path

  1. An attacker causes the Skill to be invoked with an attacker-controlled --url or --file argument beginning with file://.
  2. cmd_add identifies the argument as a file URL and passes it to convert_file_url.
  3. convert_file_url removes the file:// prefix.
  4. The remaining attacker-controlled text is interpolated into the source string supplied to `p ...[truncated 1271 chars]
Remediation
View remediation

Remediation Suggestions

Do not place user-controlled data inside dynamically constructed Python source. Pass the path as a separate process argument and retrieve it through sys.argv:

bash
convert_file_url() {
  local input="$1"

  if [[ "$input" == file://* ]]; then
    local path="${input#file://}"
    python3 -c \
      'import sys, urllib.parse; print(urllib.parse.unquote(sys.argv[1]))' \
      "$path"
  else
    printf '%s\n' "$input"
  fi
}

Additional hardening should include:

  1. Use printf '%s\n' instead of echo when outputting untrusted values.
  2. Reject malformed file URLs, embedded NUL representations, and unexpected control characters.
  3. Canonicalize the decoded path and enforce an allowlisted directory when callers should only upload files from approved locations.
  4. Preserve a clear failure state if decoding fails rather than silently falling back to potentially malformed input.
  5. Add regression tests covering single and double quotes, semicolons, command substitutions, newlines, percent-encoded quotes, backslashes, and Python syntax in file URLs.
  6. Run the Skill with the least-privileged user account necessary and avoid invoking it with administrative privileges.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (9)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill documents use of a network-capable CLI (nlm) that authenticates with Google and accesses remote URLs/YouTube/Drive, but the manifest shown in SKILL.md declares no explicit tool scope such as permissions or allowed-tools. This creates a transparency and governance gap: an agent may invoke networked behavior users or platform policy did not clearly authorize, increasing the risk of unintended external data transfer.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger conditions are broad enough to match generic learning requests such as '快速学习某个领域' or '用 AI 辅助构建知识体系', which can cause the skill to activate unexpectedly outside a narrowly intended context. Over-broad activation is dangerous because it may steer ordinary conversations into a workflow that performs authenticated network actions, uploads materials, or generates external content without the user specifically requesting this skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill sets a default output language via MIT_LEARN_LANG to zh-CN without stating that the user should choose or consent to that preference. While not a direct code-execution issue, this can cause unintended behavior, miscommunication, or silent preference overriding in multilingual contexts, especially if prompts or outputs are sent to external services in a language the user did not request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script sets LANG to zh-CN by default and passes it to audio and video generation, which imposes a specific locale unless the user knows to override MIT_LEARN_LANG. This matches the policy concern for language/locale constraints without explicit opt-in or a clearly documented justified regional limitation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script performs automatic re-authentication by calling nlm login whenever a lightweight status check fails, even though the skill is presented as a learning workflow rather than an account/session-management tool. This expands the skill's authority and can trigger unintended authentication flows, browser/device-code prompts, or session renewal under the user's account without an explicit consent step.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Invoking an automatic login capability is security-relevant because it can silently change authentication state and cause the tool to act under a user's account when the user only intended to run a content-processing workflow. In an agent skill context, hidden auth actions are especially risky because users may not realize the script can initiate or refresh privileged sessions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This manifest contains multiple user-facing descriptive fields in Chinese, including the main description and auth note, but does not state that the skill is Chinese-only or offer any language choice. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comment claims audio generation waits for confirmation, but the implementation uses --confirm, which auto-confirms the operation. This mismatch can mislead users about whether a potentially billable or externally visible generation action requires consent, reducing transparency and increasing the chance of unintended actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The script stores notebook identifiers and environment-style metadata in predictable files under the user's home directory without notice or permission. While the data is not highly sensitive by itself, it can expose activity metadata, be read by other local processes under the same account, and create unexpected persistence that users did not consent to.

Content

No source excerpt is available for this finding.