A privacy protection method and system for network transmission

By encrypting and identifying the data packets transmitted by the network in the distributed cluster, and using the netfilter tool to filter the data packets, the problem of privacy data leakage in the distributed system is solved, the secure transmission and high versatility of the data packets are achieved, and the data is satisfied. Controllable requirements.

CN118509254BActive Publication Date: 2024-10-11北京熠智科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410954359.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-11
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

Existing technology is difficult to prevent data leakage when transmitting private data between different hosts in distributed clusters such as federated learning. Especially in socket communication, the stand-alone solution cannot be applied to distributed systems.

Method used

Use a symmetric encryption algorithm to encrypt data packets transmitted over the network, and add data labels to the data packets. By tracking and counting data packets, modify the protocol header to ensure that the data packets are not leaked outside the security domain during transmission, and use the netfilter tool to filter the data. Packet filtering and modification ensure that the encryption and decryption of data packets are transparent to the upper layer protocol.

Benefits of technology

It realizes the encryption and identification of data packets in network communication, ensuring that data packets are not leaked outside the security domain during transmission, meeting the requirements of data controllability, and having high versatility and compatibility to prevent processes from sending and receiving data in the network. data leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118509254B_ABST
    Figure CN118509254B_ABST
Patent Text Reader

Abstract

The invention discloses a privacy protection method for network transmission, comprising: a host obtains original plaintext in network transmission; a symmetric encryption algorithm is used to encrypt the original plaintext to obtain an encrypted data packet; a payload is added to the data packet to obtain a data packet including an encrypted ciphertext, an authentication tag, a random vector and a data tag; all data packets passing through the host are tracked and counted, and the protocol header of the data packet is modified to obtain a modified data packet and transmit it to the opposite host through the network; the opposite host receives the modified data packet, decrypts the modified data packet and searches for the corresponding process of the data packet, and determines whether the data packet can be received according to the process, if not, the data packet is discarded, and if it can be received, the data packet is decrypted and the protocol header is modified and handed over to the upper protocol stack for processing. The method can provide additional protection for network communication, so that even if the process sends and receives data in the network, there will be no process leaking data outside the security domain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and in particular to a privacy protection method and system for network transmission. Background Art

[0002] Application No. 202311241074.X "A method for controllable use of data" provides a new paradigm for privacy computing, that is, the storage logical partitions in the storage / computing nodes of the data user are divided into security domains controlled by the data provider, ensuring that the private data can only be processed in the security domain and cannot flow out of the security domain. This ensures that the private data of the data provider is visible to the data user, but prevents the data user from copying the private data out of the security domain in various ways for secondary sales. This solution can run properly in a single machine, ensuring that no process can violate restrictions and illegally copy data, but it cannot be applied to distributed clusters such as federated learning. Therefore, in order to meet such requirements, it is necessary to extend the above file restrictions to distributed systems. In some cases, there will be only one security domain in a cluster, because a separate cluster will be assigned to a data provider. Therefore, in this case, there is no data exchange between multiple security domains. How to achieve communication between different hosts through sockets without leaking information in the security domain is a problem that needs to be solved. Summary of the invention

[0003] In view of the defects in the prior art, the present invention provides a privacy protection method and system for network transmission, which can provide additional protection for network communications and ensure that even if a process sends and receives data in the network, there is no risk of the process leaking data outside the security domain.

[0004] In a first aspect, an embodiment of the present invention provides a privacy protection method for network transmission, comprising:

[0005] The host obtains the original plaintext transmitted over the network;

[0006] The original plaintext is encrypted using a symmetric encryption algorithm to obtain an encrypted data packet, wherein the data packet includes the encrypted ciphertext, the authentication tag, and the random vector;

[0007] The data packet obtained by adding a payload to the data packet includes an encrypted ciphertext, an authentication tag, a random vector and a data tag, wherein the data tag is used to identify whether the data packet has been encrypted and may contain private data;

[0008] Track and count all data packets passing through the host, modify the protocol header of the data packet, obtain the modified data packet and transmit the modified data packet to the peer host through the network;

[0009] The peer host receives the modified data packet, decrypts the modified data packet and searches for the process corresponding to the data packet, and determines whether the data packet can be received based on the process. If not, the data packet is discarded. If it can be received, the data packet is decrypted, the protocol header is modified and handed over to the upper protocol stack for processing.

