Back to skill

Security audit

heartbeat-scanner

Security checks for vulnerabilities and agentic risk

Overview

This is a local profile classifier that validates a user-provided Turtle file and does not show hidden persistence, exfiltration, or privilege-seeking behavior.

Install only in a virtual environment and consider pinning reviewed versions of rdflib and pyshacl. Use the tool on your own profiles or data you are authorized to analyze, and treat Agent/Human/Cron/Hybrid output as a heuristic label rather than reliable identity evidence.

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
requirements.txt:4
Finding

Unpinned and Unhashed Third-Party Dependencies

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-9; installation command at README.md:17-23
Vulnerability Type: Supply-chain risk caused by open-ended dependency constraints and missing integrity hashes
Risk Level: Medium

Vulnerable Code

requirements.txt:1-9:

text
# Heartbeat Scanner Dependencies

# RDF processing
rdflib>=6.0.0

# SHACL validation
pyshacl>=1.3.0

# No other dependencies - uses Python standard library

README.md:17-23:

markdown
## Installation

```bash
pip install -r requirements.txt

Requirements: pyshacl, rdflib

text

### Technical Analysis

The dependency specifications only define minimum versions and have no upper bounds, exact version pins, lock file, or cryptographic hashes. Consequently, each installation may resolve to different package versions, including future releases that were not reviewed with this project.

Python packages can execute package-controlled code during installation and when imported. The scanner imports both dependencies in `heartbeat_scanner.py`:

```python
from pyshacl import validate
import rdflib

This does not establish that the currently published packages are malicious. The weakness is that the project does not guarantee that users install the same reviewed artifacts. If a dependency release or its distribution channel is compromised, the installation instructions can expose users to attacker-controlled code.

Attack Path

  1. An attacker compromises a permitted future release of rdflib or pyshacl, or the corresponding package distribution account or artifact.
  2. The malicious release still satisfies rdflib>=6.0.0 or pyshacl>=1.3.0.
  3. A user follows the documented command pip install -r requirements.txt.
  4. The package resolver selects and installs the compromised release because no exact version or expected hash is enforced.
  5. Attacker-controlled code executes during p ...[truncated 589 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace open-ended constraints with exact versions that have been reviewed and tested, for example:

    text
    rdflib==REVIEWED_VERSION
    pyshacl==REVIEWED_VERSION
    
  2. Generate a fully resolved lock file containing transitive dependencies and cryptographic hashes, for example with:

    bash
    pip-compile --generate-hashes requirements.in
    
  3. Require hash verification during installation:

    bash
    python -m pip install --require-hashes -r requirements.txt
    
  4. Review and update pinned versions through a controlled dependency-update process. Run automated vulnerability and license scans before accepting each update.

  5. Install the project in an isolated virtual environment under a non-privileged account. Avoid system-wide or administrator-level package installation.

  6. Use a trusted package index or an internally controlled package mirror, and retain reviewed artifacts to support reproducible builds.

Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description overstates and mischaracterizes the implementation. The code's real primary purpose is heuristic classification using a fixed formula and threshold logic, plus minimal parsing of Turtle files to extract precomputed values. There is no SHACL library usage, no shape validation, no heartbeat-specific analysis, and no notable 'quirky personality' behavior beyond text labels. The broad category outputs (Agent/Human/Cron/Hybrid) do align partially with the description, but the stated mechanism and core functionality are materially different, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The overall high-level purpose mostly aligns in that the code is a self-classification tool producing Agent/Human/Cron/Hybrid labels with quirky output. However, the description specifically advertises 'SHACL-based heartbeat analysis' and structural validation, which are not implemented. The code contains no SHACL libraries, RDF graph handling, shape validation, or heartbeat-specific analysis. Instead, it applies hard-coded heuristic thresholds to numeric profile metrics and post/day counts. This is a material description-to-behavior mismatch because the named analysis method and validation mechanism are absent, even though the classification theme is similar.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README describes a behavioral classifier that infers whether a subject is an 'Agent', 'Human', 'Cron', or 'Hybrid' from posting timing and language cues, but it does not mention consent, user choice, acceptable-use limits, or caveats about cultural/locale-dependent interpretation. That creates a real safety and privacy risk because operators may use the tool for profiling or identity inference on third parties without understanding the limits, bias, or policy constraints of those inferences.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest describes a self-classification tool based on SHACL heartbeat analysis, but this file performs regex extraction from Turtle text and applies a custom scoring formula. There is no SHACL validation or heartbeat-structure analysis in the implementation shown, which is a semantic mismatch with the advertised behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file's operational focus is running unit tests, parsing provided metric profiles, and classifying raw scores through a bespoke formula. That behavior fits a classifier/test utility more than a heartbeat validator with quirky self-classification backed by SHACL analysis.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

When given a profile file, the program prints agent identifiers, names, and derived metrics directly to stdout without masking or warning. In a skill context, stdout may be logged, surfaced to users, or captured by orchestration systems, which can unintentionally disclose sensitive profile information or internal identifiers.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This Python skill's natural-language interface, messages, suggestions, and CLI output are all hard-coded in English, and the file provides no mechanism for user opt-in or locale selection. Under the language/locale policy rule, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment at L370 says the test is 'Good data - Agent', but the actual inputs at L377-L379 have very low CV and meta scores, which the classifier explicitly maps to CRON at L208-L210. This is an active contradiction between documentation/comments and code behavior, even though it is confined to a test case label.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
92% confidence
Finding

The dependency specification uses a lower-bound only constraint for rdflib, which allows installation of any newer release, including versions with breaking changes or newly introduced malicious or vulnerable transitive behavior. In a security-sensitive validation tool that parses untrusted RDF/SHACL content, supply-chain drift increases the chance of unexpected code paths, parser flaws, or incompatible behavior being pulled into production.

Content

Scanner excerpt · requirements.txt (reported line 4)May include surrounding context.

text
# Heartbeat Scanner Dependencies

# RDF processing
rdflib>=6.0.0

# SHACL validation
pyshacl>=1.3.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
93% confidence
Finding

The pyshacl dependency is not pinned and may resolve to arbitrary future versions, creating a supply-chain risk and making builds non-reproducible. Because this skill performs SHACL validation, pyshacl is part of the core parsing and validation surface, so an unsafe or compromised release could directly affect processing of attacker-controlled input.

Content

Scanner excerpt · requirements.txt (reported line 7)May include surrounding context.

text
rdflib>=6.0.0

# SHACL validation
pyshacl>=1.3.0

# No other dependencies - uses Python standard library

Static analysis

No suspicious patterns detected.