WO2017146094A1 - 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム - Google Patents

攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム Download PDF

Info

Publication number
WO2017146094A1
WO2017146094A1 PCT/JP2017/006575 JP2017006575W WO2017146094A1 WO 2017146094 A1 WO2017146094 A1 WO 2017146094A1 JP 2017006575 W JP2017006575 W JP 2017006575W WO 2017146094 A1 WO2017146094 A1 WO 2017146094A1
Authority
WO
WIPO (PCT)
Prior art keywords
rop
label
code
sequence
byte
Prior art date
Application number
PCT/JP2017/006575
Other languages
English (en)
French (fr)
Inventor
利宣 碓井
誠 岩村
健 矢田
知範 幾世
Original Assignee
日本電信電話株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to US16/074,320 priority Critical patent/US10878091B2/en
Priority to JP2018501734A priority patent/JP6592177B2/ja
Priority to EP17756532.2A priority patent/EP3404572B1/en
Publication of WO2017146094A1 publication Critical patent/WO2017146094A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • H04L63/1416Event detection, e.g. attack signature detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/03Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
    • G06F2221/033Test or assess software

Definitions

  • the present invention relates to an attack code detection device, an attack code detection method, and an attack code detection program.
  • a malicious document file is a document file that is configured such that when the file is opened with a viewer application to view the contents, an attack is started and malware infection is caused.
  • the exploit code is code for exploiting a vulnerability in order to realize a malicious operation. Attacks often exploit vulnerabilities with the aim of executing arbitrary code by attackers, and malicious document files exploit exploitation codes to exploit vulnerabilities and execute attack codes on attack targets. Eventually download and execute the malware. Shell codes and ROP (Return Oriented Programming) codes are used as this attack code.
  • a shell code is a machine language code piece created by an attacker, and can make an application perform any operation according to the created code.
  • shell code In order to realize an attack by shell code, it is necessary to inject shell code by writing to memory and execute it.
  • a data execution prevention mechanism that disables execution of a writable memory area, it has become difficult to make an attack successful with only shell code.
  • ROP attack is an attack method that captures a vulnerability and overwrites the call stack to gain control of the return destination, and connects existing code such as a library by repeating the ret instruction, thereby realizing arbitrary code execution. It is. Note that the existing code to be spliced and existing after the return by ROP is called an ROP gadget.
  • This ROP attack is realized by the following procedure.
  • the attacker confirms that the call stack can be rewritten by taking advantage of vulnerabilities such as buffer overflow. As a result, the attacker can grasp the subsequent return destination.
  • the attacker then generates code that overwrites the call stack.
  • the attacker splices existing codes such as a library by repeating the return, and generates a code that can realize an arbitrary operation.
  • This generated code is called an ROP code.
  • the attacker causes the attack target to execute arbitrary code of the attacker by overwriting the call stack with the ROP code.
  • the above is a general ROP procedure. In this ROP attack, it is possible to execute arbitrary code without injecting shell code.
  • the exploit code may or may not be included in the document file.
  • a script document or a malicious document file that often exploits plug-in vulnerabilities such as PDF (Portable Document Format) format is likely to have an exploit code.
  • a malicious document file that often exploits vulnerabilities that exist in the poor handling of the viewer application format, such as the OLE (Object Linking and Embedding) format often has no exploit code. Therefore, attack code detection is an effective method.
  • Non-Patent Document 1 proposes the following method. In the method described in Non-Patent Document 1, first, an execution instruction is monitored, and a return address pushed to the stack when a call instruction is executed is stored in the shadow stack. Then, by comparing the return address that is the return destination when the ret instruction is executed with the address stored at the top of the shadow stack, it is verified whether the return is properly performed and ROP is detected.
  • Non-Patent Document 1 describes that according to this method, ROP can be detected by an experiment without erroneous detection.
  • Non-Patent Document 2 proposes a technique for opening a document file to be inspected with a viewer application in a virtual environment, and acquiring and analyzing a memory snapshot. As an analysis, first, an address included in the memory snapshot is extracted, and an operation of each candidate ROP gadget is profiled. Based on this profile, the entire ROP code is profiled.
  • Non-Patent Document 3 proposes a policy-based static detection method based on the characteristics of the ROP code. In this method, it is possible to detect the ROP code statically without depending on the signature, and the number of false detections for a benign document file is very small.
  • Non-Patent Document 1 it is necessary to monitor an execution instruction, and a document file to be inspected must be opened using a viewer application in a virtual environment.
  • DBI Dynamic Binary Instrumentation
  • Non-Patent Document 2 can be performed in a shorter time than the dynamic analysis using the DBI technique, and further, it is possible to associate what kind of gadget the address in the ROP code indicates.
  • a certain amount of time is required because execution in a virtual environment and acquisition of a memory snapshot take time.
  • Non-Patent Document 3 since the method described in Non-Patent Document 3 employs a deterministic detection method, there is a problem that an attacker who knows the policy is likely to be avoided. Further, the policy proposed in Non-Patent Document 3 has a problem that, for example, there is a high possibility that an extremely short ROP code or an ROP code configured across a plurality of libraries cannot be detected.
  • the present invention has been made in view of the above, and an attack code detection apparatus and an attack code detection method capable of realizing high-speed and high-accuracy ROP code detection while preventing an attacker from avoiding ROP detection.
  • An object of the present invention is to provide an attack code detection program.
  • the attack code detection device uses a known malicious data sequence including an ROP code as learning data, and features of byte sequences that are constituent elements of the data sequence.
  • a learning unit that generates a model that learns the characteristics of a byte string that is a component of an ROP code
  • a detection unit that detects an ROP code included in an unknown data sequence to be inspected based on the model
  • a detection A malignancy determination unit that determines whether or not the unknown data series to be inspected is a malignant data series that executes an attack by ROP using the detection result of the unit.
  • FIG. 1 is a diagram for explaining an example of a configuration of an attack code detection apparatus according to the first embodiment.
  • FIG. 2 is a diagram showing an example of the labeled malicious document file shown in FIG.
  • FIG. 3 is a diagram for explaining the ROP code portion in the file shown in FIG.
  • FIG. 4 is a diagram in which the bytes and labels in the first to fifth rows in the left part of the table in FIG. 3 are schematically associated with each other.
  • FIG. 5 is a diagram illustrating an example of transition of labels that are latent variables of a latent sequence (label sequence).
  • FIG. 6 is a diagram showing a table in which the initial state probabilities of the latent sequences are associated with each latent variable (label).
  • FIG. 1 is a diagram for explaining an example of a configuration of an attack code detection apparatus according to the first embodiment.
  • FIG. 2 is a diagram showing an example of the labeled malicious document file shown in FIG.
  • FIG. 3 is a diagram for explaining the ROP code portion
  • FIG. 7 is a diagram showing a table in which the output probability of the observed variable (byte) is associated with each latent variable (label).
  • FIG. 8 is a diagram showing a table in which transition probabilities between latent variables (labels) are associated with each combination of latent variables to be transitioned.
  • FIG. 9 is a diagram illustrating an example of label transition corresponding to a 64-bit environment.
  • FIG. 10 is a flowchart showing a processing procedure until the attack code detection apparatus shown in FIG. 1 generates a probability model.
  • FIG. 11 is a flowchart showing a processing procedure of the probability model generation processing shown in FIG.
  • FIG. 12 is a diagram for explaining all the combinations of label rows assumed by the detection unit shown in FIG. FIG.
  • FIG. 13 is a diagram for explaining an example of a label string that the detection unit illustrated in FIG. 1 assigns to a byte string of a file to be inspected.
  • FIG. 14 is a flowchart showing a processing procedure until the attack code detection apparatus shown in FIG. 1 determines an unknown document file to be inspected.
  • FIG. 15 is a flowchart illustrating a processing procedure of the detection process illustrated in FIG. 14.
  • FIG. 16 is a diagram illustrating an example of a computer in which an attack code detection apparatus is realized by executing a program.
  • Embodiment 1 About the attack code detection apparatus which concerns on Embodiment 1, the schematic structure of an attack code detection apparatus, the flow of processing in an attack code detection apparatus, and a specific example are demonstrated.
  • the attack code detection apparatus uses a known malicious data sequence including an ROP code in advance to learn the characteristics of the byte sequence of each of the document file portion and the ROP code portion. Is generated. Then, the attack code detection device, based on the generated probability model, for an unknown document to be inspected, a label (document label) indicating that it is a component of a document file in a byte string constituting the document Alternatively, a label (ROP label) indicating that it is a constituent element of the ROP code is labeled. Thus, the attack code detection device according to the first embodiment detects whether or not this unknown document includes the ROP code portion without opening the unknown document with the viewer application.
  • the attack code detection apparatus realizes the detection of the ROP code portion included in the unknown document to be inspected at high speed by so-called heuristic determination.
  • ROP code-likeness is defined based on learning so far, and determination is performed according to the definition.
  • FIG. 1 is a diagram for explaining an example of a configuration of an attack code detection apparatus according to the first embodiment.
  • the attack code detection apparatus 10 includes an input unit 11, a control unit 12, an output unit 13, a storage unit 14, and a probability model database (DB) 20.
  • DB probability model database
  • the input unit 11 is composed of an input device such as a keyboard and a mouse, receives input of information from the outside, and inputs it to the control unit 12.
  • the input unit 11 receives an input of the labeled malignant document file 100 or the inspection target unknown document file 200 and outputs it to the control unit 12.
  • the labeled malicious document file 100 is a known malicious data sequence including an ROP code, and a document label is assigned to a byte that is a component of the document file, while an ROP label is assigned to a byte that is a component of the ROP code. Is a malignant data series.
  • the inspection target unknown document file 200 is an unknown document file.
  • the control unit 12 has an internal memory for storing a program that defines various processing procedures and the necessary data, and executes various processes using these.
  • the control unit 12 is an electronic circuit such as a CPU (Central Processing Unit) or MPU (Micro Processing Unit).
  • the control unit 12 includes a file format determination unit 121, a decoding unit 122, a learning unit 123, a detection unit 124, and a malignancy determination unit 125.
  • the file format determination unit 121 determines which file format is used for all input document files.
  • the file format determination unit 121 determines the format of the input document file based on the header of the document file and the characteristics of the file structure. For example, DOC, XLS, PPT, PDF, etc. are assumed as file formats.
  • the decoding unit 122 decodes the encoded area if there is an encoded area.
  • the learning unit 123 uses the labeled malicious document file 100 as learning data to generate a probability model in which the characteristics of the byte sequence that is a constituent element of the document file and the characteristics of the byte sequence that is a constituent element of the ROP code are learned. .
  • the learning unit 123 stores the generated probability model in the probability model DB 20 in the form of model parameters.
  • the detection unit 124 detects an ROP code included in the data series of the inspection target unknown document file 200 based on the probability model stored in the probability model DB 20. Specifically, the detection unit 124 is a component of a document file or a component of an ROP code with respect to a byte string constituting an unknown data series to be inspected based on a probability model. The ROP code included in the data series of the inspection target unknown document file 200 is detected. In other words, the detection unit 124 labels the component label of the inspection target unknown document file 200 with the ROP code portion by labeling the inspection target unknown document file 200 with the document label or the ROP label on the byte string constituting the document. Detect whether it is included.
  • the malignancy determination unit 125 determines whether the data series of the inspection target unknown document file 200 to be inspected is malignant data that performs an attack by ROP. To do. When the detection unit 124 detects that the ROP code portion is included in the inspection target unknown document file 200, the malignancy determination unit 125 determines that the inspection target unknown document file 200 is malignant data. On the other hand, if the detection unit 124 detects that the ROP code portion is not included in the inspection target unknown document file 200, the malignancy determination unit 125 performs malicious data in which the inspection target unknown document file 200 attacks by ROP. Judge that it is not.
  • the output unit 13 is, for example, a liquid crystal display or a printer, and outputs various types of information including information related to attack code detection.
  • the output unit 13 may be an interface that controls input / output of various data to / from an external device, and may output various information to the external device.
  • the storage unit 14 is realized by a semiconductor memory device such as a RAM (Random Access Memory), a flash memory (Flash Memory), or a storage device such as a hard disk, an optical disk, and the like. Data used during the execution of the program is stored.
  • a semiconductor memory device such as a RAM (Random Access Memory), a flash memory (Flash Memory), or a storage device such as a hard disk, an optical disk, and the like. Data used during the execution of the program is stored.
  • the probability model DB 20 stores the probability model generated by the learning unit 123 in the form of model parameters.
  • the probability model DB 20 is managed by the attack code detection device 10.
  • the probability model DB 20 may be managed by another device (such as a server).
  • the learning unit 123 converts the generated probability model to the probability model via the communication interface of the output unit 13.
  • the data is output to the management server of the DB 20 and stored in the probability model DB 20.
  • FIG. 2 is a diagram showing an example of the labeled malicious file 100 shown in FIG.
  • the labeled malicious document file 100 is obtained by investigating an actual malicious document file, and includes, for example, an exploit code part, a shell code part, an ROP code part, etc., as shown in the file D of FIG.
  • the learning unit 123 uses, for example, such a file D as data for learning, and learns the characteristics of the byte sequence that is a component of the document file and the characteristics of the byte sequence that is the component of the ROP code. Generate a probabilistic model.
  • FIG. 3 is a diagram for explaining an ROP code portion in the file D (labeled malicious document file 100) shown in FIG.
  • FIG. 3 shows a specific example of the data series of the ROP code portion and the portion before and after the portion for explanation.
  • “0xff” is shown as a partial byte value of the document file immediately before the ROP code portion together with the ROP code portion
  • “0x31” is shown as a partial byte value of the document file immediately after the ROP code portion.
  • each byte value of the labeled malicious document file 100 is associated with a label representing the origin of each byte. Is used.
  • the origin indicates whether the byte value is a constituent element of the document file or a constituent element of the ROP code.
  • the names of the labels respectively associated with the respective byte values are arranged in a line in the right column of the table Ta in accordance with the arrangement of the bytes constituting the group. In the following, this column will be described as a label column.
  • the ROP gadget address is an address value indicating the ROP gadget.
  • the constant is an argument when a function is called by ROP.
  • the junk code is for adjusting the position of the stack pointer and is not referred to in the attack.
  • the above three components are referred to as “address”, “constant”, and “junk”, respectively.
  • the component of the document file is expressed as “document label”.
  • ROP address 1, 2, 3, 4 label
  • ROP constant 1, 2, 3, 4 label
  • ROP junction label
  • the numbers “1, 2, 3, 4” are indexes indicating the number of bytes of the 4-byte address or constant.
  • the least significant byte of the address or constant corresponds to the label of ROP (address 1) or ROP (constant 1)
  • the label of ROP (address 4) or ROP (constant 4) The most significant byte corresponds.
  • the ROP (address 1) label is attached to the byte value “0xd9”, and the byte value “0xd9”.
  • the ROP (address 2) label is assigned to “0xac”
  • the ROP (address 3) label is assigned to the byte value “0x01”
  • the ROP (address 4) label is assigned to the byte value “0x01”.
  • the ROP (constant 1) label is assigned to the byte value “0x00” for the constant “0x00003000” starting from the first line on the right side of the table Ta, and the ROP ( Constant 2) is given a label, ROP (constant 3) label is given to byte value “0x00”, and ROP (constant 4) label is given to byte value “0x00”.
  • the attack code detection apparatus 10 uses, as learning data, a document label or ROP label associated with each byte of the labeled malicious document file 100.
  • the design of the label is not limited to this, and for example, the document label may be further finely decomposed according to the format of the document file.
  • a word document stream including a text document, a data stream including various data, and a macro storage including a macro program are considered to have different byte string distributions.
  • the labeled malicious document file 100 as learning data is created in advance.
  • a malicious document file including the ROP code is found, and the found malicious document file is divided into bytes by a predetermined method. Subsequently, a label is assigned to each byte by manual or dynamic analysis.
  • a label when manually attached, it is embedded in a document file with reference to a ROP address described in a PoC (Proof-of-Concept) code for vulnerabilities that is generally distributed. Extract the ROP code. Then, the type of library used by the ROP is checked from the address value, and labeling is performed while checking the ROP address.
  • PoC Proof-of-Concept
  • Non-Patent Document 1 when a label is assigned by dynamic analysis, the method shown in Non-Patent Document 1 can be used. That is, the ROP code portion is extracted using a system that detects the ROP by monitoring the execution instruction, the state of the stack, and the like. In this system, labeling is performed by referring to the address of the executed ROP gadget.
  • the learning unit 123 uses the byte of the labeled malicious document file 100 as described above, in which the document label or the ROP label is associated, and uses the byte sequence of each of the document file portion and the ROP code portion. Generate a probability model with learned features.
  • FIG. 4 is a diagram in which the bytes and labels in the first to fifth rows in the left part of the table Ta in FIG. 3 are schematically associated with each other.
  • learning data in which each byte is associated with a label representing the origin of each byte is prepared. That is, each byte of the document file is labeled with one of a document label and a plurality of ROP labels. For this reason, it can be said that one of the labels is hidden behind each byte.
  • the ROP code is used to successively transition between short ROP gadgets to connect the codes and generate a code that can realize an arbitrary operation.
  • the ROP code structure is based on the ROP address that makes transitions.
  • FIG. 4 there is a label sequence that is a sequence of potential states that probabilistically transitions behind the byte sequence that is a sequence that can be observed from the document file.
  • a model that outputs byte values stochastically can be considered.
  • a byte string corresponds to an observable series (observation series)
  • a label string corresponds to a series of potential states (latent series). Therefore, the learning unit 123 generates the output probability of the observation variable from the latent sequence as one of the model parameters of the probability model.
  • FIG. 5 is a diagram illustrating an example of transition of labels that are latent variables of a latent sequence (label sequence). For example, in a graphical model such as a hidden Markov model or a conditional random field that can be applied to the problem of ROP code detection, one important factor is how the latent variable transitions.
  • the address label (ROP address 1 to 4 label) and the constant label (ROP constant 1 to 4 label) are 4 One left-to-right one-byte way. This is because addresses and constants are in units of 4 bytes under a 32-bit environment.
  • the learning unit 123 further includes a model that stochastically indicates the transition state of the latent variable, that is, the transition between the latent variables. Probability is generated as one of the model parameters of the probability model.
  • the learning unit 123 assumes a model having, as model parameters, the output probability of an observed variable, the transition probability between latent variables, and the initial state probability of a latent sequence, and the probability model as illustrated in FIGS. Generate.
  • FIG. 6 is a diagram showing a table in which the initial state probabilities of the latent sequences are associated with each latent variable (label).
  • FIG. 7 is a diagram showing a table in which the output probability of the observed variable (byte) is associated with each latent variable (label).
  • FIG. 8 is a diagram showing a table in which transition probabilities between latent variables (labels) are associated with each combination of latent variables to be transitioned.
  • the learning unit 123 receives, as learning data, a known labeled malicious document file 100 as learning data (see, for example, table Ta in FIG. 3).
  • the learning unit 123 uses, as an initial state probability, a table T1 (see FIG. 6) in which “1” is associated with the document label and “0” is associated with a label other than the document.
  • a model parameter indicating the initial state probability of the sequence is generated and stored in the probability model DB 20.
  • the learning unit 123 calculates the probability that the label outputs an observation variable (byte) for all the latent variables (labels).
  • the probability that a document label outputs a byte value “0x00” is obtained by dividing “the number of bytes having a value of 0x00 with a document label” by “the total number of bytes with a document label”. Can be calculated by: This calculation is performed for the byte value “0xFF” from the byte value “0x00”. Thereby, the probability that the document label outputs the byte value “0xFF” from each byte value “0x00” can be calculated. This calculation is performed for all labels.
  • the learning unit 123 obtains the output probability of the observed variable from the table T2 (see FIG. 7) in which the output probability of each observed variable (byte) is associated with each latent variable (label).
  • the model parameter is generated and stored in the probability model DB 20.
  • i-th ones l i of the L is the probability that l i outputs a x j b i, and j.
  • the probability “b document, 0x00 ” to “b document, 0xFF ” for outputting byte values from “ 0x00 ” to “ 0xFF ” is associated.
  • the learning unit 123 calculates transition probabilities between labels for all possible sets of latent variables (labels).
  • the learning unit 123 uses the label transition feature described in FIG. 5 that the address label and the constant label are in a left-to-right one-way form of 4 bytes, and the document label is used as a document. Based on the label transition characteristic of transitioning only to the label, address label, or junk label, and the label transition state relationship shown in FIG. 5, all possible label sets are obtained.
  • the number of transitions between the latent variables can be calculated. For example, the transition probability from the ROP (address 4) label to the ROP (junk) label is “the number of transitions from the ROP (address 4) label to the ROP (junk) label”. It can be calculated by dividing by the “number of transitions”. This calculation is calculated for every possible set of latent variables.
  • the learning unit 123 calculates transition probabilities between latent variables for all possible sets of latent variables, so that the probability of transition for each combination of latent variables (a combination of a transition source label and a transition destination label). Is generated as a model parameter indicating the transition probability between latent variables, and stored in the probability model DB 20.
  • the transition probability between the latent variables is l i
  • the j-th one is l j
  • the probability of transition from l i to l j is a i, j .
  • a document, ROP (address 1) is associated with the transition probability from the “document” label to the “ROP (address 1)” label.
  • the transition probabilities “a document, ROP (address 2) ” to “a document, ” from each “ROP (address 2)” label to “document” label are also illustrated .
  • Documents are associated with each other.
  • the transition probabilities to all possible transition destination labels are associated with other labels.
  • the learning unit 123 performs relearning based on the address of the ROP gadget candidate in the file.
  • the address when this file is loaded on the memory is fixed. This relearning can be expected to keep the detection rate high even if an address that is not included in the ROP code of the learning data is used in the inspection target.
  • This re-learning can be realized by updating the output probability in the latent state of the ROP (address 4) label from the ROP (address 1) label among the model parameters.
  • the learning unit 123 extracts a list of ROP gadget candidate addresses from the file. It is known that this extraction can be realized using existing software.
  • the learning unit 123 divides the extracted address of the ROP gadget candidate for each byte, and for each byte, the first byte is ROP (address 1), the second byte is ROP (address 2), and so on. Associate labels and calculate output probabilities. For example, the probability that the label of ROP (address 1) outputs a byte value “0x00” can be calculated by dividing “the number of addresses where the first byte has a value of 0x00” by “the total number of addresses”. .
  • This calculation is performed for each label from “ROP (address 1)” to “ROP (address 4)” from the byte value “0x00” to the byte value “0xFF”, thereby calculating each output probability and calculating the model parameter. Re-learn by updating.
  • the learning unit 123 performs a smoothing process if there is a transition probability or output probability having a value of “0” in the probability model generated in this way.
  • the smoothing process is a method of correcting this probability to a value other than “0” when a dimension of probability “0” exists in the parameter vector. This is a countermeasure against a problem called a zero frequency problem, in which when an appearance probability of “0” that does not appear in the learning data appears in the recognition target, it cannot be recognized well.
  • a method of the smoothing process there are methods such as addition smoothing and Kneser-ney smoothing. Of course, the method is not limited to these methods.
  • the probabilistic model may be refined by re-learning it. is there.
  • the learning unit 123 may re-learn the model using a Baum-Welch algorithm or the like.
  • learning techniques for realizing sequence labeling include hidden Markov models, conditional random fields, structured support vector machines, and the like, but of course not limited to these techniques.
  • FIG. 9 is a diagram illustrating an example of label transition corresponding to a 64-bit environment.
  • the register width is 8 bytes
  • the ROP address and the constant are also 8 bytes.
  • the probability model is also changed accordingly, and the latent variable (label) increases, and the ROP address portion and the constant portion that have changed every 4 bytes are changed every 8 bytes.
  • the ROP address label and the ROP constant label increase to 8.
  • address labels (ROP addresses 1 to 8 labels) and constant labels (ROP constants 1 to 8 labels) are in a one-way form of 8 bytes left-to-right (for example, From the document label, the document label, the address label, or the junk label is changed (see arrows Y1 ′ to Y3 ′ in FIG. 9).
  • the present invention is not limited to the 32-bit and 64-bit environments described above, and in other environments, the number of ROP addresses and constant latent variables (labels) and the number of continuous transitions can be changed according to the environment. Thus, it is possible to generate a probability model.
  • the learning unit 123 By performing the processing described above, the learning unit 123 generates a probability model having, as model parameters, the output probability of the observed variable, the transition probability between the latent variables, and the initial state probability of the latent sequence.
  • FIG. 10 is a flowchart showing a processing procedure until the attack code detection apparatus 10 shown in FIG. 1 generates a probability model.
  • the control unit 12 first checks the probability model DB 20 and determines whether or not model parameters of the probability model corresponding to each file format are stored (step S11). When it is determined that the model parameters of the probability model corresponding to each file format are stored (step S11: Yes), the control unit 12 ends the generation of the model parameters of the probability model.
  • the control unit 12 determines that the model parameter of the probability model corresponding to each file format is not stored (step S11: No)
  • the labeled malignant document file 100 is used as input data (step S11).
  • learning is started.
  • the file format determination unit 121 determines the format of the file from the characteristics of the header and the file structure (step S13).
  • the file format for example, DOC, XLS, PPT, RTF, PDF, and the like are assumed.
  • the decoding unit 122 determines whether or not an encoded area exists in the input labeled malicious document file 100 (step S14). If the decoding unit 122 determines that there is an encoded area in the input labeled malicious document file 100 (step S14: Yes), the decoding unit 122 detects the encoding method and performs the corresponding decoding (step S15). ). For detection of this encoding method, pattern matching of a known encoding method is used.
  • step S14 determines that there is no encoded area in the input labeled malicious document file 100 (step S14: No), or after step S15, the learning unit 123 uses the known label.
  • a probability model generation process for generating a probability model corresponding to the file format from the attached malicious document file 100 and the file format is executed (step S16).
  • the learning unit 123 stores the generated probability model in the probability model DB 20 in the form of model parameters (step S17), and ends the process.
  • the present embodiment describes detection of ROP codes and determination of malignancy for document files, the present invention is not limited to this, and the same method can be applied to any data series.
  • FIG. 11 is a flowchart showing a processing procedure of the probability model generation process (step S16) shown in FIG.
  • the learning unit 123 uses the data series of the ROP code portion and the portions before and after the labeled malicious document file 100. Learn.
  • the learning unit 123 sets the initial state probability of a latent variable to a probability ( ⁇ document ) starting from a latent variable corresponding to the document label (1) and a probability starting from a latent variable corresponding to the other label (for example, ⁇ ROP ( Address 1) ) is set as 0 (step S22).
  • the learning unit 123 uses, as an initial state probability, a table T1 (see FIG. 6) in which “1” is associated with a document label and “0” is associated with a label other than a document, as an initial state probability. It is generated as a model parameter indicating the state probability.
  • s t l i ) of the observed variables (bytes) “0x00” to “0xFF” at the label l i Is calculated (step S24).
  • This calculation as described above, for example, the probability of label l i outputs a byte value "0x00" is attached to "the number of bytes with values of 0x00 that labeled l i" of "label l i Calculate by dividing by the total number of bytes.
  • the learning unit 123 calculates this calculation for the label l i for each byte value “0xFF” from the byte value “0x00”, and the label l i is calculated from each byte value “0x00” to the byte value “0xFF”. Are obtained respectively.
  • the learning unit 123 the output probability of the observed variables (in bytes) for all of the label P whether or not to calculate the
  • s t l i ) of observation variables (bytes) “0x00” to “0xFF” for all labels.
  • step S25 No
  • 1 is added to i to make l i to be calculated as the next label (step S26), and the process returns to step S24, and this label is observed.
  • the output probability P (o t 0x00
  • s t l i) ⁇ P
  • the table T2 in which the output probability of each observation variable (byte) of the observation series (byte string) is associated with each latent variable (label) by this calculation (FIG. 7). Can be generated as a model parameter indicating the output probability of the observed variable.
  • s t ) between the latent variables (l i ⁇ l j ) for all possible latent variable (label) pairs l i and l j. L i )) is calculated (step S27).
  • l i indicates a transition source label
  • l j indicates a transition destination label.
  • the calculation in step S27 is performed by counting the number of transitions between latent variables as described above.
  • the transition probability from the ROP (address 4) label to the ROP (junk) label is “the number of transitions from the ROP (address 4) label to the ROP (junk) label”. It can be calculated by dividing by the “number of transitions”. This calculation is calculated for every possible set of latent variables.
  • the learning unit 123 obtains a table T3 (see FIG. 8) that associates the probability of transition for each combination of latent variables (a combination of a transition source label and a transition destination label) between latent variables. It can be generated as a model parameter indicating the transition probability.
  • the learning unit 123 determines whether or not a file such as a DLL used for the configuration of the address portion of the ROP code is known (step S28).
  • a file such as a DLL used for the configuration of the address portion of the ROP code is known (step S28: Yes)
  • the learning unit 123 performs relearning based on the address of the ROP gadget candidate in the file (step S29). .
  • the learning unit 123 determines that the file used for the configuration of the address portion of the ROP code is not known (step S28: No), or after the processing of step S29, the value is included in the transition probability and the output probability. It is determined whether or not a zero frequency problem in which “0” appears appears (step S30). If the learning unit 123 determines that a zero frequency problem has occurred (step S30: Yes), the learning unit 123 performs a smoothing process (step S31).
  • step S30 determines that the zero frequency problem does not occur (step S30: No), or after the smoothing process of step S31 is completed, the learning unit 123 uses the model parameters of the generated probability model as the probability model DB20. (Step S32), and the probability model generation process is terminated.
  • the learning unit 123 outputs, for each latent variable, the output probability of the observation variable (byte) in which the output probability of each byte that is the observation variable is associated with each label that is the latent variable. Then, a probability model is generated that has, as model parameters, a transition probability between latent variables associated with a transition probability to a latent variable that can be transitioned, and an initial state probability of the latent sequence.
  • the detection unit 124 assigns a label sequence having the most likely label combination to the byte sequence of the inspection target unknown document file 200, and the ROP code of the inspection target unknown document file 200 is determined. The presence or absence is detected.
  • the detection unit 124 probabilistically determines and assigns the most likely label combination to the byte string of the inspection target unknown document file 200. In other words, the detection unit 124 labels the most likely label sequence on the byte sequence of the inspection target unknown document file 200.
  • the detection unit 124 detects this portion as the ROP code.
  • the detection unit 124 sets the model parameter of the probability model corresponding to the file format determined by the file format determination unit 121 as ⁇ , and acquires the probability model corresponding to the model parameter ⁇ from the probability model DB 20. .
  • S T latent variables (labels) forming latent sequences
  • o 1 , o 2, ⁇ , o T are the observed variables that forms each observation sequence (bytes), o 1, o 2, ⁇ , a o T ⁇ X.
  • FIG. 12 is a diagram for explaining all combinations of label sequences assumed by the detection unit 124.
  • the observation sequence (byte sequence) O (o 1 , o 2 ,..., O T ) is associated with the time t (1, 2, 3,..., T). It has been.
  • the table T4 includes all possible latent sequences (label sequences) S (s 1 , s 2 ,..., S T for the byte sequence O (o 1 , o 2 ,..., O T ). ) Are associated with each other.
  • the label string (s 1, s 2, ⁇ , s T) as a combination of, the label string (s 1, s 2, ⁇ , s T) as shown in the leftmost column of the column, all There is a combination “1” in which a “document” label is associated with a byte value of “1”. As shown in the right column, the “document” label is stored in the byte (o 1 ), the “document” label is stored in the byte (o 2 ), the “ROP (address 1)” label is stored in the byte (o 3 ), and the byte ( Each of o 4 ) (not shown) to (o T ) has a combination “2” associated with a “document” label.
  • Table T4 there are “K” combinations of such label sequences S (s 1 , s 2 ,..., S T ) for the byte sequence O (o 1 , o 2 ,..., O T ). It is shown that there is.
  • the detecting unit 124 assumes this “K” combination of label sequences by referring to the output probability of the observed variable, the transition probability between the latent variables, and the initial state probability of the latent sequence. As described above, the detection unit 124 obtains all possible combinations of labels with respect to the length of the byte sequence based on the probability model, and then the latent sequence (label sequence) of each combination is a byte sequence. Is calculated on the basis of the model parameter ⁇ .
  • the detection unit 124 first determines the byte value (“0x30”) of the byte string corresponding to each label from each label (all “document” labels) of the label string. , “0x00”, “0x00”,..., “0xff”) is calculated for each byte value. Subsequently, the detection unit 124 determines each of the following combination “2” from each label (“document”, “document”, “ROP (address 1)”,..., “Document”) of the label sequence.
  • the detection unit 124 selects the label string of the combination having the highest probability from the combinations, and assigns it to the byte string of the inspection target file.
  • FIG. 13 is a diagram for explaining an example of a label string that the detection unit 124 gives to the byte string of the inspection target file.
  • the detection unit 124 is as shown in the table T5 of FIG.
  • the label sequence of the combination “k” is associated with the observation sequence (byte sequence) O as a transition sequence (label sequence) S * associated with the byte sequence O.
  • the detection unit 124 adds, to the byte sequence O of the data sequence of the inspection target unknown document file 200, the label sequence S * having the label combination having the highest probability of outputting the byte sequence based on the probability model.
  • the detection unit 124 obtains all possible label combinations for the byte sequence O based on the probability model using the probability model, and the most likely label among the obtained label combinations.
  • a label sequence S * having a combination is probabilistically determined and assigned.
  • the detection unit 124 detects this portion as the ROP code portion. .
  • the detection unit 124 detects the presence or absence of the ROP code portion included in the data series to be inspected.
  • the malignancy determination unit 125 determines whether or not the data series to be inspected is a malignant data series that executes an attack by ROP according to the presence or absence of the ROP code portion detected by the detection unit 124.
  • the calculation amount may be reduced based on dynamic programming. For example, since a Viterbi algorithm can be used for a hidden Markov model or a conditional random field, S * may be obtained using such a method.
  • FIG. 14 is a flowchart illustrating a processing procedure until the attack code detection apparatus 10 illustrated in FIG. 1 determines the unknown document file 200 to be inspected.
  • the attack code detection apparatus 10 acquires the inspection target unknown document file 200 as input data (step S41). Then, the file format determination unit 121 determines the format of the file for the input unknown document file 200 to be inspected as in steps S12 to S13 shown in FIG. 10 (step S42). If it exists (step S43: Yes), the decoding unit 122 performs decoding (step S44).
  • step S43 If the encoded region does not exist (step S43: No), or after the decoding of step S44 is completed, the control unit 12 reads the model parameter corresponding to the file format of the unknown document file 200 to be examined from the probability model DB 20. Is taken out (step S45). Then, the detection unit 124 performs detection processing for detecting the presence or absence of the ROP code in the inspection target unknown document file 200 using the model parameter (probability model) (step S46). The detection result of the ROP code in the detection unit 124 is output to the malignancy determination unit 125.
  • the malignancy determination unit 125 determines whether an ROP code exists in the inspection target unknown document file 200 based on the detection result of the detection unit 124 (step S47). If the malignant determination unit 125 determines that the ROP code is present in the inspection target unknown document file 200 (step S47: Yes), the inspection target unknown document file 200 is determined to be a malignant document file (step S48). On the other hand, when the malignancy determination unit 125 determines that the ROP code does not exist in the inspection target unknown document file 200 (step S47: No), the inspection target unknown document file 200 performs an attack with the ROP code.
  • the control unit 12 makes it possible to execute an application such as a viewer application on the inspection target unknown document file 200.
  • FIG. 15 is a flowchart illustrating a processing procedure of the detection process illustrated in FIG. 14.
  • the detection unit 124 extracts the input byte sequence of the inspection target unknown document file 200 as an observation sequence O (step S ⁇ b> 51). Then, the detection unit 124 has a latent sequence (label sequence) S (s 1 , s 2 ,... S, which is a combination of all possible labels with respect to the length T of the observed sequence (byte sequence) O. In T 2 ), a label combination (latent series; label string) S to be first calculated is set (step S52). For example, the label combination “1” in FIG. 12 is set as the first calculation target.
  • the detection unit 124 refers to the output probability of the observed variable, the transition probability between the latent variables, and the initial state probability of the latent sequence, whereby the probability P (S , O; ⁇ ) is calculated based on the model parameter ⁇ (step S53).
  • the detection unit 124 determines whether there is a next label combination (label string) S to be calculated (step S54).
  • the detection unit 124 determines that there is a next label combination (label string) S to be calculated (step S54: Yes)
  • the detection unit 124 sets the next combination label string S as the calculation target (step S54).
  • the probability P (S, O; ⁇ ) is also calculated for the label string of this combination.
  • the detection unit 124 determines that there is no label sequence S of the next combination to be calculated (step S54: No)
  • the detection unit 124 determines that the calculation has been completed for all possible label sequences. Based on the calculation result for this probability, the label string of the combination showing the highest probability is selected as the label string S * corresponding to the byte string O from each combination (step S56). In other words, the detection unit 124 assigns the most likely combination of label strings to the byte string of the inspection target file with respect to the byte string O of the inspection target unknown document file 200.
  • the detection unit 124 determines whether or not there is a label indicating the ROP code in the label sequence S * given to the byte sequence O of the inspection target unknown document file 200 (step S57).
  • the detection unit 124 determines that there is a label indicating the ROP code (step S57: Yes)
  • the detection target unknown document file 200 detects that the file includes the ROP code (step S58).
  • the detection target unknown document file 200 detects that the file does not include the ROP code (step S59).
  • the detection unit 124 outputs the detection result for the unknown document file 200 to be inspected to the malignancy determination unit 125 (step S60), and ends the detection process.
  • a probability model in which the characteristics of a byte sequence that is a component of a document file and the characteristics of a byte sequence that is a component of an ROP code are generated in advance.
  • the constituent elements of the document file can be estimated without opening the unknown document file to be inspected by an application such as a viewer application.
  • the malignancy determination of a document file can be realized at high speed by a heuristic method.
  • addresses and constants are divided in accordance with the actual environment, and the output probability of the byte string (observation series) is obtained as a model parameter for each divided byte unit. Accordingly, the transition probability of the transition sequence and the initial state probability of the latent sequence are generated as model parameters in consideration of the number of latent variables (labels) and the transition state of the latent variables. For this reason, according to the first embodiment, detection can be performed using model parameters including the transition state of the ROP code while corresponding to the actual environment, so that highly accurate detection of the ROP code is realized. it can.
  • the characteristics of the ROP code can be captured by a static method that does not involve execution of an application program, so that high-speed and high-precision detection can be realized, and further robust. Since detection is performed using a heuristic technique, it is possible to prevent detection by an attacker.
  • the first embodiment is useful for detecting an ROP code included in a document file and is suitable for performing a high-speed inspection on a large number of document files. Therefore, by introducing the attack detection device 10, the attack code detection method, and the attack code detection program according to the first embodiment into the network together with the network monitoring device, many document files that pass through the network include ROP codes. It is possible to test for malignancy.
  • the ROP code embedded in the document file is premised. However, even if the data is not a document file, if the distribution of the byte sequence has some tendency, the ROP is similarly applied. The code can be detected. Therefore, the first embodiment can be used for detecting an ROP code in communication data, for example. Specifically, the first embodiment can be applied to any file such as an image file, a moving image file, and an execution file.
  • each component of each illustrated device is functionally conceptual and does not necessarily need to be physically configured as illustrated.
  • the specific form of distribution / integration of each device is not limited to the one shown in the figure, and all or a part of the distribution / integration is functionally or physically distributed in arbitrary units according to various loads or usage conditions. Can be integrated and configured.
  • all or a part of each processing function performed in each device may be realized by a CPU and a program that is analyzed and executed by the CPU, or may be realized as hardware by wired logic.
  • FIG. 16 is a diagram illustrating an example of a computer in which the attack code detection device 10 is realized by executing a program.
  • the computer 1000 includes a memory 1010 and a CPU 1020, for example.
  • the computer 1000 also includes a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These units are connected by a bus 1080.
  • the memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM 1012.
  • the ROM 1011 stores a boot program such as BIOS (Basic Input Output System).
  • BIOS Basic Input Output System
  • the hard disk drive interface 1030 is connected to the hard disk drive 1090.
  • the disk drive interface 1040 is connected to the disk drive 1100.
  • a removable storage medium such as a magnetic disk or an optical disk is inserted into the disk drive 1100.
  • the serial port interface 1050 is connected to a mouse 1110 and a keyboard 1120, for example.
  • the video adapter 1060 is connected to the display 1130, for example.
  • the hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, the program that defines each process of the attack code detection apparatus 10 is implemented as a program module 1093 in which a code executable by the computer 1000 is described.
  • the program module 1093 is stored in the hard disk drive 1090, for example.
  • a program module 1093 for executing processing similar to the functional configuration in the attack code detection device 10 is stored in the hard disk drive 1090.
  • the hard disk drive 1090 may be replaced by an SSD (Solid State Drive).
  • the setting data used in the processing of the above-described embodiment is stored as program data 1094 in, for example, the memory 1010 or the hard disk drive 1090. Then, the CPU 1020 reads the program module 1093 and the program data 1094 stored in the memory 1010 and the hard disk drive 1090 to the RAM 1012 and executes them as necessary.
  • the program module 1093 and the program data 1094 are not limited to being stored in the hard disk drive 1090, but may be stored in, for example, a removable storage medium and read by the CPU 1020 via the disk drive 1100 or the like. Alternatively, the program module 1093 and the program data 1094 may be stored in another computer connected via a network (LAN, WAN, etc.). Then, the program module 1093 and the program data 1094 may be read by the CPU 1020 from another computer via the network interface 1070.
  • LAN local area network
  • WAN wide area network