[0010] In a second aspect, an embodiment of the present invention provides a privacy protection system for network transmission, including a host and a peer host, the host including an acquisition module, an encryption module, a load increase module and an update protocol header module, the peer host including a receiving processing module,

[0011] The acquisition module is used by the host to acquire the original plaintext in network transmission;

[0012] The encryption module is used to encrypt the original plaintext using a symmetric encryption algorithm to obtain an encrypted data packet, which includes an encrypted ciphertext, an authentication tag and a random vector;

[0013] The payload adding module is used to add a payload to a data packet to obtain a data packet including an encrypted ciphertext, an authentication tag, a random vector and a data tag, wherein the data tag is used to identify whether the data packet has been encrypted;

[0014] The update protocol header module is used to track and count all data packets passing through the host, and modify the protocol header of the data packet to obtain the modified data packet and transmit the modified data packet to the opposite host through the network;

[0015] The receiving and processing module receives the modified data packet from the opposite host, decrypts the modified data packet and searches for the process corresponding to the data packet, determines whether the data packet can be received according to the process, and discards the data packet if it cannot be received; if it can be received, decrypts the data packet, modifies the protocol header and hands it over to the upper protocol stack for processing.

[0016] Beneficial effects of the present invention:

[0017] The embodiment of the present invention provides a privacy protection method and system for network transmission, which encrypts the data packet in transmission and adds a payload to the encrypted data packet, that is, marks an identification bit (data tag) to identify whether the data packet may contain privacy data. The kernel at the other end of the socket connection can know that all encrypted data packets may contain privacy data, and then the kernel will perform permission verification on the process receiving the data packet to determine whether it can receive the data packet. If it can be received, the kernel will decrypt it and hand it over to the application layer. If it cannot be received, the packet will be directly discarded. It provides additional protection for network communication, and satisfies the requirement that even if the process sends and receives data in the network, there will be no process leaking data outside the security domain, and the data can be controlled. At the same time, it also has high versatility and high compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.

[0019] Figure 1 A flowchart of the netfilter implementation is shown;

[0020] Figure 2 A flowchart of a privacy protection method for network transmission provided by a first embodiment of the present invention is shown;

[0021] Figure 3 shows the structure of the data packet after the load is increased;

[0022] Figure 4 A structural block diagram of a privacy protection system for network transmission provided by another embodiment of the present invention is shown. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0025] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0026] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0027] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0028] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by those skilled in the art to which the present invention belongs.

[0029] Since we cannot modify the TCP or UDP protocol, we can only modify the payload of the data packet to mark the data packet. Encryption and decryption will inevitably change the size of the data packet, and we need to be transparent to the TCP and IP layers. Therefore, we can only capture the packet at the lower two layers and modify the TCP and IP protocol headers and encrypted content of the data packet, and modify the header and decrypted content at the same location on the other end. This process is completely transparent to the entire upper layer. From the upper layer's point of view, there is only occasional packet loss, because this function discards the data packets that do not meet the receiving conditions.

[0030] Due to the various limitations of the above functions, we use netfilter as a tool to implement this function. Netfilter is a packet filtering tool in the Linux kernel, which means that it will monitor and filter all data packets passing through this host, not only data packets with this host as destination and source, but also data packets forwarded by this host. Any modifications can be made to the header and content of the data packet. Of course, this modification must comply with IP and upper-layer protocols, otherwise the data packet will be discarded due to errors. Netfilter includes five hook functions, representing the five path points of the data packet, named pre_routing, local_in, forward, local_out, and post_routing, respectively. Figure 1 shown.

[0031] In netfilter, each path point is a series of hook functions. All packets passing through this path point must pass through these functions according to a certain priority. If a function determines that the packet needs to be discarded, it will be discarded directly, and no subsequent function judgment will be performed. Figure 1It can be seen that all data packets need to pass through the PRE_ROUTING path point before making routing decisions. Data packets that enter the local machine after routing will enter the LOCAL_IN path point, and then enter the upper layer protocol processing. Data packets that are only forwarded on the local machine will enter the FORWARD path point, and then directly enter POST_ROUTING, and then flow out. Data packets originating from the local machine will first pass through LOCAL_OUT, and then flow out through POST_ROUTING. It can be seen that netfilter itself does not have any restrictions. Any user can mount a function at any priority at any path point, which also brings a high degree of freedom, and can intercept and modify any data packet in any way. Netfilter has become the basic tool and platform for Linux to process network packets.

