T09 · Insecure Skill Coding Practices
- Location
axiom_hash_multi.py:230- Finding
Manifest Path Traversal Enables Out-of-Scope File Hashing
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent local hashing tool, but its manifest verification and special-file handling can reach beyond the user’s intended files or run indefinitely on streams.
Review before installing if you may verify MANIFEST files from other people or automation. Use only trusted manifests, avoid running it on device files, FIFOs, or arbitrary symlinks, and prefer a patched version that confines manifest entries to an intended directory and rejects non-regular files by default.
axiom_hash_multi.py:230Manifest Path Traversal Enables Out-of-Scope File Hashing
axiom_hash_multi.py:93Unbounded Hashing of Character Devices and Streams Enables Denial of Service
Although compare mode, manifest verification, and JSON output are not inherently unsafe, the finding also indicates interaction with special device files and subprocess/testing behavior beyond the declared scope. In a security review context, undisclosed parsing and verification features expand the attack surface, and special-file handling can lead to hangs, excessive reads, or unexpected behavior if not carefully constrained.
Although compare mode, manifest verification, and JSON output are not inherently unsafe, the finding also indicates interaction with special device files and subprocess/testing behavior beyond the declared scope. In a security review context, undisclosed parsing and verification features expand the attack surface, and special-file handling can lead to hangs, excessive reads, or unexpected behavior if not carefully constrained.
The skill documentation and usage guidance are predominantly written in French, including operational instructions and feature descriptions, but there is no indication that the user can choose another language or that the skill is intentionally limited to a French-speaking context. This matches the policy category for language or locale constraints imposed without opt-in or justification.
The skill documentation declares no explicit tool scope, yet the described and statically detected capabilities include file access and shell execution. In an agent setting, missing permission boundaries can cause the skill to run with broader ambient authority than intended, increasing the chance of unauthorized file operations or command execution if the implementation is invoked unsafely.
This file contains natural-language instructions, usage examples, errors, and help text in French, which effectively forces a specific language for users. The policy allows locale constraints only when they are optional or clearly justified, and neither condition is present here.
The manifest description presents the skill as a multi-algorithm hash generator for a file or string. However, the code and module documentation add a separate MANIFEST-processing feature that parses a manifest file and verifies hashes for many referenced files, which is broader than simple hashing of a direct input.
Manifest verification accepts filenames from a MANIFEST and reads each referenced local file relative to the manifest directory, which expands file access beyond the single user-specified target implied by the skill purpose. An attacker who can supply or influence the MANIFEST can cause the tool to hash arbitrary readable local files, including via path traversal entries like '../secret', exposing existence and digest information for additional files.
The skill manifest describes a deterministic, local, zero-dependencies multi-hash generator, but this file imports and later uses subprocess execution to invoke the CLI itself and external tools like sha256sum, md5sum, and openssl. Spawning subprocesses and depending on host-installed binaries is not justified by the stated hashing purpose and expands capability beyond what users would expect from such a skill.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
print("=" * 70)
# F1: --algo invalid
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", f1mb.name, "--algo", "sha999"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "invalid --algo (sha999)", result.returncode == 1)
# F2: --all with file
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", f1mb.name, "--all"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "--all returns 5 lines", len(lines) == 5, f"got {len(lines)} lines")
# F3: --string with empty
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", "", "--string"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "empty --string", got == expected, f"got={got[:16]}..." if got != expected else "")
# F4: --string with unicode
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", "🐺", "--string"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "--string with emoji", got == expected, f"got={got[:16]}..." if got != expected else "")
# F5: stdin with no data
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", "--stdin", "--algo", "sha256"],
input="", capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "stdin with no data", got == expected)
# F6: file doesn't exist
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", "/tmp/this_does_not_exist_xyz.txt"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("F", "nonexistent file rejected", result.returncode == 1)
# F7: input is a directory
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(tmpdir)],
capture_output=True, text=True, cwd=Path(__file__).parent
)
The manifest explicitly markets the skill as having 'zero dependencies,' but this test file validates behavior by calling sha256sum, md5sum, and openssl from the host environment. That behavior is semantically inconsistent with the advertised zero-dependency posture, because successful execution of these paths depends on external executables being installed.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
print("=" * 70)
# H1: Compare with sha256sum
sha256sum_result = subprocess.run(
["sha256sum", str(f1mb)], capture_output=True, text=True
)
if sha256sum_result.returncode == 0:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("H", "sha256sum not available", True, "(skipped)")
# H2: Compare with md5sum
md5sum_result = subprocess.run(
["md5sum", str(f1mb)], capture_output=True, text=True
)
if md5sum_result.returncode == 0:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
report("H", "md5sum not available", True, "(skipped)")
# H3: Compare with openssl sha512
openssl_result = subprocess.run(
["openssl", "dgst", "-sha512", str(f1mb)], capture_output=True, text=True
)
if openssl_result.returncode == 0:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_10_json_single(self):
"""--json doit retourner un JSON valide."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(self.f), "--algo", "sha256", "--json"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_11_json_all(self):
"""--all --json doit retourner les 5 algos en JSON."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(self.f), "--all", "--json"],
capture_output=True, text=True, cwd=Path(__file__).parent
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_12_compare_match(self):
"""--compare avec bon hash doit exit 0 et dire MATCH."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(self.f),
"--compare", self.expected],
capture_output=True, text=True, cwd=Path(__file__).parent
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_13_compare_mismatch(self):
"""--compare avec mauvais hash doit exit 1 et dire MISMATCH."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(self.f),
"--compare", "0" * 64],
capture_output=True, text=True, cwd=Path(__file__).parent
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_14_compare_with_json(self):
"""--compare --json doit retourner un JSON structuré."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py", str(self.f),
"--compare", self.expected, "--json"],
capture_output=True, text=True, cwd=Path(__file__).parent
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def test_15_manifest_verify_ok(self):
"""--verify-manifest doit exit 0 si tout passe."""
result = subprocess.run(
[sys.executable, "axiom_hash_multi.py",
"--verify-manifest", str(self.manifest)],
capture_output=True, text=True, cwd=Path(__file__).parent