Abstract

攻撃コード検知装置(10)は、ROPコードを含む既知のラベル付き悪性文書ファイル(100)を学習データとして、文書ファイルの構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴とを学習したモデルを生成する学習部(123)と、モデルを基に、検査対象未知文書ファイル(200)に含まれるROPコードを検知する検知部(124)と、検知結果を基に検査対象未知文書ファイル(200)がROPにより攻撃を実行する悪性なデータ系列であるか否かを判定する悪性判定部(125)と、を有する。

Description

攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム
 本発明は、攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラムに関する。
 近年、悪性文書ファイルによる脅威が顕在化している。悪性文書ファイルとは、内容を閲覧するためにこのファイルをビューアアプリケーションで開くと、攻撃が開始され、マルウェアの感染に至るように構成された文書ファイルである。
 このような悪性文書ファイルの多くは、文書ファイル内に脆弱性を攻略するエクスプロイトコードを持つ。このエクスプロイトコードとは、悪意のある動作を実現するために、脆弱性を攻略するためのコードである。攻撃は、攻撃者の任意のコードを実行させることを目指して脆弱性を攻略するものが多く、悪性文書ファイルは、エクスプロイトコードを用いて脆弱性を攻略し、攻撃対象に攻撃コードを実行させ、最終的にマルウェアをダウンロードして実行させる。この攻撃コードとして、シェルコードやROP(Return Oriented Programming)コードが用いられる。
 まず、シェルコードとは、攻撃者が作成した機械語コード片であり、作成したコードに応じて、アプリケーションに任意の動作をさせることができるものである。シェルコードによる攻撃を実現するためには、メモリへの書き込みによってシェルコードを注入し、それを実行させる必要がある。ただし、近年では、書き込み可能なメモリ領域を実行不可にするデータ実行防止機構の普及により、シェルコードのみで攻撃を成功させることは難しくなってきている。
 それにともなって、ROP攻撃と呼ばれる新たな攻撃手法の脅威が顕在化してきている。ROP攻撃とは、脆弱性を攻略してコールスタックを上書きすることでリターン先を掌握し、ret命令の繰り返しによってライブラリなどの既存のコードを継ぎ接ぎすることで、任意のコード実行を実現する攻撃手法である。なお、ROPでリターンした先に存在する、継ぎ接ぎされる既存のコードは、ROPガジェットと呼ばれる。
 このROP攻撃は、以下の手順で実現される。まず、攻撃者は、バッファオーバーフローなどの脆弱性を突いて、コールスタックを書き換えられることを確認する。これによって、攻撃者は、以降のリターン先を掌握できるようになる。続いて、攻撃者は、コールスタックを上書きするコードを生成する。このとき、攻撃者は、リターンの繰り返しによってライブラリなどの既存のコードを継ぎ接ぎし、任意の動作を実現できるコードを生成する。この生成されたコードを、ROPコードと呼ぶ。そして、攻撃者は、コールスタックをROPコードで上書きさせることによって、攻撃対象に対し、攻撃者の任意のコードを実行させる。以上が一般的なROPの手順である。このROP攻撃では、シェルコードを注入することなく、任意のコードを実行させることが可能である。
 このROP攻撃は、データ実行防止機構に影響されずに任意コード実行が可能であるものの、攻撃対象の環境によって、ROPコードの長さに制約があり、自由な攻撃を実現できない場合も少なくない。したがって、近年では、攻撃手法として、短いROPコードによってデータ実行防止機構を回避し、実際の悪性な動作は、シェルコードによって実施する手法が多い。特に、脆弱性を攻略してROPコードを実行し、シェルコードを実行可能な状態にしてから該シェルコードを実行することによって、マルウェアのダウンロードなどの攻撃を行う文書ファイルが発見されている。
 以上のような悪性文書ファイルによる脅威を検知し、対処するためには、文書ファイルの悪性判定が必要となる。この悪性文書ファイルを判定する方法として、文書ファイル中にエクスプロイトコードや攻撃コードが含まれているか否かを検知する方法がある。
 ここで、エクスプロイトコードは、文書ファイル中に含まれている場合と、含まれていない場合とが存在する。例えば、PDF(Portable Document Format)形式のように、スクリプトエンジンや、プラグインの脆弱性を攻略することが多い悪性文書ファイルは、エクスプロイトコードを具備している可能性が高い。一方で、OLE(Object Linking and Embedding)形式のように、ビューアアプリケーションのフォーマットの扱いの不備に存在する脆弱性を攻略することが多い悪性文書ファイルでは、エクスプロイトコードを持たない場合が少なくない。そのため、攻撃コードの検知が有効な手法となる。
 しかしながら、攻撃コードの一つであるシェルコードの検知が困難な場合がある。例えば、シェルコードがエンコードされており、実行の直前にデコードされるという手法が存在するためである。この場合、シェルコードの特徴がエンコードによって隠蔽されるため、シェルコードの検知が難しくなる。したがって、シェルコードの検知による悪性判定は、正しく機能しない場合がある。以上より、攻撃コードのうち、ROPコードを検知する技術が重要となってきている。このROPコードを検知する手法として、従来、以下に挙げる手法が提案されている。
 例えば、非特許文献1には、次のような手法が提案されている。非特許文献1記載の手法では、まず、実行命令を監視し、call命令実行時にスタックにプッシュされるリターンアドレスを、シャドウスタックに保存しておく。そして、ret命令実行時にリターンする先となるリターンアドレスと、シャドウスタックの最上位に保存されているアドレスとを比較することによって、適切にリターンしているかを検証し、ROPを検知する。非特許文献1には、この手法によれば、実験によって、誤検知なくROPを検知できることが記載されている。
 また、例えば、非特許文献2には、仮想環境上で、検査対象の文書ファイルをビューアアプリケーションで開き、メモリスナップショットを取得して解析を行う手法が提案されている。この解析として、まず、メモリスナップショット中に含まれているアドレスを抽出して、ROPガジェットの候補がそれぞれどんな動作をするかをプロファイルする。そして、このプロファイルを基に、ROPコード全体のプロファイルを行っている。
 そして、非特許文献3には、ROPコードの特徴に基づいて、ポリシーベースで静的に検知する手法が提案されている。この手法では、シグネチャに依存せずに静的にROPコードを検知でき、良性の文書ファイルに対する誤検知も非常に少ないとされる。