[0032] As mentioned above, both encryption and decryption require modification of the data packet payload, and at the same time, they need to remain transparent to the TCP layer. Therefore, the seq and ack numbers in the TCP header must be modified accordingly to prevent the data packet from being discarded by the TCP protocol. Each modification of the data packet payload requires modification of the TCP header and the IP header.

[0033] Because netfilter has a very high degree of freedom, Linux itself also includes some firewall mechanisms whose functions require statistics and tracking of data packets. These firewall mechanisms are also implemented based on netfilter. Tracking and counting data packets requires reading the original IP and port information of the data packet and recording them. The Linux kernel implements this module called nf_conntrack. This module identifies a connection based on the five-tuple of the data packet, which includes the source IP, source port, destination IP, destination port, and connection protocol. For each connection, nf_conntrack will also record the traffic passing through it, so that when we modify the data packet payload, we can change the seq and ack sequence number of this connection accordingly, thus making the transmission process transparent to the upper layer protocol.

[0034] like Figure 2 FIG. 1 is a flowchart of a privacy protection method for network transmission provided by a first embodiment of the present invention, and the method comprises the following steps:

[0035] The host obtains the original plaintext transmitted over the network;

[0036] The original plaintext is encrypted using a symmetric encryption algorithm to obtain an encrypted data packet, wherein the data packet includes the encrypted ciphertext, the authentication tag, and the random vector;

[0037] The data packet obtained by adding a payload to the data packet includes an encrypted ciphertext, an authentication tag, a random vector and a data tag, wherein the data tag is used to identify whether the data packet has been encrypted and may contain private data;

[0038] Track and count all data packets passing through the host, modify the protocol header of the data packet, obtain the modified data packet and transmit the modified data packet to the peer host through the network;

[0039] The peer host receives the modified data packet, decrypts the modified data packet and searches for the process corresponding to the data packet, and determines whether the data packet can be received based on the process. If not, the data packet is discarded. If it can be received, the data packet is decrypted, the protocol header is modified and handed over to the upper protocol stack for processing.

[0040] The encryption and decryption algorithm used is a mixed strategy of GCM and AES, which is completed by using the GCM encryption mode in conjunction with the underlying AES encryption algorithm. AES is a symmetric encryption method that uses the same key for encryption and decryption. If the keys used by the encryption and decryption parties are inconsistent, decryption will fail. AES supports multiple key lengths, and a 32-byte key is used here. GCM is an encryption mode that provides encryption, authentication, and integrity protection on block ciphers such as AES. Encryption uses a random vector to ensure that the ciphertext is different each time even if the encrypted content is the same. This random vector will also be attached to the ciphertext. The transmission of the random vector is plain text and will not be encrypted. After encryption, an encrypted authentication tag will be generated and spliced ​​after the encrypted ciphertext. Encryption of the data itself does not change the data size, and length overflow will occur after splicing the authentication tag. The encrypted data packet (data ciphertext) includes the encrypted ciphertext, authentication tag, and random vector. The key for this symmetric encryption is generated by the hash value of DvAgent passed in by the kernel startup item, which is a function that generates a 32-byte key from this hash value.

[0041] Add a payload to the encrypted data packet, that is, splice the data tag after the data ciphertext. The resulting data includes the encrypted ciphertext, authentication tag, random vector, and data tag. The data tag is used to identify that the data packet is encrypted and may contain private data. This tag is also generated by the hash value of DvAgent to ensure that the tags are the same in the same cluster. Therefore, the structure of the data after encryption is as follows: Figure 3 shown.

[0042] The data packet formed by the original plaintext after encryption will have a fixed 36 bytes more than the original data. Therefore, in order to maintain transparent transmission to the upper layer protocol, modifying the TCP and IP headers is a must. Because the data payload is increased, the seq and ack numbers of both parties must be changed. This change is cumulative, so it is necessary to track and record each connection. Therefore, the nf_conntrack module is used. This module will record all the data packets passing through this host, and at the same time provide some functions to modify the seq and ack numbers of the tracked connection data packets. The fields that need to be modified in the TCP and IP headers are not only the TCP seq and ack numbers, but also the TCP checksum field, the IP checksum field, and the total length field of the data packet. After changing these fields, the data packet can pass through the network normally to the peer host. The netfilter part on the peer end will first verify whether the data packet is encrypted. If not, it will pass directly. Otherwise, it will determine whether the data packet can be received. If not, it will be discarded directly. Otherwise, the data packet will be decrypted and the datagram header will be modified and handed over to the upper layer protocol for processing, and finally reach the application layer.

