Adversarial sample generation method based on artificial immune optimization algorithm

Through artificial immune optimization algorithm, SHAP is used to extract benign software features and dichotomy optimization perturbation rate, combined with fitness selection and double cloning method, solves the problem of large perturbation and slow speed in adversarial sample generation, improves the success rate and speed, and achieves Efficient adversarial example generation.

CN118552808AInactive Publication Date: 2024-08-27HEBEI NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410645874.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-08-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing adversarial sample generation methods have problems such as excessive amount of perturbation, damaging the executability of malware, or slow generation speed and low success rate.

Method used

Using a method based on artificial immune optimization algorithm, SHAP is used to extract benign software features, construct an initial population, and use the dichotomy method and fitness selection plus bi-cloning method to optimize the perturbation rate and population to improve the success rate and speed of generating adversarial samples.

Benefits of technology

It improves the success rate and speed of adversarial sample generation, reduces the number of algorithm iterations, enhances the intrusiveness of the disturbance information of the initial population, and achieves good adversarial sample generation effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552808A
    Figure CN118552808A
Patent Text Reader

Abstract

The invention relates to an adversarial sample generation method based on an artificial immune optimization algorithm, and the method comprises the following steps: 1, carrying out the feature extraction of pictures in a benign training set in a data set through employing an interpretable method SHAP, and constructing an initial population; 2, according to the range of the disturbance rate, calculating the sum of the fitness of the disturbance antibody obtained under different disturbance rates by using a dichotomy thought, and selecting an optimal disturbance rate; 3, updating the population by adopting a fitness selection and double cloning method; according to the method, benign characteristic files of benign software are extracted through the SHAP method to form the initial population, the number of algorithm iterations is reduced, and the invasion of disturbance information in the initial population is improved; the optimal disturbance rate is selected according to the fitness sum calculated according to the fitness of each antibody in the population by using a dichotomy thought strategy, the sample disturbance rate is reduced, and the generation success rate of the confrontation sample is improved; the population is optimized by adopting a fitness selection and double cloning method, the convergence speed of the algorithm is accelerated, and good adversarial sample generation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for generating adversarial samples based on an artificial immune optimization algorithm, and belongs to the field of network security adversarial attacks. Background Art

[0002] In recent years, computer systems have been widely used in human production activities, the scale of the software industry has become increasingly large, and malicious software directly threatens the security of computer systems, causing huge economic losses to users. Therefore, it is necessary to further study the methods of countering attacks, which is conducive to the mutual exploration and progress of countering defense.

[0003] Since the classification models built by machine learning or deep learning algorithms inevitably have the disadvantages of underfitting or overfitting, their generalization ability and robustness are not enough to resist adversarial attacks. In response to this, many scholars have proposed various adversarial sample generation algorithms for neural networks, one of which is to apply visualization technology to malicious code classification. The visualization method converts the software into an image, extracts the texture and global features of the code image, and uses machine learning or deep learning models to classify the image, thereby realizing the detection and classification of malicious code.

[0004] At present, there have been some attempts at adversarial attacks against malicious code visualization technology, such as appending perturbations to the tail of grayscale images to be misdetected to form adversarial samples; introducing some small perturbations on the image based on gradient descent to make it evade detection or mislead the classifier to form adversarial samples; modifying and adding bytecodes, using the gap space and expansion space generated by the alignment mechanism to bypass the deep learning model to form adversarial samples; using tail injection and section injection based on genetic algorithms, and continuously optimizing the perturbation to generate adversarial samples without destroying the executableness and maliciousness of the malware. However, the above-mentioned methods may have problems such as too large perturbation injection, or destroying the executableness and maliciousness of the malware during the adversarial sample formation process, or too slow adversarial sample generation speed, and low adversarial sample generation rate. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide an adversarial sample generation method based on an artificial immune optimization algorithm, which can improve the intrusion of the initial population, improve the success rate of adversarial sample generation in a small perturbation range, and accelerate the convergence speed of the algorithm in generating adversarial samples.

[0006] The present invention adopts the following technical solution:

[0007] The adversarial sample generation method based on the artificial immune optimization algorithm of the present invention adopts the following steps:

[0008] S1. Use the interpretable method SHAP to extract features from the images in the benign training set in the dataset, convert them into byte format, form a benign feature file, randomly select byte segments from the benign feature file, and construct the initial population;

[0009] S2. According to the range of perturbation rates, the idea of ​​dichotomy is used to calculate the sum of fitness of perturbation antibodies obtained under different perturbation rates, and the optimal perturbation rate is selected according to the sum of fitness;

