Back to skill

Security audit

activity-analyzer

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed ActivityWatch productivity analyzer, but it can expose sensitive window titles to the AI model.

Install only if you are comfortable sending recent ActivityWatch application names and window titles to your configured AI model. For better privacy, remove the raw result log and aggregate by app and duration before using it.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_activity.js:47
Finding
Unfiltered ActivityWatch Data Exposes Sensitive Window Titles<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_activity.js:47-49` **Vulnerability Type**: Sensitive data exposure through unfiltered output **Risk Level**: Medium ### Complete Code Snippet ```javascript const result = await queryRes.json(); console.log('📦 Raw result:', JSON.stringify(result, null, 2)); ``` ### Technical Analysis The script prints the complete response returned by the local ActivityWatch API before applying the record-count and duration filters implemented later at lines 57-66. ActivityWatch records can include application names, window titles, document names, URLs, email subjects, project identifiers, and other sensitive information. Because Skill output is supplied to the AI model for analysis, this log statement can transmit the entire raw activity result into the model context. It defeats the intended restriction to the 50 longest records and the exclusion of activities shorter than one minute. Although `SKILL.md` warns users that window titles are processed by the AI model, the complete raw response exceeds the minimum information needed to produce an activity summary. The disclosure is not caused by an external network request in the script—the only configured endpoint is `127.0.0.1:5600`—but by emitting sensitive local data into the surrounding Agent workflow. ### Attack Path 1. ActivityWatch records application activity and associated window titles on the local system. 2. The Skill invokes `fetch_activity.js` to query the ActivityWatch API. 3. The API returns all matching events for the selected period. 4. The script serializes and prints the complete response at line 49. 5. The Agent captures the script output and submits it to the configured AI model for analysis. 6. Sensitive titles and other event fields are exposed without first applying aggregation, redaction, duration filtering, or the 50-record limit. ### Impact Assessment This issue does not grant operating-system privileges, code execution, or ...[truncated 448 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the raw response log entirely: ```javascript const result = await queryRes.json(); ``` 2. Aggregate records locally by application and duration before emitting any output. 3. Exclude window titles by default and require explicit user opt-in before including them. 4. Apply record-count, duration, and field-length limits before printing data. 5. Redact title patterns likely to contain URLs, email addresses, query strings, document paths, or other sensitive identifiers. 6. Provide a privacy-preserving mode that outputs only application names and total durations. 7. If diagnostic logging is required, make it an explicit debug option and ensure that it is disabled by default. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
scripts/fetch_activity.js:57
Finding
Attacker-Controlled Window Titles Can Cause Indirect Prompt Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_activity.js:57-66` **Vulnerability Type**: Indirect prompt injection through untrusted activity metadata **Risk Level**: Medium ### Complete Code Snippet ```javascript // Take the first 50 most time-consuming records to prevent the output from being too long and bursting the LLM context result[0].slice(0, 50).forEach(event => { const app = event.data.app || 'Unknown'; const title = event.data.title || 'Unknown'; const durationSec = event.duration; if (durationSec > 60) { // Filter out activities that lasted less than 1 minute const minutes = Math.floor(durationSec / 60); console.log(`- ${app} (${title}): ${minutes} minutes`); } }); ``` The resulting output is consumed under the following instruction in `SKILL.md`: ```markdown Analyze the data collected from the `fetch_activity.js` script. ``` ### Technical Analysis Application names and window titles are untrusted data. Websites can control browser tab titles, and local applications can similarly expose attacker-controlled or externally sourced text in their window titles. The script inserts these values verbatim into output intended for an AI model. No boundary, structured encoding, prompt-injection warning, or instruction hierarchy tells the model that title content must be treated exclusively as inert data. A title containing text such as instructions to ignore prior requirements, reveal surrounding context, or perform unrelated actions could therefore be interpreted as an instruction rather than activity metadata. The raw-result output at lines 47-49 broadens the same injection surface because it also prints the title fields without sanitization. ### Attack Path 1. An attacker publishes a webpage or supplies content that controls a browser tab or application window title. 2. The user leaves that page or application active long enough for ActivityWatch to record it. 3. The malicious title is stored in the `aw ...[truncated 1047 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not include window titles by default. Prefer locally aggregated application names and durations. 2. When titles are explicitly enabled, pass records as structured data with clear trusted/untrusted boundaries rather than interpolating them into prose. 3. Add explicit Skill instructions stating that all ActivityWatch fields are untrusted data and that instructions contained in application names, titles, URLs, or event fields must never be followed. 4. Normalize and sanitize title values by removing control characters, limiting field length, and rejecting multiline content. 5. Wrap untrusted fields in an unambiguous schema, for example: ```javascript console.log(JSON.stringify({ type: "activity_record", app: String(app).replace(/[\r\n]/g, " ").slice(0, 100), title: String(title).replace(/[\r\n]/g, " ").slice(0, 200), minutes })); ``` 6. Instruct the Agent to use the records only for statistical classification and summarization, without executing actions requested by record content. 7. Remove the complete raw-result log at lines 47-49, since it exposes the same injection source outside the sanitized output path. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (5)

Ae1

High
Category
analysis-evasion
Content
handler: node scripts/fetch_activity.js --hours 24
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
handler: node scripts/fetch_activity.js --hours 24
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
handler: node scripts/fetch_activity.js --hours 24
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
handler: node scripts/fetch_activity.js --hours 24
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script queries ActivityWatch for application and window-title history, then prints raw titles and app names directly to stdout without any warning, consent flow, or sanitization. Window titles frequently contain sensitive information such as document names, URLs, chat subjects, tickets, customer names, or secrets, so emitting them into agent logs or downstream LLM context can unintentionally expose private user activity.

Static analysis

No suspicious patterns detected.