Embedded layered security protection method and system for message queue telemetry transport and storage medium
By employing digital certificate authentication, transport layer security protocol handshakes, and topic-level access control, combined with payload encapsulation in the publisher module and anomaly detection in the subscriber module, the problems of unauthorized access, network sniffing, and fake data injection in the MQTT communication system are solved, thus achieving system security protection.
Patent Information
- Application Number
- CN202611655713.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-26
- Publication Date
- 2026-11-27
AI Technical Summary
Existing MQTT communication systems lack a complete protection chain from access authentication, encrypted transmission, topic authorization to payload verification, making it difficult to simultaneously defend against unauthorized client access, network sniffing and eavesdropping, unauthorized topic access, and fake data injection attacks within the same system.
A layered security protection approach is adopted, which includes digital certificate authentication, transport layer security protocol handshake, topic-level access control, and payload verification. This approach includes client certificate verification, establishment of encrypted secure sessions, topic permission judgment, encapsulation of business data in the publisher module, and anomaly detection in the subscriber module, to ensure the integrity and legitimacy of message payloads.
It achieves layered and coordinated protection from access authentication to anomaly handling, improving the access reliability, transmission confidentiality, topic controllability, and message inspectability of the embedded message queue telemetry transmission communication system, and preventing unauthorized access, network sniffing, and fake data injection attacks.
Smart Images