[0010] S3. Use fitness selection plus double cloning method to update the population.

[0011] The specific process of S1 of the present invention is as follows:

[0012] S11. Use the deep neural network training data set to obtain a binary classification model for malware images;

[0013] S12, using the interpretable method SHAP to randomly extract b significant features of benign software from the training set of the binary classification model, obtain the coordinate values ​​of the first d pixels with the highest SHAP values ​​in the grayscale image of the benign software, reverse the grayscale image of these d pixels in sequence, convert them into byte format, and store them in a text file to form a benign feature file, which contains a total of b×d bytes of data;

[0014] S13. Randomly select pop_size ori_size×ε from the benign feature file h benign byte segments, forming the initial population n; ε h is the maximum perturbation rate, and ori_size is the original malicious sample size.

[0015] The present invention S2 specifically adopts the following steps:

[0016] S21, the custom perturbation rate range is [ε l , ε h ],ε l is the minimum perturbation rate, ε h is the highest perturbation rate, and use pointers left and right to point to them respectively; initialize the variable to M ε ;

[0017] S22, obtain the middle position mid by taking the average of the left and right positions;

[0018] S23, respectively compare the values ​​of the left, mid and right positions as the sum of the fitness of the perturbation antibody s sum_l , S sum_m and sum_r ;

[0019] S24, adjust the search range and variable Mε The value, specifically:

[0020] If s sum_l The value of is greater than the fitness threshold, set the variable M ε The value of is the value of the pointer left position and the loop ends; the fitness threshold is 10% of the maximum fitness sum value; the maximum fitness sum value is the maximum fitness value that can be achieved by the antibodies in the population multiplied by the initial population number;

[0021] If s sum_l 、s sum_m and sum_r The values ​​of the three are the same, set the variable M ε The value of is the value of the pointer right position and the loop ends;

[0022] If s sum_m The value of is greater than the other two values, set the variable M ε The value of is the value of the mid pointer position and the loop ends;

[0023] In s sum_l and sum_r The value of is greater than s sum_m If s sum_l Greater than s sum_r , let the pointer right point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the left pointer position, otherwise let the pointer left point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the right pointer position;

[0024] If s sum_l Greater than s sum_m , right points to mid and sets the variable M ε The value is the value of the left pointer position;

[0025] If none of the above conditions are met, left points to mid and sets the variable M ε The value is the value of the right pointer position;

[0026] S25, repeat S22 to S24 until the loop ends or the preset number of iterations is reached, and obtain the variable M ε The value of is the optimal disturbance rate.

[0027] The present invention S3 is specifically composed of:

[0028] n i =c1+c2+argpartition(n i-1, g) (3)

[0029] Among them, n i Indicates the population to be updated in the i-th iteration; select according to the sum of the fitness value s and the affinity value A of the antibody in the population, and select the first clo_num antibodies with the highest s+A value to form a clone c, where the value of clo_num is an integer less than half the size of the population; c1 and c2 are new subpopulations obtained by mutation and crossover of clone c using different mutation parameters; argpartition(n i-1 , g) is to obtain the population n i-1 The first g antibodies with the largest fitness; the number of g is obtained by subtracting the number of subpopulations c1 and c2 from the population size pop_size.

[0030] The affinity value A of the present invention is: the similarity is calculated by comparing the antibody X in the population with all antibodies in the population including itself by single byte, and the affinity value A is the cumulative sum of the similarity values; the specific calculation formula is as follows:

[0031]

[0032]

[0033] In the formula, b j Represents the jth byte of antibody X whose affinity is to be calculated; Represents the i-th antibody X in the population i The jth byte of ; the size value is the byte length of antibody X.

[0034] The method for obtaining the sum of fitness described in the present invention is:

[0035] The antibodies in the population are used as perturbation information and injected into the original malicious samples to generate pop_size perturbation samples. All the generated perturbation samples are converted into grayscale images and input into the detection model f to obtain their respective fitness values. The obtained pop_size fitness values ​​are accumulated to get the total fitness.

[0036] The detection model f described in the present invention is a high-precision malware image classifier obtained by training a data set through a neural network, and performs a binary classification task.

[0037] The specific calculation formula of the fitness value of the present invention is as follows:

[0038] s=f(I(x+X)) (1)

[0039] I=IO+SO (2)

