T09 · Insecure Skill Coding Practices
- Location
scripts/bootstrap_vps_systemd_one_liner.sh:94- Finding
Command Injection Through Untrusted Bootstrap Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill can do the advertised NotebookLM querying, but its bundled setup scripts handle Google session cookies and make privileged VPS/systemd changes with unsafe command boundaries.
Review before installing on any real VPS. Use a dedicated low-privilege Google account/profile, protect and rotate NotebookLM cookies, avoid exposing /nlm to untrusted Telegram users, and do not run the bootstrap as root unless you accept its package installs, /etc changes, group changes, OpenClaw config edits, and optional systemd hook. Prefer a manually reviewed, pinned, least-privilege setup if possible.
scripts/bootstrap_vps_systemd_one_liner.sh:94Command Injection Through Untrusted Bootstrap Arguments
scripts/bootstrap_vps_systemd_one_liner.sh:159Predictable Temporary Files Used During Privileged Installation
scripts/bootstrap_vps_systemd_one_liner.sh:107Unpinned Third-Party Packages Installed With Elevated Privileges
SKILL.md:30Raw Telegram Input Forwarded to the Exec Tool as CLI Arguments
The declared description says this skill is for searching and answering questions over existing NotebookLM documents via the nlm CLI. The supplied code does not perform any search, summarization, notebook querying, or document interaction at all. Instead, its primary function is credential injection/setup: it obtains a secret payload containing cookies/metadata, optionally calls AWS Secrets Manager, and writes authentication files into a NotebookLM profile directory with restrictive permissions. This is a materially different purpose and includes undeclared secret-access and auth-file-writing capabilities, so the description does not accurately represent the code.
The declared description presents a document-querying/search skill for NotebookLM, but the supplied code chunk is not performing search, summarization, or answering over uploaded documents. Instead, it is an infrastructure/bootstrap script for Linux VPS deployment and service integration. Its primary behavior is system administration: package installation, CLI installation, workspace setup, auth cookie injection, config mutation, permission management, group membership changes, and optional systemd integration/restart. These are materially different capabilities and resource accesses from the declared purpose, and none of them are reflected in the declared permissions. This is a clear description-behavior mismatch.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
Trong NotebookLM notebook alias tai_lieu_dien: trả lời câu hỏi "giá của A9N61500 là bao nhiêu?". Bắt buộc dùng nlm để truy vấn, không tìm web, không đọc file local.
## Output Guidelines
- Be explicit about notebook identity (title + id when available).
- If query result is empty or vague, suggest a refined follow-up query.
The document explicitly directs the operator to extract Google cookies from a browser profile and move them to another machine for automated use. Even though framed as setup instructions, this mirrors credential-harvesting and session-transfer behavior and can enable unauthorized account access if reused, stolen, or applied outside the intended environment.
service start (if you pass --service)
Compatibility notes:
apt install npm to prevent nodejs/npm conflict on NodeSource-based systems.externally-managed-environment), it uses pipx first and only falls back to pip --break-system-packages if required.NotebookLM requires Google cookies. You must prepare auth on a machine with Chrome:
nlm login
The default profile is stored at:
~/.notebooklm-mcp-cli/profiles/default/
- cookies.json
- metadata.json
Create one JSON file named notebooklm-auth.json:
{
"cookies": <contents of cookies.json>,
"metadata": <contents of metadata.json>
}
On the VPS, store the file at:
/etc/openclaw/notebooklm-auth.json
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-a
The script requires sudo/root and exercises privileged system administration capabilities that exceed what is justified for querying NotebookLM documents. Because it can install software, modify groups and file permissions, and inject an ExecStartPre hook into a service, any mistake, dependency compromise, or parameter abuse can affect the whole host rather than only the skill's user environment.
This bootstrap script performs broad privileged actions unrelated to a narrow document-query skill: installing OS packages, globally installing tools, modifying user config, creating groups, writing to /etc, and altering systemd service behavior. In the context of an agent skill, this materially expands the trust boundary and persistence surface, so a compromised or swapped package/slug could lead to full host compromise or lasting service manipulation.
The skill declares no explicit tool scope or allowed-tools restrictions even though its instructions clearly require shell execution and environment access. In practice this gives the runtime broader discretion than necessary, increasing the blast radius if the skill is misused, modified, or prompt-injected into running unintended commands.
The guide instructs users to consolidate browser-derived cookies and metadata into a reusable JSON credential file and persist it on a VPS. That creates a long-lived bearer secret that can grant access to a Google/NotebookLM session if the file, backups, logs, or the host are compromised.
Create one JSON file named `notebooklm-auth.json`:
```json
{
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json
sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json
sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json
sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json
sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json
sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json
sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json
sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json
sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Set permissions (recommended):
sudo mkdir -p /etc/openclaw
sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json
sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json
sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo mkdir -p /etc/openclaw sudo cp ./notebooklm-auth.json /etc/openclaw/notebooklm-auth.json sudo chown root:openclaw /etc/openclaw/notebooklm-auth.json sudo chmod 640 /etc/openclaw/notebooklm-auth.json
Then restart your OpenClaw service:
This script provisions and persists live authentication material to disk, which is a privileged capability beyond the skill's stated document-query purpose. Even if intended for headless setup, embedding credential injection logic inside the skill increases the attack surface and creates a path for secret handling, misuse, or accidental exposure in environments that only expected read/query behavior.
The script reads sensitive cookies and metadata from files, environment variables, or AWS Secrets Manager and writes them to local files without any user-facing warning, consent flow, or audit controls. In this skill context, silently materializing session credentials is risky because these cookies may grant account access and could be exposed through misconfiguration, backups, or later filesystem access.
The script can fetch secrets directly from AWS Secrets Manager, granting the skill an external secret-retrieval capability not implied by its query-oriented description. In a skill context, this broadens trust boundaries: anyone able to trigger this setup path in a privileged environment may cause sensitive auth data to be materialized locally.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
> "${METADATA_FILE}"
fi
chmod 700 "${NOTEBOOKLM_MCP_CLI_PATH}" "${NOTEBOOKLM_MCP_CLI_PATH}/profiles" "${PROFILE_DIR}" || true
chmod 600 "${COOKIES_FILE}" "${METADATA_FILE}" || true
echo "NotebookLM auth injected to: ${PROFILE_DIR}"
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
> "${METADATA_FILE}"
fi
chmod 700 "${NOTEBOOKLM_MCP_CLI_PATH}" "${NOTEBOOKLM_MCP_CLI_PATH}/profiles" "${PROFILE_DIR}" || true
chmod 600 "${COOKIES_FILE}" "${METADATA_FILE}" || true
echo "NotebookLM auth injected to: ${PROFILE_DIR}"
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
fi
chmod 700 "${NOTEBOOKLM_MCP_CLI_PATH}" "${NOTEBOOKLM_MCP_CLI_PATH}/profiles" "${PROFILE_DIR}" || true
chmod 600 "${COOKIES_FILE}" "${METADATA_FILE}" || true
echo "NotebookLM auth injected to: ${PROFILE_DIR}"
echo "Set NOTEBOOKLM_MCP_CLI_PATH=${NOTEBOOKLM_MCP_CLI_PATH} for OpenClaw runtime."
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
fi
chmod 700 "${NOTEBOOKLM_MCP_CLI_PATH}" "${NOTEBOOKLM_MCP_CLI_PATH}/profiles" "${PROFILE_DIR}" || true
chmod 600 "${COOKIES_FILE}" "${METADATA_FILE}" || true
echo "NotebookLM auth injected to: ${PROFILE_DIR}"
echo "Set NOTEBOOKLM_MCP_CLI_PATH=${NOTEBOOKLM_MCP_CLI_PATH} for OpenClaw runtime."
The comment claims the script does not obtain cookies, but the implemented behavior goes further than simple setup by reading ${AUTH_FILE} and writing .cookies and .metadata into the NotebookLM CLI profile for operational use. While it does not fetch cookies from Google itself, the comment understates that the script actively handles and deploys authentication material.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
require_sudo() {
if [[ "$(id -u)" -ne 0 ]]; then
if ! command -v sudo >/dev/null 2>&1; then
echo "Error: sudo is required (run as root or install sudo)." >&2
exit 1
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
require_sudo() {
if [[ "$(id -u)" -ne 0 ]]; then
if ! command -v sudo >/dev/null 2>&1; then
echo "Error: sudo is required (run as root or install sudo)." >&2
exit 1
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
require_sudo() {
if [[ "$(id -u)" -ne 0 ]]; then
if ! command -v sudo >/dev/null 2>&1; then
echo "Error: sudo is required (run as root or install sudo)." >&2
exit 1
fi
No suspicious patterns detected.