Embedded MQTT CA Private Key Permits Unauthorized Broker Access
Disclosure information
| Field | Value |
|---|---|
| Vendor | Milesight |
| Product | UG65 and UG67 LoRaWAN gateways |
| Tested firmware | 60.0.0.50 |
| Component | Embedded Mosquitto broker and LoRa gateway bridge |
| Vulnerability class | CWE-321, Use of Hard-coded Cryptographic Key |
| Suggested severity | High |
| Suggested CVSS 3.1 | 8.1 (CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N) |
| Discovery date | 2026-10-12 |
| Reporter | [Name or organization] |
| Contact | [Email address] |
| Disclosure status | Vendor notification pending |
Summary
Milesight UG65 and UG67 firmware version 60.0.0.50 contains the private key for the certificate authority used by the gateway's embedded MQTT broker. The firmware startup scripts use this CA to sign both the broker certificate and the gateway bridge client certificate. The broker listens on TCP port 18883, requires a client certificate signed by the embedded CA, and uses the certificate identity as the MQTT username.
Anyone who obtains the publicly distributed firmware can extract the CA private key and issue an arbitrary client certificate. In a local AArch64 service emulation of the firmware, a newly generated certificate signed with the extracted key successfully authenticated to the broker. The resulting client was permitted to subscribe to the wildcard topic # and publish a QoS 1 message.
If a physical gateway exposes TCP port 18883 to an attacker and retains the CA from the firmware image, the attacker can bypass MQTT client authentication. If the same CA is retained across deployed gateways, one extracted firmware image may compromise the MQTT trust boundary for the affected fleet.
Affected assets
The analyzed firmware image has the following SHA-256 digest:
010b6f8699b7074d4c3526efdd0451b8becd611501d76d50bbcbad765d9d98b7
The affected CA files are installed at:
/etc/ssl/certs/ca-mqtt.crt
/etc/ssl/certs/ca-mqtt.key
The CA private key is stored with file mode 0644. The matching certificate is self-signed, has the CA:TRUE basic constraint, and has this SHA-256 fingerprint:
4A:97:D5:69:C2:F6:F6:F6:AE:45:89:7D:D1:68:F6:24:31:90:17:08:82:9A:58:6F:A3:99:29:C1:7B:1B:69:0E
The SHA-256 digest of the public key derived from ca-mqtt.key is:
35b0d89fcf1be0048975691dd2a63796d043fe649742a944b6ef65ba42b1e700
Only firmware version 60.0.0.50 was available for this assessment. Other versions and OEM variants have not been compared.
Technical details
The Mosquitto configuration defines a non-loopback TLS listener:
allow_anonymous false
password_file /etc/mosquitto/pwd
listener 18883
protocol mqtt
cafile /etc/ssl/certs/ca-mqtt.crt
certfile /etc/ssl/certs/server.crt
keyfile /etc/ssl/certs/server.key
require_certificate true
use_identity_as_username true
No acl_file or authentication plugin is configured. Consequently, possession of a certificate accepted by this listener provides the broker permissions available to an authenticated client.
The Mosquitto startup script generates a new server key and signs its certificate with the CA private key distributed in the firmware:
openssl genrsa -out /etc/ssl/certs/server.key 2048
chmod 644 /etc/ssl/certs/server.key
openssl req -new -out /etc/ssl/certs/server.csr \
-key /etc/ssl/certs/server.key -subj "..."
openssl x509 -req -in /etc/ssl/certs/server.csr \
-CA /etc/ssl/certs/ca-mqtt.crt \
-CAkey /etc/ssl/certs/ca-mqtt.key \
-CAcreateserial -out /etc/ssl/certs/server.crt -days 36500
The LoRa gateway bridge startup script independently uses the same CA key to sign its MQTT client certificate. This confirms that the CA private key is runtime signing material rather than an unused file.
The gateway bridge defines these MQTT topic templates:
gateway/<MAC>/rx LoRa uplink traffic
gateway/<MAC>/tx LoRa downlink traffic
gateway/<MAC>/stats Gateway statistics
gateway/<MAC>/ack Acknowledgements
gateway/<MAC>/config Gateway configuration messages
gateway/<MAC>/event Gateway events
Security impact
An attacker who can reach TCP port 18883 can create a certificate trusted by the gateway and authenticate without knowing a legitimate device credential. In the tested service environment, the forged identity received unrestricted ordinary MQTT publish and subscribe access.
This can enable:
- Monitoring MQTT topics and collecting gateway, sensor, status, event, or application data carried by the broker.
- Impersonating a trusted gateway bridge or other MQTT client.
- Publishing fabricated uplink, status, acknowledgement, configuration, or event messages.
- Publishing to downlink topics used by the gateway bridge. Whether a particular message results in a LoRa radio transmission depends on downstream format validation and was not tested.
- Replaying captured MQTT messages or interfering with application state and automation that trusts broker data.
- Disrupting service through conflicting, malformed, retained, or high-volume messages, subject to broker and consumer behavior.
- Forging server certificates if other clients use this CA for server authentication and the attacker can intercept or redirect their network traffic.
The finding does not by itself provide SSH, web administrator, or operating-system access. Its direct effect is compromise of the MQTT certificate authentication boundary and the messages and actions reachable through that broker.
Attack prerequisites
Exploitation requires:
- A copy of the affected firmware or another source of the embedded CA private key.
- Network access to the gateway's TCP port
18883. - A deployed gateway that still trusts the CA certificate distributed in the firmware.
No valid Milesight account, MQTT password, existing client certificate, or physical access to the target gateway is required under the tested broker configuration.
Proof of concept validation
Testing was performed against a local QEMU AArch64 service VM using the firmware userspace. The VM used an Alpine kernel and mounted the original firmware SquashFS read-only with a writable overlay. Network access was restricted to host loopback forwards.
The validation sequence was:
- Extract
ca-mqtt.crtandca-mqtt.keyfrom the firmware. - Generate a temporary RSA client key and certificate signing request with an arbitrary common name.
- Sign the client certificate using the extracted CA private key and the
clientAuthextended key usage. - Connect to the emulated broker on TCP port
18883using the generated certificate. - Send an MQTT 3.1.1
CONNECTpacket. - Subscribe to the wildcard topic
#. - Publish a harmless QoS 1 message to a randomized
lab-review/impact-check/...topic.
Observed results:
CONNECT accepted: True
SUBSCRIBE # granted: True
PUBLISH QoS1 acknowledged: True
A control connection without a client certificate was rejected during TLS negotiation with a certificate_required alert. Test keys and certificates were created in a temporary directory and removed after testing. No physical gateway, sensor, or production service was contacted.
Reproduction guidance for the vendor
The issue can be verified safely on an isolated test gateway:
- Confirm that the device certificate at
/etc/ssl/certs/ca-mqtt.crthas the fingerprint shown above. - Confirm that TCP port
18883is reachable only from the intended test network. - Create a temporary client certificate signed by the CA key from the firmware image.
- Connect to the broker with that certificate and an arbitrary certificate common name.
- Subscribe to a dedicated test topic and publish a benign test message to it.
- Repeat without a client certificate to confirm that certificate authentication is otherwise enforced.
Testing downlink topics should use a shielded RF environment, a non-production gateway, and a dedicated test device.
Recommended remediation
- Treat the embedded CA private key and every certificate issued by it as compromised.
- Remove the CA private key from firmware images and from deployed gateways.
- Replace the CA certificate trusted by the MQTT listener. Removing only the private-key file does not invalidate certificates already issued by the exposed key.
- Generate a unique private key and certificate for every gateway during a controlled provisioning process.
- Keep the issuing CA offline or in an appropriately protected signing service or hardware security module.
- Add explicit topic ACLs that bind each certificate identity to the minimum required topic paths and operations.
- Restrict TCP port
18883to required management interfaces and trusted network segments. Block it on WAN, guest Wi-Fi, and other untrusted interfaces. - Store broker and client private keys with least-privilege ownership and mode, such as
0600, and use hardware-backed key storage where supported. - Provide an upgrade path that rotates the CA, broker certificate, gateway client certificate, and any dependent credentials without restoring the compromised trust anchor from configuration backups.
- Audit other firmware releases and related gateway models for the same certificate fingerprint or public-key digest.
Verification after remediation
A corrected release should satisfy all of the following:
- The firmware image contains no CA or fleet-wide signing private key.
- Two factory-reset gateways have different client private keys and certificates.
- A certificate signed by the CA from firmware
60.0.0.50is rejected. - MQTT topic ACLs prevent a valid client from subscribing or publishing outside its assigned topic namespace.
- TCP port
18883is unreachable from interfaces where MQTT management is not required. - Configuration restore and firmware downgrade cannot restore the compromised CA.
Scope limitations
The broker authentication bypass, wildcard subscription, and arbitrary test-topic publication were reproduced in the service VM. The VM does not reproduce the gateway's physical interface firewall policy, hardware provisioning state, LoRa concentrator, or complete network-server operation. A representative physical gateway is required to establish exposed interfaces, persistence across factory reset, and the downstream effect of messages published to operational topics.
The presence of the same key in a firmware image distributed for UG65 and UG67 strongly indicates that installations retaining the image's CA share the same trust anchor. Fleet-wide exposure should be confirmed by comparing the CA certificate fingerprint or public-key digest across representative physical devices and firmware versions.
Related public vulnerabilities
- CVE-2016-2357 covers a hard-coded SSL private key in older Milesight IP security cameras. It affects a different product and does not cover this gateway finding.
- CVE-2024-31410 covers identical device certificates based on a hard-coded key that permitted client impersonation in CyberPower PowerPanel.
- CVE-2026-32324 covers reusable certificate and key material affecting MQTT communications in Anviz firmware.
No public CVE specifically covering the MQTT CA private key in Milesight UG65 or UG67 firmware 60.0.0.50 was identified as of 2026-10-12.
Disclosure timeline
| Date | Event |
|---|---|
| 2026-10-12 | Firmware key and matching CA certificate identified |
| 2026-10-12 | Forged client authentication reproduced in isolated service VM |
| 2026-10-12 | Wildcard subscription and benign publication reproduced |
| Pending | Vendor notified |
| Pending | Vendor acknowledgement |
| Pending | Fixed firmware available |