Back to skill

Security audit

heartflow-pipeline

Security checks for vulnerabilities and agentic risk

Overview

The shipped code is mostly a local text-checking pipeline, but the package documentation and manifest give conflicting security claims and direct users toward unaudited server and background-process workflows.

Treat this as a Review install. The local pipeline may be usable for text screening, but do not follow the Git clone, MCP server, or nohup daemon instructions unless you deliberately want to run unaudited external code and a long-running service. Review or disable the local memory/auto-rule files if conversation snippets or adaptive blocking rules would be sensitive in your environment.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
src/error-memory.js:25
Finding

Plaintext Cross-Session Storage of Conversation Content

Content
View full analysis

Vulnerability Details

File Location: src/error-memory.js:25, 41-56, 61-70, 87-94
Vulnerability Type: Plaintext sensitive-data persistence
Risk Level: Medium

Vulnerable Code

js
const MEMORY_FILE = path.join(__dirname, '..', 'data', 'error-memory.json');

function loadMemory() {
  try {
    const dir = path.dirname(MEMORY_FILE);
    if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
    if (!fs.existsSync(MEMORY_FILE)) return { errors: [], version: '1.0' };
    const raw = fs.readFileSync(MEMORY_FILE, 'utf8');
    return JSON.parse(raw);
  } catch {
    return { errors: [], version: '1.0' };
  }
}

function saveMemory(data) {
  const dir = path.dirname(MEMORY_FILE);
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
  fs.writeFileSync(MEMORY_FILE, JSON.stringify(data, null, 2), 'utf8');
}

function logCorrection(category, detail, context = '') {
  if (!category || !CATEGORIES[category]) return { success: false, reason: 'Unknown error category' };

  const memory = loadMemory();
  const entry = {
    id: memory.errors.length + 1,
    category,
    detail: detail || '',
    context: context.slice(0, 200),
    timestamp: new Date().toISOString(),
    prevention: CATEGORIES[category].preventionPatterns,
    recurrenceCount: 0,
  };

  memory.errors.push(entry);

  if (memory.errors.length > 200) {
    memory.errors = memory.errors.slice(-200);
  }

  saveMemory(memory);
  return { success: true, id: entry.id, recurrence: false };
}

Technical Analysis

The exported logCorrection() function stores caller-provided correction details and up to 200 characters of conversation context in data/error-memory.json. The information is serialized as plaintext and retained across sessions.

The implementation does not:

  • Require explicit consent before retaining conversation content.
  • Detect or redact credentials, personal data, tokens, or other secrets.
  • Encrypt retained content.
  • configure restrictive fi ...[truncated 1839 chars]
Remediation
View remediation

Remediation Suggestions

  1. Disable retention of raw conversation context by default and require explicit opt-in.
  2. Store only derived categories, counters, or keyed hashes where raw text is unnecessary.
  3. Apply secret and personal-data redaction before persistence.
  4. Use a configurable, user-specific application-data directory rather than the package installation directory.
  5. Create the directory with mode 0700 and the state file with mode 0600, subject to platform support.
  6. Add tenant or user identifiers and enforce isolation when used in multi-user services.
  7. Implement time-based expiration in addition to the existing record-count limit.
  8. Document exactly what is retained, for how long, and how users can inspect or delete it.
  9. If raw context is operationally necessary, encrypt it using a key stored separately from the data file.
  10. Handle persistence failures explicitly rather than silently falling back to empty state, so operators can detect integrity and permission problems.

T03 · Remote Payload Retrieval and Execution

Warning
Location
README.md:18
Finding

Execution Instructions Retrieve Mutable and Unaudited Remote Code

Content
View full analysis

Vulnerability Details

File Location: README.md:18-25, 56-68
Additional Location: The same instructions are duplicated in src/README.md.
Vulnerability Type: Mutable remote payload retrieval and execution
Risk Level: Medium

Vulnerable Code

bash
# Clone (zero npm dependencies)
git clone https://github.com/yun520-1/mark-heartflow-skill.git
cd mark-heartflow-skill

# Verify installation
node bin/verify.js

# Interactive mode
node bin/cli.js chat
bash
git clone https://github.com/yun520-1/mark-heartflow-skill.git
cd mark-heartflow-skill
node src/mcp-server.js --port 8588
bash
nohup node src/mcp-server.js --port 8588 > heartflow.log 2>&1 &

Technical Analysis

The installation instructions clone and execute the repository’s mutable default branch without pinning an immutable commit or signed release. Consequently, the code executed by a user can change after this Skill artifact has been reviewed.

The audited artifact does not include the referenced files:

  • bin/verify.js
  • bin/cli.js
  • src/mcp-server.js

Following the documentation therefore causes users to obtain and execute code that is outside the audited artifact. The nohup example further instructs users to keep the unaudited server process running in the background.

This behavior is not performed automatically by the included JavaScript pipeline. It requires a user or Agent to follow the documented shell commands. Nevertheless, the documentation presents the remote repository as the recommended installation path without integrity pinning.