L. Davi, A. Sadeghi, and M. Winandy, "ROPdefender: A Detection Tool to Defend Against Return-Oriented Programming Attacks", Proceedings of the 6th ACM Symposium on Information, Computer and Communications Security, Pages 40-51, ASIACCS, 2011 B. Stancill, K. Z. Snow, N. Otterness, F. Monrose, L. Davi and A. Sadeghi, "Check My Profile: Leveraging Static Analysis for Fast and Accurate Detection of ROP Gadgets", Volume 8145 of the series Lecture Notes in Computer Science, pp62-81,RAID, 2013 田中 恭之,後藤 厚宏, "悪性文書ファイル内のROP攻撃コード静的判定手法", 情報処理学会論文誌,Vol.56,No.9,1693-1705(Sep, 2015)
 しかしながら、非特許文献1記載の動的手法では、実行命令の監視が必要であり、かつ、検査対象の文書ファイルを仮想環境上でビューアアプリケーションを用いて開かなければならない上に、実行命令の監視の際に、DBI(Dynamic Binary Instrumentation) 技術を用いているため、ビューアアプリケーション自体の実行速度も低下することから、ファイルの検査に一定の時間を必要とするという問題があった。
 また、非特許文献2記載の手法では、DBI技術を用いた動的解析よりも短時間で実施でき、さらに、ROPコード中のアドレスが、どのようなガジェットを指しているかの対応付けも可能であるものの、仮想環境での実行や、メモリスナップショットの取得に時間がかかるため、一定の時間を必要とするという問題があった。
 そして、非特許文献3記載の手法では、決定論的な検知手法を採用しているため、ポリシーを知る攻撃者には、回避されてしまう可能性が高いという問題があった。また、非特許文献3の中で提案されているポリシーでは、例えば、ごく短いROPコードや、複数のライブラリにまたがって構成されたROPコードを、検知できない可能性が高いという問題があった。
 本発明は、上記に鑑みてなされたものであって、攻撃者によるROP検知の回避を防ぎながら、高速かつ高精度なROPコードの検知を実現することができる攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラムを提供することを目的とする。
 上述した課題を解決し、目的を達成するために、本発明に係る攻撃コード検知装置は、ROPコードを含む既知の悪性データ系列を学習データとして、データ系列の構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習したモデルを生成する学習部と、モデルを基に、検査対象の未知のデータ系列に含まれるROPコードを検知する検知部と、検知部の検知結果を用いて、検査対象の未知のデータ系列がROPにより攻撃を実行する悪性なデータ系列であるか否かを判定する悪性判定部と、を有することを特徴とする。
 本発明によれば、攻撃者によるROP検知の回避を防ぎながら、高速かつ高精度なROPコードの検知を実現することができる。
