Back to skill

Security audit

BMS CAN Analyzer

Security checks for vulnerabilities and agentic risk

Overview

This local CAN log analyzer is not malicious, but it needs review because it can automatically install dependencies and one bundled plotting utility can write files to paths controlled by input data.

Review this skill before installing. Use it in a virtual environment, install dependencies yourself from trusted pinned sources, avoid processing untrusted JSON/DBC data when exporting CSV, and always pass an explicit safe output path for plots and extracted data.

Vulnerability Patterns
  • 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
  • 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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
parse_blf_signal.py:76
Finding

Spreadsheet Formula Injection in CSV Exports

Content
View full analysis

Vulnerability Details

File Location: parse_blf_signal.py:76-79; visualize_signal.py:85-89
Vulnerability Type: CSV formula injection
Risk Level: Medium

Vulnerable Code

parse_blf_signal.py:76-79:

python
elif output_format == 'csv':
    csv_lines = ['timestamp,value']
    for point in timeseries:
        csv_lines.append(f"{point['timestamp']},{point['value']}")
    return '\n'.join(csv_lines)

visualize_signal.py:85-89:

python
elif format_type == 'csv':
    if 'time_series' not in data:
        return "No time series data available"
    
    csv_lines = ['timestamp,value']
    for point in data['time_series']:
        if 'timestamp' in point and 'value' in point:
            csv_lines.append(f"{point['timestamp']},{point['value']}")
    return '\n'.join(csv_lines)

Technical Analysis

Both CSV export implementations construct rows through direct string interpolation. They do not use a standards-compliant CSV writer, quote fields, validate value types, or neutralize spreadsheet formula prefixes.

Values decoded from attacker-controlled DBC definitions may be represented as strings, while visualize_signal.py directly accepts values from an input JSON document. If a cell begins with a spreadsheet formula marker such as =, +, -, or @, spreadsheet applications may interpret the value as a formula rather than inert data.

Quoting a field is not, by itself, sufficient protection against every spreadsheet application. Formula-leading string cells should be explicitly neutralized or rejected.

Attack Path

  1. An attacker creates a DBC or JSON input containing a signal value represented by a formula-like string, such as =HYPERLINK("https://attacker.example","Open report").
  2. The victim processes that input and requests CSV output.
  3. The application interpolates the attacker-controlled value directly into a CSV cell.
  4. The victim opens the r ...[truncated 823 chars]
Remediation
View remediation

Remediation Suggestions

  • Use Python's csv module instead of manually concatenating fields.
  • Enforce numeric types for signal values when the expected signal domain is numeric.
  • For string fields, neutralize values whose first non-whitespace character is =, +, -, or @, for example by prefixing an apostrophe.
  • Apply neutralization only to string fields so legitimate negative numeric values remain numeric.
  • Quote fields consistently and handle embedded commas, quotes, and line breaks.
  • Add tests covering formula prefixes, leading whitespace, embedded delimiters, quotes, and newline characters.

Example hardening approach:

python
import csv
import io

def safe_spreadsheet_cell(value):
    if isinstance(value, str) and value.lstrip().startswith(('=', '+', '-', '@')):
        return "'" + value
    return value

output = io.StringIO()
writer = csv.writer(output)
writer.writerow(['timestamp', 'value'])
for point in timeseries:
    writer.writerow([
        safe_spreadsheet_cell(point['timestamp']),
        safe_spreadsheet_cell(point['value'])
    ])
csv_data = output.getvalue()

T09 · Insecure Skill Coding Practices

Warning
Location
visualize_signal.py:130
Finding

Arbitrary File Write Through Unsanitized Signal Name

Content
View full analysis

Vulnerability Details

File Location: visualize_signal.py:68; visualize_signal.py:130-131
Vulnerability Type: Path traversal and attacker-controlled file overwrite
Risk Level: Medium

Vulnerable Code

The default plot path is derived directly from the JSON-controlled signal_name field:

python
if not args.no_plot:
    plot_file = args.output or f"{data.get('signal_name', 'signal')}_timeseries.png"
    create_plot(data, plot_file)

The resulting path is passed to the filesystem write operation without validation:

python
if output_file:
    plt.savefig(output_file, dpi=150, bbox_inches='tight')
    print(f"Plot saved to: {output_file}")

Technical Analysis

load_signal_data() accepts an arbitrary JSON document, and main() uses its signal_name property as part of the default output filename. The value is not restricted to a basename and may contain absolute-path prefixes, directory separators, or .. traversal components.

matplotlib.pyplot.savefig() subsequently writes the generated image to that path. No designated output directory is enforced, no canonical-path containment check is performed, and no protection against overwriting an existing file is present.

The explicit --output option also permits arbitrary destinations, but that is direct command-line behavior initiated by the caller. The security issue is that an untrusted input document can select the default destination even when the caller does not provide an output path.

Attack Path

  1. An attacker supplies a JSON file containing a crafted signal name, for example:

    json
    {
      "signal_name": "../../target",
      "time_series": [
        {"timestamp": 1700000000, "value": 1}
      ]
    }
    
  2. The victim runs visualize_signal.py without --no-plot and without an explicit --output destination.

  3. The program constructs ../../target_timeseries.png.

  4. `creat ...[truncated 942 chars]

Remediation
View remediation

Remediation Suggestions

  • Never derive a filesystem path directly from an untrusted signal name.
  • Convert the signal name to a safe basename and permit only a conservative character set such as letters, digits, underscores, periods, and hyphens.
  • Place generated plots in a dedicated output directory controlled by the application.
  • Resolve the candidate path and verify that it remains beneath the resolved output directory.
  • Reject absolute paths, path separators, .. components, empty names, and platform-specific reserved names.
  • Avoid silently overwriting existing files; use exclusive creation, a generated unique filename, or require explicit confirmation.
  • Keep the signal's display label separate from its filesystem-safe identifier.

Example containment pattern:

python
from pathlib import Path
import re

output_dir = Path("plots").resolve()
output_dir.mkdir(parents=True, exist_ok=True)

raw_name = str(data.get("signal_name", "signal"))
safe_name = re.sub(r"[^A-Za-z0-9_.-]", "_", Path(raw_name).name)
safe_name = safe_name.strip("._") or "signal"

plot_file = (output_dir / f"{safe_name}_timeseries.png").resolve()
if output_dir not in plot_file.parents:
    raise ValueError("Invalid output path")

create_plot(data, str(plot_file))
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (2)

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill states it will automatically install dependencies if they are not present, which expands behavior beyond passive BLF/DBC analysis into modifying the host environment. Automatic package installation can introduce unreviewed code, create supply-chain risk, and execute package install hooks without explicit user consent, making the skill more dangerous than its stated data-extraction purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Describing automatic dependency installation without warning the user that the skill may modify the system is unsafe because it hides side effects unrelated to the core parsing task. In this context, the skill handles local files and should be low-risk, so undisclosed environment modification increases the chance of unwanted package installs, privilege misuse, or execution of installer scripts.

Content

No source excerpt is available for this finding.