[0040] In the formula, s represents the fitness value, x represents the original sample, X represents the injected disturbance information, i.e., the antibodies in the population, and I represents the injection operation. The I operation is a strategy of combining the section tail gap injection operation IO with the section injection operation SO. Specifically, IO is a replacement injection of a segment of bytes from the actual size of each section of the malicious PE to the beginning of the offset position of the next section. Specifically, SO is to change the offset of the section table pointer and perform benign byte injection before the last section.

[0041] The positive effects of the present invention are as follows: the present invention extracts the benign characteristic files of benign software through the SHAP method to form an initial population, reduces the number of algorithm iterations, and improves the invasiveness of the disturbance information in the initial population; utilizes the binary thinking strategy, selects the optimal disturbance rate according to the sum of fitness calculated according to the fitness of each antibody in the population, achieves the effect of reducing the sample disturbance rate and improving the success rate of adversarial sample generation; adopts the fitness selection plus double cloning method to optimize the population, accelerates the convergence speed of the algorithm, and achieves a good adversarial sample generation effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 is a flow chart of the method of the present invention;

[0043] Figure 2 A schematic diagram of a process for generating an initial population for the present invention;

[0044] Figure 3 A schematic diagram of the process of generating adversarial samples according to the present invention. DETAILED DESCRIPTION

[0045] The present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation examples described herein are only used to explain the present invention and are not intended to limit the present invention:

[0046] like Figure 1 As shown, the adversarial sample generation method based on the artificial immune optimization algorithm provided by the embodiment of the present invention includes the following steps:

[0047] S101, using the interpretable method SHAP to extract features from the images in the benign training set in the data set, reversely converting them into byte format to form a benign feature file, randomly selecting byte segments from the benign feature file, and constructing an initial population;

[0048] S102, according to the range of perturbation rates, using the dichotomy idea, calculating the sum of fitness of perturbation antibodies obtained under different perturbation rates, and selecting the optimal perturbation rate according to the sum of fitness;

[0049] S103, using fitness selection plus double cloning method to update the population.

[0050] like Figure 2 ,3 As shown, the adversarial sample generation method based on the artificial immune optimization algorithm provided by the embodiment of the present invention includes the following steps:

[0051] The specific process of constructing the initial population in S101 is as follows:

[0052] (1) A high-precision binary classification model for malware images was trained using the resnet18 neural network. The data in the training dataset was divided into a training set and a test set. Malware samples were obtained by converting PE files in VirusShare into grayscale images, and benign software was obtained by converting PE files in the Windows system into grayscale images. The conversion rules of the grayscale images were consistent with those of the Malimg dataset.

[0053] (2) Using the interpretable method SHAP, benign significant features are extracted from b random benign software in the training set, and the coordinate values ​​of the first d pixels with higher SHAP values ​​(i.e., the contribution value of each pixel to the prediction result of the binary classification model) in the grayscale image of each benign software are obtained. The grayscale images of these d pixels are reversed in sequence, converted into byte format, and stored in a text file to form a benign feature file, which contains a total of b×d bytes of data. In the process of benign feature extraction, the grayscale image is not clipped in width; the size of d can be determined according to needs;

[0054] (3) Randomly select pop_size ori_size×ε from the benign feature file h benign byte segments, forming the initial population n; ε h is the highest perturbation rate, ori_size is the original malicious executable file size;

[0055] The purpose of selecting the optimal perturbation rate in step S102 is to reduce the sample perturbation rate, improve the success rate of malware adversarial sample generation and the quality of adversarial sample generation; the specific steps include:

[0056] (1) The range of custom perturbation rate is [ε l , ε h ],ε l is the minimum perturbation rate, ε h is the maximum disturbance rate, and two pointers left and right point to them respectively; initialize the variable M ε ; In this example, the disturbance rate range is [0.01, 0.1];

[0057] (2) Get the middle position mid by taking the average of the left and right positions;

[0058] (3) Compare the fitness sum s of the perturbation antibodies with the values ​​of the left, mid and right positions as the perturbation ratesum_l 、s sum_m and sum_r ;

[0059] (4) Adjust the search range and variable M ε The value, specifically:

[0060] If s sum_l The value of is greater than the fitness threshold, set the variable M ε The value of is the value of the left pointer position and the loop ends; the fitness threshold is the minimum fitness sum value for completing the adversarial sample generation task (that is, in order to select a small perturbation rate under the condition that the adversarial sample can be generated equally: for example, the fitness sums corresponding to the perturbation rates of 1% and 5% are 10 and 20 respectively, but the fitness sum of 10 has reached the standard for generating adversarial samples); the fitness threshold of this embodiment is preset to 5;