図1は、実施の形態1に係る攻撃コード検知装置の構成の一例を説明するための図である。 図2は、図1に示すラベル付き悪性文書ファイルの一例を示す図である。 図3は、図2に示すファイルにおけるROPコード部分を説明するための図である。 図4は、図3の表の左側部分の1行目から5行目のバイト及びラベルを模式的に対応付けた図である。 図5は、潜在系列(ラベル列)の潜在変数となるラベルの遷移の例を示した図である。 図6は、各潜在変数(ラベル)について潜在系列の初期状態確率を対応付けた表を示す図である。 図7は、潜在変数(ラベル)ごとに、観測変数(バイト)の出力確率を対応付けた表を示す図である。 図8は、潜在変数(ラベル)間の遷移確率を、遷移する潜在変数の組み合わせごとに対応付けた表を示す図である。 図9は、64bit環境に対応させたラベルの遷移の例を示す図である。 図10は、図1に示す攻撃コード検知装置が確率モデルを生成するまでの処理手順を示すフローチャートである。 図11は、図10に示す確率モデル生成処理の処理手順を示すフローチャートである。 図12は、図1に示す検知部が想定する全てのラベル列の組み合わせを説明するための図である。 図13は、図1に示す検知部が、検査対象ファイルのバイト列に付与するラベル列の例を説明するための図である。 図14は、図1に示す攻撃コード検知装置が検査対象未知文書ファイルを判定するまでの処理手順を示すフローチャートである。 図15は、図14に示す検知処理の処理手順を示すフローチャートである。 図16は、プログラムが実行されることにより、攻撃コード検知装置が実現されるコンピュータの一例を示す図である。
 以下、図面を参照して、本発明の一実施形態を詳細に説明する。なお、この実施形態により本発明が限定されるものではない。また、図面の記載において、同一部分には同一の符号を付して示している。
[実施の形態1]
 実施の形態1に係る攻撃コード検知装置について、攻撃コード検知装置の概略構成、及び、攻撃コード検知装置における処理の流れ及び具体例を説明する。
 この実施の形態1に係る攻撃コード検知装置は、事前に、ROPコードを含む既知の悪性データ系列を用いて、文書ファイル部分とROPコード部分とのそれぞれが有するバイト列の特徴を学習した確率モデルを生成する。そして、この攻撃コード検知装置は、生成した確率モデルに基づき、検査対象である未知の文書に対し、この文書を構成するバイト列に、文書ファイルの構成要素であることを示すラベル(文書ラベル)或いはROPコードの構成要素であることを示すラベル(ROPラベル)をラベリングする。これによって、実施の形態1に係る攻撃コード検知装置は、この未知の文書をビューアアプリケーションで開くことなく、この未知の文書がROPコード部分を含むか否かを検知する。
 したがって、実施の形態1に係る攻撃コード検知装置は、検査対象の未知の文書に含まれるROPコード部分の検知を、いわゆるヒューリスティック判定で高速に実現する。ヒューリスティック判定とは、これまでの学習に基づいて、ROPコードらしさを定義し、その定義に従って判定するものである。
[攻撃コード検知装置の構成]
 そこで、図1を参照して、実施の形態1に係る攻撃コード検知装置の構成について説明する。図1は、実施の形態1に係る攻撃コード検知装置の構成の一例を説明するための図である。
 図1に示すように、実施の形態1に係る攻撃コード検知装置10は、入力部11、制御部12、出力部13、記憶部14及び確率モデルデータベース(DB)20を有する。
 入力部11は、キーボードやマウス等の入力デバイスで構成され、外部からの情報の入力を受け付け、制御部12に入力する。入力部11は、ラベル付き悪性文書ファイル100、或いは、検査対象未知文書ファイル200の入力を受け付け、制御部12に出力する。ラベル付き悪性文書ファイル100は、ROPコードを含む既知の悪性データ系列であり、文書ファイルの構成要素であるバイトに文書ラベルが付与される一方、ROPコードの構成要素であるバイトにROPラベルが付与された悪性データ系列である。検査対象未知文書ファイル200は、未知の文書ファイルである。
 制御部12は、各種の処理手順などを規定したプログラム及び所要データを格納するための内部メモリを有し、これらによって種々の処理を実行する。例えば、制御部12は、CPU(Central Processing Unit)やMPU(Micro Processing Unit)などの電子回路である。制御部12は、ファイル形式判定部121、デコード部122、学習部123、検知部124及び悪性判定部125を有する。
 ファイル形式判定部121は、入力される全ての文書ファイルに対し、いずれのファイル形式によって構成されているファイルであるかを判定する。ファイル形式判定部121は、入力された文書ファイルについて、この文書ファイルのヘッダやファイル構造の特徴に基づいて、ファイルの形式を判別する。例えば、ファイルの形式として、DOC、XLS、PPT、PDFなどが想定される。
 デコード部122は、文書ファイルの形式によってはエンコードされている領域が存在するため、エンコードされた領域があれば、このエンコードされた領域をデコードする。
 学習部123は、ラベル付き悪性文書ファイル100を学習データとして、文書ファイルの構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習した確率モデルを生成する。学習部123は、生成した確率モデルを、確率モデルDB20にモデルパラメータの形で記憶させる。
 検知部124は、確率モデルDB20に記憶された確率モデルに基づいて、検査対象未知文書ファイル200のデータ系列に含まれるROPコードを検知する。具体的には、検知部124は、確率モデルを基に、検査対象の未知のデータ系列を構成するバイト列に対して、文書ファイルの構成要素であるか、或いは、ROPコードの構成要素であるかのラベリングを行い、検査対象未知文書ファイル200のデータ系列に含まれるROPコードを検知する。すなわち、検知部124は、検査対象未知文書ファイル200に対し、この文書を構成するバイト列に、文書ラベル或いはROPラベルをラベリングすることによって、検査対象未知文書ファイル200の構成要素にROPコード部分が含まれているか否かの検知を行う。
 悪性判定部125は、検知部124が検知したROPコード部分の有無に基づいて、検査対象の検査対象未知文書ファイル200のデータ系列がROPにより攻撃を実行する悪性なデータであるか否かを判定する。悪性判定部125は、検知部124が検査対象未知文書ファイル200にROPコード部分が含まれることを検知した場合には、検査対象未知文書ファイル200が悪性なデータであることを判定する。一方、悪性判定部125は、検知部124が検査対象未知文書ファイル200にROPコード部分が含まれていないことを検知した場合には、検査対象未知文書ファイル200がROPによる攻撃を行う悪性なデータでないことを判定する。
 出力部13は、例えば、液晶ディスプレイやプリンタ等であって、攻撃コード検知に関する情報を含む各種情報を出力する。また、出力部13は、外部装置との間で、各種データの入出力を司るインタフェースであってもよく、外部装置に各種情報を出力してもよい。
 記憶部14は、RAM(Random Access Memory)、フラッシュメモリ(Flash Memory)等の半導体メモリ素子、または、ハードディスク、光ディスク等の記憶装置によって実現され、攻撃コード検知装置10を動作させる処理プログラムや、処理プログラムの実行中に使用されるデータなどが記憶される。
 確率モデルDB20は、学習部123によって生成された確率モデルをモデルパラメータの形で蓄積する。確率モデルDB20は、攻撃コード検知装置10によって管理される。もちろん、確率モデルDB20は、他の装置(サーバ等)によって管理されていてもよく、この場合には、学習部123は、出力部13の通信インタフェースを介して、生成した確率モデルを、確率モデルDB20の管理サーバ等に出力して、確率モデルDB20に記憶させる。