Attack Path

  1. An attacker compromises the upstream repository, maintainer account, release process, or mutable default branch.
  2. The attacker modifies one of the referenced scripts or adds a malicious replacement.
  3. A user follows the README and clones the repository without specifying a commit or verified release tag.
  4. The user runs node bin/verify.js, node bin/cli.js, or `node sr ...[truncated 1041 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin clone and checkout instructions to an immutable commit hash or cryptographically signed release tag.
  2. Publish SHA-256 checksums and signature-verification instructions for downloadable releases.
  3. Include all referenced CLI, verification, and MCP server files in the reviewed package.
  4. Remove commands referencing files absent from the distributed artifact.
  5. Prefer installation from a versioned package whose contents correspond exactly to the audited source.
  6. Document the server’s bind address, authentication model, exposed methods, shutdown procedure, and filesystem/network privileges.
  7. Avoid recommending nohup background execution unless process lifecycle, logging, access control, and update behavior are clearly documented.
  8. Require a new security review whenever the pinned release or commit changes.

other

Note
Location
package.json:6
Finding

Manifest and Documentation Advertise Security-Relevant Components Absent from the Artifact

Content
View full analysis

Vulnerability Details

File Location: package.json:6-7, 89-126
Related Location: README.md:89-113, 213-236, 314-323
Vulnerability Type: Misleading capability and security documentation
Risk Level: Low

Vulnerable Code

json
"main": "src/pipeline.js",
"bin": {
  "heartflow": "src/mcp-server.js"
}
json
"exports": {
  ".": "./src/pipeline.js",
  "./gate": "./src/gate.js",
  "./pipeline": "./src/pipeline.js",
  "./discriminate": "./src/index.js",
  "./engine": "./src/core/heartflow.js"
}

The README additionally claims that the package contains hundreds of modules, 30 MCP tools, encrypted memory, an MCP server, CLI tooling, and numerous engine directories. Those components are not present in the audited directory structure.

Technical Analysis

The package manifest registers a command-line executable and an engine export whose target files are absent. Documentation also describes security-relevant functions—including an HTTP-capable MCP service, encrypted memory, code execution controls, and a large engine implementation—that cannot be validated in this artifact.

This mismatch can cause installation or import failures and makes it difficult for users to determine which security guarantees apply to the actual package. It also encourages users to retrieve a different implementation from the remote repository to obtain the advertised functionality.

The discrepancy is not evidence of embedded malicious code. It is a release-integrity and documentation-quality problem that weakens informed security review.

Attack Path

  1. A user reviews the security claims in the README and assumes the distributed artifact contains the described controls.
  2. The user installs the artifact or attempts to invoke the registered CLI or engine export.
  3. The referenced files are missing, causing failure or prompting the user to retrieve another version from the remote repository.
  4. The user may then execute code that was not part of the ...[truncated 383 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove manifest entries whose target files are not shipped.
  2. Include and audit every file referenced by bin, exports, scripts, and usage documentation.
  3. Regenerate the README from the actual release contents or add automated checks that verify every documented path exists.
  4. Reconcile claims concerning module counts, MCP tools, encryption, dependencies, and background services with the shipped artifact.
  5. Clearly distinguish lightweight-pipeline functionality from optional full-engine functionality.
  6. Ensure the package version, README version, VERSION file, and published contents are synchronized during release.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (56)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README claims no HTTP service, but documents starting an MCP server on a TCP port and registering it over HTTP. This contradiction can cause users to expose a network service while believing the package is local-only, materially increasing remote attack surface and the likelihood of unsafe deployment defaults.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README claims there are no background processes, yet instructs users to run the server permanently with nohup as a daemon. This is dangerous because it understates persistence and service lifetime, leading operators to deploy a long-running process without accurately assessing monitoring, patching, exposure, and abuse risks.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

A code-execution module is a high-risk capability for a package presented as an AI output screening layer, because it expands the trust boundary from passive analysis into active execution. Even if described as sandboxed or disabled by default, its presence materially increases the attack surface and can enable command execution pathways if later exposed through tools, plugins, or misconfiguration.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The documented purpose does not mention mutable conversational state, anchor storage, or drift-detection state, yet the code reportedly maintains session-like memory. Hidden state can influence future outputs in ways users and hosting agents do not expect, which can lead to prompt contamination, privacy leakage across interactions, or policy bypass through state poisoning.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented purpose does not mention mutable conversational state, anchor storage, or drift-detection state, yet the code reportedly maintains session-like memory. Hidden state can influence future outputs in ways users and hosting agents do not expect, which can lead to prompt contamination, privacy leakage across interactions, or policy bypass through state poisoning.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented purpose does not mention mutable conversational state, anchor storage, or drift-detection state, yet the code reportedly maintains session-like memory. Hidden state can influence future outputs in ways users and hosting agents do not expect, which can lead to prompt contamination, privacy leakage across interactions, or policy bypass through state poisoning.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

The documented purpose does not mention mutable conversational state, anchor storage, or drift-detection state, yet the code reportedly maintains session-like memory. Hidden state can influence future outputs in ways users and hosting agents do not expect, which can lead to prompt contamination, privacy leakage across interactions, or policy bypass through state poisoning.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README claims there are no background processes, yet it instructs users to run the server under nohup as a permanent daemon. This contradiction is dangerous because it conceals persistence and service exposure, leading operators to underestimate runtime footprint, network availability, and the need for supervision, logging, and hardening.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Advertising code execution inside a skill presented as a text discrimination layer materially increases risk because consumers may deploy it in trusted agent environments without expecting execution capability. Even if described as sandboxed or disabled by default, the presence of an execution subsystem expands the blast radius to command execution, sandbox escape attempts, and misuse through MCP or future configuration drift.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README markets HeartFlow as a narrow, zero-LLM rule-based discriminator, but the same document describes a much broader agent platform with memory, planning, learning, philosophy, code execution, and server exposure. This scope mismatch is dangerous because reviewers or operators may grant it trust and deployment permissions appropriate for a lightweight filter while actually installing a far more privileged and complex system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README provides copy-paste instructions to start an HTTP-accessible MCP server but does not place a nearby warning about network exposure, trust boundaries, or safe binding. In practice, users may run this on a shared host or exposed interface, making internal tools or sensitive agent capabilities reachable over the network without understanding the risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The nohup example encourages persistent unattended execution, which increases the risk of forgotten long-running services, stale processes, and unnoticed network exposure. In the context of a package positioned as a lightweight discrimination layer, this persistence is more dangerous because users may not apply the operational safeguards they would use for a server process.

Content

Scanner excerpt · README.md (reported line 68)May include surrounding context.

Or run as a permanent daemon:

bash
nohup node src/mcp-server.js --port 8588 > heartflow.log 2>&1 &

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Persistent memory and an encrypted memory bank are not necessary for a rule-only discriminator and introduce data retention risk, especially if users assume the tool is stateless. In an agent integration context, this can lead to unintended storage of prompts, secrets, personal data, or cross-session context that changes the privacy and compliance posture of the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Self-healing reinforcement learning and self-evolution claims are unjustified for a simple rules engine and create operational risk by implying behavior can change over time outside normal review. In a gating or safety layer, unreviewed adaptation can weaken determinism, complicate auditing, and make failures harder to reproduce or contain.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill metadata does not declare any tool scope or permissions, yet the package reportedly has network-capable code. Undeclared network capability weakens the trust boundary for users and orchestrators because the skill can perform outbound communication beyond what its manifest suggests, enabling data exfiltration or remote dependency behavior without informed consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This JSON manifest contains user-facing warning strings entirely in Chinese, but does not document that the package is China/Chinese-specific or offer a language choice. That can violate language/locale policy expectations by forcing a specific language for safety-critical disclosures without user opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Optional inclusion of @xenova/transformers and pm2 contradicts the stated purpose of a pure rule engine and expands the runtime capability surface to local model execution and process management. Even if optional, these dependencies create ambiguity about what the package may do in some environments, increasing the chance of unexpected code execution paths, persistence, or resource abuse.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest claims a narrowly scoped, zero-LLM rule engine, but the same package metadata advertises workflows for session context, dreaming, system-prompt absorption, bridge layers, and memory features. This scope mismatch is dangerous because it can conceal materially broader capabilities than users expect, weakening informed consent and making risky behavior easier to smuggle into a supposedly simple safety component.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README describes a much broader autonomous agent surface than the skill metadata suggests, including memory, learning, planning, psychology, dream, and execution features. This scope inflation is dangerous because reviewers and users may install a supposedly narrow rule-based gatekeeping layer while actually exposing far more privileged functionality and attack surface.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Starting the MCP server with nohup in the background encourages persistent unattended execution without any warning about service exposure, lifecycle management, or resource impact. In agent environments, this can leave an always-on local service running longer than intended and potentially reachable by unintended clients.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
96% confidence
Finding

The use of nohup and background execution introduces session persistence beyond a normal transient CLI workflow. In the context of an agent skill, unattended persistence is more dangerous because the package presents itself as a lightweight cognitive filter while also exposing an MCP server that can remain available indefinitely.

Content

Scanner excerpt · src/README.md (reported line 68)May include surrounding context.

Or run as a permanent daemon:

bash
nohup node src/mcp-server.js --port 8588 > heartflow.log 2>&1 &

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Persistent memory, encrypted memory banks, and cross-session indexing exceed what users would reasonably expect from a zero-LLM text discriminator. This creates privacy and retention risk because sensitive prompts or derived user data may be stored across sessions under a misleadingly narrow product description.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The security section says there is no self-upgrade, but the version history references self-upgrade behavior. Even if this only means internal version-awareness logic, the wording creates ambiguity around autonomous code or capability changes, which is a high-trust concern for agent skills.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file’s descriptive comments, usage guidance, and rule messages are all written in Chinese, and there is no indication that the skill supports other languages or that Chinese-only behavior is intentional and justified. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes HeartFlow as a rule-engine-based text discrimination gate layer, which suggests applying a defined pipeline of checks. This module goes beyond static checking by learning from prior error statistics and appending newly generated rules to a persistent JSON file, introducing self-modifying behavior not reflected in the stated description.

Content

No source excerpt is available for this finding.