Summary
The OCPP WebSocket endpoint accepts connections and commands from charging stations without enforcing authentication, allowing arbitrary clients to impersonate legitimate devices.
By connecting with a known or guessed station identifier, an attacker can issue or receive OCPP commands as if they were a real charger, enabling unauthorized control of charging infrastructure and manipulation of backend data.
Affected context
This vulnerability appears in EV charging backends that expose OCPP (Open Charge Point Protocol) WebSocket endpoints and rely solely on a station identifier for trust.
It becomes relevant when:
- WebSocket endpoints are reachable from untrusted networks (e.g., the public internet or shared operator networks), and
- There is no additional authentication or cryptographic binding between the charging station and backend, and
- The system accepts OCPP messages as authoritative once a WebSocket session is established with a given station ID.
In such environments, any actor capable of reaching the endpoint and providing a valid-looking identifier can be treated as a legitimate charging station.
Exploit preconditions
- Attack surface: Public or operator-exposed OCPP WebSocket endpoint used by charging stations to communicate with the backend.
- Required access: Network-level ability to reach the OCPP WebSocket URL (e.g., via the internet, VPN, or shared carrier network).
- Knowledge prerequisites: A valid or guessable charging station identifier (ID, serial, or logical name) used in the OCPP handshake.
- Trigger point: Initiation of a WebSocket connection to the OCPP endpoint followed by standard OCPP traffic under the spoofed station ID.
- Why exploitation is possible: The server does not require any authentication factor beyond the station identifier and does not cryptographically verify the identity of the connecting client. The protocol session is therefore bound only to an easily obtainable identifier rather than to a secret or certificate, enabling straightforward impersonation.
Why this happens
The core issue is a design-level absence of authentication on a critical protocol endpoint. The backend treats any WebSocket client that presents a plausible OCPP charging station identifier as a trusted device, without verifying its identity via credentials, certificates, or tokens.
This maps to CWE-306: Missing Authentication for Critical Function, where a security-sensitive operation—here, issuing and receiving OCPP commands that control physical charging infrastructure and update operational data—is exposed without an authentication mechanism. The system assumes that knowledge of a station ID implies legitimacy, which is an insecure pattern because identifiers are often predictable, discoverable through passive observation, or retrievable from physical devices, documentation, or logs.
Potential impact
- An attacker can impersonate a legitimate charging station and participate in OCPP sessions as that device.
- Unauthorized control over charging sessions, including starting, stopping, or modifying charging operations.
- Manipulation of configuration parameters for chargers, potentially degrading service or creating unsafe operating conditions.
- Corruption of billing and metering data reported to the backend, leading to financial loss or disputes.
- Pollution of operational and monitoring data, affecting fleet management, analytics, and incident response.
- Potential lateral impact if backend logic propagates malicious state changes or trust decisions to other components in the charging ecosystem.
General mitigation guidance
Mitigation should focus on introducing strong, protocol-appropriate authentication between charging stations and the backend, and on minimizing implicit trust based on identifiers alone.
Common defensive patterns include:
- Mutual authentication: Use mutual TLS (mTLS) or equivalent mechanisms that bind each station to a unique private key and certificate, validated by the backend for every WebSocket connection.
- Strong station credentials: Assign each charging station non-guessable credentials (e.g., tokens, API keys, or device-bound secrets) and validate them during the OCPP handshake or an initial authentication phase.
- Identifier binding: Cryptographically bind station identifiers to certificates or tokens so that merely knowing the identifier is insufficient for impersonation.
- Network segmentation and access control: Place OCPP endpoints behind controlled networks, VPNs, or dedicated APNs, and enforce network-level ACLs to reduce exposure from arbitrary internet clients.
- Least-privilege backend handling: Treat station-originated data as untrusted input, and design backend logic to validate commands and state transitions, limiting the blast radius if a single station identity is compromised.
- Secure onboarding and lifecycle: Use secure provisioning for devices so credentials are generated, stored, and rotated in a way that does not rely on static, reuse-prone secrets shared across devices.
How teams detect issues like this
Detecting this class of issue typically involves reviewing both protocol design and implementation details around endpoint exposure and authentication.
Potential approaches include:
- Architecture and code review: Examine OCPP WebSocket handlers and connection bootstrap code to confirm whether authentication checks (certificate validation, token verification, or credential checks) are present and enforced for every session.
- Static analysis patterns: Use static analysis or linters to flag WebSocket or OCPP server endpoints that lack calls into authentication or authorization components, or that rely only on non-secret identifiers.
- Configuration and policy enforcement: Enforce security policies that require mutual TLS or authenticated WebSockets for all device-to-backend protocols, and flag deviations during deployment or CI/CD pipeline checks.
- Runtime monitoring: Instrument WebSocket endpoints to log connection metadata and station IDs, then monitor for anomalies such as multiple concurrent sessions for the same ID, unusual station geolocation patterns, or connections from unexpected networks.
- Periodic penetration testing: Include tests that attempt to connect to OCPP endpoints with arbitrary or cloned station identifiers to verify that authentication controls prevent impersonation.