[0061] If s sum_l 、s sum_m and sum_r The values ​​of the three are the same, set the variable M ε The value of is the value of the right pointer position and the loop ends;

[0062] If s sum_m The value of is greater than the other two values, set the variable M ε The value of is the value of the mid pointer position and the loop ends;

[0063] In s sum_l and sum_r The value of is greater than s sum_m If s sum_l Greater than s sum_r , let the pointer right point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the left pointer position, otherwise let the pointer left point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the right pointer position;

[0064] If s sum_l Greater than s sum_m , right points to mid and sets the variable M ε The value is the value of the left pointer position;

[0065] If none of the above conditions are met, left points to mid and sets the variable M ε The value is the value of the right pointer position;

[0066] (5) Repeat steps (2) to (4) until the loop ends or the preset number of iterations reaches 3, and the variable M is obtained. ε The value of is the optimal perturbation rate;

[0067] The method for obtaining the total fitness is as follows: the perturbation information contained in the antibodies in the population is injected into the original executable malicious sample through injection operations to generate pop_size perturbation antibodies, all the generated perturbation antibodies are converted into grayscale images and then input into the detection model f to obtain their respective fitness values, and the obtained pop_size fitness values ​​are accumulated to obtain the total fitness.

[0068] f is the detection model in the experiment, which is a high-precision malware image classifier obtained by training the data set through a neural network, and performs a binary classification task; in this embodiment, deep neural networks such as DenseNet121, MobilenetV2 and ResNet18 are used.

[0069] The specific calculation formula of the fitness value is as follows:

[0070] s=f(I(x+X)) (1)

[0071] I=IO+SO (2)

[0072] Where s represents the fitness value, x is the original sample, X is the injected perturbation information, i.e., the antibody in the population, and I is the injection operation. The I operation is a strategy of combining the section tail gap injection operation IO with the section injection operation SO. IO specifically performs replacement injection in the last unused space of each section of the malicious executable sample. SO specifically changes the offset of the section table pointer and performs benign byte injection before the last section. The range of the obtained fitness value is [0, 1].

[0073] S103 uses fitness selection plus double cloning method to update the population and optimize the antibodies in the population; the specific composition is:

[0074] n i =c1+c2+argpartition(n i-1 , g) (3)

[0075] Among them, n i Indicates the population to be updated in the i-th iteration; select according to the sum of the fitness value s and the affinity value A of the antibody in the population, and select the first clo_num antibodies with the highest s+A value to form a clone c, where the value of clo_num is an integer less than half the size of the population; c1 and c2 are new subpopulations obtained by mutation and crossover of clone c using different mutation parameters; argpartition(n i-1 , g) The formula means to obtain the population ni-1 The first g antibodies with the largest fitness; the number of g is obtained by subtracting the number of subpopulations c1 and c2 from the initial population size pop_size.

[0076] The affinity value A is obtained by calculating the similarity between antibody X in the population and all antibodies in the population including itself in the form of single byte comparison and then accumulating the similarity values. The purpose is to use the similarity of antibodies as an influencing factor to affect the population optimization direction and accelerate the convergence speed of the algorithm. The calculation formula of affinity value A is as follows:

[0077]

[0078]

[0079] Where b j Represents the jth byte of antibody X whose affinity is to be calculated; Represents the i-th antibody X in the population i The jth byte of ; the size value is the byte length of antibody X; pop_size is the population size.

[0080] In this embodiment, the preset value of the population size pop_size is 50, the preset value of clo_num is 23, and the mutation operation is specifically as follows:

[0081]

[0082]

[0083] Among them, VO i is the ith antibody X i After the mutation operation, Three mutually exclusive antibodies X from the population r , X m , X q Obtained in Represents X r The jth byte in The mutated antibody VO i The jth byte of ; F is the scaling factor, which controls the variability of the population antibodies. The value range of F is [0.1, 1]. The two mutation parameters F1 used in this experiment are preset to 0.2 and F2 are preset to 0.8.

[0084] Crossover operation; specifically

[0085]

[0086]

[0087] Among them, CO i is the i-th variant antibody VOi For antibodies after the crossover operation, rand(0, 1) represents the generation of a random number between 0 and 1, and the crossover parameter CR is preset to 0.7.

[0088] Example:

[0089] Programming language: python3.9 Dependency environment: pytorch1.13.1

