Back to skill

Security audit

File Converter

Security checks for vulnerabilities and agentic risk

Overview

This file-converter skill is mostly local and purpose-related, but its documentation and scripts expose mismatched commands plus unsafe converters that users should review before installing.

Install only if you are comfortable reviewing and constraining this skill first. Treat it as a broad local file utility, not just the four frontmatter commands; avoid running it on untrusted filenames or arguments, do not execute generated SQL without review, and do not render generated HTML/XML in sensitive contexts without sanitization.

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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:149
Finding
Bash Arithmetic Expansion Allows Command Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh:149-153` **Vulnerability Type**: Command injection through unsafe arithmetic evaluation **Risk Level**: High ### Vulnerable Code ```bash cmd_hex() { local file="${1:?}" local n="${2:-256}" xxd "$file" 2>/dev/null | head -$((n / 16 + 1)) || od -A x -t x1z "$file" | head -$((n / 16 + 1)) } ``` ### Technical Analysis The second argument to `hex` is copied directly into `n` and then evaluated inside Bash arithmetic expansion: ```bash $((n / 16 + 1)) ``` Bash can recursively interpret variable values as arithmetic expressions. Crafted expressions involving array subscripts and command substitutions can therefore cause shell commands to execute while Bash evaluates the ostensibly numeric value. Quoting the initial assignment does not make the later arithmetic evaluation safe. The value must be validated as a decimal integer before it is used in an arithmetic context. ### Attack Path 1. An attacker persuades a user or automated process to invoke `scripts/script.sh hex` with an attacker-controlled second argument. 2. The argument contains a malicious arithmetic expression that triggers command substitution during recursive arithmetic evaluation. 3. `cmd_hex` evaluates the argument in `$((n / 16 + 1))`. 4. The embedded command executes before `head` receives its numeric argument. 5. The command runs with the operating-system privileges of the user or service executing the skill. ### Impact Assessment Successful exploitation provides arbitrary command execution as the current skill process account. The attacker can read or modify files accessible to that account, invoke local programs, alter project data, and potentially access credentials available in the process environment or user account. This does not independently grant elevated system privileges, but its scope includes all resources already accessible to the invoking account. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions Validate the byte-count argument before performing arithmetic and pass the resulting value to `head` using its explicit option form: ```bash cmd_hex() { local file="${1:?Usage: file-converter hex <file> [n]}" local n="${2:-256}" local lines [[ "$n" =~ ^[0-9]+$ ]] || { printf 'Invalid byte count: %s\n' "$n" >&2 return 2 } (( n <= 1048576 )) || { printf 'Byte count exceeds the permitted limit\n' >&2 return 2 } lines=$((n / 16 + 1)) if command -v xxd >/dev/null 2>&1; then xxd "$file" 2>/dev/null | head -n "$lines" else od -A x -t x1z "$file" | head -n "$lines" fi } ``` Use a reasonable upper bound to prevent resource abuse. Do not evaluate arbitrary user strings as arithmetic expressions. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
<table>}" local table="${2:?}" FILE="$file" TABLE="$table" python3 << 'PYEOF' import csv, os with open(os.environ["FILE"]) as f: for row in csv.DictReader(f): cols = ', '.join(row.keys()) vals = ', '.join("'{}'".format(v.replace("'","''")) for v in row.values()) print('INSERT INTO {} ({}) VALUES ({});'.format(os.environ["TABLE"], cols, vals)) PYEOF } ``` ### Technical Analysis CSV field values have single quotes escaped, but two classes of SQL identifiers are emitted wi ...[truncated 1623 chars]:81
Finding
Generated SQL Contains Unvalidated Table and Column Identifiers<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh:81-92` **Vulnerability Type**: SQL injection in generated statements **Risk Level**: Medium ### Vulnerable Code ```bash cmd_csv2sql() { local file="${1:?Usage: file-converter csv2sql <file> <table>}" local table="${2:?}" FILE="$file" TABLE="$table" python3 << 'PYEOF' import csv, os with open(os.environ["FILE"]) as f: for row in csv.DictReader(f): cols = ', '.join(row.keys()) vals = ', '.join("'{}'".format(v.replace("'","''")) for v in row.values()) print('INSERT INTO {} ({}) VALUES ({});'.format(os.environ["TABLE"], cols, vals)) PYEOF } ``` ### Technical Analysis CSV field values have single quotes escaped, but two classes of SQL identifiers are emitted without validation or database-specific quoting: - The table name supplied through the `TABLE` environment variable. - Column names obtained from the untrusted CSV header. These values are directly interpolated into each `INSERT` statement. An attacker can use SQL punctuation or additional clauses in a table argument or CSV header to change the meaning of the generated SQL. The converter does not execute the statements itself. Exploitation occurs when a user or downstream process executes the generated SQL, which is the intended purpose of this command's output. ### Attack Path 1. An attacker controls the table argument, a CSV file, or its header row. 2. The attacker places SQL syntax into the table name or a column heading. 3. The user runs `csv2sql`, producing statements containing the injected syntax. 4. The generated output appears to be a normal SQL import script. 5. A user, deployment job, or database administration process executes that script. 6. The injected statements run with the database privileges of that downstream process. ### Impact Assessment The impact depends on the downstream database account. Possible consequences include unauthorized reads, modifications, or deletion ...[truncated 291 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Strictly validate table and column identifiers before generating SQL. If only simple identifiers are required, enforce an allow-list such as: ```python import re IDENTIFIER = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$") table = os.environ["TABLE"] columns = list(row.keys()) if not IDENTIFIER.fullmatch(table): raise ValueError("Invalid table identifier") for column in columns: if not IDENTIFIER.fullmatch(column): raise ValueError("Invalid column identifier") ``` For broader identifier support, select a specific database dialect and use its official identifier-quoting mechanism. Do not attempt to use value escaping for identifiers. Prefer a database driver with parameterized queries if the tool is extended to execute SQL directly. Clearly warn users that generated scripts should be reviewed before execution. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/convert.sh:274
Finding
JSON-to-XML Conversion Emits Unescaped Names, Attributes, and Text<![CDATA[ ## Vulnerability Details **File Location**: `scripts/convert.sh:274-307` **Vulnerability Type**: XML structure injection **Risk Level**: Medium ### Vulnerable Code ```python def to_xml(obj, tag="root", indent=0): prefix = " " * indent if isinstance(obj, dict): attrs = "" children = [] for k, v in obj.items(): if k.startswith("@"): attrs += ' {}="{}"'.format(k[1:], v) elif k == "#text": children.append(("_text_", v)) else: children.append((k, v)) print("{}<{}{}>".format(prefix, tag, attrs)) for k, v in children: if k == "_text_": print("{} {}".format(prefix, v)) elif isinstance(v, list): for item in v: to_xml(item, k, indent + 1) else: to_xml(v, k, indent + 1) print("{}</{}>".format(prefix, tag)) elif isinstance(obj, list): for item in obj: to_xml(item, "item", indent) else: val = "" if obj is None else str(obj) print("{}<{}>{}</{}>".format(prefix, tag, val, tag)) ``` ### Technical Analysis The converter constructs XML through string interpolation rather than an XML serialization library. It does not: - Validate JSON keys before using them as XML element or attribute names. - Escape quotation marks or entity characters in attribute values. - Escape `<`, `>`, or `&` in text nodes. - Reject malformed or namespace-manipulating names. Consequently, attacker-controlled JSON can terminate attributes or elements and inject additional XML structure. It can also generate malformed output that is interpreted differently by downstream parsers. ### Attack Path 1. An attacker supplies or modifies a JSON document processed by `json2xml`. 2. The JSON contains crafted keys, attribute values, or scalar text with XML metacharacters. 3. `to_xml` interpolates those values direct ...[truncated 763 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Construct XML with a standard serialization library such as `xml.etree.ElementTree` rather than concatenating strings. Validate every element and attribute name against the permitted XML naming rules. Example design: ```python from xml.etree.ElementTree import Element, SubElement, tostring def append_value(parent, tag, value): child = SubElement(parent, tag) child.text = "" if value is None else str(value) xml_bytes = tostring(root, encoding="utf-8", xml_declaration=True) ``` The serializer will escape text and attribute values correctly. Add explicit rejection for unsupported names and ambiguous structures, define how namespaces are handled, and test values containing `<`, `>`, `&`, single quotes, and double quotes. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:58
Finding
Markdown-to-HTML Conversion Permits Active HTML Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh:58-72` **Vulnerability Type**: HTML injection and potential cross-site scripting **Risk Level**: Medium ### Vulnerable Code ```bash cmd_md2html() { local file="${1:?}" [ -f "$file" ] || return 1 FILE="$file" python3 << 'PYEOF' import re, os with open(os.environ["FILE"]) as f: t = f.read() t = re.sub(r'^### (.+)$', r'<h3>\1</h3>', t, flags=re.MULTILINE) t = re.sub(r'^## (.+)$', r'<h2>\1</h2>', t, flags=re.MULTILINE) t = re.sub(r'^# (.+)$', r'<h1>\1</h1>', t, flags=re.MULTILINE) t = re.sub(r'\*\*(.+?)\*\*', r'<strong>\1</strong>', t) t = re.sub(r'\*(.+?)\*', r'<em>\1</em>', t) print(t) PYEOF } ``` ### Technical Analysis The function reads arbitrary Markdown and emits it as HTML after applying a few regular-expression substitutions. It neither escapes source HTML nor sanitizes the generated output. Raw tags, event-handler attributes, script-capable elements, and dangerous URLs therefore remain in the result. Malicious content can also be placed inside heading or emphasis captures and is inserted verbatim into generated tags. Regular expressions are not an appropriate HTML security boundary. A proper Markdown parser must be combined with explicit raw-HTML handling and output sanitization. ### Attack Path 1. An attacker creates a Markdown file containing active HTML or malicious attributes. 2. A user or automated process converts the file with `md2html`. 3. The converter copies the malicious markup into its output without escaping or sanitization. 4. The output is opened in a browser or embedded into a web application. 5. If the rendering context permits active content, attacker-controlled script executes in that context. ### Impact Assessment In a browser-based downstream context, exploitation may allow script execution under the origin where the converted HTML is served. This can expose page data, perform actions available to the victim, modify displayed content, or ...[truncated 193 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Escape raw HTML by default before introducing generated markup. Prefer a maintained Markdown parser configured to disable or escape embedded HTML. If raw HTML support is required, sanitize the final result with an allow-list-based HTML sanitizer. Permit only required elements and attributes, remove event handlers and script-capable elements, and validate URL schemes. Document whether output is safe for direct browser rendering and add tests covering `<script>`, event-handler attributes, dangerous links, SVG content, and malicious markup inside headings and emphasis. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/convert.sh:7
Finding
Promotional Text Is Appended to Machine-Readable Conversion Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/convert.sh:7, 100, 155, 193, 224, 264, 316, 361, 396` **Vulnerability Type**: Output-integrity violation **Risk Level**: Low ### Vulnerable Code ```bash BRAND="Powered by BytesAgain | bytesagain.com | hello@bytesagain.com" ``` Representative machine-readable output suffixes include: ```bash echo "# $BRAND" ``` ```bash echo "// $BRAND" ``` ```bash echo "<!-- $BRAND -->" ``` For example, the `yaml2json` branch appends the following after serialized JSON: ```bash print(json.dumps(data, indent=2, ensure_ascii=False)) PYEOF echo "" echo "// $BRAND" ``` ### Technical Analysis Multiple conversion branches append fixed branding to standard output. For machine-readable formats, this changes the converted artifact rather than providing separate diagnostic information. In particular, `// Powered by ...` is not valid JSON. Redirecting `yaml2json` or `xml2json` output to a file therefore produces a document that strict JSON parsers reject. Similar suffixes can alter CSV, YAML, XML, minified code, or other generated artifacts and may be propagated into downstream systems without the user noticing. The text is fixed rather than attacker-controlled, so this is not instruction hijacking. The issue is silent corruption of output integrity. ### Attack Path 1. A user runs a conversion command and redirects standard output to a destination file. 2. The converter emits the requested data. 3. It then appends promotional text to the same standard-output stream. 4. A downstream parser or application consumes the file as a machine-readable artifact. 5. Parsing fails, or the unintended content is accepted and propagated as part of the artifact. ### Impact Assessment The likely impact is denial of processing, broken automation, invalid configuration files, and unintended content propagation. It does not directly provide code execution or additional privileges. The scope includes workflows that trust stand ...[truncated 62 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Remove branding from all machine-readable standard output. Conversion commands should emit only the requested artifact. If attribution or status output is required: 1. Write it to standard error rather than standard output. 2. Disable it by default for conversion operations. 3. Place it behind an explicit option such as `--show-branding`. 4. Never append it to JSON, CSV, XML, YAML, SQL, or source-code output. Add automated tests that redirect each command's standard output to a file and parse that file with a strict parser for the expected format. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
98% confidence
Finding
This finding shows substantial divergence between the declared purpose and the apparent implementation, including missing advertised conversions and several undeclared capabilities such as SQL generation, base64 handling, URL encoding/decoding, hex inspection, and Markdown-to-HTML conversion. Such discrepancies are risky because they expand the skill's effective attack surface, undermine reviewability, and can cause agents to expose, inspect, or transform sensitive content in ways operators did not authorize.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
This finding shows substantial divergence between the declared purpose and the apparent implementation, including missing advertised conversions and several undeclared capabilities such as SQL generation, base64 handling, URL encoding/decoding, hex inspection, and Markdown-to-HTML conversion. Such discrepancies are risky because they expand the skill's effective attack surface, undermine reviewability, and can cause agents to expose, inspect, or transform sensitive content in ways operators did not authorize.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The front-matter description and body documentation describe different command sets and capabilities, which creates a misleading interface contract for users and automated agents. In a skill ecosystem, inconsistent documentation can cause unsafe invocation decisions, missed review of real behavior, and misuse of commands that were not expected from the manifest.

Intent-Code Divergence

Medium
Confidence
90% confidence
Finding
The documentation claims YAML/XML/CSV/Markdown conversion support, but the listed command interface does not substantiate those features and instead documents a different set of utilities. This inconsistency is dangerous because users may trust unsupported or differently implemented conversions, while hidden functionality can be invoked without appropriate scrutiny, especially in automation contexts handling untrusted files.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The script implements additional capabilities beyond those declared in the skill metadata, including md2csv, xml2json, json2xml, minify, and prettify. Undeclared functionality weakens review and policy enforcement because users or orchestrators may invoke behaviors that were never security-assessed, creating hidden attack surface and trust-boundary violations.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The script exposes capabilities beyond the manifest’s stated scope, including SQL generation, base64 operations, file inspection, and markdown-to-HTML conversion. Scope drift is dangerous in agent skills because users and orchestrators may grant trust based on the declared purpose, while the extra commands can be used to inspect, transform, or exfiltrate data in ways not expected from a simple format converter.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
The hex dump command provides raw file-inspection functionality unrelated to the declared conversion purpose. In an agent context, this can be abused to read and expose contents of arbitrary local files, including binary secrets or sensitive headers, making the skill more useful for reconnaissance and data extraction than its manifest suggests.

Intent-Code Divergence

Low
Confidence
94% confidence
Finding
The help text advertises commands that are not listed in the manifest, reinforcing the existence of undocumented functionality and making it easier for users to discover and use unreviewed features. While the issue is primarily metadata inconsistency, in an agent skill ecosystem this can bypass allowlisting, confuse security controls, and expose operators to unexpected file-processing behaviors.

Intent-Code Divergence

Low
Confidence
81% confidence
Finding
The comment states base64 decode was removed, but the command remains exposed in the dispatcher, creating misleading security expectations and undefined behavior. Even though the function currently only expands a user-supplied filename and performs no decode, mismatches between comments and exposed interfaces are risky because they hide real runtime behavior and can undermine review and policy enforcement.

Description-Behavior Mismatch

Low
Confidence
89% confidence
Finding
The manifest says the skill's commands are `detect`, `json2yaml`, `yaml2json`, and `csv2md`, but this tips file also instructs users to use `minify`, `prettify`, and `xml2json`. That indicates documented behavior beyond the explicitly declared command set, creating a mismatch between the claimed interface and the documented capabilities.

Static analysis

No suspicious patterns detected.