[ラベル付き悪性文書ファイルの構成]
 次に、ラベル付き悪性文書ファイル100について説明する。図2は、図1に示すラベル付き悪性ファイル100の一例を示す図である。ラベル付き悪性文書ファイル100は、実際の悪性文書ファイルを調査し得られたものであり、例えば、図2のファイルDに示すように、エクスプロイトコード部、シェルコード部、ROPコード部等を含む。学習部123は、例えば、このようなファイルDを、学習するためのデータとして用い、文書ファイルの構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習した確率モデルを生成する。
 図3は、図2に示すファイルD(ラベル付き悪性文書ファイル100)におけるROPコード部分を説明するための図である。図3は、説明のために、ROPコード部分及びその前後の部分のデータ系列の具体例を示す。図3では、ROPコード部分とともにROPコード部分の直前の文書ファイルの一部バイト値として「0xff」、及び、ROPコード部分の直後の文書ファイルの一部バイト値として「0x31」を示す。
 ここでは、リトルエンディアンの環境下で、4バイトで構成されるアドレスや定数を1バイトごとに分割し、最下位のバイトから順に記録した例を示している。そこで、図3では、分割された各バイトの値を、表Taの左列に、記録順に一列に配置している。以降については、この列をバイト列として説明する。
 図3に示すように、攻撃コード検知装置10では、ラベル付き悪性文書ファイル100として、ラベル付き悪性文書ファイル100のそれぞれのバイト値に、各バイトの由来を表すラベルが対応付けられて組になったものが用いられている。由来とは、そのバイト値が文書ファイルの構成要素か、ROPコードの構成要素かを示すものである。なお、図3では、各バイト値にそれぞれ対応付けられたラベルの名前は、表Taの右列に、組となるバイトの配置に合わせて一列に配置している。以降については、この列をラベル列として説明する。
 ここで、ROPコードの構成要素には、具体的には、ROPガジェットアドレス、定数、及び、ジャンクコードの3つがある。ROPガジェットアドレスは、ROPガジェットを指し示すアドレス値である。定数は、ROPで関数呼び出しをする際の引数である。そして、ジャンクコードは、スタックポインタの位置を調整するためにあるもので、攻撃の際に参照されないコードである。
 以降では、上記の3つの構成要素をそれぞれ、「アドレス」、「定数」、「ジャンク」と表記する。また、本実施の形態1は、文書ファイルの構成要素を「文書ラベル」と表記する。
 そして、ROPコードの構成要素には、ROP(アドレス1,2,3,4)ラベル、ROP(定数1,2,3,4)ラベル、ROP(ジャンク)ラベルを用いている。ここで、「1,2,3,4」の数字は、4バイトで構成されるアドレスや定数のうち、何バイト目のバイトであるかを示すインデックスである。リトルエンディアンの環境下では、ROP(アドレス1)やROP(定数1)のラベルには、アドレスや定数の最下位バイトが対応し、ROP(アドレス4)やROP(定数4)のラベルには、最上位バイトが対応する。
 例えば、図3の表Taの左側部分の上から2行目から始まる「0x0101acd9」というROPアドレスに対しては、バイト値「0xd9」にROP(アドレス1)ラベルが付与されており、バイト値「0xac」にROP(アドレス2)ラベルが付与されており、バイト値「0x01」にROP(アドレス3)ラベルが付与されており、バイト値「0x01」にはROP(アドレス4)ラベルが付与されている。同様に、表Taの右側部分の1行目から始まる「0x00003000」という定数に対しては、バイト値「0x00」にROP(定数1)ラベルが付与されており、バイト値「0x30」にROP(定数2)ラベルが付与されており、バイト値「0x00」にROP(定数3)ラベルが付与されており、バイト値「0x00」にROP(定数4)ラベルが付与されている。
 このように、攻撃コード検知装置10においては、学習用のデータとして、ラベル付き悪性文書ファイル100のそれぞれのバイトに、文書ラベル或いはROPラベルが対応付けられたものを用いる。
 なお、ラベルの設計はこれに限るものではなく、例えば、文書ラベルを文書ファイルの形式にあわせてさらに細かく分解してもよい。また、テキスト文書が含まれるワードドキュメントストリーム、様々なデータが含まれるデータストリーム、マクロプログラムが含まれるマクロストレージなどでは、それぞれバイト列の分布が異なると考えられるため、これらを分けるなどが考えられる。
 また、学習データとなるラベル付き悪性文書ファイル100は、予め作成されたものである。ラベル付き悪性文書ファイル100の作成は、ROPコードが含まれる悪性文書ファイルを発見し、この発見した悪性文書ファイルを用いて、所定の方法でバイトに分割する。続いて、手動或いは動的解析によって、各バイトに、ラベルを付与する。
 例えば、手動によってラベルを付与する場合には、一般に流通している、脆弱性に対するPoC(Proof-of-Concept)コードなどに記載されているROPアドレスを参照して、文書ファイル中に埋め込まれたROPコードを抽出する。そして、アドレス値から、ROPが用いるライブラリの種類を調べ、ROPアドレスを確認しながらラベル付けをしていく。
 また、動的解析によってラベルを付与する場合は、非特許文献1に示す手法を用いることもできる。すなわち、実行命令やスタックの状態などを監視することによってROPを検知するシステムを用いて、ROPコード部分を抽出する。そして、このシステムでは、ラベル付けについても、実行されたROPガジェットのアドレスを参照し、付与している。
[学習部の学習処理]
 学習部123は、上述したような、ラベル付き悪性文書ファイル100のバイトに、文書ラベル或いはROPラベルが対応付けられたものを用いて、文書ファイル部分とROPコード部分とのそれぞれが有するバイト列の特徴を学習した確率モデルを生成する。
 図4は、図3の表Taの左側部分の1行目から5行目のバイト及びラベルを模式的に対応付けた図である。上述したように、本実施の形態1では、各バイトに各バイトの由来を表すラベルが対応付けた学習データを用意している。すなわち、文書ファイルの各バイトに、文書ラベルと複数のROPラベルとの中からいずれか一つをラベル付けしたものである。このため、各バイトの背後には、いずれかのラベルが潜んでいると言える。そして、攻撃検知対象のROP攻撃では、ROPコードにより、短いROPガジェット間を次々に遷移させることによって、コードを継ぎ接ぎし、任意の動作を実現できるコードを生成するものである。ROPコードの構成は、遷移していくROPアドレスを基本としていて、ROPアドレスによる関数呼び出しがあれば定数が続き、さらにスタックの調整が必要であればジャンクが連なる、というように、それぞれ前後で関連性がある。このため、各バイトの背後にそれぞれ潜むラベルは、他のラベルへと遷移するものと言える。
 したがって、図4に示すように、文書ファイルから観測可能な系列であるバイト列の背後には、確率的に遷移する潜在的な状態の系列であるラベル列が潜んでおり、それぞれの状態ごとに、確率的にバイト値を出力するというモデルが考えられる。なお、観測可能な系列(観測系列)にはバイト列が対応し、潜在的な状態の系列(潜在系列)にはラベル列が対応する。したがって、学習部123は、潜在系列からの観測変数の出力確率を、確率モデルのモデルパラメータの一つとして生成する。
 そして、潜在系列(ラベル列)の潜在変数となる各ラベルは、他のラベルへと遷移する特徴を有する。図5は、潜在系列(ラベル列)の潜在変数となるラベルの遷移の例を示した図である。例えば、ROPコード検出の問題に適用可能な、隠れマルコフモデルや条件付き確率場のようなグラフィカルモデルでは、潜在変数がどのように遷移するかが一つの重要な要素となる。
 ここでは、潜在変数(ラベル)の遷移の特徴として、図5の矢印R1,R2に示すように、アドレスラベル(ROPアドレス1~4ラベル)や定数ラベル(ROP定数1~4ラベル)は、4バイト分のleft-to-rightの一方通行の形になっていることが挙げられる。これは、32bit環境下では、アドレスや定数が4バイト単位であるためである。
 そして、潜在変数の遷移の特徴として、文書ラベルからは、文書ラベル、アドレスラベル、または、ジャンクラベルにのみ遷移すること(図5の矢印Y1~Y3参照)が挙げられる。これは、文書の直後に定数が来るROPコードは存在し得ないためである。
 ROPコード検知の際には、このような特徴を基にROPコードの有無を検知するため、学習部123は、さらに、潜在変数の遷移状態を確率的に示すモデル、すなわち、潜在変数間の遷移確率を、確率モデルのモデルパラメータの一つとして生成する。
 以上より、学習部123は、観測変数の出力確率、潜在変数間の遷移確率及び潜在系列の初期状態確率をモデルパラメータとして持つモデルを想定し、図6~図8に例示するような確率モデルの生成を行う。図6は、各潜在変数(ラベル)について潜在系列の初期状態確率を対応付けた表を示す図である。図7は、潜在変数(ラベル)ごとに、観測変数(バイト)の出力確率を対応付けた表を示す図である。図8は、潜在変数(ラベル)間の遷移確率を、遷移する潜在変数の組み合わせごとに対応付けた表を示す図である。
 まず、学習部123が、モデルパラメータのうち観測変数の出力確率を生成するまでの処理について説明する。上述したように、文書ファイルのバイト列が観測系列に対応し、ラベル列が潜在系列に対応する。学習部123は、まず、学習データとして、既知のラベル付き悪性文書ファイル100を学習データとして受け取る(例えば、図3の表Ta参照)。
 続いて、潜在変数の初期状態確率πについて、文書ラベルに対応する潜在変数から始まる確率π文書を1、それ以外のラベルに対応する潜在変数から始まる確率を0として設定する。ROPコードから始まる文書ファイルは、ファイル形式上、考えにくいためである。学習部123は、このため、初期状態確率として、文書ラベルには「1」が対応付けられ、文書以外のラベルには「0」が対応付けられた表T1(図6参照)を、この潜在系列の初期状態確率を示すモデルパラメータとして生成し、確率モデルDB20に格納する。
 そして、学習部123は、全ての潜在変数(ラベル)に対して、そのラベルが観測変数(バイト)を出力する確率を計算する。ここで、観測変数の取り得る値はバイト値であるため、その集合Xは、X={0x00,…,0xFF}となる。また、潜在変数の取り得る値はラベルであるため、その集合Lは、L={文書,ROP(アドレス1),…,ROP(アドレス4),ROP(定数1),…,ROP(定数4),ROP(ジャンク)}となる。
 このため、例えば、文書ラベルがバイト値「0x00」を出力する確率は、「文書ラベルの付いている0x00の値を持つバイト数」を「文書ラベルの付いている全バイト数」で除することによって計算することができる。この計算を、バイト値「0x00」からバイト値「0xFF」についてそれぞれ計算する。これによって、文書ラベルが、各バイト値「0x00」からバイト値「0xFF」をそれぞれ出力する確率が計算できる。この計算を全てのラベルについて計算する。
 学習部123は、これらの計算を行うことによって、潜在変数(ラベル)ごとに、それぞれの観測変数(バイト)の出力確率を対応付けた表T2(図7参照)を、観測変数の出力確率を示すモデルパラメータとして生成し、確率モデルDB20に格納する。
 この観測変数の出力確率として、Lのうちi番目のものをl,Xのうちj番目のものをxとして、lがxを出力する確率をbi,jとする。その場合、表T2に例示するように、例えば「文書」ラベルについては、「0x00」から「0xFF」までのバイト値を出力する確率「b文書,0x00」から「b文書,0xFF」が対応付けられ、「ROP(アドレス1)」ラベルについては、「0x00」から「0xFF」までの全ての取り得るバイト値を出力する確率「bROP(アドレス1),0x00」から「bROP(アドレス1),0xFF」が対応付けられたものである。
 次に、学習部123が、モデルパラメータのうち潜在変数間の遷移確率を生成するまでの処理について説明する。この場合、学習部123は、全てのあり得る潜在変数(ラベル)の組について、ラベル間の遷移確率を計算する。まず、学習部123は、図5を用いて説明した、アドレスラベルや定数ラベルが4バイト分のleft-to-rightの一方通行の形になるというラベルの遷移の特徴、文書ラベルからは、文書ラベル、アドレスラベル、または、ジャンクラベルにのみ遷移するというラベルの遷移の特徴、及び、図5に示すラベルの遷移状態関係に基づいて、全てのあり得るラベルの組を求める。
 この全てのあり得る潜在変数(ラベル)の組について、潜在変数間の遷移確率を計算するには、潜在変数間の遷移回数を集計することで計算できる。例えば、ROP(アドレス4)ラベルからROP(ジャンク)ラベルへの遷移確率は、「ROP(アドレス4)ラベルからROP(ジャンク)ラベルへの遷移回数」を「ROP(アドレス4)ラベルからの全ての遷移回数」で除することによって計算することができる。この計算を、全てのあり得る潜在変数の組について計算する。
 学習部123は、全てのあり得る潜在変数の組について潜在変数間の遷移確率を計算することによって、潜在変数の組み合わせ(遷移元のラベルと遷移先のラベルとの組み合わせ)ごとに、遷移する確率を対応付けた表T3(図8参照)を、潜在変数間の遷移確率を示すモデルパラメータとして生成し、確率モデルDB20に格納する。
 この潜在変数間の遷移確率として、Lのうちi番目のものをl,j番目のものをlとして、lからlに遷移する確率をai,jとする。その場合、表T3に例示するように、「文書」ラベルから「ROP(アドレス1)」ラベルへの遷移確率には、「a文書,ROP(アドレス1)」が対応付けられている。そして、表T3に例示するように、「文書」ラベルから、各「ROP(アドレス2)」ラベルから「文書」ラベルについても、遷移確率「a文書,ROP(アドレス2)」から「a文書,文書」がそれぞれ対応付けられている。さらに、他のラベルについても同様に、全てのあり得る遷移先のラベルへの遷移確率がそれぞれ対応付けられている。
 さらに、学習部123は、ROPコードのアドレス部分の構成に用いられるDLL等のファイルが判明している場合は、そのファイル中のROPガジェット候補のアドレスを基に再学習する。なお、学習部123がアドレスを学習するために、前提として、このファイルがメモリ上にロードされる際のアドレスが固定である必要がある。この再学習によって、学習データのROPコードに含まれていないアドレスが検査対象で用いられていても、検知率を高く保つことが期待できる。
 この再学習は、モデルパラメータのうち、ROP(アドレス1)ラベルからROP(アドレス4)ラベルの潜在状態における出力確率を更新することで実現できる。まず、学習部123は、ファイル中からROPガジェット候補のアドレス一覧を抽出する。この抽出は、既存のソフトウェアを用いて実現できることが知られている。
 そして、学習部123は、抽出したROPガジェット候補のアドレスを1バイトごとに分割し、1バイト目をROP(アドレス1)、2バイト目をROP(アドレス2)、というように、バイトごとに各ラベルを対応付け、出力確率の計算を行う。例えば、ROP(アドレス1)のラベルがバイト値「0x00」を出力する確率は、「1バイト目が0x00の値を持つアドレス数」を「全アドレス数」で除することによって計算することができる。この計算を「ROP(アドレス1)」から「ROP(アドレス4)」までのラベルについて、それぞれバイト値「0x00」からバイト値「0xFF」まで行うことによって、各出力確率を計算し、モデルパラメータを更新することで、再学習する。
 続いて、学習部123は、このように生成された確率モデルの中で、遷移確率、出力確率の中に、値が「0」となるものがあれば、平滑化処理を行う。平滑化処理とは、パラメータのベクトルの中に確率「0」の次元が存在する場合に、この確率を「0」以外の値に修正する手法である。これは、ゼロ頻度問題と呼ばれる、学習データ中に現れずに出現確率が「0」となっていたものが認識対象中に現れた場合に、うまく認識できなくなるという問題への対策となる。この平滑化処理の手法として、加算スムージングやKneser-neyスムージングなどの手法があるが、もちろん、これらの手法に限るものではない。
 また、確率モデルを生成した後、ラベル付けはされていないが、ROPコードが含まれていることが分かっている悪性文書ファイルがあるとき、これを再学習することによって確率モデルを洗練できる場合がある。
 例えば、学習部123は、採用している確率モデルが隠れマルコフモデルの場合は、Baum-Welchアルゴリズムなどを用いてモデルを再学習してもよい。なお、系列ラベリングを実現する学習手法としては、隠れマルコフモデル、条件付き確率場、構造化サポートベクターマシンなどがあるが、もちろん、これらの手法に限るものではない。
 なお、32bit環境下での確率モデルの生成について説明したが、もちろん、64bit環境下においても、確率モデルを生成することが可能である。図9は、64bit環境に対応させたラベルの遷移の例を示す図である。64bit環境では、レジスタ幅が8バイトとなるため、ROPアドレス及び定数も8バイトとなる。
 したがって、確率モデルもそれに合わせて変更し、潜在変数(ラベル)が増えるとともに、4バイトごとに遷移していたROPアドレス部分と定数部分が、8バイトごとの遷移となっている。具体的には、図9に示すように、潜在変数のうち、ROPアドレスラベル及びROP定数ラベルは8まで増える。なお、64bit環境の場合も、アドレスラベル(ROPアドレス1~8ラベル)や定数ラベル(ROP定数1~8ラベル)は、8バイト分のleft-to-rightの一方通行の形になり(例えば、矢印R3,R4参照)、文書ラベルからは、文書ラベル、アドレスラベル、または、ジャンクラベルにのみ遷移する(図9の矢印Y1’~Y3’参照)。
 もちろん、上述した32bit、64bit環境の例に限るものではなく、他の環境においても、該環境に応じて、ROPアドレス及び定数の潜在変数(ラベル)の数と遷移の連続数とを変化させることで、確率モデルの生成が可能である。
 以上に説明した処理を行うことによって、学習部123は、観測変数の出力確率、潜在変数間の遷移確率、潜在系列の初期状態確率をモデルパラメータとして持つ確率モデルを生成する。