[0090] Data source and dataset composition: This embodiment randomly extracts 4,000 malicious samples from the malware collected by VirusTotal, and collects 3,000 benign samples from the Windows system. These samples are converted into grayscale images according to the grayscale image conversion rules of the Malimg dataset to obtain 7,000 image samples. These images are divided into training sets and test sets according to the benign and malicious labels in a ratio of 4:1 (that is, the training set contains 3,200 malicious samples and 2,400 benign samples; the test set contains 800 malicious samples and 600 benign samples).

[0091] Detection model: The dataset was trained by three models: DenseNet121, MobilenetV2 and ResNet18. Image preprocessing was performed by scaling the image to 300×300 pixels, and three image binary classification models with accuracy rates of 98.8%, 97.3% and 98% were obtained.

[0092] Model used by the SHAP method: The data set was trained using the resnet18 neural network, and the model binary classification test result was 91.87%; the image was preprocessed during the network training process without rotation or width cropping, and the height was cropped to the same height as the width; the purpose of the above preprocessing is to extract effective image feature textures in the subsequent process of interpreting the model using the SHAP method (Note: in this example, only this model uses this image preprocessing).

[0093] The interpretable method SHAP is used to extract features from 100 random benign software grayscale images selected from the training set according to the above step S101, and the extracted benign bytes are stored in a text file named Benignfeature.txt. Benignfeature.txt is the benign feature file of this experiment.

[0094] It is known that the disturbance rate range selected in this embodiment is [0.01, 0.1], which means that the disturbance range is 1% to 10%; 300 executable malicious samples are randomly selected from the collected malware to generate adversarial samples; assuming that the size of the malicious sample is size; then the size of each antibody in the population is 0.1×size; 50 byte segments of 0.1×size are randomly selected from Benignfeature.txt to form the initial population.

[0095] The process of finding the optimal perturbation rate using the binary search method: the strategy described in S102 is used to calculate the sum of the fitness of the initial population at different perturbation rates in the range of [0.01, 0.1], and find the optimal perturbation rate; this process can solve the problem that in the process of generating adversarial samples, some samples do not have better effects when the perturbation injected is higher, thereby improving the success rate of generating adversarial samples.

[0096] During the population optimization process, the fitness selection plus double cloning method described in S103 is used to update the population, and the population is continuously optimized until adversarial samples are generated or the preset number of iterations, 200, is reached; finally, the success rates of malware adversarial sample generation for the three image classification models are DenseNet121: 98.5%, MobilenetV2: 86.5%, and ResNet18: 89%, respectively.

[0097] The present invention extracts benign characteristic files of benign software through the SHAP method to form an initial population, reduces the number of algorithm iterations, and improves the invasiveness of disturbance information in the initial population; utilizes the binary thinking strategy, selects the optimal disturbance rate according to the fitness sum calculated by the fitness of each antibody in the population, achieves the effect of reducing the sample disturbance rate and improving the success rate of adversarial sample generation; adopts the fitness selection plus double cloning method to optimize the population, accelerates the convergence speed of the algorithm, and achieves a good adversarial sample generation effect.

[0098] The above description is only a preferred example of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit of the present invention are within the protection scope of the present invention.

Claims

1. A method for generating adversarial samples based on artificial immune optimization algorithm. It is characterized in that Use the following steps: S1. Use the interpretable method SHAP to extract features from the images in the benign training set in the dataset, convert them into byte format, form a benign feature file, randomly select byte segments from the benign feature file, and construct the initial population; S2. According to the range of perturbation rates, the idea of ​​dichotomy is used to calculate the sum of fitness of perturbation antibodies obtained under different perturbation rates, and the optimal perturbation rate is selected according to the sum of fitness; S3. Use fitness selection plus double cloning method to update the population.

2. The adversarial sample generation method based on the artificial immune optimization algorithm according to claim 1, It is characterized in that The specific process of S1 is as follows: S11. Use the deep neural network training data set to obtain a binary classification model for malware images; S12, using the interpretable method SHAP to randomly extract b significant features of benign software from the training set of the binary classification model, obtain the coordinate values ​​of the first d pixels with the highest SHAP values ​​in the grayscale image of the benign software, reverse the grayscale image of these d pixels in sequence, convert them into byte format, and store them in a text file to form a benign feature file, which contains a total of b×d bytes of data; S13. Randomly select pop_size ori_size×ε from the benign feature file h benign byte segments, forming the initial population n; ε h is the maximum perturbation rate, and ori_size is the original malicious sample size.

