T09 · Insecure Skill Coding Practices
- Location
SKILL.md:62- Finding
Unauthenticated Remote Task Processing and Unsafe JSON Construction
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 62–73
Vulnerability Type: Missing peer authorization, insufficient input validation, and unsafe output serialization
Risk Level: MediumVulnerable Code
bash while true; do MSG=$(pilotctl --json recv 5000 --timeout 30s) TYPE=$(echo "$MSG" | jq -r '.type') SENDER=$(echo "$MSG" | jq -r '.sender') case "$TYPE" in task) RESULT=$(process_task "$(echo "$MSG" | jq -r '.payload')") pilotctl --json send-message "$SENDER" --data "{\"type\":\"result\",\"data\":\"$RESULT\"}" ;; esac doneTechnical Analysis
The documented workflow accepts messages from the bridge and invokes
process_taskwhenever the remotely controlledtypefield equalstask. It does not authenticate or allowlist the sender, authorize the requested task, validate the message against a strict schema, limit payload size, or enforce processing time and resource limits.Encryption and network tunneling do not, by themselves, prove that every reachable peer is authorized to submit work. A malicious or compromised peer could therefore supply hostile data to the undefined
process_taskhandler. The precise downstream consequence depends on that handler; arbitrary command execution cannot be confirmed from the reviewed file alone.The workflow also inserts
RESULTdirectly into a JSON string. Quotes, backslashes, newlines, and other control characters in the result are not escaped. This can produce malformed JSON or allow the result to alter the structure of the outbound protocol message.Attack Path
- An attacker obtains access to the Pilot overlay, controls a connected peer, or otherwise becomes capable of sending a message to the listener.
- The attacker submits a message whose
typefield istaskand whosepayloadcontains malicious, oversized, or computationally expensive input. - The listener accepts the message witho ...[truncated 1077 chars]
- Remediation
View remediation
Remediation Suggestions
- Authenticate peers using cryptographically verified identities supplied by the transport.
- Maintain an explicit allowlist of senders permitted to submit tasks.
- Authorize permitted actions separately for each sender rather than treating tunnel access as task authorization.
- Validate every message against a strict schema, including required fields, accepted types, allowed actions, data types, and maximum lengths.
- Enforce payload-size, execution-time, concurrency, and resource limits to reduce denial-of-service risk.
- Ensure
process_tasktreats payloads strictly as data and never evaluates them as shell commands, code, templates, or unparameterized queries. - Construct outbound JSON with a serializer rather than string interpolation:
bash DATA=$(jq -n \ --arg type "result" \ --arg data "$RESULT" \ '{type: $type, data: $data}') pilotctl --json send-message "$SENDER" --data "$DATA"- Reject malformed input and log authorization failures without recording sensitive payload contents.
- Document the authentication and authorization guarantees expected from
pilotctland fail closed when peer identity cannot be verified.
