Back to skill

Security audit

Enrich Company Name

Security checks for vulnerabilities and agentic risk

Overview

This skill supports a legitimate HubSpot cleanup task, but it asks users to enable ongoing and bulk CRM changes without enough scoping, safety, or rollback guidance.

Review this before installing or running in production. Use a least-privilege HubSpot token, test the workflow on a small segment or sandbox first, export affected contact/company fields before bulk changes, confirm duplicate and auto-association settings, and define rollback or cleanup steps before enrolling the full backlog. Remove unnecessary contact PII fields from the audit scripts if you use them.

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

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/before.py:83
Finding

Unnecessary Retrieval of Contact Personally Identifiable Information

Content
View full analysis

Vulnerability Details

File Location: scripts/before.py:83-111 and scripts/after.py:92-120
Vulnerability Type: Excessive CRM data access violating least-privilege principles
Risk Level: Medium

Complete Code Snippet

scripts/before.py:83-111:

python
while sampled < SAMPLE_SIZE:
    payload = {
        "filterGroups": [{"filters": [
            {"propertyName": "company", "operator": "NOT_HAS_PROPERTY"},
        ]}],
        "properties": ["email", "firstname", "lastname", "company"],
        "limit": 100,
    }
    if after:
        payload["after"] = after

    resp = requests.post(SEARCH_URL, headers=HEADERS, json=payload)
    if resp.status_code != 200:
        print(f"  Search error {resp.status_code} — stopping sample.")
        break

    data = resp.json()
    results = data.get("results", [])
    if not results:
        break

    for contact in results:
        cid = contact["id"]
        assoc_resp = requests.get(
            f"{BASE}/crm/v4/objects/contacts/{cid}/associations/companies",
            headers=HEADERS,
        )

scripts/after.py:92-120 contains the equivalent behavior:

python
while sampled < SAMPLE_SIZE:
    payload = {
        "filterGroups": [{"filters": [
            {"propertyName": "company", "operator": "NOT_HAS_PROPERTY"},
        ]}],
        "properties": ["email", "firstname", "lastname", "company"],
        "limit": 100,
    }
    if after:
        payload["after"] = after

    resp = requests.post(SEARCH_URL, headers=HEADERS, json=payload)
    if resp.status_code != 200:
        break

    data = resp.json()
    results = data.get("results", [])
    if not results:
        break

    for contact in results:
        cid = contact["id"]
        assoc_resp = requests.get(
            f"{BASE}/crm/v4/objects/contacts/{cid}/associations/companies",
            headers=HEADERS,

...[truncated 2088 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the unnecessary properties entry if HubSpot returns object IDs without an explicit property selection:

    python
    payload = {
        "filterGroups": [{"filters": [
            {"propertyName": "company", "operator": "NOT_HAS_PROPERTY"},
        ]}],
        "limit": 100,
    }
    
  2. If the API requires an explicit property selection, request only a non-sensitive field strictly necessary for pagination or object identification.

  3. Apply the same correction to both scripts/before.py and scripts/after.py.

  4. Avoid enabling HTTP body logging while processing CRM responses.

  5. Use a HubSpot private-app token restricted to the minimum read-only CRM scopes needed by these audit scripts.

  6. Keep generated reports aggregate-only, as the current CSV output already does.

T08 · Insecure Dependencies

Note
Location
scripts/before.py:1
Finding

Unpinned Dependencies Execute in a Credential-Bearing Process

Content
View full analysis

Vulnerability Details

File Location: scripts/before.py:1-7 and scripts/after.py:1-7
Vulnerability Type: Unpinned third-party dependencies and insufficient supply-chain integrity controls
Risk Level: Low

Complete Code Snippet

Both scripts declare the following dependency metadata:

python
# /// script
# requires-python = ">=3.10"
# dependencies = [
#   "requests>=2.31",
#   "python-dotenv>=1.0",
# ]
# ///

Technical Analysis

The dependency declarations set only minimum versions and do not impose upper bounds, exact versions, lock-file resolution, or artifact hashes. A future execution may therefore install versions that were not reviewed during this audit.

These packages execute inside a Python process that loads HUBSPOT_ACCESS_TOKEN from the environment and processes HubSpot CRM responses. A malicious or compromised future package release could read the token directly from the environment, inspect authenticated request headers, intercept response data, manipulate aggregate audit results, or transmit information elsewhere.

No evidence was found that the currently named packages are typosquatted or intentionally malicious. The finding concerns the absence of reproducible dependency resolution and integrity controls.

Attack Path

  1. An attacker compromises a future release of one of the declared packages or its publication account.
  2. The script runner resolves the open-ended >= constraint and installs the compromised version.
  3. The malicious package executes when imported by the script.
  4. It reads HUBSPOT_ACCESS_TOKEN, intercepts authenticated requests, or accesses CRM response data.
  5. The attacker uses the stolen token within its assigned HubSpot scopes or exfiltrates CRM information visible to the process.

This attack depends on a supply-chain compromise, malicious package release, or untrusted package-index configuration.

Impact Assessment

...[truncated 464 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin each dependency to a reviewed exact version instead of using open-ended minimum constraints.
  2. Generate and commit a lock file that records the complete transitive dependency graph.
  3. Require package hashes during installation to prevent substitution of unexpected artifacts.
  4. Install packages only from a trusted, explicitly configured package index.
  5. Use automated dependency monitoring and review updates before changing pinned versions.
  6. Run these scripts in a dedicated virtual environment or isolated container.
  7. Supply a HubSpot token with only the minimum read-only scopes required for contact search and association queries.
  8. Rotate the HubSpot token immediately if dependency compromise or unauthorized package resolution is suspected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Tainted flow: 'HEADERS' from os.environ (line 28, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/after.py (reported line 50)May include surrounding context.

python
# ── Helpers ──────────────────────────────────────────────────────

def search_count(filters):
    resp = requests.post(SEARCH_URL, headers=HEADERS, json={
        "filterGroups": [{"filters": filters}],
        "limit": 1,
    })

Tainted flow: 'HEADERS' from os.environ (line 28, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/after.py (reported line 67)May include surrounding context.

python
# Step 1 — totals
print("Step 1: Total contacts...")
resp_all = requests.get(
    f"{BASE}/crm/v3/objects/contacts", headers=HEADERS, params={"limit": 1},
)
total_contacts = resp_all.json().get("total", 0) if resp_all.status_code == 200 else 0

Tainted flow: 'HEADERS' from os.environ (line 28, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/after.py (reported line 109)May include surrounding context.

python
if after:
        payload["after"] = after

    resp = requests.post(SEARCH_URL, headers=HEADERS, json=payload)
    if resp.status_code != 200:
        break

Tainted flow: 'HEADERS' from os.environ (line 28, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/after.py (reported line 120)May include surrounding context.

python
for contact in results:
        cid = contact["id"]
        assoc_resp = requests.get(
            f"{BASE}/crm/v4/objects/contacts/{cid}/associations/companies",
            headers=HEADERS,
        )

Tainted flow: 'HEADERS' from os.environ (line 32, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/before.py (reported line 46)May include surrounding context.

python
def search_count(filters):
    """Return the total count of contacts matching *filters*."""
    resp = requests.post(SEARCH_URL, headers=HEADERS, json={
        "filterGroups": [{"filters": filters}],
        "limit": 1,
    })

Tainted flow: 'HEADERS' from os.environ (line 32, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/before.py (reported line 63)May include surrounding context.

python
# Step 1 — total contacts
print("Step 1: Total contacts...")
resp_all = requests.get(
    f"{BASE}/crm/v3/objects/contacts", headers=HEADERS, params={"limit": 1},
)
total_contacts = resp_all.json().get("total", 0) if resp_all.status_code == 200 else 0

Tainted flow: 'HEADERS' from os.environ (line 32, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/before.py (reported line 106)May include surrounding context.

python
if after:
        payload["after"] = after

    resp = requests.post(SEARCH_URL, headers=HEADERS, json=payload)
    if resp.status_code != 200:
        print(f"  Search error {resp.status_code} — stopping sample.")
        break

Tainted flow: 'HEADERS' from os.environ (line 32, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/before.py (reported line 118)May include surrounding context.

python
for contact in results:
        cid = contact["id"]
        assoc_resp = requests.get(
            f"{BASE}/crm/v4/objects/contacts/{cid}/associations/companies",
            headers=HEADERS,
        )

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill advertises a record-enrichment capability but only provides read/audit examples and a vague backfill outline while omitting explicit permission declarations for HubSpot API access. In an agent ecosystem, that mismatch can cause unsafe operator assumptions about what the skill will change, what credentials it needs, and whether it performs writes, increasing the risk of accidental misuse or uncontrolled execution paths.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill advertises a record-enrichment capability but only provides read/audit examples and a vague backfill outline while omitting explicit permission declarations for HubSpot API access. In an agent ecosystem, that mismatch can cause unsafe operator assumptions about what the skill will change, what credentials it needs, and whether it performs writes, increasing the risk of accidental misuse or uncontrolled execution paths.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

Loading secrets from a repo-relative .env file is a credential-handling weakness because such files are commonly mismanaged, copied, or accidentally committed, and the script assumes direct access to a high-value HubSpot token. In an agent skill ecosystem, local secret file loading expands the chance that credentials are exposed to unintended users or automation contexts.

Content

Scanner excerpt · scripts/after.py (reported line 24)May include surrounding context.

python
from dotenv import load_dotenv

# ── Configuration ────────────────────────────────────────────────
load_dotenv(os.path.join(os.path.dirname(__file__), "..", ".env"))

TOKEN = os.environ["HUBSPOT_ACCESS_TOKEN"]
BASE = "https://api.hubapi.com"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/before.py (reported line 28)May include surrounding context.

python
from dotenv import load_dotenv

# ── Configuration ────────────────────────────────────────────────
load_dotenv(os.path.join(os.path.dirname(__file__), "..", ".env"))

TOKEN = os.environ["HUBSPOT_ACCESS_TOKEN"]
BASE = "https://api.hubapi.com"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill includes executable code examples that access environment variables and a remote HubSpot API, but it declares no tool scope or permissions. In an agent setting, this creates an under-specified trust boundary: a reviewer or runtime may not realize the skill expects networked API access and secret handling, increasing the chance of unintended credential use or execution with broader privileges than intended.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs users to enable HubSpot auto-association, which can create and link company records automatically, but it does not prominently warn that this changes CRM data at scale. Because associations and auto-created companies can be wrong or noisy, users may unintentionally introduce widespread data integrity issues affecting segmentation, reporting, and downstream automations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The optional API backfill describes bulk-updating contact company fields without an explicit safety warning, dry-run mode, scoping guidance, or rollback plan. In a production CRM, a mistaken query, bad associations, or field-mapping error could overwrite or mass-populate records incorrectly, causing large-scale data corruption and harmful downstream business automation effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script silently loads a HubSpot access token from a local .env file and performs authenticated external API access without any user-facing disclosure or consent checkpoint. In an agent-skill setting, this reduces transparency around credential use and external data transmission, increasing the risk of unintended access to CRM data by operators who run the skill without fully understanding its behavior.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

This request sends contact-query data to HubSpot and retrieves contact records including email, firstname, and lastname for sampling. In this skill context the transmission is expected, but it still moves potentially sensitive personal data off the local environment to an external service and should be treated as a privacy-relevant data transfer rather than a code-execution flaw.

Content

Scanner excerpt · scripts/after.py (reported line 109)May include surrounding context.

python
if after:
        payload["after"] = after

    resp = requests.post(SEARCH_URL, headers=HEADERS, json=payload)
    if resp.status_code != 200:
        break

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/after.py (reported line 50)May include surrounding context.

python
def search_count(filters):
    """Return the total count of contacts matching *filters*."""
    resp = requests.post(SEARCH_URL, headers=HEADERS, json={
        "filterGroups": [{"filters": filters}],
        "limit": 1,
    })

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/before.py (reported line 46)May include surrounding context.

python
def search_count(filters):
    """Return the total count of contacts matching *filters*."""
    resp = requests.post(SEARCH_URL, headers=HEADERS, json={
        "filterGroups": [{"filters": filters}],
        "limit": 1,
    })

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/before.py (reported line 106)May include surrounding context.

python
def search_count(filters):
    """Return the total count of contacts matching *filters*."""
    resp = requests.post(SEARCH_URL, headers=HEADERS, json={
        "filterGroups": [{"filters": filters}],
        "limit": 1,
    })

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The script reads HUBSPOT_ACCESS_TOKEN directly from the environment, which is a sensitive credential access operation covered by the warning requirement for code files. While the module docstring explains the business purpose, it does not disclose that the script requires and uses an API access token.

Content

No source excerpt is available for this finding.