T09 · Insecure Skill Coding Practices
- Location
SKILL.md:51- Finding
Shell command injection through unvalidated port and service-name arguments
- Content
View full analysis
``` ```bash meshlink publish --name --port ``` ```bash meshlink unpublish --name ``` ### Technical Analysis The Skill directs the agent to insert port numbers and service names into Bash command templates. It does not require strict validation of the user-provided port or the name accepted by the unpublish workflow. Publication names generated during the normal publishing flow are restricted to lowercase kebab-case. However, this restriction is not explicitly applied to the independently invoked unpublish command. Port input also lacks a required numeric type check and range check. If these templates are executed through a shell after direct string substitution, shell metacharacters in an attacker-controlled value can terminate or extend the intended command. For example, a port value such as `3000; id > /tmp/meshlink-proof` could cause the shell to run both the intended `meshlink` command and the injected command. The vulnerability depends on the agent or command-execution layer constructing a shell command from the template rather than passing arguments as a structured argument array. The Skill does not mandate the safer execution method. ### Attack Path 1. An attacker asks the agent to publish a service and supplies a crafted port value containing a valid-looking port followed by a shell separator and an operating-system command. 2. The Skill directs the agent to insert that value into `meshlink check-port --port `. 3. If the agent executes the resulting text through Bash, the shell interprets the separator. 4. The injected command executes with the same operating-system privileges as the agent. 5. Alternatively, the attacker re ...[truncated 693 chars]- Remediation
View remediation