[確率モデルを生成するまでの流れ]
 次に、攻撃コード検知装置10が確率モデルを生成するまでの流れについて説明する。図10は、図1に示す攻撃コード検知装置10が確率モデルを生成するまでの処理手順を示すフローチャートである。
 図10に示すように、制御部12は、まず、確率モデルDB20を確認し、各ファイル形式に対応する確率モデルのモデルパラメータが格納されているか否かを判断する(ステップS11)。制御部12は、各ファイル形式に対応する確率モデルのモデルパラメータが格納されていると判断した場合には(ステップS11:Yes)、確率モデルのモデルパラメータの生成を終了する。
 これに対し、制御部12は、各ファイル形式に対応する確率モデルのモデルパラメータが格納されていないと判断した場合には(ステップS11:No)、ラベル付き悪性文書ファイル100を入力データとして(ステップS12)、学習を開始する。この入力されたラベル付き悪性文書ファイル100に対し、まず、ファイル形式判定部121が、ヘッダやファイル構造の特徴から、ファイルの形式を判定する(ステップS13)。ここで、ファイルの形式としては、例えば、DOC、XLS、PPT、RTF、PDF等を想定している。
 続いて、デコード部122は、入力されたラベル付き悪性文書ファイル100に、エンコードされた領域が存在するか否かを判断する(ステップS14)。デコード部122は、入力されたラベル付き悪性文書ファイル100にエンコードされた領域が存在すると判断した場合には(ステップS14:Yes)、エンコード方法を検出して、対応するデコードを実施する(ステップS15)。このエンコード方法の検出としては、既知のエンコード方法のパターンマッチングを用いる。
 そして、入力されたラベル付き悪性文書ファイル100にエンコードされた領域が存在しないとデコード部122が判断した場合(ステップS14:No)、または、ステップS15終了後、学習部123は、この既知のラベル付き悪性文書ファイル100とそのファイル形式とから、ファイル形式に対応する確率モデルを生成する確率モデル生成処理を実行する(ステップS16)。
 学習部123は、生成した確率モデルを、モデルパラメータの形で、確率モデルDB20に格納して(ステップS17)、処理を終了する。なお、本実施例では文書ファイルを対象としたROPコードの検知、悪性判定について記述しているが、これに限らず、任意のデータ系列に対して同様の手法を適用することができる。
[確率モデル生成処理の流れ]
 次に、図10に示す確率モデル生成処理の流れについて説明する。図11は、図10に示す確率モデル生成処理(ステップS16)の処理手順を示すフローチャートである。
 図11に示すように、学習部123は、ラベル付き悪性文書ファイル100を入力されると(ステップS21)、このラベル付き悪性文書ファイル100から、ROPコード部分及びその前後の部分のデータ系列を用いて学習を行う。
 まず、学習部123は、潜在変数の初期状態確率を、文書ラベルに対応する潜在変数から始まる確率(π文書)を1、それ以外のラベルに対応する潜在変数から始まる確率(例えば、πROP(アドレス1))を0として設定する(ステップS22)。学習部123は、初期状態確率として、文書ラベルには「1」が対応付けられ、文書以外のラベルには「0」が対応付けられた表T1(図6参照)を、この潜在系列の初期状態確率を示すモデルパラメータとして生成する。
 次に、学習部123は、全ての潜在変数(ラベル)lに対して、そのラベルが観測変数(バイト)を出力する確率を計算するために、まず、演算対象であるlのiを1とし、Lの1番目のラベルとする(ステップS23)。続いて、このラベルlにおける観測変数(バイト)「0x00」から「0xFF」の出力確率P(o=0x00|s=l)~P(o=0xFF|s=l)を計算する(ステップS24)。ここで、oおよびsは、長さTの観測系列(バイト列)O=o,o,・・・,oおよび対応する潜在系列(ラベル列)S=s,s,・・・,sにおける時刻tの変数である。この計算は、上述したように、例えば、ラベルlがバイト値「0x00」を出力する確率は、「ラベルlの付いている0x00の値を持つバイト数」を「ラベルlの付いている全バイト数」で除することによって計算する。学習部123は、この計算を、ラベルlについて、バイト値「0x00」からバイト値「0xFF」ごとに、それぞれ計算して、ラベルlが、各バイト値「0x00」からバイト値「0xFF」をそれぞれ出力する確率を求める。
 学習部123は、全てのラベルについて観測変数(バイト)の出力確率P(o=0x00|s=l)~P(o=0xFF|s=l)を計算したか否かを判断する(ステップS25)。学習部123は、全てのラベルについて観測変数(バイト)「0x00」から「0xFF」の出力確率P(o=0x00|s=l)~P(o=0xFF|s=l)を計算していないと判断した場合には(ステップS25:No)、iに1を加算して計算対象のlを次のラベルとし(ステップS26)、ステップS24に戻り、このラベルについて観測変数(バイト)の出力確率P(o=0x00|s=l)~P(o=0xFF|s=l)を計算する。
 一方、学習部123は、全てのラベルについて観測変数(バイト)の出力確率P(o=0x00|s=l)~P(o=0xFF|s=l)を計算したと判断した場合には(ステップS25:Yes)、この計算によって、潜在変数(ラベル)ごとに、観測系列(バイト列)のそれぞれの観測変数(バイト)の出力確率を対応付けた表T2(図7参照)を、観測変数の出力確率を示すモデルパラメータとして生成することができる。
 続いて、学習部123は、全てのあり得る潜在変数(ラベル)の組l,lについて、潜在変数間(l→l)の遷移確率(P(st+1=l|s=l))を計算する(ステップS27)。なお、lは、遷移元のラベルを示し、lは、遷移先のラベルを示す。
 このステップS27における計算は、上述したように、潜在変数間の遷移回数を集計することで計算する。例えば、ROP(アドレス4)ラベルからROP(ジャンク)ラベルへの遷移確率は、「ROP(アドレス4)ラベルからROP(ジャンク)ラベルへの遷移回数」を「ROP(アドレス4)ラベルからの全ての遷移回数」で除することによって計算することができる。この計算を、全てのあり得る潜在変数の組について計算する。学習部123は、この計算によって、潜在変数の組み合わせ(遷移元のラベルと遷移先のラベルとの組み合わせ)ごとに、遷移する確率を対応付けた表T3(図8参照)を、潜在変数間の遷移確率を示すモデルパラメータとして生成することができる。
 そして、学習部123は、ROPコードのアドレス部分の構成に用いられるDLL等のファイルが判明しているか否かを判断する(ステップS28)。学習部123は、ROPコードのアドレス部分の構成に用いられるファイルが判明している場合には(ステップS28:Yes)、そのファイル中のROPガジェット候補のアドレスを基に再学習する(ステップS29)。
 続いて、学習部123は、ROPコードのアドレス部分の構成に用いられるファイルが判明していない場合(ステップS28:No)、または、ステップS29処理後、遷移確率、出力確率の中に、値が「0」となるものが現れたゼロ頻度問題が発生しているか否かを判断する(ステップS30)。学習部123は、ゼロ頻度問題が発生していると判断した場合には(ステップS30:Yes)、平滑化処理を行う(ステップS31)。
 そして、学習部123は、ゼロ頻度問題が発生していないと判断した場合には(ステップS30:No)、または、ステップS31の平滑化処理終了後、生成した確率モデルのモデルパラメータを確率モデルDB20に格納して(ステップS32)、確率モデル生成処理を終了する。
 以上に説明した処理を行うことによって、学習部123は、潜在変数であるラベルごとに、観測変数である各バイトの出力確率を対応付けた観測変数(バイト)の出力確率と、潜在変数ごとに、遷移可能である潜在変数への遷移確率が対応付けられた潜在変数間の遷移確率と、潜在系列の初期状態確率と、をモデルパラメータとして有する確率モデルを生成する。後述する検知部124は、この確率モデルを用いて、検査対象未知文書ファイル200のバイト列に対し、最も尤もらしいラベルの組み合わせを有するラベル列を付与し、検査対象未知文書ファイル200におけるROPコードの有無を検知している。
