Summary
A missing authentication check on OCPP WebSocket endpoints allows attackers to connect as if they were legitimate charging stations, using only a known or guessed charger identifier.
Once connected, an unauthenticated attacker can send and receive OCPP commands as that station, potentially escalating privileges, manipulating charging operations, and corrupting backend network data.
Affected context
This vulnerability appears in backends that expose Open Charge Point Protocol (OCPP) WebSocket endpoints without enforcing robust authentication and station identity verification.
It is most relevant where:
- Charging stations are identified primarily by an ID in the WebSocket URL or initial handshake
- The backend accepts connections and OCPP messages based solely on this identifier
- There is no cryptographic proof-of-identity (e.g., mutual TLS, signed tokens, or station certificates)
Under these conditions, any party able to reach the WebSocket endpoint over the network can attempt to impersonate a charger.
Exploit preconditions
- Attack surface: Public or internal OCPP WebSocket endpoint exposed over the network.
- Required access: Network-level ability to reach the WebSocket service (e.g., internet access, VPN, or internal network access).
- Station identifier knowledge: Ability to know, guess, or enumerate valid charging station identifiers (through documentation, observation, logs, naming patterns, or trial-and-error).
- Trigger point: Establishing a WebSocket connection to the OCPP endpoint and presenting a valid-looking station ID without needing any credentials or cryptographic proof.
- Why exploitation is possible: The server treats possession of the station identifier as sufficient proof of identity, omitting authentication and authorization enforcement (CWE-306), so any client can impersonate a charger once a valid ID is supplied.
Why this happens
The core issue is the absence of authentication and identity verification for WebSocket connections that represent critical system actors—in this case, EV charging stations.
The backend implementation implicitly trusts the charger identifier in the WebSocket connection or initial OCPP messages as the sole basis for mapping a connection to a specific station.
This design maps directly to CWE-306: Missing Authentication for Critical Function, as it allows clients to:
- Initiate a charger session as any known or guessed station
- Invoke sensitive OCPP operations that were intended only for authenticated hardware devices
Abstractly, the insecure pattern is: "Treating a user- or network-supplied identifier as proof of identity without any additional authentication, cryptographic binding, or authorization checks."
Potential impact
- Attackers can impersonate charging stations and send arbitrary OCPP commands as those devices.
- Unauthorized remote control of charging operations (e.g., start/stop sessions, change configurations, disable chargers).
- Manipulation or corruption of charging session data reported to the backend (e.g., energy delivered, timestamps, status).
- Creation of misleading operational telemetry, affecting billing, analytics, and capacity planning.
- Potential cascading impact on grid integration or load management systems that rely on trustworthy OCPP data.
- Abuse of the infrastructure to conduct denial-of-service conditions by repeatedly connecting, disconnecting, or misreporting status.
- Expansion of attacker privileges if station impersonation is used as a pivot into backend workflows or administrative tooling that trusts device-originated messages.
General mitigation guidance
Effective mitigation focuses on requiring strong, verifiable authentication for every charger-WebSocket session and enforcing least-privilege behavior for device identities.
Common defensive patterns include:
- Mutual authentication: Use mutual TLS (mTLS) or equivalent mechanisms so each charging station presents a unique certificate or credential that the backend validates before accepting OCPP traffic.
- Cryptographically bound identities: Tie the logical station identifier to a cryptographic key or certificate, ensuring that only the holder of the key can act as that station.
- Per-device credentials: Issue per-device secrets or tokens, stored securely in the charger and validated by the backend at connection or protocol handshake.
- Strong authorization checks: Enforce authorization policies so each authenticated station can only perform operations and access data associated with its own identity.
- Defense in depth on the network layer: Limit exposure of OCPP endpoints using network segmentation, IP allowlists, VPNs, or API gateways with strict authentication requirements.
- Secure defaults: Configure the backend to reject any unauthenticated or anonymous station connections by default and log such attempts for operational visibility.
- Resilience against ID enumeration: Make station identifiers non-predictable and avoid relying on them as secrets, while still assuming they can be enumerated and protecting the system accordingly.
How teams detect issues like this
Organizations can detect and monitor for this class of issue and its exploitation using a mix of design review, code analysis, and runtime monitoring:
- Architecture and design review:
- Examine diagrams and specs for OCPP/WebSocket flows to ensure each charger connection requires explicit authentication and authorization.
- Verify that station identity is cryptographically bound rather than inferred from easily spoofed identifiers.
- Static analysis and code review:
- Search for WebSocket handlers or OCPP connection logic that map a connection to a station solely using URL parameters, headers, or message fields without follow-up credential checks.
- Flag code paths where critical OCPP operations are performed without verifying an authenticated principal or device context.
- Use custom static analysis rules or SAST tools to require authentication checks for all entrypoints that execute privileged backend actions.
- Configuration and policy enforcement:
- Apply security policies that disallow anonymous WebSocket endpoints for operational systems and require mTLS or token-based access.
- Integrate automated checks into CI/CD pipelines to ensure that new or modified endpoints are registered with an authentication and authorization scheme.
- Runtime detection and logging:
- Log all WebSocket connection attempts, including station IDs and authentication outcome, to spot patterns such as repeated failed IDs or high churn.
- Use anomaly detection or SIEM rules to alert on unusual station behavior (e.g., odd geolocation, impossible session patterns, or many different IDs from the same source IP).

