T09 · Insecure Skill Coding Practices
- Location
scripts/control4_cli.py:248- Finding
Overbroad Generic Method Invocation with Incomplete Safety Enforcement
- Content
View full analysis
Vulnerability Details
File Location:
scripts/control4_cli.py:248-270; related command-line configuration atscripts/control4_cli.py:360-366
Vulnerability Type: Arbitrary public API method invocation through reflection
Risk Level: HighAffected code:
python async def cmd_call(args: argparse.Namespace) -> int: director = await _login_and_director() obj = _entity_factory(args.entity, director, args.id) fn = getattr(obj, args.method, None) is_sensitive = any(k in args.method.lower() for k in SENSITIVE_METHOD_KEYWORDS) if is_sensitive and not args.allow_sensitive: raise RuntimeError( "Sensitive method blocked. Re-run with --allow-sensitive if intentional." ) if not callable(fn): raise RuntimeError(f"Method not found: {args.method}") call_args = json.loads(args.args_json) if args.args_json else [] call_kwargs = json.loads(args.kwargs_json) if args.kwargs_json else {} if not isinstance(call_args, list): raise RuntimeError("--args-json must decode to a JSON array") if not isinstance(call_kwargs, dict): raise RuntimeError("--kwargs-json must decode to a JSON object") result = fn(*call_args, **call_kwargs) if inspect.isawaitable(result): result = await resultRelated command-line exposure:
python sp = sub.add_parser("call", help="Call any exposed method on an entity") sp.add_argument("--entity", required=True, choices=["director", "light", "relay", "climate", "blind", "room", "fan", "security-panel", "contact-sensor"]) sp.add_argument("--id", type=int) sp.add_argument("--method", required=True) sp.add_argument("--args-json", help='JSON array, e.g. "[10,1000]"') sp.add_argument("--kwargs-json", help='JSON object, e.g. "{\"LEVEL\":20}"') sp.add_argument("--allow-sensitive", action="store_true", help="Allow sensitive methods (arm/disarm/open/close/etc)")...[truncated 2596 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove unrestricted reflective invocation from normal Skill operation.
- Define explicit per-entity allowlists containing only the methods required for supported use cases.
- Separate read-only methods from mutating methods and deny all unrecognized methods by default.
- Disable director and security-panel mutations unless an administrator explicitly enables them in local configuration.
- Require interactive confirmation for physical-security operations, including alarm changes, locks, gates, garages, doors, and sensitive relays.
- Do not treat a command-line flag alone as sufficient authorization. Consider a separate privileged configuration file or execution mode with restrictive file permissions.
- Validate argument count, types, ranges, and accepted values independently for every permitted method.
- Record security-sensitive operations in an audit log without recording passwords or bearer tokens.
- If generic method inspection is required, retain
methodsas a read-only diagnostic command while replacingcallwith narrowly scoped commands.
