Summary
A missing authentication control on OCPP WebSocket endpoints allows attackers to impersonate charging stations by connecting with a known or guessable charger identifier.
Once connected, an attacker can issue or receive OCPP commands as if they were a legitimate station, which can result in unauthorized control over charging operations, data manipulation, and privilege escalation within the charging network.
Affected context
This vulnerability appears in OCPP-based charging infrastructure where backend WebSocket endpoints accept connections without enforcing strong authentication or binding identities to cryptographic credentials.
It is most relevant in deployments where:
- Charging station identifiers (IDs) are static, predictable, or discoverable
- WebSocket endpoints are reachable from untrusted networks (e.g., the public internet or shared networks)
- The backend implicitly trusts that any client using a valid charger ID is the legitimate physical station
In such environments, backend systems may treat all messages received over the unauthenticated WebSocket as authoritative, enabling impersonation and unauthorized command execution.
Exploit preconditions
- Attack surface: Public or semi-public OCPP WebSocket endpoint exposed by the charging backend.
- Required access: Network-level ability to reach the WebSocket server (e.g., internet connectivity or access to the relevant network segment).
- Identity knowledge: Knowledge or discovery of a valid charging station identifier, which may be obtained via documentation, enumeration, observation of traffic, physical access to a station, or predictable ID schemes.
- Trigger point: Establishing a WebSocket connection to the OCPP endpoint while claiming the target station's identifier and then sending or receiving OCPP messages.
- Why exploitation is possible: The backend does not require authentication (such as certificates, tokens, or cryptographic proof of identity) before accepting a station ID as valid, so it cannot distinguish between legitimate chargers and arbitrary clients using the same ID.
Why this happens
The underlying issue is the absence of authentication and identity verification for entities connecting to the OCPP WebSocket endpoint.
This maps to CWE-306: Missing Authentication for Critical Function, where a system exposes functionality that should require authentication but instead trusts unauthenticated input.
In this case, the backend implicitly treats possession or presentation of a charger identifier as sufficient proof of identity, without:
- Binding the charger ID to a cryptographic identity
- Requiring client-side credentials (e.g., mutual TLS, signed tokens)
- Implementing per-connection authorization checks
As a result, any network client that can reach the WebSocket endpoint and provide a plausible charger ID is able to access critical operational functions typically reserved for actual charging stations.
Potential impact
- Unauthorized issuance of OCPP commands (e.g., start/stop transactions) as a specific charging station
- Remote manipulation or interruption of charging sessions, potentially affecting availability of charging services
- Corruption or falsification of metering and session data reported to the backend
- Privilege escalation within the charging network by impersonating high-privilege or central stations
- Misleading operational dashboards and billing systems through falsified charge data
- Potential staging of broader attacks against the backend ecosystem based on trusted but spoofed station data
General mitigation guidance
Effective mitigation centers on treating charging station identity as a security boundary and enforcing strong authentication at the WebSocket layer.
Common defensive patterns include:
- Mutual authentication: Use mutual TLS (mTLS) or equivalent mechanisms so each station presents a unique cryptographic credential bound to its identifier.
- Token-based access control: Require time-limited, signed tokens or API keys tied to a charger's identity that are validated on every connection.
- Per-connection authorization: Verify that the claimed station ID is authorized for the presented credential before accepting OCPP messages.
- Non-predictable identifiers: Avoid sequential or easily guessable station identifiers; incorporate randomness or opaque IDs to reduce trivial enumeration.
- Network segmentation: Place OCPP endpoints behind controlled network boundaries (e.g., VPNs, private APNs) so only managed devices can initiate connections.
- Least privilege in backend logic: Limit what each station can affect in the backend and avoid trusting station-supplied data for critical decisions without cross-checks.
These patterns focus on strengthening identity, reducing implicit trust in simple identifiers, and ensuring that operational commands originate from authenticated entities.
How teams detect issues like this
Organizations can identify and monitor for this class of issue using a combination of design review, code inspection, and runtime monitoring:
- Architectural and code review:
- Examine WebSocket connection handlers to confirm that authentication and authorization checks occur before binding a session to a station ID.
- Review OCPP server frameworks and configuration to ensure mutual TLS or token-based authentication is required.
- Look for logic that maps a client to a charger solely based on a parameter (e.g., URL path, query string, JSON field) without credential verification.
- Static analysis and policy checks:
- Apply static analysis rules or custom linters to flag WebSocket endpoints that lack calls to authentication middleware or identity checks.
- Enforce security policies that require explicit authentication configuration for any externally exposed WebSocket endpoint.
- Runtime monitoring and logging:
- Log station identifiers alongside IP addresses, certificate subjects, or tokens and alert on anomalies such as:
- Multiple distinct client sources claiming the same station ID
- Connections presenting no credentials for critical endpoints
- Use anomaly detection tools to identify suspicious patterns of station impersonation or unexpected command flows.
Automated application security testing and SAST/DAST tools can support these efforts by highlighting missing authentication paths and verifying that authentication is enforced for critical backend interfaces.