[0043] Not only user-mode processes can send data packets, the kernel can also send some messages, and even some hardware can also send data packets. In the Linux kernel, the connection corresponding to the data packet will be mapped to an abstract file, so the process that sent the data packet cannot be directly obtained. This invention uses a mapping from the process number pid to the source port to find the process number pid that occupies this source port, and then the process can be found through the process number pid. This mapping is implemented through a static array, so the upper limit of the number of ports is 65535, and this structure can be directly recorded in the kernel. The port and pid of this connection will be recorded during each three-way handshake of the connection and deleted after four handshakes.

[0044] In the sending part of the data packet, if the sender of the data packet is a user-mode process and has read the information in the security domain, the data content will be encrypted. When receiving the data packet, the peer host first decrypts it, decrypts the data packet to obtain the encrypted ciphertext, authentication tag, random vector and data tag, and then determines whether the data packet is an encrypted data packet based on the data tag. If it is an unencrypted data packet, it is passed directly; if it is an encrypted data packet, the corresponding process number pid of the data packet is obtained. According to the process number pid, the corresponding process is found, and it is determined whether it can be received based on the obtained process. If it cannot be received, the message is discarded; if it can be received, the TCP and IP headers are decrypted and modified and handed over to the upper layer protocol stack. Because there is only one security domain, the situation that this process cannot receive this data packet will only occur when the current process reads and writes a file outside the security domain. Other situations are allowed. If this process has not read the security domain, it is recorded that this process has read it.

[0045] The privacy protection method for network transmission provided by the embodiment of the present invention encrypts the data packet in transmission and adds a payload to the encrypted data packet, that is, marks an identification bit (data tag) to identify whether the data packet may contain privacy data. The kernel at the other end of the socket connection can know that all encrypted data packets may contain privacy data, so the kernel will perform permission verification on the process receiving the data packet to determine whether it can receive the data packet. If it can be received, the kernel will decrypt it and hand it over to the application layer. If it cannot be received, the packet will be directly discarded. The privacy protection method for network transmission provided by this embodiment provides additional protection for network communication, and satisfies the requirement that even if a process sends and receives data in the network, there will be no process leaking data outside the security domain, and the data can be controlled. At the same time, it also has high versatility and high compatibility.

[0046] In the above first embodiment, a privacy protection method for network transmission is provided. Correspondingly, the present application also provides a privacy protection system for network transmission. Figure 4 , which is a structural block diagram of a privacy protection system for network transmission provided by the second embodiment of the present invention. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0047] like Figure 4 As shown, a privacy protection system for network transmission provided by another embodiment of the present invention is shown, the system includes: a host and a peer host, characterized in that the host includes an acquisition module, an encryption module, a load adding module and an update protocol header module, and the peer host includes a receiving processing module, wherein the acquisition module is used by the host to obtain the original plaintext in the network transmission; the encryption module is used to encrypt the original plaintext using a symmetric encryption algorithm to obtain an encrypted data packet, and the data packet includes an encrypted ciphertext, an authentication tag and a random vector; the load adding module is used to add a load to the data packet to obtain a data packet including an encrypted ciphertext, an authentication tag, a random vector and a data tag, and the data tag is used to identify whether the data packet has been encrypted; the update protocol header module is used to track and count all data packets passing through the host, and modify the protocol header of the data packet to obtain a modified data packet and transmit the modified data packet to the peer host through the network; the receiving processing module receives the modified data packet, decrypts the modified data packet and searches for the corresponding process of the data packet, and determines whether the data packet can be received according to the process. If it cannot be received, the data packet is discarded; if it can be received, the data packet is decrypted and the protocol header is modified and handed over to the upper protocol stack for processing.

[0048] The symmetric encryption algorithm uses the AES-GCM algorithm. The protocol header includes the TCP seq number, ack number, TCP checksum field, IP checksum field, and total packet length field.