[検知部の処理]
 そこで、次に、検知部124の検知処理を説明する。検知部124は、学習部123が生成した確率モデルを用いて、検査対象未知文書ファイル200のバイト列に対し、最も尤もらしいラベルの組み合わせを確率的に求めて付与する。言い換えると、検知部124は、検査対象未知文書ファイル200のバイト列に対し、最も尤もらしいラベル列をラベリングする。検知部124は、このラベル列の中にROPコードの構成要素を示すラベルが含まれている場合に、この部分をROPコードとして検知する。
 具体的には、まず、検知部124は、ファイル形式判定部121が判定したファイル形式に対応する確率モデルのモデルパラメータをθとし、該モデルパラメータθに対応する確率モデルを確率モデルDB20から取得する。
 そして、検知部124は、検査対象ファイルのバイト列を、観測系列Oとして抽出する。続いて、検知部124は、Tを観測系列Oの長さとして、潜在系列(ラベル列)をS=s,s,・・・,sとし、観測系列(バイト列)をO=o,o,・・・,oとし、確率モデルのモデルパラメータをθとする。そして、検知部124は、確率モデルに基づいて、観測系列(バイト列)の長さに対して、取り得る全ての組み合わせの潜在系列(ラベル列)を想定する。なお、s,s,・・・,sは、それぞれ潜在系列をなす潜在変数(ラベル)であるため、s,s,・・・,s∈Lであり、o,o,・・・,oは、それぞれ観測系列をなす観測変数(バイト)であるため、o,o,・・・,o∈Xである。
 まず、検知部124が想定する、バイト列の長さに対して取り得る全てのラベル列の組み合わせについて説明する。図12は、検知部124が想定する全てのラベル列の組み合わせを説明するための図である。図12に示す表T4には、時刻t(1,2,3,・・・,T)に、観測系列(バイト列)O(o,o,・・・,o)が対応付けられている。さらに、表T4には、バイト列O(o,o,・・・,o)について、取り得る全ての潜在系列(ラベル列)S(s,s,・・・,s)の各組み合わせが対応付けられている。
 例えば、ラベル列(s,s,・・・,s)の組み合わせとして、ラベル列(s,s,・・・,s)欄の最も左側の列に示すように、全てのバイト値に対して「文書」ラベルが対応付けられる組み合わせ「1」がある。また、その右側の列に示すように、バイト(o)に「文書」ラベル、バイト(o)に「文書」ラベル、バイト(o)に「ROP(アドレス1)」ラベル、バイト(o)(不図示)~(o)にはそれぞれ「文書」ラベルが対応付けられた組み合わせ「2」がある。表T4では、バイト列O(o,o,・・・,o)について、このようなラベル列S(s,s,・・・,s)の組み合わせが「K」通りあることが示されている。
 検知部124は、この「K」通りのラベル列の組み合わせを、観測変数の出力確率、潜在変数間の遷移確率及び潜在系列の初期状態確率を参照することによって想定する。このように、検知部124は、確率モデルに基づいて、バイト列の長さに対して、取り得る全てのラベルの組み合わせを求めた後、これらの各組み合わせの潜在系列(ラベル列)がバイト列を出力する確率P(S,O;θ)を、モデルパラメータθに基づいて計算する。
 具体的には、検知部124は、まず、組み合わせ「1」のラベル列について、このラベル列のそれぞれのラベル(全て「文書」ラベル)から、各ラベルに対応するバイト列のバイト値(「0x30」,「0x00」,「0x00」,・・・・,「0xff」)を出力する確率P(S,O;θ)をバイト値ごとにそれぞれ計算する。続いて、検知部124は、次の組み合わせ「2」について、ラベル列のそれぞれのラベル(「文書」,「文書」,「ROP(アドレス1)」,・・・,「文書」)から、各ラベルに対応するバイト列のバイト値(「0x30」,「0x00」,「0x00」,・・・・,「0xff」)を出力する確率P(S,O;θ)をバイト値ごとにそれぞれ演算する。この計算を、組み合わせ「K」についてまで実行する。なお、P(S,O;θ)は、観測系列の長さをT、潜在系列の初期状態がkである確率をπ、潜在変数(ラベル)lからlに遷移する確率をai,j、潜在変数(ラベル)lが観測変数(バイト)xを出力する確率をbj,kとしたとき、以下の(1)式によって求められる。
Figure JPOXMLDOC01-appb-M000001
 そして、検知部124は、この確率に対する計算結果を基に、各組み合わせの中から、確率が最も高くなる組み合わせのラベル列を選択し、検査対象ファイルのバイト列に付与する。図13は、検知部124が、検査対象ファイルのバイト列に付与するラベル列の例を説明するための図である。ここで、例えば、図12の表T4のうち、組み合わせ「k」のラベル列が、確率が最大となる組み合わせのラベル列である場合には、検知部124は、図13の表T5に示すように、観測系列(バイト列)Oに対し、組み合わせ「k」のラベル列を、バイト列Oに対応付ける遷移系列(ラベル列)Sとして対応付ける。
 このように、検知部124は、確率モデルを基に、検査対象未知文書ファイル200のデータ系列のバイト列Oに、該バイト列を出力する確率が最も高いラベルの組み合わせを有するラベル列S*を付与する。言い換えると、検知部124は、確率モデルを用いて、確率モデルを基に、バイト列Oに対し、取り得る全てのラベルの組み合わせを求め、該求めたラベルの組み合わせのうち、最も尤もらしいラベルの組み合わせを有するラベル列S*を確率的に求め付与する。
 そして、検知部124は、この検査対象の文書ファイルのバイト列Oに付与されたラベル列S*の中に、ROPコードの構成要素を示すラベルがあれば、この部分をROPコード部分として検知する。
 以上に説明した処理を行うことによって、検知部124は、検査対象のデータ系列に含まれるROPコード部分の有無を検知する。悪性判定部125は、検知部124の検知したROPコード部分の有無に応じて、検査対象のデータ系列がROPにより攻撃を実行する悪性なデータ系列であるか否かを判定する。
 なお、系列の長さが長くなればなるほど、全ての取り得るラベルの組み合わせのラベル列Sに対して、確率P(S,O;θ)を計算することは、計算量の増加のために難しくなる。このような場合に、動的計画法に基づいて、計算量を削減できる場合がある。例えば、隠れマルコフモデルや条件付き確率場であれば、ビタビアルゴリズムを利用できるため、このような手法を用いてSを求めてもよい。
[検査対象の未知文書ファイルの判定までの流れ]
 次に、攻撃コード検知装置10による検査対象未知文書ファイル200に対する判定の流れを説明する。図14は、図1に示す攻撃コード検知装置10が検査対象未知文書ファイル200を判定するまでの処理手順を示すフローチャートである。
 図14に示すように、攻撃コード検知装置10は、検査対象未知文書ファイル200を入力データとして取得する(ステップS41)。そして、この入力された検査対象未知文書ファイル200に対し、図10に示すステップS12~ステップS13と同様に、ファイル形式判定部121がファイルの形式を判定し(ステップS42)、エンコードされた領域が存在する場合には(ステップS43:Yes)、デコード部122がデコードを実施する(ステップS44)。
 そして、エンコードされた領域が存在しない場合(ステップS43:No)、または、ステップS44のデコード終了後、制御部12は、確率モデルDB20から、検査対象未知文書ファイル200のファイル形式に対応したモデルパラメータを取り出す(ステップS45)。そして、検知部124は、このモデルパラメータ(確率モデル)を用いて、検査対象未知文書ファイル200におけるROPコードの有無を検知する検知処理を行う(ステップS46)。この検知部124におけるROPコードの検知結果は、悪性判定部125に出力される。
 続いて、悪性判定部125は、検知部124の検知結果を基に、検査対象未知文書ファイル200内にROPコードが存在するか否かを判定する(ステップS47)。悪性判定部125は、検査対象未知文書ファイル200内にROPコードが存在すると判定した場合には(ステップS47:Yes)、この検査対象未知文書ファイル200を悪性文書ファイルと判定する(ステップS48)。これに対し、悪性判定部125は、検査対象未知文書ファイル200内にROPコードが存在しないと判定した場合には(ステップS47:No)、検査対象未知文書ファイル200が、ROPコードによる攻撃は行われないと判定し(ステップS49)、制御部12は、この検査対象未知文書ファイル200について、ビューアアプリケーション等のアプリケーションを実行可能とする。
[検知処理の流れ]
 次に、図14に示す検知処理の流れについて説明する。図15は、図14に示す検知処理の処理手順を示すフローチャートである。
 図15に示すように、検知部124は、入力された検査対象未知文書ファイル200のバイト列を、観測系列Oとして抽出する(ステップS51)。そして、検知部124は、観測系列(バイト列)Oの長さTに対して、取り得る全てのラベルの組み合わせである潜在系列(ラベル列)S(s,s,・・・,s)のうち、最初の演算対象となるラベルの組み合わせ(潜在系列;ラベル列)Sを設定する(ステップS52)。例えば、図12のラベルの組み合わせ「1」を最初の演算対象として設定する。
 そして、検知部124は、観測変数の出力確率、潜在変数間の遷移確率及び潜在系列の初期状態確率を参照することによって、演算対象となるラベル列Sが観測系列Oを出力する確率P(S,O;θ)を、モデルパラメータθに基づいて計算する(ステップS53)。
 続いて、検知部124は、演算対象となる次のラベルの組み合わせ(ラベル列)Sがあるか否かを判断する(ステップS54)。検知部124は、演算対象となる次のラベルの組み合わせ(ラベル列)Sがあると判断した場合には(ステップS54:Yes)、演算対象として、次の組み合わせのラベル列Sを設定し(ステップS55)、ステップS53において、この組み合わせのラベル列に対しても、確率P(S,O;θ)を計算する。
 これに対し、検知部124は、演算対象となる次の組み合わせのラベル列Sがないと判断した場合(ステップS54:No)、取り得る全ての組み合わせのラベル列についての計算が終了したと判断し、この確率に対する計算結果を基に、各組み合わせの中から、最も高い確率を示す組み合わせのラベル列を、バイト列Oに対応付けるラベル列Sと選択する(ステップS56)。言い換えると、検知部124は、検査対象未知文書ファイル200のバイト列Oに対して、最も尤もらしい組み合わせのラベル列を検査対象ファイルのバイト列に付与する。
 そして、検知部124は、検査対象未知文書ファイル200のバイト列Oに付与したラベル列Sの中にROPコードを示すラベルがあるか否かを判断する(ステップS57)。検知部124は、ROPコードを示すラベルがあると判断した場合(ステップS57:Yes)、この検査対象未知文書ファイル200は、ROPコードを含むファイルであると検知する(ステップS58)。一方、検知部124は、ROPコードを示すラベルがないと判断した場合(ステップS57:No)、この検査対象未知文書ファイル200は、ROPコードを含まないファイルであると検知する(ステップS59)。
 検知部124は、この検査対象未知文書ファイル200に対する検知結果を、悪性判定部125に出力して(ステップS60)、検知処理を終了する。
[第1の実施の形態の効果]
 以上のように、本実施の形態1においては、事前に、文書ファイルの構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習した確率モデルを生成する。そして、実施の形態1においては、生成した確率モデルを基に、検査対象の未知の文書ファイルを構成するバイト列に対して、文書ファイルの構成要素であるか、ROPコードの構成要素であるかのラベリングを行っている。したがって、本実施の形態1によれば、検査対象の未知の文書ファイルをビューアアプリケーション等のアプリケーションで開くことなく、該文書ファイルの構成要素を推定することができるため、ROPコードの検知および抽出、文書ファイルの悪性判定を、ヒューリスティック手法で高速に実現することができる。
 また、本実施の形態1では、実際の環境下に合わせて、アドレスや定数を分割し、分割したバイト単位で、バイト列(観測系列)の出力確率をモデルパラメータとして求めるとともに、実際の環境下に合わせて、潜在変数(ラベル)の数や潜在変数の遷移状態を考慮して、遷移系列の遷移確率、及び、潜在系列の初期状態確率をモデルパラメータとして生成している。このため、実施の形態1によれば、実際の環境下に対応させながら、ROPコードの遷移状態を含めたモデルパラメータを用いて検知を行うことができるため、高精度なROPコードの検知を実現できる。
 このように、本実施の形態1によれば、アプリケーションプログラムの実行を伴わない静的な手法によってROPコードの特徴を捉えることができるため、高速で高精度な検知を実現でき、さらに、頑強なヒューリスティック手法を用いて検知を行っているため、攻撃者による検知の回避を防ぐことが可能である。
 上述したように、本実施の形態1は、文書ファイル中に含まれるROPコードの検出に有用であり、多数の文書ファイルに対して高速に検査を実施することに適している。このため、本実施の形態1に係る攻撃検知装置10、攻撃コード検知方法及び攻撃コード検知プログラムを、ネットワーク監視装置と共にネットワークに導入することによって、ネットワークを通過する多数の文書ファイルがROPコードを含む悪性なものであるかどうかの検査を行うことが可能である。
 また、本実施の形態1では、文書ファイルに埋め込まれたROPコードを前提としているが、文書ファイルでないデータであっても、そのバイト列の分布に何らかの傾向があるものであれば、同様にROPコードを検出可能である。したがって、本実施の形態1は、例えば、通信データ中のROPコードの検出にも利用できる。具体的には、本実施の形態1は、画像ファイル、動画ファイル、実行ファイル等、いずれのファイルに適用可能である。
[他の実施の形態]
[システム構成等]
 図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部又は一部を、各種の負荷や使用状況等に応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。さらに、各装置にて行なわれる各処理機能は、その全部又は任意の一部が、CPU及び当該CPUにて解析実行されるプログラムにて実現され、或いは、ワイヤードロジックによるハードウェアとして実現され得る。
 また、本実施形態において説明した各処理のうち、自動的に行われるものとして説明した処理の全部又は一部を手動的におこなうこともでき、或いは、手動的におこなわれるものとして説明した処理の全部又は一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。
