T09 · Insecure Skill Coding Practices
- Location
SKILL.md:185- Finding
Path Traversal Through an Unvalidated Message ID
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 185
Vulnerability Type: Path traversal caused by unsafe path construction
Risk Level: HighVulnerable Code
bash kubectl -n kube-system exec -it rocketmq-master1.teambition.local -- cat /tmp/rocketmq/msgbodys/<message-id>Technical Analysis
The Skill instructs the agent to append a user-supplied
message-iddirectly to a filesystem path inside the RocketMQ pod. It does not define validation, canonicalization, or containment checks for that value.The
--separator preventskubectlfrom interpreting subsequent arguments as its own options, but it does not prevent filesystem traversal. If the supplied value includes../components,catresolves them inside the target container and may access a file outside/tmp/rocketmq/msgbodys/.For example, substituting
../../../etc/passwdproduces a path that escapes the intended message-body directory. Exploitability depends on whether the agent executes the documented command with an attacker-controlled value and whether the pod user can read the targeted file.Attack Path
- An attacker asks the agent to read a message body and supplies a crafted message ID containing traversal components, such as
../../../etc/passwd. - The agent substitutes the value into the documented command without validation.
kubectl execinvokescatin the RocketMQ master pod.- The container filesystem resolves the traversal components outside
/tmp/rocketmq/msgbodys/. - The contents of the targeted file are returned through the command output.
Impact Assessment
A successful exploit can disclose arbitrary files readable by the RocketMQ pod's effective user. Potentially exposed data may include application configuration, environment-related files, credentials, tokens, or Kubernetes service-account material if such files exist and are readable.
The issue provides file-read access within the target pod's existing permi ...[truncated 162 chars]
- An attacker asks the agent to read a message body and supplies a crafted message ID containing traversal components, such as
- Remediation
View remediation
Remediation Suggestions
- Do not construct filesystem paths directly from untrusted message identifiers.
- Validate message IDs with a strict allowlist matching the exact RocketMQ identifier format. If hexadecimal IDs are expected, permit only the required number of hexadecimal characters.
- Explicitly reject path separators, traversal sequences, whitespace, control characters, leading hyphens, and unexpected punctuation.
- Use a trusted helper that canonicalizes the requested path and verifies that the result remains beneath
/tmp/rocketmq/msgbodys/. - Pass the validated value as a distinct argument and use
cat -- "$validated_path"to prevent option interpretation. - Run the operation under a minimally privileged pod user that cannot read secrets or unrelated system files.
- Require the agent to reject invalid identifiers rather than attempting to sanitize malformed input.
