Back to skill

Security audit

google analytics and search improve

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a coherent website analytics and audit helper, but its site-audit scripts can be steered into requesting internal network URLs through user-supplied URLs, sitemaps, or redirects.

Install only if you are comfortable with a review-level risk: use it on sites you control or trust, avoid auditing untrusted sitemaps, keep analytics credentials read-only, restrict permissions on .skills-data, and remove or rotate keys when finished. The skill should add URL validation before it is used in environments with access to private networks or cloud metadata services.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
.
Finding
Unrestricted Website Audit Requests Enable Server-Side Request Forgery<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/geo_audit.py:67-92` - `scripts/seo_audit.py:52-59` - `scripts/seo_audit.py:215-229` - `scripts/seo_audit.py:249-256` - `scripts/perf_audit.py:55-69` - `scripts/perf_audit.py:130-141` - `scripts/perf_audit.py:183-192` - `scripts/perf_audit.py:348-349` **Vulnerability Type**: Server-Side Request Forgery (SSRF) through user-controlled URLs, sitemap entries, sub-sitemap entries, and redirects **Risk Level**: High ### Vulnerable Code #### `scripts/geo_audit.py:67-92` ```python def fetch(url: str) -> requests.Response: return requests.get( url, headers={"User-Agent": USER_AGENT, "Accept-Encoding": "gzip, br"}, timeout=REQUEST_TIMEOUT, allow_redirects=True, ) def safe_fetch(url: str) -> requests.Response | None: try: return fetch(url) except Exception as exc: print(f" ⚠️ Failed to fetch {url}: {exc}", file=sys.stderr) return None def extract_sitemap_urls(sitemap_url: str) -> list[str]: resp = safe_fetch(sitemap_url) if not resp or resp.status_code != 200: return [] content = resp.text urls = [] if "<sitemapindex" in content.lower(): sub_sitemaps = re.findall(r'<loc>\s*(.*?)\s*</loc>', content) for sub_url in sub_sitemaps: sub_resp = safe_fetch(sub_url) if sub_resp and sub_resp.status_code == 200: urls.extend(re.findall(r'<loc>\s*(.*?)\s*</loc>', sub_resp.text)) else: urls = re.findall(r'<loc>\s*(.*?)\s*</loc>', content) return urls ``` #### `scripts/seo_audit.py:52-59` ```python def fetch(url: str, *, follow_redirects: bool = True) -> requests.Response: """Fetch a URL with standard headers.""" return requests.get( url, headers={"User-Agent": USER_AGENT, "Accept-Encoding": "gzip, br"}, timeout=REQUEST_TIMEOUT, allow_redirects=follow_redirects, ) ``` #### `scripts/seo_audit.py:215- ...[truncated 6593 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Restrict URL schemes** - Parse every URL before use. - Permit only `https` and, where explicitly necessary, `http`. - Reject URLs containing credentials, malformed hostnames, or unsupported schemes. 2. **Restrict requests to the audited origin** - Record the normalized scheme, hostname, and effective port of the approved base URL. - Reject sitemap entries and nested sitemap URLs whose origin differs from the approved origin by default. - If cross-origin resources are required, require explicit user approval or a narrow allowlist. 3. **Block non-public network destinations** - Resolve the destination hostname before connecting. - Reject every resolved IPv4 and IPv6 address classified as loopback, private, link-local, reserved, multicast, or unspecified. - Apply the check to all addresses returned by DNS, not only the first result. - Explicitly block common metadata destinations and IPv4-mapped IPv6 representations. 4. **Validate redirects manually** - Disable automatic redirects with `allow_redirects=False`. - Follow redirects through a bounded loop. - Reapply scheme, origin, hostname, port, and resolved-address validation before every redirect request. - Set a low maximum redirect count. 5. **Protect against DNS rebinding** - Avoid validating one DNS result and allowing the HTTP library to perform an unrelated second resolution. - Bind the validated address to the connection where practical while preserving correct TLS hostname verification. - Revalidate every new connection and redirect. 6. **Harden sitemap processing** - Limit sitemap response size, nesting depth, entry count, and total number of outbound requests. - Require sitemap and page entries to use the audited public origin. - Parse XML with a hardened parser and reject malformed or unexpectedly large documents. 7. **Secure the TLS probe** - Apply the same public-address and origin validation bef ...[truncated 797 chars]
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (47)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description promises a higher-level website analysis and optimization workflow centered on GA4/GSC and live-site auditing. The actual code only performs data extraction from Bing Webmaster Tools via specific API endpoints (query stats, page stats, rank/traffic, keyword, links, crawl stats/issues). It contains no logic for goal discovery, journey analysis, behavioral validation, site auditing, diagnosis, or roadmap generation. This is a material mismatch in both primary purpose and accessed resources.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The description promises a comprehensive analysis workflow spanning website goals, user journeys, GA4 and GSC data analysis, live-site auditing, validation of intended behavior, and generation of improvement recommendations. The code does not implement any of that broader workflow. It only authenticates to Google Analytics, constructs a funnel definition from CLI arguments or JSON config, calls run_funnel_report on the GA4 Data API alpha client, parses the response, and writes structured JSON output. This is materially narrower than the declared purpose and omits several central claimed capabilities, especially Search Console support, live site auditing, and recommendation generation. There is no clearly dangerous undeclared behavior, but there is a significant description/behavior mismatch in primary scope and functionality.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description promises an end-to-end website analysis capability combining goal discovery, user journey validation, GA4/GSC analysis, live site auditing, and actionable recommendations. The actual code only queries GA4 Data API reports using presets or user-specified dimensions/metrics and serializes the results. While GA4 analysis is one component of the declared purpose, the code lacks the broader behaviors that define the skill’s stated function. Therefore the description materially overstates and misrepresents what this code chunk actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description promises a strategy-and-analytics workflow: understand business goals and user journeys, analyze GSC/GA4 data, validate real user behavior against intended journeys, and produce goal-aligned improvement plans. The code does none of that. It is a standalone GEO audit script focused on AI discoverability and content structure. It fetches robots.txt, llms.txt, llms-full.txt, sitemap.xml, and page HTML; evaluates AI crawler blocking, explicit allow rules, content depth, intro summaries, FAQ/HowTo signals, question headings, and schema presence; and emits a report. While this is loosely related to search optimization, it is materially different from the declared primary purpose and omits the central promised capabilities around GA4/GSC and user behavior analysis. Therefore this is a clear mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
This code chunk’s primary purpose is significantly narrower than the declared description. It only reads data from Google Search Console APIs (search analytics, sitemaps, URL inspection) and serializes results. The declared description promises a higher-level workflow involving understanding business goals and user journeys, analyzing both GSC and GA4, auditing the live site, validating behavioral intent, and producing optimization plans. None of that analytical or planning behavior appears in the code. Additionally, the code includes concrete GSC operations like sitemap listing and URL inspection that are not reflected in the description. While GSC access is directionally related to SEO diagnosis, the actual behavior is materially just data retrieval rather than the described end-to-end diagnostic and recommendation capability.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description suggests a broad diagnostic skill centered on business goals, user journeys, and behavioral analytics from GA4/GSC, with live-site validation against intended user behavior. The supplied code does none of that. Instead, it performs a technical HTTP performance/security audit of webpages: requests pages, optionally via sitemap, measures response/load times, HTML size, compression, HSTS, CSP, X-Frame-Options, X-Content-Type-Options, HTTPS/TLS version, redirects, cache headers, and inferred CDN provider. While 'audit website performance' appears in the description, that is only one small part of the declared overall purpose, and the code's primary behavior is much narrower and materially different from the stated analytics- and journey-focused workflow. Therefore this is a clear description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
There is a material mismatch between the declared purpose and the supplied code. The description promises a high-level analytics and strategy workflow centered on goals, user journeys, GA4/GSC analysis, and diagnosing gaps between intended and actual user behavior. The code only performs live-site technical SEO auditing via HTTP requests and HTML parsing. While this partially overlaps with 'audit the live site' and SEO improvement use cases, the primary declared capabilities around analytics platforms, behavioral validation, and goal-aligned planning are absent. The code also reads SITE_URL from environment and accesses public site resources (pages, sitemap.xml, robots.txt), which is consistent with site auditing, but not with the much broader declared analytics/strategy functionality. Therefore the description overstates and misrepresents the actual behavior.

Credential Access

High
Category
Privilege Escalation
Content
```
<project_root>/.skills-data/google-analytics-and-search-improve/
  .env        # Configuration (auth, URLs, etc.), auto-loaded by scripts
  data/       # Raw data only: API responses, user-uploaded CSVs (GSC/GA4/PSI JSON/CSV)
  analysis/   # Analysis outputs: reports, audit results, website profile, funnel analysis
  charts/     # Generated chart images (PNG) for embedding in analysis reports
Confidence
98% confidence
Finding
The skill design explicitly relies on a local `.env` and service-account configuration for authentication, which is a credential-access pattern. In this context, the risk is amplified because scripts auto-load these secrets and then perform shell and network operations, creating opportunities for accidental exposure, misuse, or leakage via logs and generated artifacts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
source "$DATA_DIR/venv/bin/activate"
set -a; source "$DATA_DIR/.env"; set +a
python scripts/seo_audit.py --url "$SITE_URL" --sitemap -o "$DATA_DIR/analysis/seo_audit.json"
python scripts/geo_audit.py --url "$SITE_URL" --sitemap -o "$DATA_DIR/analysis/geo_audit.json"
python scripts/perf_audit.py --url "$SITE_URL" --sitemap -o "$DATA_DIR/analysis/perf_audit.json"
Confidence
99% confidence
Finding
The instruction `set -a; source "$DATA_DIR/.env"; set +a` imports every variable from a local secrets file into the shell environment for subsequent script execution. This broad export pattern increases the risk that secrets are inherited by child processes, exposed in debugging output, or accessed by scripts that do not actually need them.

Credential Access

High
Category
Privilege Escalation
Content
| Document | Contents |
|----------|----------|
| [references/data-collection-reference.md](references/data-collection-reference.md) | Auth setup (GSC/GA4/Bing), .env configuration, collection commands, script usage (gsc_query.py, ga4_query.py, ga4_funnel.py, bing_query.py), dimensions & metrics, CSV export instructions, custom queries, PSI collection |
| [references/metrics-glossary.md](references/metrics-glossary.md) | Six analysis dimensions: thresholds, diagnostics, priority matrix |
| [references/SEO-GEO-Optimization-Checklist.md](references/SEO-GEO-Optimization-Checklist.md) | SEO & GEO optimization checklist: structured data, AI readability, content depth, performance |
| [references/data-visualization-guide.md](references/data-visualization-guide.md) | Chart generation patterns, type selection, per-phase chart requirements, CJK font support |
Confidence
95% confidence
Finding
The reference documentation explicitly covers auth setup and `.env`-based configuration for multiple external services, confirming that the skill's workflow includes credential acquisition and use. In combination with auto-loading, local storage, and broad shell/network operations, this creates a meaningful credential-handling risk surface.

Credential Access

High
Category
Privilege Escalation
Content
1. In the Google Analytics Admin page, click "Property Settings" (or "Property Details") under "Property"
2. The "Property ID" is displayed in the top-right — a numeric string (e.g., `123456789`, no "UA-" prefix)

### Step 8: Write to .env

```bash
cat > "$DATA_DIR/.env" <<EOF
Confidence
90% confidence
Finding
Writing credentials into $DATA_DIR/.env creates a plaintext secret store on disk, which can be read by other local users, backup systems, logs, or accidentally committed to repositories. In this skill, the risk is amplified because the file is later sourced into the shell, making secret handling part of routine execution without any warning or safeguards.

Credential Access

High
Category
Privilege Escalation
Content
```bash
source "$DATA_DIR/venv/bin/activate"
set -a; source "$DATA_DIR/.env"; set +a

# GSC data
python scripts/gsc_query.py --dimensions query --limit 500 -o "$DATA_DIR/data/gsc_queries.json"
Confidence
88% confidence
Finding
The instructions tell users to source $DATA_DIR/.env directly into the shell, which imports any secrets in plaintext and trusts the file contents as executable shell syntax. If the .env file is modified maliciously or contains unexpected shell constructs, sourcing it can expose credentials or trigger unintended command execution in addition to leaking secrets into the process environment.

Credential Access

High
Category
Privilege Escalation
Content
from pathlib import Path
from urllib.parse import urljoin, urlparse

import utils  # noqa: F401  — triggers .env loading & warning suppression

try:
    import requests
Confidence
71% confidence
Finding
Importing utils specifically to trigger .env loading and warning suppression causes the script to automatically ingest environment-sourced values from a local .env file without explicit user consent at runtime. In an agent-skill context, implicit loading of all environment configuration can unnecessarily expose secrets to process memory and to any code in utils, increasing the blast radius if that helper is modified or compromised.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Centralizes:
- Data directory discovery (.skills-data/google-analytics-and-search-improve/)
- .env loading
- Google Service Account credential auto-discovery
- Warning suppression for clean output
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

No suspicious patterns detected.