T09 · Insecure Skill Coding Practices
- Location
scripts/generate_template.py:137- Finding
Unescaped CLI Input Allows XML and DockerMan Configuration Injection
- Content
View full analysis
{args.extra_params}" elif args.bypass_entrypoint: extra_params = "\n --entrypoint /bin/sh" # PostArgs post_args = build_post_args(args) # WebUI webui = "" if args.web_port: webui = f"\n http://[IP]:[PORT:{args.web_port}]/" # Icon icon = "" if args.icon: icon = f"\n {args.icon}" # Extra volumes from CLI extra_volumes = "" for vol in (args.volume or []): host_path, container_path = vol.split(":") extra_volumes += f"\n {host_path}" template = f""" {args.name} {args.image} bridge{icon}{webui}{extra_params} {post_args} {config_xml}{extra_volumes} """ ``` Related unsafe interpolation is also present in `build_configs()` at lines 35–103, where names, proxy settings, time zones, and environment-variable values are inserted into XML attributes or text nodes without escaping. ### Technical Analysis The generator constructs XML using Python formatted strings. User-controlled values are inserted into XML text nodes and attributes without XML escaping, validation, or use of a structured XML API. Characters such as `<`, `>`, `&`, single quotes, and double quotes can therefore terminate the intended XML element or attribute. An attacker can inject additional DockerMan elements, including `Config`, `ExtraParams`, or `PostArgs` entries. ...[truncated 2150 chars]- Remediation
View remediation