3. The adversarial sample generation method based on artificial immune optimization algorithm according to claim 1, It is characterized in that S2 specifically adopts the following steps: S21, the custom perturbation rate range is [ε l , ε h ],ε l is the minimum perturbation rate, ε h For the highest perturbation rate, use pointers left and right to point to them respectively; Initialize the variable to M ε ; S22, obtain the middle position mid by taking the average of the left and right positions; S23, respectively compare the values ​​of the left, mid and right positions as the sum of the fitness of the perturbation antibody s sum_l 、s sum_m and sum_r ; S24, adjust the search range and variable M ε The value of, specifically: If s sum_l The value of is greater than the fitness threshold, set the variable M ε The value of is the value of the pointer left position and the loop ends; the fitness threshold is 10% of the maximum fitness sum value; the maximum fitness sum value is the maximum fitness value that can be achieved by the antibodies in the population multiplied by the initial population number; If s sum_l 、s sum_m and sum_r The values ​​of the three are the same, set the variable M ε The value of is the value of the pointer right position and the loop ends; If s sum_m The value of is greater than the other two values, set the variable M ε The value of is the value of the mid pointer position and the loop ends; In s sum_l and sum_r The value of is greater than s sum_m If s sum_l Greater than s sum_r , let the pointer right point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the left pointer position, otherwise let the pointer left point to mid, then let mid point to the middle value of left and right and set the variable M ε The value is the value of the right pointer position; If s sum_l Greater than s sum_m , right points to mid and sets the variable M ε The value is the value of the left pointer position; If none of the above conditions are met, left points to mid and sets the variable M ε The value is the value of the right pointer position; S25, repeat S22 to S24 until the loop ends or the preset number of iterations is reached, and obtain the variable M ε The value of is the optimal disturbance rate.

4. The adversarial sample generation method based on the artificial immune optimization algorithm according to claim 1, It is characterized in that The specific composition of S3 is: n i =c1+c2+argpartition(n i-1 ,g) (3) Among them, n i Indicates the population to be updated in the i-th iteration; select according to the sum of the fitness value s and the affinity value A of the antibody in the population, and select the first clo_num antibodies with the highest s+A value to form a clone c, where the value of clo_num is an integer less than half the size of the population; c1 and c2 are new subpopulations obtained by mutation and crossover of clone c using different mutation parameters; argpartition(n i-1 , g) is to obtain the population n i-1 The first g antibodies with the largest fitness; the number of g is obtained by subtracting the number of subpopulations c1 and c2 from the population size pop_size.

5. The method for generating adversarial samples based on artificial immune optimization algorithm according to claim 4, It is characterized in that The affinity value A is: The similarity is calculated by comparing the single byte of antibody X in the population with all antibodies in the population including itself. The affinity value A is the cumulative sum of the similarity values. The specific calculation formula is as follows: In the formula, b j Represents the jth byte of antibody X whose affinity is to be calculated; Represents the i-th antibody X in the population i The jth byte of ; the size value is the byte length of antibody X.

6. The method for generating adversarial samples based on artificial immune optimization algorithm according to claim 3, It is characterized in that The method for obtaining the sum of fitness is: The antibodies in the population are used as perturbation information and injected into the original malicious samples to generate pop_size perturbation samples. All the generated perturbation samples are converted into grayscale images and input into the detection model f to obtain their respective fitness values. The obtained pop_size fitness values ​​are accumulated to get the total fitness.

7. The method for generating adversarial samples based on artificial immune optimization algorithm according to claim 6, It is characterized in that The detection model f is a high-precision malware image classifier obtained by training the dataset through a neural network, and performs a binary classification task.

8. The method for generating adversarial samples based on artificial immune optimization algorithm according to claim 6, It is characterized in that The specific calculation formula of the fitness value is as follows: s=f(I(x+X)) (1) I=IO+SO (2) In the formula, s represents the fitness value, x represents the original sample, X represents the injected disturbance information, i.e., the antibodies in the population, and I represents the injection operation. The I operation is a strategy of combining the section tail gap injection operation IO with the section injection operation SO. Specifically, IO is a replacement injection of a segment of bytes from the actual size of each section of the malicious PE to the beginning of the offset position of the next section. Specifically, SO is to change the offset of the section table pointer and perform benign byte injection before the last section.

Citation Information

Cited By

  • Adversarial sample generation method, system and device in combination with disturbance evolution in sample and disturbance amplitude normalization, and storage medium

    CN120932075A