T09 · Insecure Skill Coding Practices
- Location
scripts/car_connect.py:71- Finding
Unsafe Tesla vehicle selection can execute commands against the wrong vehicle
- Content
View full analysis
Vulnerability Details
File Location:
scripts/car_connect.py, lines 71-77
Vulnerability Type: Unsafe object selection and fail-open behavior
Risk Level: Highpython # Filter by car name if given v = vehicles[0] if args.car: for veh in vehicles: if args.car.lower() in veh["display_name"].lower(): v = veh breakTechnical Analysis
The handler selects the first Tesla before processing
--car. If the supplied name does not match any vehicle, the code does not report an error and leaves the first vehicle selected. The match is also substring-based and does not detect ambiguous matches.All subsequent Tesla operations use
v, including locking, unlocking, charging, opening the trunk, operating windows, activating climate controls, and sounding the horn. This violates fail-safe selection principles for safety-relevant remote controls.Attack Path
- The account contains multiple Tesla vehicles.
- A user or automated agent invokes a consequential command with a misspelled, obsolete, or nonexistent
--carvalue. - The loop finds no match.
vremains set tovehicles[0].- If
--yesis present, the command executes against that unintended vehicle.
Impact Assessment
The issue does not grant access beyond the authenticated Tesla account, but it can direct existing vehicle-control privileges toward the wrong vehicle. Possible consequences include unlocking doors, opening a trunk, changing charging state, operating windows, or activating other remote functions on an unintended vehicle.
- Remediation
View remediation
Remediation Suggestions
- Do not preselect the first vehicle when
--caris supplied. - Require an exact, unique match by VIN or normalized display name.
- Abort when no vehicle matches or when multiple vehicles match.
- For consequential actions, display the resolved vehicle name and VIN before execution.
- Consider requiring VIN-based selection when an account has multiple vehicles.
- Add tests for nonexistent, misspelled, partial, duplicate, and ambiguous vehicle names.
- Do not preselect the first vehicle when
