Back to skill

Security audit

Google Analytics CLI

Security checks for vulnerabilities and agentic risk

Overview

This GA4 skill is related to analytics work, but it needs review because it asks for a persistent unpinned CLI install and includes sensitive user-level/export commands despite describing the tool as read-only.

Install only after reviewing the npm package provenance and preferably using a pinned, isolated install. Use a least-privilege service account limited to the needed GA4 properties, and require explicit approval before access reports or audience exports, especially any output containing emails, device IDs, or user IDs.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:25
Finding
Unpinned Global Installation of a Third-Party npm Package## Vulnerability Details **File Location**: `SKILL.md`, lines 25-29 **Vulnerability Type**: Unpinned third-party dependency installed globally **Risk Level**: Medium ```bash If the CLI is not installed, install it: ```bash npm install -g google-analytics-cli ``` ``` ### Technical Analysis The skill instructs the agent to install `google-analytics-cli` globally from the npm registry without specifying an exact version or verifying package integrity. Consequently, the code installed and executed can change after the skill has been reviewed. A global npm installation can execute package lifecycle scripts, including `preinstall`, `install`, and `postinstall`, with the permissions of the user running the agent. The absence of a pinned version, lockfile, integrity hash, or provenance verification exposes the installation to upstream package compromise, malicious releases, and registry or maintainer-account compromise. The package name corresponds to the tool declared by the skill, so the dependency is functionally relevant rather than obviously unrelated. Nevertheless, global installation exceeds the minimum practical privilege needed to invoke a reporting CLI because it changes the user's persistent tool environment and may expose credentials and files available to the agent process. ### Attack Path 1. An attacker compromises the npm package, its maintainer account, or its publishing pipeline and publishes a malicious version under the existing package name. 2. The agent loads this skill on a host where the CLI is not already installed. 3. Following the skill instructions, the agent runs `npm install -g google-analytics-cli`. 4. npm resolves the current registry-selected version because no exact version or integrity value is provided. 5. Malicious package code or lifecycle scripts execute with the privileges of the user running the agent. 6. The payload can inspect accessible files and environment variables, potentially including Google Application Default C ...[truncated 1240 chars]
Remediation
## Remediation Suggestions 1. Do not automatically install the dependency. Ask the user for explicit approval before changing the environment. 2. Pin the package to a reviewed exact version, for example: ```bash npm install --global --ignore-scripts google-analytics-cli@<reviewed-exact-version> ``` 3. Verify the selected release against trusted provenance, checksums, signatures, and the official project repository before installation. 4. Prefer an isolated, non-global environment, such as a dedicated container or temporary project directory with a lockfile. 5. Use `--ignore-scripts` where compatible to prevent dependency lifecycle scripts from executing during installation. 6. Run the CLI as an unprivileged user and never invoke the installation through `sudo`. 7. Restrict filesystem and environment access so the CLI can access only the selected GA4 credential and required network endpoints. 8. Require service-account credentials with GA4 Viewer access only, limited to the specific properties needed for the requested report. 9. Avoid passing credential contents through command-line arguments or displaying them in logs. Accept only a path selected or approved by the user. 10. Document a trusted package version and update it only after a fresh security review.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Credential Access

High
Category
Privilege Escalation
Content
1. `--credentials <path>` flag (per-command)
2. `GOOGLE_APPLICATION_CREDENTIALS` env var
3. `~/.config/google-analytics-cli/credentials.json` (auto-detected)
4. gcloud Application Default Credentials

Before running any command, verify credentials by running `google-analytics-cli accounts`. If it fails, ask the user to set up a service account and grant it Viewer access in Google Analytics.
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

High
Confidence
97% confidence
Finding
The audience export workflow can create and query user-level export rows, including identifiers such as `deviceId` and `userId`, but the skill provides no warning or gating around that sensitive capability. In an agent context, this makes unintended retrieval and disclosure of user-level analytics data materially more dangerous than ordinary aggregate reporting.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The skill documentation explicitly calls the CLI 'read-only' and frames it as analysis/reporting and property exploration. However, the documented `audience-export-create` command creates a new export resource, which is a write/action operation rather than read-only reporting.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill documents commands that can reveal potentially sensitive analytics, account structure, access patterns, and user-related metadata without warning the operator to minimize, redact, or confirm disclosure. In an agent setting, this increases the chance that sensitive business intelligence or access data is fetched and surfaced to a user who asked a broad analytics question.

Description-Behavior Mismatch

Low
Confidence
76% confidence
Finding
The manifest focuses on traffic checks, reports, realtime users, account structure, and user behavior analysis. The documented `access-report` and `change-history` commands add administrative/audit capabilities about who accessed the property and what configuration changes occurred, which extend beyond the stated analytics-reporting focus.

Static analysis

No suspicious patterns detected.