Ciphertext confrontation sample detection and defense method based on secret sharing and medium
By using generative adversarial networks and secret filtering protocols in a privacy protection neural network based on secret sharing, the adversarial sample detection problem under data encryption is solved, and the adversarial sample detection is recognized and defended on the basis of data security is realized, and the model's immunity is improved. performance.
Patent Information
- Application Number
- CN202411069742.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art is difficult to identify and defend against adversarial samples while ensuring data security, especially in privacy protection neural networks based on secret sharing, where data encryption makes adversarial samples detection and defense difficult.
Design a method of ciphertext adversarial sample detection and defense based on secret sharing. By generating adversarial networks and privacy-protecting neural networks based on secret sharing, split the discriminator to encrypt and detect shallow and deep networks, and use secret filtering protocols Correct data to ensure data security and improve disturbance resistance.
Effectively identify and filter potential malicious data, enhance data transmission security, prevent malicious attackers from obtaining complete data, improve the anti-confrontation performance of the model, and ensure data privacy protection.
Smart Images

Figure CN119004529A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security technology, and in particular relates to a ciphertext adversarial sample detection and defense method and medium based on secret sharing. Background Art
[0002] Privacy-preserving neural networks based on secret sharing are a method that combines secret sharing technology and neural networks. They aim to solve the privacy leakage problem that may be involved in training or using neural networks. They can perform effective model training or inference while protecting user privacy. Traditional neural networks usually need to collect a large amount of user data in a centralized manner for model training, which may lead to user privacy exposure. Privacy-preserving neural networks based on secret sharing provide a distributed model training method. User data I is divided into k sub-data I i (i=1,2,...,k) and send them to the corresponding servers respectively. The k servers jointly train a distributed neural network model. During the training process, in order to ensure the accuracy of the calculation, communication between servers is required. Finally, the output O of each server is i (i=1,2,...,k) can be combined to get the output of the original data: O=O1+O2+...+O k .
[0003] In order to make the model trained on the original sample set give a classification output different from the original sample with high confidence, Christian Szegedy et al. proposed the concept of adversarial examples. The samples formed by adding carefully designed subtle perturbations to the original samples are called adversarial samples. Adversarial samples play a positive role in promoting model improvement and security testing, but their potential security threats, privacy leakage risks and challenges to model robustness cannot be ignored. In order to meet the growing demand for privacy and security, researchers have conducted research on privacy-preserving neural networks based on ciphertext. User data is encrypted and then transmitted to the server for calculation. However, data encryption also makes it difficult to detect and defend against adversarial samples. It is difficult to detect adversarial samples from sub-data. i The information of is used to infer whether the overall data I contains adversarial samples. Therefore, it is necessary to design a data privacy protection method that can identify adversarial samples while ensuring data security and further improve the anti-disturbance performance. Summary of the invention
[0004] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and to provide a ciphertext adversarial sample detection and defense method and medium based on secret sharing, which can identify adversarial samples while ensuring data security and further improve the anti-disturbance performance.
[0005] The purpose of the present invention can be achieved by the following technical solutions:
[0006] The present invention provides a ciphertext adversarial sample detection and defense method based on secret sharing, comprising the following steps:
[0007] Obtain user data I and input it into the secret sharing-based ciphertext adversarial sample detection and defense model for segmentation and reconstruction;
[0008] The ciphertext adversarial sample detection and defense model based on secret sharing includes a generative adversarial network and a privacy-preserving neural network based on secret sharing. The generative adversarial network includes a generator G and a discriminator D. The generator G is used to output generated samples, and the discriminator D is used to distinguish generated samples from real samples. The specific process of the ciphertext adversarial sample detection and defense model based on secret sharing processing user data I is as follows:
[0009] S1, split the discriminator D in the trained generative adversarial network into a shallow discriminant network D1 and a deep discriminant network D2;
[0010] S2, obtaining user data I, encrypting it through the shallow discriminant network D1, sending the encrypted user data I' to the deep discriminant network D2, judging whether the encrypted user data I' contains adversarial samples through the deep discriminant network D2, and obtaining a result set C;
[0011] S3. Determine whether the user who provides the user data I is a malicious user according to the proportion of the number of adversarial samples in the result set C. If not, directly divide the user data I into multiple sub-data and input them into the privacy-preserving neural network based on secret sharing; if yes, divide the user data I into multiple sub-data, execute the secret filtering protocol SFP for correction, and then input them into the privacy-preserving neural network based on secret sharing;
[0012] S4. The privacy-preserving neural network based on secret sharing reconstructs and calculates the received multiple sub-data and outputs them.
[0013] Furthermore, the generative adversarial network is trained based on a plaintext data set. During the training process, the generator G generates a sample x′ according to the random noise vector z output, and the generated sample x′ has the same distribution as the real sample x.
[0014] Furthermore, during the training process of the generative adversarial network, the minimum maximization loss function is used as the training objective, and the loss function includes generator loss and discriminator loss.
[0015] Furthermore, the loss function is expressed as follows:
[0016]
[0017] Among them, p data (x) is the distribution of the real sample x, p z (z) is the distribution of random noise vector z.
[0018] Furthermore, the specific process of step S1 is as follows:
[0019] The discriminator D has a total of k layers, which are L1, L2, ..., L k , the output of each layer is the input of the next layer, the threshold t is set, and the discriminator D is split into a shallow discriminant network D1 and a deep discriminant network D2, where the shallow discriminant network D1 contains the 1st to tth layers, and the deep discriminant network D2 contains the t+1th to kth layers.
[0020] Furthermore, the number of layers included in the shallow discriminant network D1 is smaller than the number of layers included in the deep discriminant network D2.
[0021] Furthermore, the privacy-preserving neural network based on secret sharing includes two servers S1 and S2, the user data I is divided into two sub-data I1 and I2, each sub-data corresponds to one server, and the specific process of executing the secret filtering protocol SFP for correction is as follows:
[0022] After receiving the sub-data I1, server S1 randomly adds a low-frequency noise K to obtain the encrypted sub-data I′1, and then sends it to server S2;
[0023] The server S2 adds the sub-data I2 to I′1 to obtain I′, and then performs high-pass filtering on I′ to obtain the high-frequency component ε′ in I′, and corrects the sub-data I2 to I′2.
[0024] Furthermore, the specific expression of the correction of the sub-data I2 is: I′2=I2-ε′.
[0025] Furthermore, in step S4, server S1 performs homomorphic encryption calculation on the input sub-data to obtain O1, and server S2 performs homomorphic encryption calculation on the input sub-data to obtain O2. The reconstruction result finally output by the privacy-preserving neural network based on secret sharing is O, O=O1+O2.
[0026] The present invention also provides a computer-readable storage medium on which a computer program is stored, and the program implements the above method when executed by a processor.
[0027] Compared with the prior art, the present invention has the following beneficial effects:
[0028] 1. The present invention segments and reconstructs user data I through a ciphertext adversarial sample detection and defense model based on secret sharing, wherein the ciphertext adversarial sample detection and defense model based on secret sharing includes a generative adversarial network and a privacy-preserving neural network based on secret sharing, the generative adversarial network includes a generator G and a discriminator D, which are respectively used to output generated samples and distinguish generated samples from real samples, the discriminator D in the trained generative adversarial network is split into a shallow discriminant network D1 and a deep discriminant network D2, the shallow discriminant network D1 is used to encrypt the user data I, and then sent to the deep discriminant network D2, to determine whether the encrypted user data I′ contains adversarial samples, and obtain a result set C, and determine whether the user providing the user data I is a malicious user according to the proportion of the number of adversarial samples in the result set C, if not, the user data I is directly segmented into multiple sub-data and input into the privacy-preserving neural network based on secret sharing, if it is , the user data I is divided into multiple sub-data, and after being corrected by the secret filtering protocol SFP, it is input into the privacy protection neural network based on secret sharing. Finally, the privacy protection neural network based on secret sharing reconstructs and calculates the received multiple sub-data and outputs them; in the above process, the user data is encrypted by the shallow discriminant network D1, which can enhance the security of the data during transmission. The encrypted data is tested for adversarial samples by the deep discriminant network D2, which can effectively identify and filter potential malicious data. The user data detected to contain adversarial samples is corrected by the secret filtering protocol SFP, which can further improve the purity and security of the data. After the user data is divided, it is reconstructed and calculated by the privacy protection neural network based on secret sharing, which can prevent malicious attackers from obtaining complete user data and protect data privacy. In summary, the above method can improve the anti-adversarial performance of the model while maintaining data security.
[0029] 2. In the ciphertext adversarial sample detection and defense model based on secret sharing designed by the present invention, the generative adversarial network is independent of the privacy-preserving neural network based on secret sharing. The generative adversarial network can be flexibly adjusted according to the requirements of specific tasks without affecting the privacy-preserving neural network based on secret sharing, and has strong flexibility and feasibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a schematic diagram of the structure of the ciphertext adversarial sample detection and defense model based on secret sharing.
[0031] Among them, D is the discriminator, D1 is the shallow discriminant network, D2 is the deep discriminant network, I is the user data, which is divided into sub-data I1 and I2, I′ is the encrypted user data, C is the result set, SFP is the secret filtering protocol, O1 and O1 are the homomorphic encryption calculation results corresponding to sub-data I1 and I2 respectively, and O is the reconstruction calculation result of the final output. DETAILED DESCRIPTION
[0032] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0033] Example:
[0034] This embodiment provides a ciphertext adversarial sample detection and defense method based on secret sharing, including the following steps:
[0035] Obtain user data I and input the ciphertext adversarial sample detection and defense model based on secret sharing for segmentation and reconstruction.
[0036] The ciphertext adversarial sample detection and defense model based on secret sharing is as follows: Figure 1 As shown, it includes a generative adversarial network GAN and a privacy-preserving neural network based on secret sharing. The privacy-preserving neural network based on secret sharing includes server S1 and server S2. The privacy-preserving neural network models based on secret sharing with the same structure and different parameters are deployed on the two servers. During the training or prediction process of the model, some calculations require communication between the two servers.
[0037] The generative adversarial network is trained by server S3 based on the plaintext dataset. The generative adversarial network includes a generator G and a discriminator D. The generator G generates a sample x′ based on the random noise vector z output, x′=G(z); the input of the discriminator D is a sample x, and the output is a scalar value y=D(x), y∈[0,1], which represents the probability that the input sample is a real sample. The goal of the discriminator D is to distinguish the real sample from the generated sample as accurately as possible.
[0038] In the training process of the Generative Adversarial Network (GAN), the minimum maximum loss function is used as the training objective. The loss function includes the generator loss and the discriminator loss. The specific expression is as follows:
[0039]
[0040] Among them, p data (x) is the distribution of the real sample x, p z (z) is the distribution of random noise vector z.
[0041] By continuously reducing the loss function during the training process, the generator G and the discriminator D are constantly improved in rounds of mutual confrontation. Eventually, the generator G can generate realistic samples, and the discriminator D is also very capable of distinguishing between real samples and synthetic samples. The discriminator D can detect plaintext adversarial samples.
[0042] The specific process of the ciphertext adversarial sample detection and defense model based on secret sharing to process user data I is as follows:
[0043] S1. Split the discriminator D in the trained generative adversarial network into a shallow discriminant network D1 and a deep discriminant network D2. The specific process is as follows:
[0044] Assume that the discriminator D has a total of k layers, which are L1, L2, ..., L k , the output of each layer is the input of the next layer. Set the threshold t, split the discriminator D into a shallow discriminant network D1 and a deep discriminant network D2, where the shallow discriminant network D1 contains the 1st to tth layers, and the deep discriminant network D2 contains the t+1th to kth layers. The threshold t is generally set to a small positive integer, so that the calculation amount of the shallow discriminant network D1 is small, which can improve the efficiency of preliminary data processing.
[0045] S2. Obtain user data I, encrypt it through the shallow discriminant network D1, send the encrypted user data I′ to the deep discriminant network D2, and use the deep discriminant network D2 to determine whether the encrypted user data I′ contains adversarial samples to obtain the result set C.
[0046] After the user sends a request to use the model, server S3 sends the shallow discriminant network D1 with less computational complexity to the user for data encryption, and retains the deep discriminant network D2 with more computational complexity in server S3 for detecting ciphertext adversarial samples.
[0047] When encrypting through the shallow discriminant network D1, let L i The mapping from layer input to output is f i (·), then:
[0048] I′=f t (f t-1 (…f1(I)))
[0049] When adversarial sample discrimination is performed through the deep discriminant network D2, the result set C is:
[0050] C = f k (f k-1 (…f t+1 (I′)))
[0051] S3. Divide the user data I into two sub-data I1 and I2, and determine whether the user who provides the user data I is a malicious user based on the proportion of the number of adversarial samples in the result set C. If not, directly input the sub-data I1 and I2 into the privacy-preserving neural network based on secret sharing; if so, perform the secret filtering protocol SFP on the sub-data I1 and I2 to correct them, and then input them into the privacy-preserving neural network based on secret sharing.
[0052] The specific process of executing the Secret Filter Protocol (SFP) for correction is as follows:
[0053] After receiving the sub-data I1, server S1 randomly adds a low-frequency noise K to obtain the encrypted sub-data I′1, I′1=I1+K, and then sends I11 to server S2. Server S2 adds sub-data I2 to I′1 to obtain I′, I′=I′1+I2=I1+I2+K=I+K, and then performs high-pass filtering on I′ to obtain the high-frequency component ε′ in I′, and corrects sub-data I2 to I′2, I′2=I2-ε′. Server S1 inputs data I1 into the model deployed on S1, and server S2 inputs data I′2 into the model deployed on S2. At this point, the secret filtering protocol SFP is completed.
[0054] S4. The privacy-preserving neural network based on secret sharing reconstructs and calculates the received multiple sub-data and outputs them.
[0055] Server S1 performs homomorphic encryption calculation on the input sub-data to obtain O1, and server S2 performs homomorphic encryption calculation on the input sub-data to obtain O2. The final reconstruction result output by the privacy-preserving neural network based on secret sharing is O, O=O1+O2.
[0056] The above method successfully realizes the function of identifying adversarial samples under the premise of data privacy security. Under the premise of data privacy security, it achieves the filtering effect, can eliminate a certain degree of adversarial disturbance, and improves the anti-adversarial performance of the model. The generative adversarial network GAN and the SFP filtering protocol are added on top of the privacy-preserving neural network based on secret sharing, and do not interfere with the privacy-preserving neural network based on secret sharing, which is easy to implement in practice.
[0057] If the above method is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0058] The above description of the embodiments is to facilitate the understanding and use of the invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present invention without departing from the scope of the present invention should be within the scope of protection of the present invention.
Claims
1. A ciphertext adversarial sample detection and defense method based on secret sharing, It is characterized in that The following steps are involved: Obtain user data I and input it into the secret sharing-based ciphertext adversarial sample detection and defense model for segmentation and reconstruction; The ciphertext adversarial sample detection and defense model based on secret sharing includes a generative adversarial network and a privacy-preserving neural network based on secret sharing. The generative adversarial network includes a generator G and a discriminator D. The generator G is used to output generated samples, and the discriminator D is used to distinguish generated samples from real samples. The specific process of the ciphertext adversarial sample detection and defense model based on secret sharing processing user data I is as follows: S1. Split the discriminator D in the trained generative adversarial network into a shallow discriminant network D 1 And the deep discriminative network D 2 ; S2, obtain user data I, through the shallow discriminant network D 1 Encrypt and send the encrypted user data I' to the deep discriminant network D 2 , through the deep discriminant network D 2 Determine whether the encrypted user data I' contains adversarial samples and obtain a result set C; S3. Determine whether the user who provides the user data I is a malicious user according to the proportion of the number of adversarial samples in the result set C. If not, directly divide the user data I into multiple sub-data and input them into the privacy-preserving neural network based on secret sharing; if yes, divide the user data I into multiple sub-data, execute the secret filtering protocol SFP for correction, and then input them into the privacy-preserving neural network based on secret sharing; S4. The privacy-preserving neural network based on secret sharing reconstructs and calculates the received multiple sub-data and outputs them.
2. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 1, It is characterized in that The generative adversarial network is trained based on a plaintext dataset. During the training process, the generator G generates a sample x according to the random noise vector z output. ′ , the generated sample x ′ has the same distribution as the true sample x.
3. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 1, It is characterized in that During the training process of the generative adversarial network, the minimum maximization loss function is used as the training objective, and the loss function includes the generator loss and the discriminator loss.
4. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 3, It is characterized in that The expression of the loss function is as follows: Among them, p data (x) is the distribution of the real sample x, p z (z) is the distribution of random noise vector z.
5. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 1, It is characterized in that The specific process of step S1 is as follows: The discriminator D has a total of k layers, which are L 1 , L 2 , ..., L k , the output of each layer is the input of the next layer, set the threshold t, and split the discriminator D into a shallow discriminant network D 1 And the deep discriminative network D 2 , where the shallow discriminant network D 1 Contains the 1st to tth layers, the deep discriminant network D 2 Contains layers t+1 to k.
6. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 5, It is characterized in that The shallow discriminant network D 1 The number of layers contained is less than the deep discriminative network D 2 The number of layers to include.
7. The method for detecting and defending against ciphertext adversarial samples based on secret sharing according to claim 1, It is characterized in that The privacy-preserving neural network based on secret sharing includes two servers S 1 and S 2 , user data I is divided into two sub-data I 1 and I 2 , each sub-data corresponds to a server, and the specific process of executing the secret filtering protocol SFP for correction is as follows: ServerS 1 Received subdata I 1 Afterwards, a low-frequency noise K is randomly added to obtain the encrypted sub-data I ′ 1 , and then sent to the server S 2 ; ServerS 2 Sub-data I 2 Plus I ′ 1 Get I ′ , then to I ′ Perform high-pass filtering to obtain I ′ The high-frequency component ε′ in the sub-data I 2 Corrected to I ′ 2 .
8. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 7, It is characterized in that Subdata I 2 The specific expression of the correction is: ′ 2 =I 2 -ε′.
9. According to the method for detecting and defending ciphertext adversarial samples based on secret sharing according to claim 7, It is characterized in that In step S4, the server S 1 Perform homomorphic encryption calculation on the input sub-data to obtain O 1 , server S 2 Perform homomorphic encryption calculation on the input sub-data to obtain O 2 , the final reconstruction result of the privacy-preserving neural network based on secret sharing is O, O = O 1 +O 2 .
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Plaintext anti-disturbance method and device for encrypted traffic
CN121077832A
A method and apparatus for resisting plaintext disturbances in encrypted traffic
CN121077832B
