Back to skill

Security audit

Notion

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward Notion API helper skill, but users should protect the Notion API key it asks them to store locally.

Before installing, make sure the Notion integration has only the capabilities and shared pages/databases it needs. Store the API key with owner-only permissions, avoid syncing or committing ~/.config/notion/api_key, and rotate the token if you think 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:15
Finding
Notion API Key Stored Without Restrictive File Permissions## Vulnerability Details **File Location**: `SKILL.md`, lines 15–16 **Vulnerability Type**: Insecure credential storage **Risk Level**: Medium ### Vulnerable Code ```bash mkdir -p ~/.config/notion echo "ntn_your_key_here" > ~/.config/notion/api_key ``` ### Technical Analysis The setup instructions write a Notion bearer token to a plaintext file without explicitly restricting the permissions of either the configuration directory or the credential file. Their resulting permissions depend on the user's current `umask`. With a commonly used `022` mask, the directory may be created with mode `0755` and the file with mode `0644`, potentially making the API key readable by other local users. Because the file contains a bearer token, possession of the value is sufficient to authenticate as the Notion integration. No executable scripts automatically perform this setup, but users who follow the documented commands can create the insecure condition. ### Attack Path 1. A user follows the setup instructions and stores a valid Notion integration token in `~/.config/notion/api_key`. 2. The user's `umask` permits group or world read access, resulting in an inadequately protected credential file. 3. Another local user or a compromised process operating under another account reads the file. 4. The attacker submits the stolen token in the `Authorization: Bearer` header to `https://api.notion.com`. 5. The attacker reads or modifies Notion resources that were shared with the affected integration. This path requires local filesystem access and permissive resulting file permissions. ### Impact Assessment The attacker obtains the effective privileges of the compromised Notion integration. The accessible scope is limited by the integration's configured capabilities and by the pages or databases shared with it. Depending on those permissions, compromise could permit disclosure, creation, alteration, or deletion of Notion content. This iss ...[truncated 70 chars]
Remediation
## Remediation Suggestions Create the directory and credential file with explicit owner-only permissions, rather than relying on the ambient `umask`: ```bash install -d -m 700 "$HOME/.config/notion" install -m 600 /dev/null "$HOME/.config/notion/api_key" printf '%s\n' 'ntn_your_key_here' > "$HOME/.config/notion/api_key" ``` Alternatively, apply `umask 077` before creating either object: ```bash umask 077 mkdir -p "$HOME/.config/notion" printf '%s\n' 'ntn_your_key_here' > "$HOME/.config/notion/api_key" ``` The instructions should also recommend verifying permissions with `stat`, rotating any token that may have been exposed, granting the integration only the minimum required Notion capabilities, and sharing only necessary pages or databases with it. Users should avoid entering real tokens directly into commands that may be retained in shell history; a non-echoing prompt or suitable operating-system secret manager is preferable.
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
Content
## Setup

1. Create an integration at https://notion.so/my-integrations
2. Copy the API key (starts with `ntn_` or `secret_`)
3. Store it:
```bash
Confidence
90% confidence
Finding
The skill instructs users to persist the API key in a predictable long-term location under `~/.config/notion/`, which increases exposure if the host is compromised, backed up insecurely, shared, or synchronized to cloud storage. The danger is amplified because the secret grants API access to whatever pages and databases are shared with the integration, enabling unauthorized reads and writes if the file is stolen.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The setup instructions tell users to write a long-lived Notion API key directly to a file in the home directory, but provide no warning about file permissions, secret handling, shell history, or multi-user system exposure. This increases the chance of credential disclosure through permissive filesystem ACLs, backups, endpoint compromise, or accidental inclusion in support bundles and dotfile sync tools.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All requests need:
```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"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

No suspicious patterns detected.