Summary
OCPP WebSocket endpoints for charging stations are exposed without proper authentication, allowing any party to connect using a known or guessable station identifier.
An unauthenticated attacker can impersonate legitimate chargers, issue or receive OCPP commands, and manipulate operational and reporting data in the charging backend.
Affected context
This vulnerability arises in OCPP-based electric vehicle charging backends that expose WebSocket endpoints where the only distinguishing attribute of a client is its charging station identifier.
When these endpoints accept connections and OCPP messages without enforcing strong authentication or binding the station identity to cryptographic credentials, any network-reachable party can pose as a charger.
The risk is highest in deployments where endpoints are accessible from public or semi-public networks and where station IDs are predictable, reused, or discoverable through documentation, logs, or enumeration.
Exploit preconditions
- Attack surface: Network-accessible OCPP WebSocket endpoint (typically internet or wide-area network reachable).
- Required access: Ability to open a WebSocket connection to the backend; no valid charger credentials are required.
- Required knowledge: A valid or guessable charging station identifier (ID). These IDs may be discoverable via observation, weak enumeration protections, leaked configurations, or vendor defaults.
- Trigger point: Establishing a WebSocket session using the target station ID, then sending or receiving OCPP messages as if originating from that charger.
- Why exploitation is possible: The backend does not require cryptographic authentication, session binding, or proof-of-possession of secrets tied to the station identity, so identity is effectively asserted by an untrusted client string.
Why this happens
The core issue maps to CWE-306: Missing Authentication for Critical Function, where a system exposes sensitive operations without requiring proper verification of the actor's identity.
In this case, the OCPP WebSocket endpoint treats a station identifier presented during connection or protocol negotiation as sufficient proof of identity, without enforcing mutual TLS, token-based auth, signed messages, or other cryptographic guarantees.
As a result, any unauthenticated party that can reach the endpoint and supply a valid-looking station ID is granted access to critical functions: sending control commands, reporting metrics, and participating in backend workflows.
This pattern reflects a broader class of design flaws where device identifiers are treated as secrets or credentials, rather than as public or low-entropy identifiers that must be strongly authenticated and bound to secure channels.
Potential impact
- An attacker may impersonate a charging station and issue OCPP commands as if they were a legitimate device.
- Attackers could remotely start, stop, or otherwise disrupt charging sessions, potentially causing denial of service for EV drivers.
- Manipulation of meter values, transaction records, and status updates can corrupt billing, usage reports, and operational dashboards.
- Unauthorized control of charging infrastructure could be chained with other weaknesses to impact grid management systems or fleet operations.
- Adversaries may inject misleading telemetry or alarms, hindering incident response or masking other malicious activity in the network.
- Large-scale impersonation campaigns could degrade trust in the charging network and expose operators to regulatory or contractual risk.
General mitigation guidance
Effective mitigation focuses on enforcing strong, device-bound authentication for all OCPP WebSocket connections and limiting the trust placed in station identifiers alone.
Recommended defensive patterns include:
- Require mutual TLS (mTLS) or equivalent cryptographic authentication so that each charging station proves possession of a unique private key tied to its identity.
- Bind station IDs to issued credentials (certificates, keys, or secure tokens) and verify this binding on every connection and reconnection.
- Introduce signed or tokenized session establishment flows (e.g., short-lived access tokens, signed connection parameters) that the backend validates before accepting OCPP commands.
- Treat station identifiers as non-secret metadata and never as the sole basis for authorization or identity; enforce role- and device-based access controls on received commands.
- Apply network segmentation and firewall policies to narrow which networks or gateways may reach OCPP endpoints, reducing exposure to arbitrary internet clients.
- Design systems such that deviations or conflicts in identity usage (e.g., the same charger ID connecting from multiple locations) trigger rate limits, alerts, or connection rejection.
How teams detect issues like this
Detection should combine design-time review, static analysis, and runtime monitoring to identify missing or ineffective authentication around WebSocket endpoints.
Possible approaches:
- Architecture and code review: Examine OCPP connection handlers and WebSocket controllers for:
- Absence of TLS client authentication, token checks, or device credential validation.
- Logic that accepts a station ID or similar identifier without performing further identity verification.
- Authorization decisions based solely on user-supplied identifiers or headers.
- Static analysis and policy enforcement: Configure automated checks to flag:
- WebSocket endpoints accessible without authentication middleware or security filters.
- Bypassed authentication logic or optional security checks surrounding OCPP message handling.
- Configuration audits: Verify that deployment configurations (reverse proxies, gateways, load balancers) do not terminate security features such as mTLS without forwarding authenticated identity to the backend.
- Runtime monitoring: Implement logging and anomaly detection for:
- Multiple simultaneous connections claiming the same charger ID.
- Unusual geographic or network patterns per station identifier.
- OCPP commands originating from untrusted networks or unexpected IP ranges.
- Automated API and protocol testing tools can be integrated into CI/CD pipelines or pre-production staging to test that connections without valid device credentials are reliably rejected.

