Method for training a neural network to classify files into file classes, method for classifying files into file classes, and file classification device
Patent Information
- Application Number
- EP2023753806
- Authority / Receiving Office
- EP · EP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-07-29
- Filing Date
- 2023-07-25
- Publication Date
- 2025-04-30
AI Technical Summary
Existing file classification methods, especially in IT security and manufacturing, are inflexible and prone to failures when file formats change, as they rely on specific patterns that can no longer be recognized with new versions or adaptations, limiting the effectiveness of neural networks in maintaining stable classification.
Training neural networks using bit sequences of files, where the neural network focuses on general structural features rather than rigid patterns, and utilizing recurrent neural networks to classify files into classes, allowing for flexible and robust classification across format changes.
The method enables a neural network to classify files more efficiently and accurately, remaining stable against format adjustments and utilizing all file information for reliable classification, improving the robustness and accuracy of file classification.
Smart Images

Figure 1.1
Abstract
Description
[0001] Description
[0002] Method for training a neural network for classifying files into file classes, method for classifying files into file classes and file classification device
[0003] The invention relates to a method for training a neural network for classifying files into file classes, a method for classifying files into file classes and a file classification device.
[0004] Particularly in the area of IT security, i.e., information and / or functional security, the task of classifying files regularly arises. For example, malicious code in a file may be concealed using a security tool. Thus, the detection of a previous application of a security tool to a file may indicate a compromise in IT security. Classifying files can, in particular, reveal whether or not such a security tool was used. A file can thus be protected with security tools or remain unprotected. Such classification into file classes is regularly required for processing such files, for example, in manufacturing and / or automation systems.
[0005] Classifying files, also referred to as classifying files in the context of the present application, means assigning a file to exactly one of two or more predefined file classes. If there are exactly two file classes, this is referred to as binary classification; otherwise, it is referred to as multinomial classification. In binary classification, file classes can either form endpoints of a continuous scale, such as a continuous scale between the endpoints “large file” and “small file” when classifying file lengths, whereby in this example a clear, unambiguous classification is only possible in the end ranges of the continuous scale. However, an unambiguous classification can also be made based on information about the presence or absence of a specific property: a property is therefore either present or the property is not present.Such a property could be the property "File contains ASCII text," which is either present or absent. With multinomial classification, file classes can be categorized into more than two file classes. Preselected file types can form such file classes, such as the file types "Excel file," "PDF file," and "JPEG file."
[0006] It is known to perform such classification by searching the file to be classified for the string '%PDF' at the beginning of the file. Such classification is perfectly possible as long as the string appears in the file in exactly this form. However, with new versions of file types, such strings can change slightly. If strings are changed, however, such classification no longer works.
[0007] In principle, neural networks can also be used to classify files. However, even neural networks rely on recognizing such strings during continuous training, so the use of neural networks offers no significant advantage in this regard.
[0008] It is therefore an object of the invention to provide a method for training a neural network for classifying files into file classes that is improved compared to the prior art, as well as an improved method for classifying files into file classes and to provide a file classification device that is improved compared to the prior art.
[0009] In the method according to the invention for training a neural network for classifying files into file classes, a plurality of test files are used, each of which is assigned to a file class, wherein the test files are each broken down into bit sequences that remain assigned to the previously assigned file class and the neural network is trained with the bit sequences.
[0010] By means of the method according to the invention, neural networks can be advantageously used for very flexible recognition of file classes, unlike previously known methods, by suitably training neural networks with test files. According to the invention, the test files, i.e., the training files, are advantageously prepared in such a way that the neural network does not have to base its judgment on very specific, rigidly defined patterns in the contents of the test files, such as "the third byte always has the value 17." Rather, the neural network focuses significantly more strongly on structural properties of the test content than previously known.
[0011] Using the test files broken down into bit sequences according to the invention, the neural network is specifically trained to classify the contents of the test files based on general structural features, such as "a comma occurs in the file at more or less regular intervals." According to the invention, the neural network cannot therefore rely on rigid patterns that can no longer be recognized, or at least no longer reliably, if this pattern changes, for example, as a result of an adaptation of a file format due to new file versions or new file standards. Rather, using the method according to the invention, the classification remains stable against changes made to the file formats at a time after training, as long as at least the basic structure of the file contents is retained.A conventional classification, on the other hand, which only searches for the string '%PDF' at the beginning of the file, only works perfectly as long as the string occurs there in exactly that form. However, if this string is changed even minimally in a new version of the format or moved to a different location, the recognition rule no longer works at all. According to the invention, a first neural network can therefore be trained in a significantly improved manner compared to the prior art. The neural network trained in this way is advantageously designed for flexible classification that is less susceptible to adaptations of file formats. The neural network can therefore be trained much more efficiently using the method according to the invention, and the neural network trained using the method according to the invention functions significantly more accurately.
[0012] Preferably, in the method according to the invention, the training files are completely decomposed into bit sequences. In other words, each bit of the training files is expediently incorporated into at least one bit sequence with which the neural network is trained. In this way, all the information contained in the training files is used to train the neural network.
[0013] In the method according to the invention, the neural network is expediently trained with the bit sequences in a random sequence, particularly in a randomized sequence. This prevents the neural network from interpreting the sequence of bit sequences as information and consequently assigning a meaning to this sequence of bit sequences that could influence the classification by the neural network. Due to the random sequence, particularly in a randomized sequence, the sequence does not form a pattern that can be evaluated by the neural network. Instead, the neural network is trained to use more general structural features that can be recognized in the bit sequence for classification.
[0014] In a preferred development of the method according to the invention, the neural network is a recurrent first neural network, i.e. a first neural network which is known in English as a "recurrent neural network". Such a "recurrent neural network" has a type of "memory" and thus has the option of incorporating a previous number of bits of a bit sequence into the classification decision for the current bit sequence. This makes it possible, in particular, to apply the neural network to bit sequences of any length, instead of being restricted from the outset to bit sequences of a fixed length due to its input format. In addition, bit sequences of a fixed length would mean that during training the network would have to independently learn every structural relationship between consecutive bits for every position within the specified block length, whereas when recurrent networks are used, a relationship with the local context, i.e.i.e. learning is done with the “history” of the last bit sequences, regardless of the exact position of the current bit sequence within the file.
[0015] In the method according to the invention for classifying at least one file into file classes, a first neural network is used, which is or is being trained according to an inventive method for training a neural network for classifying files into file classes, as described above, and in the method at least two different sections in the form of bit sequences are used from the file, and the bit sequences are each classified into candidate file classes using the first neural network, and a file class is determined depending on the candidate file classes. Since, according to the invention, a first neural network trained by means of the method according to the invention for training a first neural network for classifying files into file classes is used, the method according to the invention advantageously enables a flexible, ieRobust classification of files is possible against adaptations of a particular file format.
[0016] Preferably, in the method according to the invention, the files are completely broken down into bit sequences. Thus, all information contained in a file is used to classify the file. The reliability of the file classification is further improved in this development of the method according to the invention.
[0017] In a preferred embodiment of the method according to the invention, the classification is performed for several different bit sequences of each of the at least one files, wherein the bit sequences taken together preferably form the at least one file. The information content of the file can be better utilized by means of the several different bit sequences. In particular, in the case where the several different bit sequences taken together form the respective file, the entire available content of the file is used for classification.
[0018] In the method according to the invention, the candidate file classes into which the bit sequences are classified are determined together with the position of the respective bit sequence within the file. In this way, the position of the bit sequence can be used as additional information during the final classification of the file.
[0019] In the method according to the invention, the file class, ie the final result of the classification method based on the candidate file classes, is suitably determined in such a way that for each file, the candidate file class into which the most bit sequences are classified is determined as the file class for this file.
[0020] In the method according to the invention, the file class is preferably determined in such a way that for each candidate file class, a measure of the bit sequence's affiliation to this candidate file class, which the first neural network assigns to the bit sequence, is determined and used to determine the file class.
[0021] Such a measure of the bit sequence's membership in this candidate file class can also be referred to as a classification value. The classification value is typically a number between 0 and 1 and indicates a clear assignment to the respective candidate file class, for example, by means of a value closer to 0 or closer to 1, while an unclear assignment is often expressed by values close to 0.5. Such a measure of the bit sequence's membership in this candidate file class can preferably be determined and used in the form of an average value, in particular in the form of an arithmetic mean, a geometric mean, or a square mean, for the multiple bit sequences of the file. Alternatively or additionally, and likewise preferably, a progression of this measure of the membership of bit sequences in the candidate file class along their position within the file can be determined and used to determine the file class.In particular, the history can be used to identify an accumulation of values of the measure at certain positions of the bit sequences and / or local deviations and / or statistical anomalies of values of this measure and to determine the file class.
[0022] In a particularly advantageous development of the method according to the invention, the file class is determined by means of a second neural network, to which, for each bit sequence, preferably the candidate file class into which it has been classified by the first neural network and / or for each candidate file class, a measure of the bit sequence's membership in this candidate file class, which the first neural network assigns to the bit sequence, preferably together with the position, are transmitted as input data.
[0023] The file classification device according to the invention has at least one first neural network, which has been trained by means of an inventive method for training a neural network for classifying files into file classes, as described above, and / or which is designed to carry out an inventive method for classifying at least one file into file classes, as described above. In a preferred development of the inventive method as described above, the file classification device is used to use an IT security property of files, which has an impact on the data and / or functional security of an automation system using the files, as a file class and to take an IT security measure depending on the file class into which the file classification device classifies the file.The automation system is particularly preferably a production system. The IT security measure is appropriately assigned to the file with a desired IT security feature if classification using the file classification device shows that the file does not have the desired IT security feature, or restricts access rights when using or executing the file, or increases monitoring when using or executing the file if it does not have the desired IT security feature. In particular, malicious code in a file can be concealed using a protection tool. Thus, the detected prior application of a protection tool to a file can indicate a compromise of IT security.Consequently, in a particularly advantageous development of the invention, it is considered a desired IT security property of a file that such a protection tool has not been previously applied to this file. Accordingly, the invention can alternatively be described in relation to a method for increasing the IT security of an automation and / or production system, in which a security property of the file is determined by means of the classification of the file, and an IT security measure is taken at the automation and / or production system based on the determined security property.
[0024] In the method according to the invention for increasing the IT security of an automation and / or production system using one or more files, the classification of the one or more files takes place by means of a method according to the invention for classifying at least one file into file classes as described above and / or by means of a file classification device according to the invention as described above, wherein in the method an IT security property of the one or more files is used as one of the file classes and an IT security measure is taken depending on the file class into which the one or more files are classified.
[0025] In the method according to the invention as described above, the IT security is expediently a functional security and / or a data security and / or the IT security property has an impact on the data and / or functional security of the automation system using the one or more files. Preferably, the one or more files are configuration files and / or control files of the automation and / or production system. Particularly preferably, the security measure is providing the one or more files with a desired IT security property as described above or a restriction of access rights when using or executing the one or more files or increased monitoring when using or executing the one or more files if they do not have the desired IT security property.In particular, malicious code in a file can be concealed using a protection tool. Thus, a detected prior application of a protection tool to a file can indicate a compromise of IT security. Consequently, in a particularly advantageous development of the invention, it is considered a desired IT security property of a file that such a protection tool has not been previously applied to this file. The invention is explained in more detail below with reference to an exemplary embodiment illustrated in the drawing. They show:
[0026] Fig. 1 in a flow diagram for the process of the inventive method for training a neural network for classifying file types in a schematic drawing and
[0027] Fig. 2 shows a schematic diagram of a file classification device according to the invention.
[0028] In the method illustrated in Fig. 1, a first neural network (NN) is trained to classify file types. For this purpose, training data TRAINO and TRAIN1 are passed to the neural network (NN) as input data, for which the neural network (NN) is to determine and output a corresponding classification in the form of file classes CLAO and CLA1 as the respective output data.
[0029] By means of training, the neural network NN should be able to classify a priori unknown files FIL (see Fig. 2) into the file classes CLAO, CLA1. For this purpose, the neural network is trained using a training data set TRAINO of training files x ul , x u2 , x u3 , which are all assigned to the file class CLAO, as well as with the help of a training data set TRAIN1 of training data x pl , x p2 , x p3 , all of which are assigned to the file class CLA1, trained.
[0030] Thus, each training example consists of a training file x ul , x u2 , x u3 , x pl , x p2 , x p3 and a label in the form of the file class CLAO, CLA1, where the file class CLAO, CLAO in the illustrated embodiment has a value of 0 or 1 and indicates the file class to which the training file x ul , x u2 , x u3 , x pl , x p2 , x p3must be assigned if the classification is correct. The procedure for training the neural network NN, such as withholding a small portion of the training data for validation purposes, follows common standards in a manner known per se and will not be explained further here. In the exemplary embodiment described here, a previous application of a protection tool to an executable binary file is to be detected. The application of the protection tool would allow malicious code to be concealed in the file, which would potentially pose a security risk to a device or system on which the file is to be used. For this purpose, the training data sets TRAINO, TRAIN1 are provided in such a way that the protection tool can access a data set x lr x2, x3 is not applied initially, so that the unchanged training data set TRAIN 1 with a set of unprotected training files x ul , x u2 , x u3in the form of binaries and on the other hand the protection tool is applied to the data set x2, x2, x3, whereby the protected training files x pl , x p2 , x p3 , which also form binaries. The training data set TRAINO therefore includes the training files x ul , x u2 , x u3 together with the file class CLAO with the label "0", indicating that these are unprotected training files. The training data set TRAIN1, on the other hand, includes the training data x pl , x p2 , x p3 together with the file class CLA1 with the label "1" (protected). The two training datasets TRAIN1, TRAIN1 together form the joint training dataset T.
[0031] In principle, in further embodiments, which otherwise correspond to the illustrated embodiment, the training data sets TRAINO, TRAIN1 can also be obtained in other ways. In particular, it is not necessary for the training data set of a file class CLA1 to be based on the training data set of the other file class CLAO. In further embodiments, it is also not necessary for exactly the same number of training files to be available for each individual file class; rather, the number of training files for the respective file class can, in principle, also differ from one another. The special feature of the illustrated method lies in the preparation of the training files x ul , x u2 , x u3 , x pl , x p2 , x p3 such that the neural network NN bases its judgment on structural properties of the file contents of the training files x ul , x u2 , xu3 , x pl , x p2 , x p3 and cannot rely on very specific patterns of the specific file types CLAO, CLA1 such as "the third byte always has the value 17".
[0032] The procedure is as follows:
[0033] All training files x ul , x u2 , x u3 , x pl , x p2 , x p3 from the common training data set T are each divided into shorter bit sequences BIF. The division can be of a uniform length, for example, 1 kilobyte, or with a variable length for each bit sequence BIF. If the division occurs at the end of a training file x u2 , x u2 , x u3 , x p2 , x p2 , x p3 not occur, the remaining part of the training file Training file x ul , x u2 , x u3 , x pl , x p2 , x p3for example, discarded or filled with dummy bits, such as zero bits.
[0034] The shortened bit sequences BIF are then processed together with the corresponding training files x ul , x u2 , x u3 , x pl , x p2 , x p3 , from which the bit sequences BIF originate, are combined to form the set of final training pairs; the set of final training pairs therefore contains all pairs of bit sequences BIF and labels for the file classes CLAO, CLA1 for all training examples of the common training data set T. The order in which the bit sequences BIF and the associated labels are presented to the neural network during training is then randomized - as usual - at the beginning of each training epoch.
[0035] This approach has the following advantages:
[0036] The main advantage is that the neural network (NN) is generally not presented with a single file "in its entirety," but rather the network accepts individual files limited to the length of the individual bit sequences (BIF) and not in the correct order, but rather in any order. Therefore, the neural network (NN) cannot rely on the presence of specific values at certain positions within a file to classify files, but must instead use more general structural features that are recognizable in the excerpt of a bit sequence (BIF) for classification.
[0037] It is also beneficial for the training process according to the method presented that the neural network NN is presented with a larger number of labels, i.e. of assigned file classes CLAO, CLA1, for the same total amount of input data, namely one label per bit sequence BIF instead of one per file of the data set xlr x2, x3.
[0038] The bytes within the BIF bit sequences are passed to the input layer of the neural network (NN), both during training and in subsequent application, not as ordinal values between 0 and 255, but as a sequence of 8 bits each with values between 0 and 1. Otherwise, distortions would arise because the higher-order bits of a byte receive an excessive share of the activation of an input neuron, while the lower-order bits receive too little. Intrinsically significant patterns in the lower-order bits could then be lost in the high random noise of the higher-order bits.
[0039] In the illustrated embodiment, the neural network NN is a so-called "recurrent neural network", also referred to as a recurrent network, which has a type of "memory" and thus the ability to incorporate previous bytes BIF of a bit sequence into the classification decision for the current byte. This allows, in particular, the neural network to be applied to bit sequences BIF of any length, instead of being restricted from the outset to bit sequences BIF of a fixed length due to its input format. Furthermore, bit sequences BIF of a fixed length would result in the neural network having to independently learn each structural relationship between consecutive bits of the file for each position within the specified block length during training, whereas when using a recurrent neural network NN, a relationship with the local context, i.e.the “history” of the last bytes, regardless of the exact position of the current byte.
[0040] The illustrated embodiment can be expanded in a further embodiment such that the application of the neural network NN to the input data in the form of the file of the data set EIL provides a continuous classification curve OB(t) across the entire file FIL by holding the output of the neural network at position t after each byte BIF of the file FIL. In principle, in further embodiments of the invention, the input data of the neural network NN can consist of a different number of bits, for example of only a single bit each instead of 8 bits for a byte BIF, so that even a bit-precise output OB(t) , where t denotes the bit position within the file FIL, is possible.
[0041] A final classification function f(OB(t)) is then applied to the classification curve OB(t) determined by the network for the measure of the bit sequence's membership in this candidate file class, which is determined for each bit sequence BIF within the file FIL. This classification function f(OB(t)) can be implemented, for example, as an average in the manner of an arithmetic mean or by identifying a specific local cluster of strongly deviating values of the classification curve or by identifying a local cluster of similar values of the classification curve. In further embodiments, the classification can also be implemented using a further neural network NN2 (see Fig. 2): For example, the further neural network NN2 is trained to assign the correct label CLAO, CLA1 to the classification curve OB(t) output by the first neural network NN.
[0042] The classification device CLAS shown in Fig. 2 uses the training of the first neural network NN described in the previous embodiments, which transfers the classification curve OB(t) to the second neural network NN2. The second neural network NN2 then determines the final file class, CLAO in the illustrated case, and transmits the file class CLAO to an action device MEA.
[0043] The FIL files, which are fed to the first neural network NN for classification, are read from a memory of a production facility MANU. The production facility MANU uses the FIL files for production control. The measures facility MEA applies a protection function to the FIL file depending on the determined file class, i.e., depending on the judgment of the classification facility CLAS. If the classification facility CLAS determines that a protection tool has been applied to the FIL file that could potentially conceal malicious code introduced into the FIL file, the protection function is applied. In the illustrated embodiment, the protection function is provided by isolating the FIL file in a secure environment and intensive monitoring during use of the FIL file.If it is detected that no protection tool has been applied to the FIL file, the security function is not applied. Accordingly, the invention can alternatively be described as an application or method for increasing the IT security of a production facility.
Claims
Patent claims 1. Method for training a first neural network (NN) for classifying files (FIL) into file classes (CLAO, CLA1), in which a plurality of test files (x ul , x u2 , x u3 , x pl , x P 2, x p3 ), each of which is assigned to a file class, whereby the test files (Xui, Xu2, Xu3, Xpi, Xp2, Xp3) are each decomposed into bit sequences (BIF) that remain assigned to the previously assigned file class (CLAO, CLA1) and the neural network (NN) is trained with the bit sequences (BIF).
2. Method according to the preceding claim, in which the test files (x ul , x u2 , x u3 , x pl , x p2 , x p3 ) can be completely decomposed into bit sequences (BIF).
3. Method according to one of the preceding claims, in which the neural network (NN) is trained with the bit sequences (BIF) in an unordered sequence, in particular in a randomized sequence.
4. Method according to one of the preceding claims, wherein the first neural network (NN) is a recurrent neural network (NN).
5. Method for classifying at least one file (FIL) into file classes, in which a first neural network (NN) of this type is used, which is or is trained according to a method according to one of the preceding claims and in which at least two different sections in the form of bit sequences (BIF) are used from the file (FIL) and the bit sequences (BIF) are each classified into candidate file classes using the neural network (NN) and a file class (CLAO, CLA1) is determined depending on the candidate file classes.
6. Method according to the preceding claim, in which the training files (x ul , x u2 , x u3 , x pl , x p2 , x p3 ) can be completely decomposed into bit sequences (BIF).
7. Method according to the preceding claim, in which the classification is undertaken for a plurality of sections of bit sequences (BIF), the bit sequences (BIF) taken together preferably forming the at least one file (FIL).
8. Method according to one of the preceding claims, in which the candidate file classes into which the bit sequences (BIF) are classified are determined together with the position (t) of the respective bit sequence (BIF) within the file (FIL).
9. Method according to one of the preceding claims, in which the file class (CLAO, CLA1) is determined in such a way that the candidate file class into which the most bit sequences (BIF) are classified is determined as the file class (CLAO, CLA1).
10. Method according to one of the preceding claims, in which the file class (CLAO, CLA1) is determined in such a way that for each candidate file class an average value of a measure for the membership of the bit sequence (BIF) to this candidate file class, which the first neural network (NN) assigns to the bit sequence (BIF), and / or a course of this measure along the position (t) of the bit sequence (BIF) within the file (FIL), in particular an accumulation of values of this measure at certain positions (t) and / or local deviations and / or statistical anomalies of values of this measure, is determined and used to determine the file class (CLAO, CLA1).
11. Method according to one of the preceding claims, in which the file class (CLAO, CLA1) is determined by means of a second neural network (NN2), to which, for each bit sequence, the candidate file class into which it is assigned by the neural network is preferably assigned. nal network (NN) and / or for each file class a measure of the bit sequence's membership in this candidate file class, which the first neural network assigns to the bit sequence, preferably together with the position (t), is transmitted as input data.
12. File classification device with at least one first neural network (NN) which has been trained by means of a method according to one of claims 1 to 4 and / or which is designed to carry out a method for classifying at least one file according to one of claims 5 to 10.
13. Method for increasing the IT security of an automation and / or production system using one or more files, in which the classification of the one or more files is carried out by means of a method for classifying at least one file (EIL) into file classes according to claim 5 and / or by means of a file classification device according to claim 12 and in which an IT security property of the one or more files is used as a file class and an IT security measure is taken depending on the file class into which the file is classified.
14. Method according to the preceding claim, in which the IT security is a functional security and / or a data security and / or the IT security property has an impact on the data and / or functional security of the automation system using the one or more files.