Back to skill

Security audit

hocnhanh_n8n

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward Notion API helper, but users should harden how they store the Notion API key.

Install only if you intend to let an agent use a Notion integration token for the pages and databases you share with it. Store the token with owner-only permissions, avoid putting the real token directly in shell history, use the narrowest Notion integration permissions practical, and revoke or rotate the token if it may have been exposed.

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

Warning
Location
SKILL.md:18
Finding

Notion API Key Stored Without Restrictive File Permissions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 18–19 and line 30
Vulnerability Type: Plaintext credential storage with insufficient permission hardening
Risk Level: Medium

Vulnerable Code

bash
mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key

The credential is subsequently loaded from that plaintext file:

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)

Technical Analysis

The setup instructions store a Notion integration API key in a plaintext file but do not explicitly restrict permissions on either the containing directory or the credential file. With a common umask of 022, the directory may be created with mode 0755 and the file with mode 0644. On a multi-user system, this can allow other local users or processes operating under different accounts to read the token.

The example also encourages entering the real token directly as an argument to echo. Depending on shell configuration, that command and its token may be retained in shell history. The token is then used as a bearer credential, so possession is sufficient for API authentication; no additional proof of identity is required.

Attack Path

  1. A user follows the documented setup instructions and substitutes a valid Notion integration token in the echo command.
  2. The shell may retain the command, including the token, in its history.
  3. The credential file is created using default permissions rather than explicit owner-only permissions.
  4. Another local user or compromised process reads ~/.config/notion/api_key or accessible shell-history data.
  5. The attacker submits requests to https://api.notion.com with Authorization: Bearer <stolen-token>.
  6. The attacker reads or modifies Notion resources available to that integration.

Impact Assessment

An attacker who obtains the token can impersonate the Notion integration. The exact scope is bounded by the integration's Notion capabilities and the p ...[truncated 533 chars]

Remediation
View remediation

Remediation Suggestions

Create the configuration directory and credential file with explicit owner-only permissions. Read the token interactively so it is not embedded directly in the demonstrated shell command:

bash
install -d -m 700 ~/.config/notion
read -rsp "Notion API key: " NOTION_KEY
echo
install -m 600 /dev/null ~/.config/notion/api_key
printf '%s\n' "$NOTION_KEY" > ~/.config/notion/api_key
unset NOTION_KEY

Additional hardening measures:

  1. Document that the file must remain mode 0600 and its directory mode 0700.
  2. Prefer an operating-system credential manager or secrets manager instead of a plaintext file where supported.
  3. Warn users not to place real API keys directly in shell command arguments or committed configuration files.
  4. Configure the Notion integration with only the capabilities and workspace resources required for its intended tasks.
  5. Rotate the token immediately if it may have entered shell history or been stored with broadly readable permissions.
  6. Periodically review the pages and databases shared with the integration and revoke unnecessary access.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (12)

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The instructions explicitly persist the API key to disk for later reuse, creating a session/credential persistence risk. Long-lived tokens stored locally in plaintext can survive beyond the immediate task and may be recovered by other local users, malware, backups, or accidental file disclosure.

Content

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

md
## Setup

1. Create an integration at https://notion.so/my-integrations
2. Copy the API key (starts with `ntn_` or `secret_`)
3. Store it:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The setup instructions tell users to store the Notion API key in a plaintext file under ~/.config/notion/api_key, but provide no warning about local credential exposure, file permissions, backups, shell history, or multi-user system risks. While this is a common convenience pattern, it increases the chance that a long-lived API token is exposed to other local processes, users, backup systems, or accidental disclosure.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

bash
NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json"

Static analysis

No suspicious patterns detected.