[0049] The receiving and processing module includes a process search unit, which is used to decrypt the data packet to obtain the encrypted ciphertext, authentication tag, random vector and data tag, and determine whether the data packet is an encrypted data packet based on the data tag. If it is an unencrypted data packet, it is passed directly. If it is an encrypted data packet, the corresponding process number of the data packet is obtained.

[0050] The privacy protection system for network transmission provided by the embodiment of the present invention encrypts the data packets in transmission and adds a payload to the encrypted data packets, that is, marks an identification bit (data tag) to identify whether the data packets may contain privacy data. The kernel at the other end of the socket connection can know that all encrypted data packets may contain privacy data, so the kernel will perform permission verification on the process receiving the data packet to determine whether it can receive the data packet. If it can be received, the kernel will decrypt it and hand it over to the application layer. If it cannot be received, the packet will be directly discarded. The privacy protection system for network transmission provided by this embodiment provides additional protection for network communications, and satisfies the requirement that even if a process sends and receives data in the network, there will be no process leaking data outside the security domain, and the data can be controlled. At the same time, it also has high versatility and high compatibility.

[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

Claims

1. A privacy protection method for network transmission, characterized in that: include: The host obtains the original plaintext transmitted over the network; The original plaintext is encrypted using a symmetric encryption algorithm to obtain an encrypted data packet, wherein the data packet includes the encrypted ciphertext, the authentication tag, and the random vector; The data packet obtained by adding a payload to the data packet includes an encrypted ciphertext, an authentication tag, a random vector and a data tag, wherein the data tag is used to identify whether the data packet has been encrypted and may contain private data; Track and count all data packets passing through the host, modify the protocol header of the data packet, obtain the modified data packet and transmit the modified data packet to the peer host through the network; The peer host receives the modified data packet, decrypts the modified data packet and searches for the corresponding process of the data packet, and determines whether the data packet can be received according to the process. If not, the data packet is discarded. If it can be received, the data packet is decrypted, the protocol header is modified and handed over to the upper protocol stack for processing; The process of decrypting the modified data packet and searching for the corresponding data packet specifically includes: Decrypt the data packet to obtain the encrypted ciphertext, authentication tag, random vector and data tag; Determine whether the data packet is an encrypted data packet according to the data label; If it is an unencrypted data packet, it will be passed directly; If it is an encrypted data packet, obtain the program number corresponding to the data packet.

2. The method according to claim 1, characterized in that The symmetric encryption algorithm adopts the AES-GCM algorithm.

3. The method according to claim 1, characterized in that The protocol header includes a seq number of TCP, an ack number, a checksum field of TCP, a checksum field of IP, and a total length field of the data packet.

4. A privacy protection system for network transmission, comprising a host and a peer host, characterized in that: The host includes an acquisition module, an encryption module, a load increase module and an update protocol header module, and the opposite host includes a receiving processing module. The acquisition module is used by the host to acquire the original plaintext in network transmission; The encryption module is used to encrypt the original plaintext using a symmetric encryption algorithm to obtain an encrypted data packet, which includes an encrypted ciphertext, an authentication tag and a random vector; The payload adding module is used to add a payload to a data packet to obtain a data packet including an encrypted ciphertext, an authentication tag, a random vector and a data tag, wherein the data tag is used to identify whether the data packet has been encrypted; The update protocol header module is used to track and count all data packets passing through the host, and modify the protocol header of the data packet to obtain the modified data packet and transmit the modified data packet to the opposite host through the network; The receiving processing module receives the modified data packet from the opposite host, decrypts the modified data packet and searches for the process corresponding to the data packet, determines whether the data packet can be received according to the process, and discards the data packet if it cannot be received; if it can be received, decrypts the data packet, modifies the protocol header, and hands it over to the upper protocol stack for processing; The receiving and processing module includes a process search unit, which is used to decrypt the data packet to obtain encrypted ciphertext, authentication tag, random vector and data tag, and determine whether the data packet is an encrypted data packet based on the data tag. If it is an unencrypted data packet, it is passed directly; if it is an encrypted data packet, the corresponding process number of the data packet is obtained.

5. The system according to claim 4, characterized in that The symmetric encryption algorithm adopts the AES-GCM algorithm.

6. The system according to claim 4, characterized in that The protocol header includes a seq number of TCP, an ack number, a checksum field of TCP, a checksum field of IP, and a total length field of the data packet.