Figure CN123184980A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet of Things (IoT) communication security technology, and in particular to an embedded layered security protection method, system, and storage medium for message queue telemetry transmission. Background Technology
[0002] In the prior art, embedded edge devices, sensors, actuators and industrial control systems typically use the Message Queuing Telemetry Transport (MQTT) protocol for data exchange.
[0003] The MQTT protocol has advantages such as being lightweight, having a clear publish-subscribe model, and low resource consumption, making it suitable for embedded scenarios with limited computing power and bandwidth.
[0004] However, standard MQTT communication is simple to deploy but lacks strong authentication mechanisms. Any client that knows the proxy server address can attempt to connect. Data transmission is in plaintext by default, allowing attackers on the same network to directly read all business data using packet capture tools. Even if some message broker servers support access control lists, in deployment scenarios without fine-grained access control or without associating client identity with topic permissions, legitimate clients may still access unauthorized topics. Furthermore, existing access control mechanisms are typically independent of client certificate authentication and application-layer payload verification mechanisms, failing to create a coordinated defense between authentication, topic authorization, and message content inspection. Legitimate clients can freely publish or subscribe to any topic. Subscribers lack validity checks on received messages, sending them directly into business processing logic regardless of whether the payload content has been tampered with, expired, or has an abnormal length.
[0005] The aforementioned deficiencies expose existing embedded message queue telemetry and communication systems to multiple security risks, including unauthorized client access, network sniffing and eavesdropping, unauthorized access to topics, and fake data injection attacks. Furthermore, they lack a closed-loop engineering approach from deployment to acceptance testing.
[0006] Therefore, there is an urgent need for a security protection method based on MQTT communication to defend against unauthorized access, link sniffing, topic privilege escalation, and fake data injection attacks within the same system.
[0007] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention
[0008] This invention provides an embedded layered security protection method, system, and storage medium for message queue telemetry transmission. It aims to solve the technical problem that existing embedded MQTT communication systems lack a complete protection chain from access authentication, encrypted transmission, topic authorization to payload verification, making it difficult to simultaneously defend against unauthorized client access, network sniffing and eavesdropping, unauthorized topic access, and fake data injection attacks within the same system.
[0009] A first aspect of the present invention provides an embedded layered security protection method for message queue telemetry transmission, the method being applied to a system including a message broker server and one or more clients, each client including a publisher module and a subscriber module, the method comprising: The message broker server receives connection requests from clients and verifies the digital certificates of the clients; If the verification is successful, the client and the message broker server complete the transport layer security protocol handshake and establish an encrypted secure session. The client initiates a target operation to the message broker server through the encrypted secure session. The target operation is a publish or subscribe operation for a target topic. After receiving the target operation, the message broker server obtains the client's identity information and determines whether the client has operation permissions for the target topic according to preset access control rules; if the client has the corresponding permissions, the target operation is allowed. If the target operation is a publish operation, the publisher module of the client obtains the business data to be published, encapsulates the business data into a first message payload according to a unified format, and publishes the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. After receiving the first message payload, the message broker server forwards the first message payload to the target subscriber module that has subscribed to the target topic. After receiving the first message payload, the target subscriber module performs anomaly detection on the first message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity verification. If the target operation is a subscription operation, the subscriber module of the client waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload; If the result of the anomaly detection is abnormal, the subscriber module discards the second message payload and records the reason for failure; if the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic.
[0010] A second aspect of the present invention provides an embedded layered security protection system for message queue telemetry transmission, comprising: The message broker server is used to receive connection requests from clients, verify the digital certificates of the clients; if the verification is successful, it completes a transport layer security protocol handshake with the clients to establish an encrypted secure session; and it is used to receive target operations initiated by the clients, the target operations being publish or subscribe operations on target topics, obtain the identity information of the clients, determine whether the clients have operation permissions for the target topics according to preset access control rules, and allow the publish or subscribe operations if they have the corresponding permissions. One or more clients, the clients including publisher modules and subscriber modules; The publisher module is used to obtain the business data to be published when the target operation is a publishing operation of the target topic, encapsulate the business data into a first message payload in a unified format, and publish the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. The subscriber module is configured to, when the target operation is a subscription operation, wait for the second message payload corresponding to the target topic to be forwarded from the message broker server, and perform anomaly detection on the second message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity check. If the result of the anomaly detection is anomaly, the subscriber module discards the second message payload and records the reason for failure. If the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic.
[0011] It also includes a support end, which includes a certificate and PKI management module, a deployment configuration module, a test triggering module, and an evidence archiving module; The certificate and PKI management module is used to generate the root certificate, the root CA private key, the server certificate of the message broker server and its corresponding server private key, the digital certificate of the client and its corresponding client private key, and configure access control rules; the root CA private key is kept by the support terminal and is not deployed to the message broker server or the client. The deployment configuration module is used to deploy the root certificate, the server certificate and its corresponding server private key, and the access control rules to the message broker server, and to deploy the root certificate and the digital certificate and their corresponding client private key to the client; The test triggering module is used to trigger connection tests, encryption verification, permission verification, and load anomaly detection verification. The evidence archiving module is used to save the message broker server's logs, the client's logs, configuration snapshots, packet capture files, and test outputs to support reproduction, maintenance, and acceptance.
[0012] In a third aspect, embodiments of the present invention also provide a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the embedded layered security protection method for message queue telemetry transmission as described in any of the preceding claims.
[0013] Beneficial Effects: Compared with existing technologies, this invention provides an embedded layered security protection method, system, and storage medium for message queue telemetry transmission. The embedded layered security protection method for message queue telemetry transmission provided by this invention is applied to a system including a message broker server and one or more clients. Each client includes a publisher module and a subscriber module. In the method, firstly, the message broker server receives a connection request from a client and verifies the client's digital certificate. If the verification is successful, the client and the message broker server complete a transport layer security protocol handshake and establish an encrypted secure session. Then, the client initiates a target operation to the message broker server through the encrypted secure session. The target operation is a publish or subscribe operation on a target topic. After receiving the target operation, the message broker server obtains the client's identity information and determines whether the client has the operation permission for the target topic according to preset access control rules. If the client has the corresponding permission, the target operation is allowed. Next, if the target operation is a publish operation, the publisher module of the client obtains the business data to be published, encapsulates the business data into a first message payload according to a unified format, and publishes the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. After receiving the first message payload, the message broker server forwards the first message payload to the target subscriber module that has subscribed to the target topic. After receiving the first message payload, the target subscriber module performs anomaly detection on the first message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity verification. If the target operation is a subscription operation, the subscriber module of the client waits for the second message payload corresponding to the target topic forwarded from the message broker server and performs the anomaly detection on the second message payload. If the result of the anomaly detection is an anomaly, the subscriber module discards the second message payload and records the reason for failure. If the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic.This invention provides users with an embedded layered security protection method for message queue telemetry transmission. It sequentially executes client digital certificate authentication, transport layer security protocol encrypted session establishment, identity-based topic-level access control, publisher module encapsulating business data into a message payload containing timestamp, length, business data, and integrity verification fields according to a unified format, and subscriber module sequentially performing length consistency checks, timestamp window checks, and integrity checks on the message payload, discarding the message if any check fails. This forms a layered, interconnected protection system along the message queue telemetry transmission communication link, from access authentication to anomaly handling. It solves the technical problem in existing embedded message queue telemetry transmission communication systems where unauthorized client access, network sniffing and eavesdropping, unauthorized topic access, and fake data injection attacks are difficult to defend against simultaneously within the same system. This achieves the beneficial effects of improving the access credibility, transmission confidentiality, topic controllability, and message detectability of the embedded message queue telemetry transmission communication system. Attached Figure Description
[0014] Figure 1 A flowchart illustrating an embodiment of the embedded layered security protection method for message queue telemetry transmission provided by the present invention; Figure 2 A system overall principle block diagram of an embodiment of the embedded layered security protection method and system for message queue telemetry transmission provided by the present invention; Figure 3 This is a flowchart illustrating the layered security protection method for embedded layered security protection of message queue telemetry transmission provided by the present invention. Figure 4 This is a secure communication timing diagram of an embodiment of the embedded layered security protection method for message queue telemetry transmission provided by the present invention; Figure 5 This is an access control flowchart of an embodiment of the embedded layered security protection method for message queue telemetry transmission provided by the present invention; Figure 6 This is a flowchart illustrating the payload verification process of an embodiment of the embedded layered security protection method for message queue telemetry transmission provided by the present invention. Figure 7 This is an archiving flowchart of an embodiment of the embedded layered security protection method for message queue telemetry transmission provided by the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0016] Example 1 The embedded layered security protection method for message queue telemetry transmission provided in this embodiment can be executed by multiple terminals. The terminals can be, but are not limited to, intelligent computers, intelligent mobile industrial equipment, or cloud servers / edge gateways. The following description uses local operation and maintenance servers, cloud servers, and field embedded devices as examples.
[0017] In existing technologies, with the development of the Industrial Internet, edge control systems, embedded sensing devices, and industrial IoT gateways, field devices, sensors, actuators, edge controllers, and upper-level platforms frequently need to exchange status data, control commands, alarm information, and business messages. Message Queuing Telemetry Transport (MQTT) is commonly used for communication between embedded edge devices and control-side systems due to its lightweight nature, clear publish / subscribe model, and low resource consumption.
[0018] While standard MQTT communication is simple to deploy, it lacks strong authentication, link encryption, topic access isolation, and application-layer message verification capabilities by default. Unauthorized clients may impersonate publishers or subscribers to access the message broker server; network sniffers may obtain plaintext business data; legitimate clients may also access unauthorized topics; and if subscribers directly process received messages, it is difficult to identify expired, replayed, future timestamped, abnormally long, or fundamentally integrity-incorrect payloads. In this embodiment, spoofed data injection refers to the situation where abnormal data, time-series-abnormal data, replayed data, or fundamentally integrity-abnormal data at the MQTT communication payload level enters the business processing flow.
[0019] Currently, Transport Layer Security (TLS) or mutual TLS authentication can improve communication confidentiality and access trustworthiness. Brokers can prove their identity using server certificates, and clients can prove their identity using client certificates. Brokers can then reject clients without certificates, with forged certificates, or with abnormal certificates. However, TLS and mutual certificate authentication primarily address who can access the network and whether the connection is encrypted; they do not directly address whether a client, after gaining access, has the right to access a specific topic.
[0020] Existing MQTT brokers often support Access Control Lists (ACLs). ACLs can assign read and write permissions to different topics for different clients, thereby restricting the scope of client publishing and subscription. However, ACLs can only determine whether a client has permission to access a specific topic; they cannot determine whether the message payload within the authorized topic is expired, replayed, has an abnormal length, or has an integrity error.
[0021] It can be seen that existing technologies lack the ability to simultaneously handle unauthorized access, link sniffing, topic privilege escalation, and abnormal payloads entering business logic within the same closed loop. Existing solutions also often lack a complete engineering loop from certificate generation, deployment, and testing to evidence archiving, leading to difficulties in reproduction, maintenance, and acceptance in embedded delivery scenarios. Therefore, this embodiment provides an embedded layered security protection method for message queue telemetry transmission, which solves the above-mentioned problems.
[0022] like Figure 1 As shown, the embedded layered security protection method for message queue telemetry transmission provided in this embodiment is applied to a system including a message broker server and one or more clients. Each client includes a publisher module and a subscriber module. The method includes the following steps: S100. The message broker server receives a connection request from the client and verifies the client's digital certificate.
[0023] Before the message broker server receives a connection request from a client, it also includes: The support end generates a root certificate, a root CA private key, a server certificate and its corresponding server private key for the message broker server, a digital certificate and its corresponding client private key for the client, and configures access control rules. The root CA private key is stored by the support end and is not deployed to the message broker server or the client. Deploy the root certificate, the server certificate and its corresponding server private key, and the access control rules to the message broker server; The root certificate and the digital certificate, along with their corresponding client private keys, are deployed to the client for verification by the message broker server when sending the connection request to the message broker server.
[0024] The access control rules are configured by the support terminal and deployed to the message broker server; The access control rules include the correspondence between the client's identity information and the operation permissions of the target topic, wherein the operation permissions include at least one of publishing permissions and subscription permissions.
[0025] Specifically, the method in this embodiment is implemented based on an embedded layered security protection system for message queue telemetry transmission. (Refer to...) Figure 2 The system includes a support terminal, an embedded Broker terminal (i.e., the message broker server), and a client.
[0026] In this embodiment, the support terminal is a local operation and maintenance server, including a certificate and PKI (Public Key Infrastructure) management module and a deployment configuration module, which is deployed in an industrial site or an enterprise internal computer room and does not participate in real-time message communication.
[0027] The message broker server is a cloud server, including a Broker secure access module, a TLS transmission protection module, an ACL topic access control module, and a Broker log module. It is deployed in a public cloud or private cloud environment and is responsible for receiving and processing connection requests and message forwarding from various clients.
[0028] The client includes a publisher module, a subscriber module, and an application layer load verification module.
[0029] Specifically, before the system is put into operation, the support terminal first generates a complete certificate system through its certificate and PKI management module. This includes the root certificate, the root CA private key corresponding to the root certificate, the server certificate of the message broker server and its corresponding server private key, and the digital certificate of each client and its corresponding client private key. The root CA is the root certificate authority. The root certificate serves as the trust anchor of the entire certificate system. The root CA private key is only used to issue server and client certificates and is strictly kept by the support terminal, not deployed to the message broker server or any client, to prevent the leakage of the root private key from causing the entire certificate system to become invalid.
[0030] Specifically, the root CA private key is used only for issuing server and client certificates and does not participate in online communication processes. Isolating the root CA private key from online devices and servers prevents the leakage of the entire certificate system's root of trust due to the compromise of the message broker server or a single client, thus preventing attackers from using the leaked root private key to issue forged certificates for arbitrary devices.
[0031] In this embodiment, the access control rules are configured by the support terminal and deployed to the message broker server along with the certificate. The access control rules contain the correspondence between client identity information and target topic operation permissions. Identity information can be derived from any one or more of the following: the common name of the client's digital certificate, the alternative topic name, the certificate serial number, the certificate fingerprint, or the device identifier. Each rule records the range of target topics that a client identity is allowed to publish to or subscribe to, and the operation permissions include at least one of publishing and subscribing permissions. One client identity can correspond to the operation permissions of multiple target topics, and one target topic can also correspond to the operation permissions of multiple client identities. The access control rules are uniformly maintained on the support terminal in the form of configuration files. After the deployment configuration module pushes these files to the message broker server, the message broker server performs topic-level permission checks based on the rules during runtime. When rules need to be changed, operations personnel modify the configuration files on the support terminal and redeploy them, without needing to manually configure them one by one on the message broker server.
[0032] Furthermore, the support terminal also includes a deployment configuration module. This module deploys the root certificate, server certificate, and access control rules to the cloud message broker server. This enables the message broker server to verify the legitimacy of the client's digital certificate based on the root certificate when it receives a client connection request, and to determine whether the client has publish or subscribe permissions for the target topic based on the access control rules. Simultaneously, it deploys the root certificate and digital certificate to the corresponding client, allowing the client to present the digital certificate for verification when sending a connection request to the message broker server, and to verify the authenticity of the message broker server certificate using the root certificate, preventing the client from connecting to a fake cloud server. At this point, the support terminal has completed all preparatory work before system operation. Subsequent communication between the message broker server and the client is based on the deployed certificates and rules.
[0033] Furthermore, the support terminal generates various certificates for testing, including valid certificates, forged certificates, and expired certificates. Valid certificates verify that normal clients can successfully pass certificate verification and establish a connection; forged certificates verify that the message broker server can correctly identify illegal certificates not issued by the support terminal and refuse connections; expired certificates verify that the message broker server can identify expired certificates and refuse connections. These test certificates are automatically invoked by the test trigger module during the CONNECT test phase to verify the effectiveness of the certificate verification logic.
[0034] The verification of the client's digital certificate includes: S110. Verify whether the client's digital certificate is a legitimate certificate issued by the support end, verify whether the digital certificate is within its validity period, and verify whether the purpose of the extended key of the digital certificate matches the client's identity. S120. If the client does not provide a digital certificate or the digital certificate fails verification, the message broker server rejects the connection request and logs it.
[0035] Specifically, refer to Figure 3 , Figure 3 The layered protection flowchart illustrates the interconnected relationship of the five layers: Access Authentication Layer → Encrypted Transport Layer → Subject Authorization Layer → Payload Verification Layer → Exception Handling Layer. First, the Access Authentication Layer is executed. After receiving a connection request from the client, the message broker server verifies the client's digital certificate.
[0036] Prior to this, when the message broker server starts, the Broker secure access module listens on a pre-configured secure port. This port is dedicated to encrypted connections using the Transport Layer Security (TLS) protocol and does not listen on unencrypted ports, ensuring that all clients can only access the server via encrypted methods. The message broker server loads the root certificate and server certificate deployed by the support terminal into memory. The root certificate is used to verify the signature chain of the client certificate, and the server certificate is used to prove the identity of the message broker server to the client during the TLS handshake phase. If certificate loading fails, the message broker server logs an error and terminates its startup.
[0037] First, the system verifies whether the client's digital certificate is a legitimate certificate issued by the supporting end. Specifically, the message broker server has pre-loaded the root certificate deployed by the supporting end. This verification is achieved by checking whether the signature chain of the digital certificate can be traced back to the root certificate. If the signature verification of each level of the certificate chain passes and can ultimately be traced back to the root certificate issued by the supporting end, then the certificate is considered a legitimate certificate issued by the supporting end; if the signature verification fails or the certificate chain is incomplete, then the certificate is considered invalid.
[0038] Next, the system verifies whether the client's digital certificate is valid. Specifically, each digital certificate includes a start time and an end time of its validity period. The message broker server obtains the current system time and determines whether the current time is within the validity period of the certificate. If the current time is earlier than the start time or later than the end time, the certificate is considered expired or not yet valid.
[0039] Finally, the extended key purpose field of the client's digital certificate is verified to ensure it matches the client's identity. Specifically, the extended key purpose field in the digital certificate specifies the intended use of the certificate, such as client authentication or server authentication. The message broker server checks if this field includes a client authentication purpose. If not, the certificate is deemed to have an abnormal purpose, and the certificate should not be used for client access authentication.
[0040] If the client fails to provide a digital certificate, or if any of the above verifications fails, the message broker server rejects the client's connection request, terminates the subsequent Transport Layer Security (TLS) handshake process, and logs a message containing the reason for the failure. This log includes the reason for the failure, the client's IP address, the connection time, and certificate information. Certificate information includes the certificate's serial number, issuer, and subject fields. All logs are written to local storage or a remote log server via the Broker log module for security auditing and anomaly tracing. The entire verification process is performed during the TLS handshake, completing the determination before the message broker server establishes an encrypted secure session with the client, ensuring that any client with an invalid certificate cannot enter the subsequent session establishment phase.
[0041] S200. If the verification is successful, the client and the message broker server complete the transport layer security protocol handshake and establish an encrypted secure session.
[0042] Specifically, refer to Figure 4 , Figure 4 This is a sequence diagram for MQTT over TLS secure communication, illustrating the timing flow of the TLS handshake, certificate verification, establishment of an encrypted secure session, and MQTT business operations between the client and the message broker server. Specifically, if all the aforementioned verifications pass, the client and the message broker server continue with the Transport Layer Security (TLS) handshake process. During the handshake, the message broker server presents its server certificate to the client, and the client uses a pre-deployed root certificate to verify the legitimacy of this server certificate, confirming the authenticity and trustworthiness of the message broker server. Thus, through a two-way certificate verification mechanism, the client confirms the identity of the message broker server, and the message broker server confirms the identity of the client, completing peer-to-peer authentication.
[0043] Subsequently, the client and message broker server negotiate encryption suites and exchange session keys, completing the transport layer security handshake and establishing an encrypted secure session between them. This encrypted secure session encrypts and protects all subsequent message queue telemetry transmission data, including client connection requests, published messages, subscription requests, and all message content forwarded by the message broker server, ensuring data confidentiality and integrity during communication and preventing network sniffers from stealing or tampering with communication content.
[0044] If any of the above verifications fails, including certificate verification failure, server certificate verification failure, or any abnormality in the handshake process, the transport layer security protocol handshake between the client and the message broker server will fail, and an encrypted secure session cannot be established. In this case, the message broker server or client will record the corresponding error log based on the specific reason for the handshake failure and terminate the connection. The client will then need to re-initiate the connection request and re-execute the certificate verification process.
[0045] S300, The client initiates a target operation to the message broker server through the encrypted secure session, the target operation being a publish or subscribe operation for a target topic.
[0046] Specifically, after the encrypted secure session is established, the client initiates a target operation to the message broker server through the encrypted secure session. The target operation is either a publish operation or a subscribe operation. If it is a publish operation, the client constructs a publish message containing the target topic and the message payload to be sent, and sends the publish message to the message broker server through the encrypted secure session. If it is a subscribe operation, the client constructs a subscribe message containing the target topic, and sends the subscribe message to the message broker server through the encrypted secure session. All messages corresponding to the target operation are encrypted using a transport layer security protocol, and the message content remains in ciphertext during transmission to prevent interception and deciphering by third parties. After receiving the message corresponding to the target operation through the encrypted secure session, the message broker server performs subsequent permission verification processing.
[0047] S400. After receiving the target operation, the message broker server obtains the client's identity information and determines whether the client has operation permissions for the target topic according to preset access control rules; if the client has the corresponding permissions, the target operation is allowed.
[0048] The step of determining whether the client has operation permissions for the target topic according to preset access control rules includes: S410. Obtain the client's identity information, wherein the identity information comes from one or more of the following: the common name of the digital certificate, the alternative subject name, the certificate serial number, the certificate fingerprint, or the device identifier; S420. Based on the identity information, query the access control rules to determine whether the client has the publishing or subscription permission for the target topic; S430. If the client has the necessary permissions, then the client is allowed to publish or subscribe to the target topic. S440. If the client does not have the necessary permissions, the message broker server is controlled to reject the client's publish or subscribe operation on the target topic and a rejection log is recorded.
[0049] Specifically, refer to Figure 5 , Figure 5 The flowchart for the Broker side, specifically the message broker server's access authentication and ACL access control process, illustrates the certificate verification and ACL permission judgment decisions made by the message broker server. After receiving the message corresponding to the target operation from the client, the message broker server parses the target topic and operation type from the message. The operation type is either a publish operation or a subscribe operation.
[0050] The message broker server obtains the client's identity information. During the transport layer security protocol handshake phase, the digital certificate provided by the client has been verified by the message broker server, and its complete content has been obtained. The message broker server extracts identity information from this digital certificate. This identity information can come from any one or more of the following: the common name field, the subject alternate name field, the certificate serial number, the certificate fingerprint, or the device identifier. The type of information extracted as identity information depends on the settings of the access control rules configured on the supporting terminal. The message broker server extracts the corresponding identity identifier from the certificate according to the same rules, ensuring the consistency of the client's identity during the certificate verification phase and the permission determination phase.
[0051] Specifically, the target client identity information can come from any one or more of the following: the common name, alternative subject name, certificate serial number, certificate fingerprint, or device identifier of the digital certificate. Among these, the common name and alternative subject name are standard X.509 certificate fields, the certificate serial number is the unique identifier of the certificate, the certificate fingerprint is the hash value of the certificate content, and the device identifier is a custom field embedded by the supporting end when issuing the certificate. The message broker server reads the identity information from the corresponding fields of the digital certificate according to the identity extraction strategy configured on the supporting end.
[0052] After obtaining the identity information, the message broker server queries preset access control rules based on the identity information. The access control rules record the correspondence between each client identity and the operation permissions of the target topic. Each client identity can correspond to one or more topics, and each topic can also correspond to one or more client identities. The operation permissions include publish permissions and subscribe permissions. Publish permissions allow clients to send messages to the topic, and subscribe permissions allow clients to receive messages from the topic.
[0053] Then, the message broker server determines the query result: if the access control rules record that the client corresponding to the identity information has operation permissions for the current target topic, then the client is allowed to publish or subscribe to the target topic. The message broker server performs corresponding actions according to the operation type: for a publish operation, it accepts the publish message sent by the client and prepares to forward it to the subscribers of the target topic; for a subscribe operation, it adds the client to the subscriber list of the target topic, and subsequent messages under the target topic will be forwarded to the client.
[0054] If the access control rules do not record that the client corresponding to the identity information has operation permissions for the target topic, the message broker server will refuse the client's publish or subscribe operation to the target topic. For publish operations, the message broker server will discard the publish message and will not forward it; for subscribe operations, the message broker server will not add the client to the subscriber list for that topic. The message broker server will also record a rejection log containing the reason for failure. The log content includes the client's identity information, the rejected target topic, the requested operation type, and the rejection time, for subsequent security auditing and anomaly tracing.
[0055] S500. If the target operation is a publish operation, the publisher module of the client obtains the business data to be published, encapsulates the business data into a first message payload according to a unified format, and publishes the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. After receiving the first message payload, the message broker server forwards the first message payload to the target subscriber module that has subscribed to the target topic. After receiving the first message payload, the target subscriber module performs anomaly detection on the first message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity verification.
[0056] The client's publisher module obtains the business data to be published and encapsulates the business data into a first message payload according to a unified format, including: S510, the publisher module obtains the current timestamp as a timestamp field, obtains the length of the business data as a length field, obtains the business data to be published as a business data field, and calculates an integrity check value for the timestamp field, the length field, and the business data field as an integrity check field; S520. The timestamp field, the length field, the business data field, and the integrity verification field are combined in sequence to form the first message payload.
[0057] Reference Figure 6 , Figure 6 The flowchart illustrates the publisher payload encapsulation and subscriber payload verification process, showing how the publisher module encapsulates business data into four fields: TS_MS, LEN, DATA, and CRC, and how the subscriber module sequentially performs three anomaly checks. Specifically, after the message broker server allows the target operation, if the target operation is a publish operation, the client's publisher module begins the message payload encapsulation process.
[0058] Specifically, the publisher module acquires the business data to be published. This business data is the raw data content that needs to be uploaded to the message broker server and ultimately forwarded to subscribers, such as temperature values collected by sensors, equipment operating status, or control commands. The publisher module encapsulates the business data into the first message payload according to a unified format. The first message payload includes four components: a timestamp field, a length field, a business data field, and an integrity verification field. These four fields are arranged in a fixed order.
[0059] In one implementation, the timestamp field is a 64-bit unsigned integer representing the number of milliseconds elapsed since standard time; the length field is a 16-bit unsigned integer representing the number of bytes in the business data field; the business data field is a variable-length byte sequence; and the integrity check field is a 16-bit or 32-bit unsigned integer. In other implementations, the field length and encoding method can be adjusted according to the byte order and protocol stack requirements of the embedded platform, as long as the publisher module and subscriber module follow the same convention.
[0060] Then, the publisher module obtains the timestamp of the current moment as the timestamp field. The timestamp is accurate to the millisecond level and is used to identify the generation time of the first message payload, so that the subsequent subscriber can determine whether the first message payload is within the valid time range when performing the timestamp window check. Next, the actual data length of the business data is obtained as a length field. The length field is in bytes and is used by the subsequent subscriber to determine whether the received business data is complete and whether there are any truncation or splicing abnormalities during the transmission process when performing a length consistency check. Finally, the publisher module fills the original business data to be published into the business data field, which carries the actual communication content, and calculates the integrity check value of the overall content of the timestamp field, length field and business data field, and fills the integrity check value into the first message payload as the integrity check field.
[0061] In one implementation, the integrity check value is a cyclic redundancy check code, specifically using either CRC-16 (16-bit Cyclic Redundancy Check) or CRC32 (32-bit Cyclic Redundancy Check) algorithms, covering all bytes of the timestamp field, length field, and business data field.
[0062] In another implementation, the integrity check value can also be a checksum, hash digest, keyed message authentication code, or digital signature. The integrity check field is used by subsequent subscribers to recalculate and compare the values during integrity checks to determine whether bit flips or data errors occurred in the message payload during transmission.
[0063] Specifically, for scenarios with high security requirements, the integrity verification field does not use cyclic redundancy check, but instead uses a message authentication code or digital signature with a key.
[0064] When using a keyed message authentication code, the publisher and subscriber modules are pre-configured with a shared symmetric key. This shared key is generated by the support terminal during system deployment and securely distributed to the corresponding publisher and subscriber modules. The publisher module calculates the keyed message authentication code for the timestamp, length, and business data fields and fills it into the integrity verification field. Upon receiving the code, the subscriber module recalculates using the same shared key and compares it with the received value. In this embodiment, CRC-16 is used for basic integrity detection and error identification, capable of detecting random transmission errors and inconsistent tampering, but it cannot defend against active forgery by attackers simultaneously modifying the business data field and recalculating the matching CRC. For scenarios requiring defense against active forgery, HMAC (Hash-based Message Authentication Code) or digital signatures should be used as enhanced implementation schemes.
[0065] In one implementation, the integrity check field uses the CRC-16 / CCITT-FALSE algorithm, which is a variant of the 16-bit Cyclic Redundancy Check (CRC) standard from the International Telephone and Telegraph Consultative Committee (CCITT). The check covers TS_MS (Timestamp in Milliseconds) || LEN (Length) || DATA (Business Data Field). The preferred parameters are: Polynomial is 0x1021, initial value (Init) is 0xFFFF, input data is not bit-reversed (RefIn=False), output result is not bit-reversed (RefOut=False), and output result is not XORed (XorOut=0x0000). The timestamp satisfies the formula: now_ms Δpast ≤ ts_ms ≤ now_ms + Δfuture, where now_ms represents the current local time of the subscriber in milliseconds; ts_ms represents the value of the timestamp field in the message payload in milliseconds; Δpast represents the allowed historical time deviation in milliseconds; and Δfuture represents the allowed future time deviation in milliseconds. The above parameters satisfy Δpast greater than Δfuture. Preferably, Δpast equals 1000 milliseconds, and Δfuture equals 500 milliseconds. Before parsing the message payload, it is determined whether the total message length (LEN) has reached the preset minimum value. The actual DATA length is determined based on the LEN. If the LEN exceeds the preset maximum allowed value, the message is rejected directly. In bidirectional TLS, the message broker server verifies the client certificate, and the client verifies the message broker server's server certificate. After successful authentication by both parties, an encrypted secure session is established.
[0066] Specifically, the parameters are: the polynomial is 0x1021, the initial value is 0xFFFF, the input data is not bit-reversed, the output result is not bit-reversed, and the output result is not XORed. The coverage of this CRC check is all bytes of the timestamp field, length field, and business data field. The publisher module calculates the CRC check value according to the above parameters and fills it into the integrity check field. The subscriber module recalculates using the same parameters and coverage and compares it with the received integrity check field.
[0067] When digital signatures are used, the publisher module uses its private key to sign the timestamp, length, and business data fields, while the subscriber module uses the corresponding public key to verify the signature. The publisher module's private key is securely held by the client hosting the publisher, and the public key can be provided to the subscriber module through a digital certificate or pre-distribution by the support terminal.
[0068] The publisher module concatenates the four fields in the following order: timestamp, length, business data, and integrity verification, to form the complete first message payload. This order is a pre-agreed format between the publisher and subscriber (the publisher and subscriber can be from the same client or different clients). The subscriber parses the message payload in the same order, extracting each field for verification. After the message payload is encapsulated, the publisher module carries the first message payload in a publication message and sends it to the message broker server via an encrypted secure session. The message broker server then forwards the message to the corresponding subscriber based on the target topic.
[0069] In another implementation, the message payload, in addition to the timestamp field, length field, business data field, and integrity verification field, also includes one or more of the following: version number field, message type field, device identifier field, or serial number field. The version number field identifies the protocol version of the message payload, facilitating compatibility between old and new versions during protocol upgrades; the message type field distinguishes different business message types such as data reporting, heartbeat maintenance, alarm notifications, or control commands; the device identifier field identifies the device from which the message originates; and the serial number field provides anti-replay detection based on serial number continuity when the timestamp is unavailable.
[0070] After receiving the first message payload, the message broker server queries the subscription list based on the target topic to determine the target subscriber module that has subscribed to the target topic, and forwards the first message payload to the target subscriber module. Upon receiving the first message payload, the target subscriber module parses the timestamp field, the length field, the business data field, and the integrity verification field from the first message payload, and performs anomaly detection on the first message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity verification, which are performed sequentially. Specific execution steps are detailed in S600.
[0071] Furthermore, if the target operation is a subscription operation, the client does not need to execute the aforementioned message payload encapsulation and sending process. The client's subscriber module enters a message receiving waiting state, simply waiting for the message broker server to forward messages from other publishers, without executing the message payload encapsulation and sending process. Specifically, after the subscriber module sends a subscription request to the message broker server through an encrypted secure session, the message broker server adds the client to the subscriber list of the target topic. Subsequently, when the message broker server receives a message about the target topic from any other publisher, it forwards the message to the subscriber module through the encrypted secure session.
[0072] After receiving the message payload, the subscriber module enters the message payload anomaly detection process. If the target operation includes both a publish operation and a subscribe operation, that is, the client both publishes a message to the target topic and subscribes to messages on the target topic, the publisher module will perform message payload encapsulation and sending, while the subscriber module enters a message receiving waiting state. The two processes are executed in parallel without interference.
[0073] S600. If the target operation is a subscription operation, the subscriber module of the client waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload. The anomaly detection includes length consistency check, timestamp window check and integrity check, and the three checks are performed in sequence.
[0074] The length consistency check, timestamp window check, and integrity check are performed in the order described above. If any check fails, the anomaly detection result is determined to be abnormal, and subsequent checks will not be performed. This order is determined based on the computational cost of each check item and the protection objective.
[0075] In one implementation, the inspection sequence is designed based on the following: The first layer is a length consistency check. This check only involves integer field comparison and byte length calculation, which has minimal computational overhead. It can filter out malformed data packets with mismatched lengths caused by transmission truncation, splicing errors, or malicious construction by attackers at the lowest cost, preventing such data packets from entering the subsequent parsing process and reducing the risk of parsing out of bounds on embedded devices.
[0076] The second layer is the timestamp window check. This check is performed after the length structure is confirmed to be valid, involving current time acquisition and integer comparison operations, with computational overhead lower than integrity verification. By using the timestamp window check, expired replay messages and messages with pre-injected future timestamps can be identified before performing the computationally expensive integrity verification, avoiding unnecessary integrity calculations for messages with timeliness issues.
[0077] The third layer is integrity verification. This check involves calculating all bytes of the timestamp field, length field, and business data field, resulting in the highest computational overhead. It is executed last to ensure that only messages that pass length structure screening and time validity screening enter the integrity verification stage. When the integrity verification mechanism employs high-security schemes such as HMAC or digital signatures, its computational overhead is significantly higher than that of length and timestamp checks. Executing it at a later stage reduces unnecessary calculations in resource-constrained embedded environments, lowering overall power consumption and response latency.
[0078] The client's subscriber module waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload, including: S610, The subscriber module parses the target timestamp field, target length field, target business data field, and target integrity verification field from the second message payload; S620. Determine whether the value of the target length field is consistent with the actual length of the target business data field, so as to perform the length consistency check; S630. If the length consistency check passes, then perform a timestamp window check: obtain the local current time of the subscriber module, and determine whether the value of the target timestamp field is within the preset time window range. S640. If the timestamp window check passes, then perform integrity verification: recalculate the integrity verification value based on the target timestamp field, the target length field, and the target business data field, and determine whether it matches the value of the target integrity verification field. S650, the length consistency check, the timestamp window check, and the integrity check are executed sequentially. If any check fails, the result of the anomaly detection is determined to be abnormal, and no further checks are performed.
[0079] Specifically, if the target operation is a subscription operation, the subscriber module of the client waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload. After receiving the message from the message broker server through an encrypted secure session, the subscriber module extracts the second message payload from the message and performs anomaly detection on the second message payload.
[0080] The subscriber module first parses the target timestamp field, target length field, target business data field, and target integrity verification field sequentially from the second message payload according to the unified format used when encapsulating the message payload. This parsing order is consistent with the field order used by the publisher module during encapsulation; that is, the target timestamp field is read first, followed by the target length field, then the target business data field, and finally the target integrity verification field, ensuring that the correspondence between the fields is correct.
[0081] Then, the subscriber module performs a length consistency check. The subscriber module reads the value of the target length field and simultaneously calculates the actual data length of the business data field, comparing the two. If the value of the target length field matches the actual length of the target business data field, the length consistency check passes; if they do not match, it is determined that the second message payload is abnormal, possibly due to data truncation, splicing errors, or length spoofing maliciously constructed by an attacker during transmission. In this case, the subscriber module terminates subsequent checks and determines the anomaly detection result as abnormal.
[0082] If the length consistency check passes, the subscriber module performs a timestamp window check. Specifically, the subscriber module obtains the local current time and determines whether the value of the target timestamp field is within a preset time window range. The preset time window refers to the time interval formed by the allowed historical deviation time and the allowed future deviation time, specifically: the current time minus the allowed historical deviation, to the current time plus the allowed future deviation. The value of the target timestamp field should be within this interval. If the value of the target timestamp field is earlier than the current time minus the allowed historical deviation, the second message payload is determined to be an expired replay message; if the value of the target timestamp field is later than the current time plus the allowed future deviation, the second message payload is determined to be a future timestamp pre-injection message. When the value of the target timestamp field is within the preset time window range, the target timestamp window check passes; if it is outside the preset time window range, the subscriber module terminates subsequent checks and determines the anomaly detection result as abnormal. In one implementation, the allowed historical deviation is 1000 milliseconds, and the allowed future deviation is 500 milliseconds, wherein the time window in the past direction is larger than the time window in the future direction to accommodate the actual characteristic of network latency fluctuations in embedded industrial communications, which are typically greater than clock lead errors. In other implementations, the allowed historical and future deviations can be adjusted according to network latency, clock synchronization errors, and service real-time requirements.
[0083] In a further embodiment, the subscriber module also performs adaptive adjustment of the timestamp window. In an optional embodiment, the subscriber module maintains statistical values of the time deviation of the most recently validated messages and continuously calculates the mean and standard deviation of the deviations. When the deviation values of multiple consecutive messages deviate from the mean by more than a preset multiple standard deviation, it is determined to be a clock anomaly event. In response to the clock anomaly event, the subscriber module automatically adjusts the time window parameters, triggers the client to perform a clock resynchronization operation, and the preset multiple is configured according to the actual communication environment. In response to the clock anomaly event, the subscriber module automatically extends the allowed historical deviation to a preset extension value, records a clock anomaly alarm log, and triggers the client to perform a network time protocol clock resynchronization operation. After the deviation returns to the normal range and multiple consecutive messages stabilize, it automatically returns to the original window parameters. If clock synchronization cannot be restored for a long time, the alarm level is escalated, and an alarm notification is sent to the operation and maintenance system through the message broker server. This can effectively address the clock drift problem caused by the lack of stable time synchronization in embedded devices and prevent normal messages from being mistakenly discarded due to clock deviation.
[0084] If the timestamp window check passes, the subscriber module performs an integrity check. Specifically, the subscriber module recalculates the integrity check value using the same integrity check algorithm as the publisher module, based on the parsed target timestamp field, target length field, and target business data field. The recalculated integrity check value is then compared with the parsed value of the target integrity check field. If they match, the integrity check passes; if they do not match, it is determined that the second message payload has experienced data errors or has been maliciously tampered with during transmission. In this case, the subscriber module determines the anomaly detection result to be abnormal.
[0085] In this embodiment, the length consistency check, the timestamp window check, and the integrity check are performed sequentially as described above. If any check fails, the anomaly detection result is determined to be abnormal, and no further checks are performed. Only when all three checks pass is the anomaly detection result determined to be normal, and the subscriber module delivers the business data fields in the message payload to the business processing logic for further processing.
[0086] S700. If the result of the anomaly detection is abnormal, the subscriber module discards the second message payload and records the reason for failure; if the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic.
[0087] Specifically, if the anomaly detection result is abnormal, the subscriber module discards the second message and records the reason for the failure. Specifically, when any of the length consistency check, the timestamp window check, and the integrity check fails, the subscriber module determines that the second message payload is abnormal, does not deliver the business data fields in the second message payload to the business processing logic, and directly discards the message.
[0088] The subscriber module also records the reasons for failure, including the specific failed check item and its corresponding detection value. For example, when the length consistency check fails, it records the comparison result between the value of the target length field and the actual data length; when the timestamp window check fails, it records the deviation and direction between the value of the target timestamp field and the preset time window; when the integrity check fails, it records the comparison result between the recalculated integrity check value and the received target integrity check field value. The subscriber module stores the log records containing the reasons for failure in local storage media.
[0089] In one implementation, the subscriber module performs tiered handling based on the anomaly type. When the length consistency check fails or the integrity check fails, the subscriber module determines it as a minor anomaly, discards the second message, and records a warning-level log. When the timestamp window check fails, the subscriber module determines it as a moderate anomaly, discards the second message, records a security event, and simultaneously triggers the message broker server to perform cumulative monitoring of the client. When the value of the target timestamp field exceeds twice the preset time window, or the value of the target length field exceeds the preset maximum limit, or multiple consecutive anomaly detection failures occur, the subscriber module determines it as a severe anomaly, discards the message, generates a high-risk alarm, and records complete anomaly information, including client identity, target topic, failure type, and timestamp. The alarm information is then manually audited and followed up by operations and maintenance personnel. In more embodiments, if the system additionally establishes an association mechanism between the message source and the original publisher's identity and network connection (e.g., carrying a unique publisher identifier in the message payload or application layer message, and having the message broker server maintain the mapping relationship between this identifier and the client's network connection), then in severe anomaly scenarios, the subscriber module can use this association mechanism to locate the source publisher of the abnormal message, and the message broker server can disconnect the source publisher's connection. It should be noted that this extended approach relies on a pre-established source association mechanism and is not a necessary feature of the core implementation scheme of this invention.
[0090] Furthermore, when the value of the target length field exceeds a preset maximum limit, the subscriber module directly determines it as a severe anomaly. This preset maximum limit is used to prevent attackers from triggering memory overflow or buffer overflow vulnerabilities on the subscriber side by setting an excessively large length field.
[0091] If the anomaly detection result is normal, meaning the length consistency check, timestamp window check, and integrity check all pass, the subscriber module delivers the message to the business processing logic. Specifically, the subscriber module extracts business data fields from the second message payload and passes the content of the business data fields to the upper-layer business processing function or application interface. The upper-layer business then performs corresponding control, recording, or response actions based on the business data content. This completes the entire process of a message being generated by one publisher module, forwarded by the message broker server to another subscriber module, and having its anomaly detection and business delivery completed by the subscriber module. For subsequently received messages, the above anomaly detection and handling process is repeated.
[0092] In one implementation, the publisher module and the message broker server use a Quality of Service (QoS) level of 0 for message queue telemetry transmission protocol. This means that after sending a message, the publisher module does not wait for confirmation from the message broker server, and the message broker server does not return confirmation to the publisher module. After the subscriber module completes anomaly detection, if the detection result is abnormal, it directly discards the message and logs it, without feeding back the application layer verification result to the publisher module. This QoS level is suitable for industrial sensor telemetry data with periodic self-refresh characteristics.
[0093] Specifically, the Quality of Service (QoS) level mechanism of the message queue telemetry transport protocol addresses the reliable delivery of messages at the protocol layer. QoS level 1 corresponds to the message broker server confirming receipt of the published message, while QoS level 2 corresponds to the message broker server confirming receipt of the published message exactly once. Neither of these confirmations involves whether the subscriber module has completed application-layer anomaly detection or whether it has accepted the message content. In this embodiment, the payload verification performed at the application layer and its result processing are independent of the protocol layer's QoS mechanism.
[0094] Specifically, in another implementation, when the business scenario requires a closed-loop application-layer verification feedback at service quality level 1 or 2, the system also includes a verification result feedback topic. After completing anomaly detection, the subscriber module publishes a verification result message through this verification result feedback topic. This message includes a status code indicating whether the verification passed or failed, and a reason code for failure. The publisher module subscribes to this verification result feedback topic, receiving and sensing the anomaly detection results from the subscriber module. This feedback topic is independent of the service quality confirmation mechanism of the message queue telemetry transmission protocol and belongs to an extended implementation method of the application layer.
[0095] Furthermore, in this embodiment, to verify the effectiveness of the load anomaly detection mechanism, the test trigger module executes the following negative test cases.
[0096] The first test case is a length field anomaly test. The publisher module constructs a message with its timestamp within the valid window and its length field set to 10, but the actual business data length is set to 8. After the message is forwarded to the subscriber module by the message broker server, the subscriber module determines during the length consistency check phase that the value of the length field is inconsistent with the actual business data length, discards the message, and logs the inconsistency between the length field and the actual business data length. It does not proceed to the timestamp window check and integrity verification.
[0097] The second test case is an expired timestamp test. The publisher module constructs a message whose length field matches the actual business data length, and the timestamp is set to the subscriber module's local current time minus 1500 milliseconds. After the message is forwarded to the subscriber module by the message broker server, the subscriber module first performs a length consistency check, and then, during the timestamp window check phase, determines that the timestamp is earlier than the current time minus the allowed historical deviation (1000 milliseconds). The module discards the message and logs it as expired or at risk of replay, without proceeding to integrity verification. Similarly, a message with a timestamp of the subscriber module's local current time plus 600 milliseconds is considered to have an abnormal future timestamp and is discarded when the allowed future deviation is 500 milliseconds.
[0098] The third test case is an integrity verification anomaly test. The publisher module constructs a message with a timestamp within the allowed time window and a length field consistent with the actual data length, but the integrity verification field is intentionally modified to an incorrect value. After the message is forwarded to the subscriber module by the message broker server, the subscriber module sequentially performs length consistency checks and timestamp window checks. During the integrity verification phase, it determines that the recalculated integrity verification value does not match the received integrity verification field value, discards the message, and logs the integrity verification failure.
[0099] The three test cases above verify that length consistency checks, timestamp window checks, and integrity checks can correctly trigger anomaly detection and execute discarding. Subscriber module logs and message broker server logs generated during the execution of each test case are automatically saved to a timestamped evidence directory for review during acceptance testing. It should be noted that timestamp expiration or future occurrences, length inconsistencies, and integrity check failures in the above test cases all fall under application-layer payload anomalies. These anomalies cannot be identified through certificate authentication, transport layer security protocol encryption, or topic-level access control, verifying the irreplaceable role of the payload verification layer in a layered protection system.
[0100] exist Figure 2As can be seen from this, in this embodiment, the support end also includes a test triggering module and an evidence archiving module.
[0101] Reference Figure 7 , Figure 7 The flowchart for testing and evidence archiving outlines the testing triggering module, which triggers CONNECT testing (connection testing), (transport layer security protocol packet capture verification to check if communication data is encrypted), ACL permission verification (access control list permission verification to verify if topic-level access control is effective), and PAYLOAD payload verification (message payload verification to verify if the anomaly detection mechanism is effective) during system deployment or acceptance phases. The PAYLOAD payload verification test cases include constructing messages exceeding length limits, constructing messages with timestamps earlier than allowed historical deviations or later than allowed future deviations, and constructing messages with incorrect integrity verification fields. This verifies whether the subscriber module's length consistency check, timestamp window check, and integrity check can correctly trigger anomaly detection and execute discarding. After all the above verifications are completed, the evidence archiving module saves the message broker server logs, client logs, configuration snapshots, packet capture files, and test outputs to a timestamped evidence directory for acceptance and subsequent auditing.
[0102] In this embodiment, a five-layer protection mechanism sequentially addresses five different types of security risks, and each layer is non-substitutable for the others. Without certificate authentication, unauthorized clients can directly access the system; without transport layer security protocol encryption, communication content can be eavesdropped on; without topic authorization, legitimate clients can access unauthorized topics; without length checks, malformed payloads may trigger parsing anomalies; without timestamp checks, expired or replayed messages can be accepted; without integrity checks, tampered messages can enter business logic; and without anomaly blocking, detected abnormal messages may still flow into upper-layer control. Each layer corresponds to different dimensions of security requirements, such as access trustworthiness, transmission confidentiality, operational controllability, structural integrity, timeliness, and data correctness. The absence of any layer will cause the corresponding dimension of security protection to fail, and this deficiency cannot be compensated for by other layers. The layers are sequentially linked according to the natural time sequence of the message queue telemetry transmission communication link. After the previous layer completes its execution, the next layer continues to process new risk dimensions based on the previous layer's processing, collectively forming a complete defense-in-depth system.
[0103] In summary, this embodiment provides an embedded layered security protection method for message queue telemetry transmission. First, the message broker server receives a connection request from a client and verifies the client's digital certificate. If the verification is successful, the client and the message broker server complete a transport layer security protocol handshake and establish an encrypted secure session. Then, the client initiates a target operation to the message broker server through the encrypted secure session. The target operation is a publish or subscribe operation on a target topic. After receiving the target operation, the message broker server obtains the client's identity information and determines whether the client has the operation permission for the target topic according to preset access control rules. If the client has the corresponding permission, the target operation is allowed. Next, in response to the permission, if the target operation is a publish operation on the target topic, the client's publisher module obtains the business data to be published, encapsulates the business data into a first message payload according to a unified format, and publishes the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. Furthermore, when the message broker server forwards the target message to the subscriber module of the client, after receiving the second message payload corresponding to the target message, the subscriber module performs anomaly detection on the second message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity check. If the result of the anomaly detection is anomaly, the subscriber module discards the second message payload and records the reason for failure; if the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic. This embodiment provides users with an embedded layered security protection method for message queue telemetry transmission. It sequentially executes client digital certificate authentication, transport layer security protocol encrypted session establishment, identity-based topic-level access control, publisher module encapsulating business data into a message payload containing timestamp, length, business data, and integrity verification fields according to a unified format, and subscriber module sequentially performing length consistency checks, timestamp window checks, and integrity checks on the message payload, discarding the message if any check fails. This forms a layered, interconnected protection system along the message queue telemetry transmission communication link, from access authentication to anomaly handling. It solves the technical problem in existing embedded message queue telemetry transmission communication systems where unauthorized client access, network sniffing and eavesdropping, unauthorized topic access, and fake data injection attacks are difficult to defend against simultaneously within the same system. This achieves the beneficial effects of improving the access credibility, transmission confidentiality, topic controllability, and message detectability of the embedded message queue telemetry transmission communication system.
[0104] It should be understood that although the steps in the flowcharts shown in the accompanying drawings are displayed sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of the steps in this invention, and these steps can be executed in other orders. Moreover, at least a portion of the steps in this invention may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0105] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program using signal-related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink, DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0106] Example 2 Based on the above embodiments, the present invention also provides an embedded layered security protection system for message queue telemetry transmission, such as... Figure 2 As shown, the embedded layered security protection system for message queue telemetry transmission includes: A message broker server is used to receive connection requests from clients, verify the digital certificates of the clients; if the verification is successful, it completes a transport layer security protocol handshake with the clients to establish an encrypted secure session; and it is used to receive target operations initiated by the clients, the target operations being publish or subscribe operations on target topics, obtain the identity information of the clients, determine whether the clients have operation permissions for the target topics according to preset access control rules, and allow the publish or subscribe operations if they have the corresponding permissions, as specifically described in Embodiment 1. One or more clients, the clients including publisher modules and subscriber modules; The publisher module is used to obtain the business data to be published when the target operation is a publishing operation of the target topic, encapsulate the business data into a first message payload according to a unified format, and publish the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field, as specifically described in Embodiment 1. The subscriber module is configured to wait for the second message payload corresponding to the target topic to be forwarded from the message broker server when the target operation is a subscription operation, and perform anomaly detection on the second message payload. The anomaly detection includes length consistency check, timestamp window check and integrity check. If the detection result is abnormal, the second message payload is discarded and the reason for failure is recorded. If the detection result is normal, the second message payload is delivered to the business processing logic, as described in Embodiment 1.
[0107] Example 3 The present invention also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the embedded layered security protection method for message queue telemetry transmission as described above.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An embedded layered security protection method for message queue telemetry transmission, characterized in that, The method is applied to a system including a message broker server and one or more clients, each client including a publisher module and a subscriber module, the method comprising: The message broker server receives connection requests from clients and verifies the digital certificates of the clients; If the verification is successful, the client and the message broker server complete the transport layer security protocol handshake and establish an encrypted secure session. The client initiates a target operation to the message broker server through the encrypted secure session. The target operation is a publish or subscribe operation for a target topic. After receiving the target operation, the message broker server obtains the client's identity information and determines whether the client has operation permissions for the target topic according to preset access control rules; if the client has the corresponding permissions, the target operation is allowed. If the target operation is a publish operation, the publisher module of the client obtains the business data to be published, encapsulates the business data into a first message payload according to a unified format, and publishes the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. After receiving the first message payload, the message broker server forwards the first message payload to the target subscriber module that has subscribed to the target topic. After receiving the first message payload, the target subscriber module performs anomaly detection on the first message payload. The anomaly detection includes length consistency check, timestamp window check, and integrity verification. If the target operation is a subscription operation, the subscriber module of the client waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload; The client's subscriber module waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload, including: The subscriber module parses the target timestamp field, target length field, target business data field, and target integrity verification field from the second message payload; Determine whether the value of the target length field is consistent with the actual length of the target business data field to perform the length consistency check; If the length consistency check passes, then a timestamp window check is performed: the local current time of the subscriber module is obtained, and it is determined whether the value of the target timestamp field is within the preset time window range; If the timestamp window check passes, then an integrity check is performed: the integrity check value is recalculated based on the target timestamp field, the target length field, and the target business data field, and it is determined whether the value matches the value of the target integrity check field. The length consistency check, the timestamp window check, and the integrity check are performed sequentially. If any check fails, the result of the anomaly detection is determined to be abnormal, and no further checks will be performed. If the result of the anomaly detection is abnormal, the subscriber module discards the second message payload and records the reason for failure; if the result of the anomaly detection is normal, the second message payload is delivered to the business processing logic.
2. The embedded layered security protection method for message queue telemetry transmission according to claim 1, characterized in that, Before the message broker server receives a connection request from a client, it also includes: The support end generates a root certificate, a root CA private key, a server certificate and its corresponding server private key for the message broker server, a digital certificate and its corresponding client private key for the client, and configures access control rules. The root CA private key is stored by the support end and is not deployed to the message broker server or the client. Deploy the root certificate, the server certificate and its corresponding server private key, and the access control rules to the message broker server; The root certificate and the digital certificate, along with their corresponding client private keys, are deployed to the client for verification by the message broker server when sending the connection request to the message broker server.
3. The embedded layered security protection method for message queue telemetry transmission according to claim 2, characterized in that, The access control rules are configured by the support terminal and deployed to the message broker server; The access control rules include the correspondence between the client's identity information and the operation permissions of the target topic, wherein the operation permissions include at least one of publishing permissions and subscription permissions.
4. The embedded layered security protection method for message queue telemetry transmission according to claim 2, characterized in that, The verification of the client's digital certificate includes: Verify whether the client's digital certificate is a legitimate certificate issued by the support end, verify whether the digital certificate is within its validity period, and verify whether the purpose of the extended key of the digital certificate matches the client's identity; If the client does not provide a digital certificate or the digital certificate fails verification, the message broker server rejects the connection request and logs the rejection.
5. The embedded layered security protection method for message queue telemetry transmission according to claim 1, characterized in that, The step of determining whether the client has operation permissions for the target topic according to preset access control rules includes: Obtain the client's identity information, which comes from one or more of the following: the common name of the digital certificate, the alternative subject name, the certificate serial number, the certificate fingerprint, or the device identifier; Based on the identity information, the access control rules are queried to determine whether the client has the permission to publish or subscribe to the target topic; If the client has the necessary permissions, then the client is allowed to publish or subscribe to the target topic. If the client does not have the necessary permissions, the message broker server will reject the client's publish or subscribe operation on the target topic and record the rejection in the log.
6. The embedded layered security protection method for message queue telemetry transmission according to claim 1, characterized in that, The client's publisher module obtains the business data to be published and encapsulates the business data into a first message payload according to a unified format, including: The publisher module obtains the current timestamp as a timestamp field, the length of the business data as a length field, and the business data to be published as a business data field, and calculates an integrity check value for the timestamp field, the length field, and the business data field as an integrity check field. The timestamp field, the length field, the business data field, and the integrity verification field are combined in sequence to form the first message payload.
7. An embedded layered security protection system for message queue telemetry transmission, characterized in that, include: A message broker server is used to receive connection requests from clients and verify the digital certificates of the clients. If the verification is successful, a transport layer security protocol handshake is completed with the client to establish an encrypted secure session; And for receiving the target operation initiated by the client, the target operation being a publish or subscribe operation on a target topic, obtaining the client's identity information, determining whether the client has operation permissions for the target topic according to preset access control rules, and allowing the publish or subscribe operation if it has the corresponding permissions; One or more clients, the clients including publisher modules and subscriber modules; The publisher module is used to obtain the business data to be published when the target operation is a publishing operation of the target topic, encapsulate the business data into a first message payload in a unified format, and publish the first message payload to the message broker server through the encrypted secure session. The first message payload includes a timestamp field, a length field, a business data field, and an integrity verification field. The subscriber module is configured to wait for the second message payload corresponding to the target topic to be forwarded from the message broker server when the target operation is a subscription operation, and perform anomaly detection on the second message payload. The anomaly detection includes length consistency check, timestamp window check and integrity check. If the detection result is abnormal, the second message payload is discarded and the reason for failure is recorded. If the detection result is normal, the second message payload is delivered to the business processing logic. The client's subscriber module waits for the second message payload corresponding to the target topic to be forwarded from the message broker server, and performs the anomaly detection on the second message payload, including: The subscriber module parses the target timestamp field, target length field, target business data field, and target integrity verification field from the second message payload; Determine whether the value of the target length field is consistent with the actual length of the target business data field to perform the length consistency check; If the length consistency check passes, then a timestamp window check is performed: the local current time of the subscriber module is obtained, and it is determined whether the value of the target timestamp field is within the preset time window range; If the timestamp window check passes, then an integrity check is performed: the integrity check value is recalculated based on the target timestamp field, the target length field, and the target business data field, and it is determined whether the value matches the value of the target integrity check field. The length consistency check, the timestamp window check, and the integrity check are performed sequentially. If any check fails, the result of the anomaly detection is determined to be abnormal, and no further checks will be performed.
8. The embedded layered security protection system for message queue telemetry transmission according to claim 7, characterized in that, It also includes a support end, which includes a certificate and PKI management module, a deployment configuration module, a test triggering module, and an evidence archiving module; The certificate and PKI management module is used to generate the root certificate, the root CA private key, the server certificate of the message broker server and its corresponding server private key, the digital certificate of the client and its corresponding client private key, and configure access control rules; the root CA private key is kept by the support terminal and is not deployed to the message broker server or the client. The deployment configuration module is used to deploy the root certificate, the server certificate and its corresponding server private key, and the access control rules to the message broker server, and to deploy the root certificate and the digital certificate and their corresponding client private key to the client; The test triggering module is used to trigger connection tests, encryption verification, permission verification, and load anomaly detection verification. The evidence archiving module is used to save the message broker server's logs, the client's logs, configuration snapshots, packet capture files, and test outputs to support reproduction, maintenance, and acceptance.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the embedded layered security protection method for message queue telemetry transmission as described in any one of claims 1-6.
