T09 · Insecure Skill Coding Practices
- Location
SKILL.md:17- Finding
Notion API Credential Stored Without Explicitly Restrictive File Permissions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 17–20
Vulnerability Type: Plaintext sensitive credential stored with umask-dependent permissions
Risk Level: MediumVulnerable Code
bash mkdir -p ~/.config/notion echo "ntn_your_key_here" > ~/.config/notion/api_keyThe credential is subsequently loaded at line 27:
bash NOTION_KEY=$(cat ~/.config/notion/api_key)Technical Analysis
The setup instructions persist a Notion bearer token as plaintext in
~/.config/notion/api_keywithout explicitly restricting the permissions of either the containing directory or the credential file. The effective permissions therefore depend on the user's currentumaskand any preexisting directory permissions.In an environment with permissive settings, another local account or process may be able to read the credential. Because the token is used as a bearer credential, possession is generally sufficient to authenticate to the Notion API; no additional proof of identity is demonstrated by the documented flow.
Attack Path
- A user follows the documented setup commands and writes the integration token to
~/.config/notion/api_key. - The file or its parent directory receives permissions derived from a permissive
umaskor retains insecure preexisting permissions. - Another local user or compromised process enumerates and reads the credential file.
- The attacker submits the stolen token in an
Authorization: Bearerheader tohttps://api.notion.com/v1/.... - The attacker accesses or modifies resources available to the compromised Notion integration.
Exploitation requires local filesystem access to the victim's credential file and permissions sufficient to read it.
Impact Assessment
A stolen token may grant unauthorized access to every Notion page or database shared with the affected integration. The precise scope is bounded by the integration's configured capabilities ...[truncated 292 chars]
- A user follows the documented setup commands and writes the integration token to
- Remediation
View remediation
Remediation Suggestions
Create the configuration directory and credential file with explicit owner-only permissions:
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" chmod 600 "$HOME/.config/notion/api_key"Prefer reading the token without placing the real value in shell history:
bash install -d -m 700 "$HOME/.config/notion" umask 077 IFS= read -r -s NOTION_KEY printf '%s\n' "$NOTION_KEY" > "$HOME/.config/notion/api_key" unset NOTION_KEYWhere supported, use a protected operating-system secret store or injected secret environment rather than a persistent plaintext file. Also document token rotation and revocation procedures, and configure the Notion integration with only the capabilities and workspace resources necessary for its intended tasks.
