Back to skill

Security audit

Habitica

Security checks for vulnerabilities and agentic risk

Overview

This Habitica skill appears to be a real integration, but it gives the agent broad account and party-chat control with weak safeguards.

Install only if you want an agent to have broad control over your Habitica account, including party chat and game-state actions. Keep the API token private, use a tightly controlled ~/.habitica file, and require explicit user confirmation before deletion, chat posting, quest acceptance, class-skill casting, cron, or batch changes.

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/habitica.sh:7
Finding
Arbitrary Code Execution Through Sourced Credential Configuration## Vulnerability Details **File Location**: `scripts/habitica.sh`, lines 7-13 **Vulnerability Type**: Unsafe execution of configuration-file contents **Risk Level**: High ### Vulnerable Code ```bash CONFIG_FILE="${HABITICA_CONFIG:-$HOME/.habitica}" # Load credentials load_creds() { if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" fi ``` ### Technical Analysis The script loads credentials by passing the configuration file to the Bash `source` built-in. `source` does not parse the file as passive configuration data; it executes every statement in that file in the current shell process. The file path defaults to `~/.habitica`, but it can also be selected through the `HABITICA_CONFIG` environment variable. Consequently, anyone able to modify the default credential file or influence both the environment and referenced file can cause arbitrary shell commands to run when any Habitica command invokes `load_creds`. The malicious content does not need to resemble a credential assignment. It can contain command substitutions, shell functions, redirections, pipelines, or direct command invocations. Execution occurs before the requested Habitica API operation and inherits the script's user privileges and environment, including credentials subsequently loaded by the file. ### Attack Path 1. An attacker gains write access to `~/.habitica`, or causes `HABITICA_CONFIG` to reference a file under attacker control. 2. The attacker inserts shell commands into that file, for example: ```bash HABITICA_USER_ID="expected-user" HABITICA_API_TOKEN="expected-token" arbitrary_command ``` 3. The user or AI Agent invokes any command through `scripts/habitica.sh`. 4. `load_creds` calls `source "$CONFIG_FILE"`. 5. Bash executes `arbitrary_command` with the privileges of the user running the skill. 6. The injected command can access local files and environment variables, steal credentials, alter ...[truncated 1003 chars]
Remediation
## Remediation Suggestions - Do not use `source`, `.`, or `eval` to read credential files. - Parse only an explicit allowlist of supported keys, such as `HABITICA_USER_ID` and `HABITICA_API_TOKEN`. - Reject unknown keys, shell metacharacters, command substitutions, malformed lines, and duplicate assignments. - Verify that the configuration is a regular file owned by the current user and is not a symbolic link. - Require restrictive permissions, preferably mode `0600`, and fail securely when ownership or permissions are unsafe. - Validate values according to Habitica's expected credential formats before using them. - If `HABITICA_CONFIG` remains supported, treat it as untrusted input and apply the same ownership, type, and permission checks to the selected path. - Prefer a dedicated secret store or environment variables supplied through a trusted execution environment. A safe implementation should read values as data rather than shell syntax, for example by using a strict parser: ```bash load_creds() { local config_file="${HABITICA_CONFIG:-$HOME/.habitica}" if [[ -f "$config_file" ]]; then while IFS='=' read -r key value; do [[ -z "$key" || "$key" == \#* ]] && continue value="${value%$'\r'}" if [[ "$value" == \"*\" && "$value" == *\" ]]; then value="${value:1:${#value}-2}" fi case "$key" in HABITICA_USER_ID) HABITICA_USER_ID="$value" ;; HABITICA_API_TOKEN) HABITICA_API_TOKEN="$value" ;; *) echo "Error: Unsupported configuration key: $key" >&2 exit 1 ;; esac done < "$config_file" fi if [[ -z "${HABITICA_USER_ID:-}" || -z "${HABITICA_API_TOKEN:-}" ]]; then echo "Error: Habitica credentials not found." >&2 exit 1 fi } ...[truncated 102 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared purpose suggests a narrow task-management integration, but the documented commands expose much broader capabilities, including social messaging, quest acceptance, skill casting, cron execution, inventory/profile access, and destructive task operations. This mismatch can mislead users and orchestrators into granting or triggering actions that affect account state, privacy, and in-game/social interactions beyond expected task checkoff workflows.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
exit 1
    fi
    
    api_request DELETE "/tasks/$task_id" | jq -r '.message // "Task deleted"'
}

cmd_update() {
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Exfiltration Commands

High
Category
Prompt Injection
Content
PARTY/SOCIAL:
  party                    Party info + recent chat
  party-chat [limit]       Show party chat (default 10)
  party-send "message"     Send message to party
  guilds                   List your guilds

SKILLS:
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill advertises shell-backed behavior but does not declare any explicit tool scope or allowed-tools boundary. That makes the execution surface implicit rather than constrained, increasing the chance an agent can invoke shell operations without clear least-privilege controls or reviewer visibility.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger conditions include broad everyday-language phrases such as generic references to habits, todos, daily tasks, or checking off tasks. Overbroad activation increases the risk of accidental invocation in unrelated conversations, which is especially dangerous here because the skill can perform authenticated, state-changing operations against a user's Habitica account.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill documents commands that update, score, create, and delete tasks without warning that these are persistent account mutations. Without user-facing warnings or confirmation requirements, an agent may perform irreversible or hard-to-notice changes based on ambiguous requests or accidental activation.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
Task deletion is destructive and happens immediately with no confirmation prompt, dry-run mode, or warning. In an agent context, a misunderstood instruction or prompt injection could permanently remove user tasks without a chance to recover.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script exposes broad Habitica account, social, party, inventory, skill, and quest functionality well beyond the declared habit/task-tracking purpose. This expands the authority available to the agent, increasing the chance that a prompt or user request can trigger unrelated state-changing actions on the account.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
The skill can send arbitrary party chat messages, which is a social/output capability not implied by simple task management. An agent with this capability could spam, impersonate the user socially, or leak sensitive information from the conversation into Habitica party chat.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill can cast class skills and perform gameplay actions unrelated to managing habits or todos. These actions mutate account and party state and could spend resources or affect other players without the user intending such gameplay interactions.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
Quest acceptance and cron execution are state-changing account actions outside the stated purpose of checking off tasks. They can alter party participation, advance the game day, and cause irreversible in-game consequences if triggered accidentally or via prompt abuse.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The quest acceptance flow automatically performs a state-changing action as soon as it detects a pending invite. In an agent setting, this removes user control over joining group activity and can affect shared party progress without clear authorization.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
Running Habitica cron is a significant state-changing operation that can apply daily resets, missed-daily penalties, and other account updates, yet the script executes it with no confirmation. In an agent workflow, accidental invocation could immediately and irreversibly affect the user's stats and tasks.

Static analysis

No suspicious patterns detected.