[プログラム]
 図16は、プログラムが実行されることにより、攻撃コード検知装置10が実現されるコンピュータの一例を示す図である。コンピュータ1000は、例えば、メモリ1010、CPU1020を有する。また、コンピュータ1000は、ハードディスクドライブインタフェース1030、ディスクドライブインタフェース1040、シリアルポートインタフェース1050、ビデオアダプタ1060、ネットワークインタフェース1070を有する。これらの各部は、バス1080によって接続される。
 メモリ1010は、ROM(Read Only Memory)1011及びRAM1012を含む。ROM1011は、例えば、BIOS(Basic Input Output System)等のブートプログラムを記憶する。ハードディスクドライブインタフェース1030は、ハードディスクドライブ1090に接続される。ディスクドライブインタフェース1040は、ディスクドライブ1100に接続される。例えば磁気ディスクや光ディスク等の着脱可能な記憶媒体が、ディスクドライブ1100に挿入される。シリアルポートインタフェース1050は、例えばマウス1110、キーボード1120に接続される。ビデオアダプタ1060は、例えばディスプレイ1130に接続される。
 ハードディスクドライブ1090は、例えば、OS1091、アプリケーションプログラム1092、プログラムモジュール1093、プログラムデータ1094を記憶する。すなわち、攻撃コード検知装置10の各処理を規定するプログラムは、コンピュータ1000により実行可能なコードが記述されたプログラムモジュール1093として実装される。プログラムモジュール1093は、例えばハードディスクドライブ1090に記憶される。例えば、攻撃コード検知装置10における機能構成と同様の処理を実行するためのプログラムモジュール1093が、ハードディスクドライブ1090に記憶される。なお、ハードディスクドライブ1090は、SSD(Solid State Drive)により代替されてもよい。
 また、上述した実施形態の処理で用いられる設定データは、プログラムデータ1094として、例えばメモリ1010やハードディスクドライブ1090に記憶される。そして、CPU1020が、メモリ1010やハードディスクドライブ1090に記憶されたプログラムモジュール1093やプログラムデータ1094を必要に応じてRAM1012に読み出して実行する。
 なお、プログラムモジュール1093やプログラムデータ1094は、ハードディスクドライブ1090に記憶される場合に限らず、例えば着脱可能な記憶媒体に記憶され、ディスクドライブ1100等を介してCPU1020によって読み出されてもよい。或いは、プログラムモジュール1093及びプログラムデータ1094は、ネットワーク(LAN、WAN等)を介して接続された他のコンピュータに記憶されてもよい。そして、プログラムモジュール1093及びプログラムデータ1094は、他のコンピュータから、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。
 以上、本発明者によってなされた発明を適用した実施形態について説明したが、本実施形態による本発明の開示の一部をなす記述及び図面により本発明は限定されることはない。すなわち、本実施形態に基づいて当業者等によりなされる他の実施形態、実施例及び運用技術等は全て本発明の範疇に含まれる。
 10 攻撃コード検知装置
 11 入力部
 12 制御部
 13 出力部
 14 記憶部
 20 確率モデルデータベース(DB)
 100 ラベル付き悪性文書ファイル
 121 ファイル形式判定部
 122 デコード部
 123 学習部
 124 検知部
 125 悪性判定部
 200 検査対象未知文書ファイル

Claims (9)

  1.  ROP(Return Oriented Programming)コードを含む既知の悪性データ系列を学習データとして、データ系列の構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習したモデルを生成する学習部と、
     前記モデルを基に、検査対象の未知のデータ系列に含まれる前記ROPコードを検知する検知部と、
     前記検知部の検知結果を用いて、前記検査対象の未知のデータ系列がROPにより攻撃を実行する悪性データ系列であるか否かを判定する悪性判定部と、
     を有することを特徴とする攻撃コード検知装置。
  2.  前記検知部は、前記モデルを基に、前記検査対象の未知のデータ系列を構成するバイト列に含まれるデータ系列の構成要素、或いは、前記ROPコードの構成要素を求め、前記検査対象の未知のデータ系列に含まれる前記ROPコードを検知することを特徴とする請求項1に記載の攻撃コード検知装置。
  3.  前記学習部は、前記データ系列の構成要素であるバイトに前記データ系列の構成要素であることを示すデータラベルが付される一方、前記ROPコードの構成要素であるバイトに前記ROPコードであることを示すROPラベルが付された前記悪性データ系列を学習することによって、前記悪性データ系列におけるバイト列を観測系列とし、ラベル列を潜在系列としたモデルを生成し、
     前記検知部は、前記モデルを基に、前記検査対象の未知のデータ系列のバイト列に、該バイト列を出力する確率が最も高いラベルの組み合わせを有するラベル列を付与し、付与したラベル列の中に前記ROPラベルを含むか否かを検知し、
     前記悪性判定部は、前記検知部が前記付与したラベル列の中に前記ROPラベルを含むことを検知した場合には、前記検査対象の未知のデータ系列が前記悪性データ系列であると判定し、前記検知部が前記付与したラベル列の中に前記ROPラベルをないことを検知した場合には、前記検査対象の未知のデータ系列が前記ROPによる攻撃を行う悪性なデータ系列でないと判定することを特徴とする請求項2に記載の攻撃コード検知装置。
  4.  前記学習部は、潜在変数である前記ラベルごとに、観測変数である各バイトの出力確率を対応付けた前記観測変数の出力確率、前記潜在変数ごとに、遷移可能である前記潜在変数への遷移確率が対応付けられた前記潜在変数間の遷移確率、及び、前記潜在系列の初期状態確率、をモデルパラメータとして有するモデルを生成し、
     前記検知部は、前記モデルを基に、前記検査対象の未知のデータ系列におけるバイト列に対し、取り得る全てのラベルの組み合わせのうち、最も尤もらしいラベルの組み合わせを有するラベル列を確率的に求め付与することを特徴とする請求項3に記載の攻撃コード検知装置。
  5.  前記検知部は、前記検査対象の未知のデータ系列の長さをTとした場合、前記モデルを基に、取り得るラベル列をS=s,s,・・・,sとし、観測したバイト列をO=o,o,・・・,oとし、モデルのモデルパラメータをθとしたときに、確率P(S,O;θ)が最も高くなるラベル列Sをバイト列Oについて求め、該求めたラベル列Sをバイト列Oに付与することを特徴とする請求項4に記載の攻撃コード検知装置。
  6.  前記学習部は、ROPコードの含まれたデータ系列に対して手動或いは所定の動的解析によるラベル付き悪性データ系列手法に基づいて、各バイトにラベル付けが実施された前記悪性データ系列を学習したモデルを生成することを特徴とする請求項1~5のいずれか一つに記載の攻撃コード検知装置。
  7.  前記悪性データ系列は、文書ファイルであることを特徴とする1~6のいずれか一つに記載の攻撃コード検知装置。
  8.  攻撃コード検知装置が実行する攻撃コード検知方法であって、
     前記攻撃コード検知装置が、ROPコードを含む既知の悪性データ系列を学習データとして、データ系列の構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習したモデルを生成する工程と、
     前記攻撃コード検知装置が、前記モデルを基に、検査対象の未知のデータ系列に含まれる前記ROPコードを検知する工程と、
     前記攻撃コード検知装置が、検知結果を用いて、前記検査対象の未知のデータ系列がROPにより攻撃を実行する悪性なデータ系列であるか否かを判定する工程と、
     を含んだことを特徴とする攻撃コード検知方法。
  9.  ROPコードを含む既知の悪性データ系列を学習データとして、データ系列の構成要素であるバイト列の特徴と、ROPコードの構成要素であるバイト列の特徴と、を学習したモデルを生成するステップと、
     前記モデルを基に、検査対象の未知のデータ系列に含まれる前記ROPコードを検知するステップと、
     検知結果を用いて、前記検査対象の未知のデータ系列がROPにより攻撃を実行する悪性なデータ系列であるか否かを判定するステップと、
     をコンピュータに実行させるための攻撃コード検知プログラム。
PCT/JP2017/006575 2016-02-24 2017-02-22 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム WO2017146094A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US16/074,320 US10878091B2 (en) 2016-02-24 2017-02-22 Attack code detection device, attack code detection method, and attack code detection program
JP2018501734A JP6592177B2 (ja) 2016-02-24 2017-02-22 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム
EP17756532.2A EP3404572B1 (en) 2016-02-24 2017-02-22 Attack code detection device, attack code detection method, and attack code detection program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2016033610 2016-02-24
JP2016-033610 2016-02-24

Publications (1)

Publication Number Publication Date
WO2017146094A1 true WO2017146094A1 (ja) 2017-08-31

Family

ID=59685263

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2017/006575 WO2017146094A1 (ja) 2016-02-24 2017-02-22 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム

Country Status (4)

Country Link
US (1) US10878091B2 (ja)
EP (1) EP3404572B1 (ja)
JP (1) JP6592177B2 (ja)
WO (1) WO2017146094A1 (ja)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6777266B1 (ja) * 2019-09-18 2020-10-28 三菱電機株式会社 作業要素分析装置及び作業要素分析方法
CN112613034A (zh) * 2020-12-18 2021-04-06 北京中科网威信息技术有限公司 恶意文档检测方法及系统、电子设备及存储介质
WO2022176209A1 (ja) * 2021-02-22 2022-08-25 日本電信電話株式会社 検索装置、検索方法および検索プログラム

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11349865B1 (en) * 2021-02-24 2022-05-31 Netskope, Inc. Signatureless detection of malicious MS Office documents containing embedded OLE objects
US11222112B1 (en) 2021-02-24 2022-01-11 Netskope, Inc. Signatureless detection of malicious MS office documents containing advanced threats in macros
CN113158184B (zh) * 2021-03-03 2023-05-19 中国人民解放军战略支援部队信息工程大学 基于有限状态自动机的攻击脚本生成方法及相关装置
US20230342460A1 (en) * 2022-04-25 2023-10-26 Palo Alto Networks, Inc. Malware detection for documents with deep mutual learning

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010146566A (ja) * 2008-12-18 2010-07-01 Symantec Corp マルウェア検出方法およびシステム
JP2015527680A (ja) * 2012-09-07 2015-09-17 クラウドストライク インコーポレイテッド リターン・オリエンテッド・プログラミングの脅威検出
JP2016009405A (ja) * 2014-06-25 2016-01-18 エヌ・ティ・ティ・コミュニケーションズ株式会社 攻撃コード検出装置、攻撃コード検出方法、及びプログラム

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014526751A (ja) 2011-09-15 2014-10-06 ザ・トラスティーズ・オブ・コロンビア・ユニバーシティ・イン・ザ・シティ・オブ・ニューヨーク リターン指向プログラミングのペイロードを検出するためのシステム、方法、および、非一時的コンピュータ可読媒体
US8839429B2 (en) * 2011-11-07 2014-09-16 Qualcomm Incorporated Methods, devices, and systems for detecting return-oriented programming exploits
US9996694B2 (en) 2013-03-18 2018-06-12 The Trustees Of Columbia University In The City Of New York Unsupervised detection of anomalous processes using hardware features
US10192052B1 (en) * 2013-09-30 2019-01-29 Fireeye, Inc. System, apparatus and method for classifying a file as malicious using static scanning
US9465936B2 (en) * 2013-11-06 2016-10-11 Bitdefender IPR Management Ltd. Systems and methods for detecting return-oriented programming (ROP) exploits
US9189627B1 (en) * 2013-11-21 2015-11-17 Fireeye, Inc. System, apparatus and method for conducting on-the-fly decryption of encrypted objects for malware detection
US10621338B1 (en) * 2015-12-30 2020-04-14 Fireeye, Inc. Method to detect forgery and exploits using last branch recording registers

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010146566A (ja) * 2008-12-18 2010-07-01 Symantec Corp マルウェア検出方法およびシステム
JP2015527680A (ja) * 2012-09-07 2015-09-17 クラウドストライク インコーポレイテッド リターン・オリエンテッド・プログラミングの脅威検出
JP2016009405A (ja) * 2014-06-25 2016-01-18 エヌ・ティ・ティ・コミュニケーションズ株式会社 攻撃コード検出装置、攻撃コード検出方法、及びプログラム

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6777266B1 (ja) * 2019-09-18 2020-10-28 三菱電機株式会社 作業要素分析装置及び作業要素分析方法
WO2021053738A1 (ja) * 2019-09-18 2021-03-25 三菱電機株式会社 作業要素分析装置及び作業要素分析方法
CN112613034A (zh) * 2020-12-18 2021-04-06 北京中科网威信息技术有限公司 恶意文档检测方法及系统、电子设备及存储介质
WO2022176209A1 (ja) * 2021-02-22 2022-08-25 日本電信電話株式会社 検索装置、検索方法および検索プログラム

Also Published As

Publication number Publication date
US20200042708A1 (en) 2020-02-06
US10878091B2 (en) 2020-12-29
EP3404572B1 (en) 2020-09-23
EP3404572A4 (en) 2019-07-24
EP3404572A1 (en) 2018-11-21
JPWO2017146094A1 (ja) 2018-07-12
JP6592177B2 (ja) 2019-10-16

Similar Documents

Publication Publication Date Title
JP6592177B2 (ja) 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム
Liao et al. Soliaudit: Smart contract vulnerability assessment based on machine learning and fuzz testing
US11714905B2 (en) Attribute relevance tagging in malware recognition
Kumar et al. A learning model to detect maliciousness of portable executable using integrated feature set
US11475128B2 (en) System and method for heterogeneous transferred learning for enhanced cybersecurity threat detection
WO2018066516A1 (ja) 攻撃コード検知装置、攻撃コード検知方法及び攻撃コード検知プログラム
US7854002B2 (en) Pattern matching for spyware detection
KR101337874B1 (ko) 파일 유전자 지도를 이용하여 파일의 악성코드 포함 여부를 판단하는 방법 및 시스템
Alazab et al. Malware detection based on structural and behavioural features of API calls
US20170353481A1 (en) Malware detection by exploiting malware re-composition variations using feature evolutions and confusions
Ali et al. Trust in IoT: dynamic remote attestation through efficient behavior capture
Nguyen et al. Toward a deep learning approach for detecting php webshell
CN110023938A (zh) 利用函数长度统计确定文件相似度的系统和方法
Thunga et al. Identifying metamorphic virus using n-grams and hidden markov model
WO2022100489A1 (en) System, method and apparatus for malicious software detection
Chen et al. A learning-based static malware detection system with integrated feature
Thompson et al. Polymorphic malware detection and identification via context-free grammar homomorphism
JP2011034377A (ja) 情報処理装置及び情報処理方法及びプログラム
Sayadi et al. Towards ai-enabled hardware security: Challenges and opportunities
Yang et al. RecMaL: Rectify the malware family label via hybrid analysis
Benkraouda et al. Attacks on visualization-based malware detection: Balancing effectiveness and executability
CN116089938A (zh) 开源组件包的安全检测方法及装置
Song et al. HGIVul: Detecting inter-procedural vulnerabilities based on hypergraph convolution
WO2023067663A1 (ja) 解析機能付与方法、解析機能付与装置及び解析機能付与プログラム
Mangle et al. Analysis of machine learning techniques for detecting malicious PDF files using WEKA

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2018501734

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2017756532

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017756532

Country of ref document: EP

Effective date: 20180813