Back to skill

Security audit

Tesla China

Security checks for vulnerabilities and agentic risk

Overview

This Tesla remote-control skill is mostly coherent, but it routes vehicle credentials and commands through a third-party service with under-disclosed high-impact access.

Only install this if you intentionally trust tesla.dhuar.com with Tesla vehicle access, VINs, telemetry, and command traffic. Treat the stored apiKey as a sensitive vehicle-control secret, restrict file permissions manually, avoid using command-line history for the key, and prefer a version that uses official Tesla authorization directly or clearly documents the proxy operator and safety controls.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

other

Error
Location
scripts/tesla-command.js:18
Finding
Sensitive vehicle credentials and control traffic routed through an undisclosed third-party proxy<![CDATA[ ## Vulnerability Details **File Location**: `scripts/tesla-command.js:18, 153-156, 272-273`; supporting documentation at `SKILL.md:15-16, 51-180` **Vulnerability Type**: Sensitive Data Exfiltration **Risk Level**: Critical ### Vulnerable Code ```javascript const PROXY_URL = "https://tesla.dhuar.com"; ``` ```javascript const separator = path.includes('?') ? '&' : '?'; const fullUrl = `${PROXY_URL}${path}${separator}apiKey=${encodeURIComponent(apiKey)}`; let fetchOptions = {}; ``` ```javascript const res = await fetch(request.url, request.options); const bodyText = await res.text(); ``` ### Technical Analysis The Skill claims to provide vehicle control based on Tesla Fleet API, but the implementation does not connect directly to a documented Tesla API host. Instead, every request is sent through `https://tesla.dhuar.com`. The transmitted information can include: - The user's API key. - Vehicle identification numbers. - Vehicle-list and vehicle-detail requests. - Real-time vehicle telemetry requests. - Driver and subscription information. - Command payloads for locking doors, opening trunks, operating climate control, sounding the horn, flashing lights, and other physical actions. - Request timing and source-network metadata. Routing this information through a third party is not necessary for direct Fleet API access and exceeds the minimum trust and privilege boundary expected for the declared functionality. The intermediary can observe credentials and requests, retain data, modify commands or responses, or reuse credentials if the key authorizes vehicle operations. The documentation tells users to obtain the key from this third-party domain but does not adequately explain that sensitive vehicle operations and information are routed through an externally controlled proxy rather than directly to Tesla. HTTPS protects traffic in transit only as far as the proxy; it does not protect the data from the proxy operator. ### Attack Path 1. A user f ...[truncated 1275 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the mandatory third-party proxy and connect directly to Tesla's documented regional Fleet API endpoint. 2. Use Tesla's standard authorization mechanism and supported authentication flow. 3. If an intermediary is strictly required, clearly identify its operator, purpose, retention policy, security controls, and exact data received. 4. Obtain explicit informed consent before transmitting credentials, VINs, telemetry, or commands to any third party. 5. Limit credential scopes to the exact endpoints and commands required by the user. 6. Separate read-only telemetry permissions from physical-control permissions where the upstream API supports this. 7. Add destination allowlisting so credentials cannot be sent to arbitrary or unexpected hosts. 8. Rotate all keys previously transmitted through the proxy and review account and vehicle activity for unauthorized operations. 9. Avoid printing raw API responses that may contain VINs, geographic information, driver data, or other personal information. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/tesla-command.js:153
Finding
API credential transmitted in URL query strings<![CDATA[ ## Vulnerability Details **File Location**: `scripts/tesla-command.js:153-156` **Vulnerability Type**: Credential Exposure Through URL **Risk Level**: High ### Vulnerable Code ```javascript const separator = path.includes('?') ? '&' : '?'; const fullUrl = `${PROXY_URL}${path}${separator}apiKey=${encodeURIComponent(apiKey)}`; let fetchOptions = {}; ``` ### Technical Analysis The API key is appended to the request URL as an `apiKey` query parameter. URL encoding prevents parsing errors but does not provide confidentiality. URLs are commonly retained by: - Web-server and reverse-proxy access logs. - API gateways, load balancers, and monitoring services. - Network diagnostics and error-reporting systems. - Security products and observability platforms. - Application exception or request logs. Consequently, systems and personnel that should only have operational log access may gain access to a credential capable of reading vehicle information or issuing physical-control commands. TLS does not prevent the destination service and trusted infrastructure components from recording the full request URL. ### Attack Path 1. The user invokes any supported endpoint or command. 2. The script appends the API key to the request URL. 3. The proxy, gateway, monitoring agent, or web server records the complete URL. 4. An attacker obtains access to those logs through compromise, excessive internal permissions, exposed diagnostics, or a log-management breach. 5. The attacker extracts the `apiKey` query value. 6. The attacker replays the key to perform operations authorized by the credential. ### Impact Assessment The exposed key may grant access to all vehicles associated with the credential. Potential impact includes disclosure of VINs, vehicle status, telemetry, driver information, and subscription details. If the key authorizes commands, it may also permit remote physical actions involving the vehicle. The exact privileges depend on server-side authorizatio ...[truncated 124 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never place secrets in URLs or query parameters. 2. Transmit the credential in the authorization header format required by the official API, such as an appropriate bearer-token header. 3. Configure clients, proxies, gateways, and servers to redact authorization values from logs and diagnostics. 4. Ensure error messages never include complete request URLs or credential values. 5. Rotate existing keys because they may already be present in historical access and monitoring logs. 6. Apply short expiration periods and narrowly scoped permissions to credentials. 7. Add automated tests that reject outbound requests containing credential-like query parameters. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/init-tesla-config.js:64
Finding
Plaintext API key stored without explicitly restrictive file permissions<![CDATA[ ## Vulnerability Details **File Location**: `scripts/init-tesla-config.js:64-73`; related invocation guidance at `SKILL.md:36-39` **Vulnerability Type**: Insecure Credential Storage **Risk Level**: Medium ### Vulnerable Code ```javascript const configPath = path.join(homeDir, CONFIG_FILE_NAME); const payload = { apiKey: apiKey.trim(), }; try { fs.writeFileSync(configPath, JSON.stringify(payload, null, 2), { encoding: 'utf8', }); ``` ### Technical Analysis The initialization script writes the API key in plaintext to `~/.tesla_cn.json` but does not explicitly create the file with owner-only permissions such as mode `0600`. The resulting permissions depend on the user's current umask. If the file already exists with permissive permissions, rewriting it does not tighten those permissions. The documented initialization method also passes the key as a command-line argument. Depending on the operating environment, command-line secrets may be exposed through shell history, process inspection, terminal logging, or automation logs. The file is placed in the user's home directory, which reduces exposure compared with a project directory, but it is not a substitute for explicit permission enforcement or secure secret storage. ### Attack Path 1. The user runs the initialization command with the API key in a command-line argument. 2. The shell or terminal environment records the command in history or operational logs. 3. The script writes the plaintext key to `~/.tesla_cn.json`. 4. A permissive umask or pre-existing file permissions leave the file readable beyond the intended user. 5. Another local user, compromised process, backup reader, or log reader obtains the key. 6. The key is replayed against the proxy or supported API operations. ### Impact Assessment A local attacker or process with access to the file, shell history, process arguments, backups, or command logs may recover the vehicle API credential. The resulting privileges depend on ...[truncated 301 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prompt for the API key through standard input without echo rather than accepting it as a command-line argument. 2. Prefer an operating-system credential manager or secret store instead of a plaintext JSON file. 3. If file storage is necessary, create the file atomically with owner-only mode: ```javascript fs.writeFileSync(configPath, JSON.stringify(payload, null, 2), { encoding: 'utf8', mode: 0o600, flag: 'w', }); fs.chmodSync(configPath, 0o600); ``` 4. Ensure the parent directory is controlled by the intended user. 5. Reject symbolic-link targets or use safe file-creation semantics to reduce unintended writes. 6. Do not print the key in success messages, errors, or debug output. 7. Document secure key rotation and deletion procedures. 8. Advise users who previously supplied the key on the command line to remove it from shell history and rotate it. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The documentation claims the skill is based on Tesla's official Fleet API, but it instructs users to obtain an `apiKey` from the third-party domain `tesla.dhuar.com` and notes local reading of `~/.tesla_cn.json`, with the key attached to requests. That mismatch is security-relevant because users may believe they are trusting Tesla directly while actually disclosing credentials and vehicle-control capability to an intermediary service, which could expose location, vehicle metadata, and remote command authority.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill exposes code capabilities that use local secrets and network access, but it does not declare any tool scope such as permissions or allowed-tools. This weakens user and platform visibility into what the skill can access, increasing the chance that a user will invoke a remote-control skill without understanding it can read `~/.tesla_cn.json` and contact external services.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The script includes Chinese-only usage/documentation comments and Chinese user-facing output strings later in the file, indicating a fixed language choice. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Session Persistence

Medium
Category
Rogue Agent
Content
});
  } catch (e) {
    console.error('error');
    console.error('failed to write config file');
    console.log(
      JSON.stringify({
        error: 'write_failed',
Confidence
91% confidence
Finding
This appears to be a duplicate of the same session-persistence finding: the script writes a sensitive API key to ~/.tesla_cn.json in plaintext. In the context of a remote vehicle-control skill, credential exposure is more serious because the stored secret may enable access to Tesla account/vehicle operations if the local machine is compromised or shared.

Session Persistence

Medium
Category
Rogue Agent
Content
});
  } catch (e) {
    console.error('error');
    console.error('failed to write config file');
    console.log(
      JSON.stringify({
        error: 'write_failed',
Confidence
91% confidence
Finding
This appears to be a duplicate of the same session-persistence finding: the script writes a sensitive API key to ~/.tesla_cn.json in plaintext. In the context of a remote vehicle-control skill, credential exposure is more serious because the stored secret may enable access to Tesla account/vehicle operations if the local machine is compromised or shared.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The code loads an API key from a local config file and appends it to the request URL as a query parameter sent to a third-party proxy domain. Putting secrets in URLs is dangerous because they may be exposed through logs, browser/history equivalents, proxy logs, monitoring systems, referrer leakage, or error reporting, and the use of a non-official intermediary materially increases the trust and exfiltration risk.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script directly executes sensitive Tesla vehicle control commands such as locking doors, opening trunks, climate control, and boombox actions as soon as it is invoked. In a remote-control skill context, lack of an explicit confirmation or safety interlock increases the risk of accidental, spoofed, or unintended physical-world actions against a vehicle.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The script's inline instructions and at least one user-facing error message are presented in Chinese only, which imposes a specific language on users without opt-in or alternative locale support. This can violate language/locale policy when the skill does not document that it is intentionally region-specific.

Static analysis

Detected: suspicious.env_credential_access, suspicious.exposed_secret_literal

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/tesla-command.js:123

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
scripts/tesla-command.js:230