WO2010009625A1 - 一种计算机文件检测的方法及装置 - Google Patents

一种计算机文件检测的方法及装置 Download PDF

Info

Publication number
WO2010009625A1
WO2010009625A1 PCT/CN2009/070554 CN2009070554W WO2010009625A1 WO 2010009625 A1 WO2010009625 A1 WO 2010009625A1 CN 2009070554 W CN2009070554 W CN 2009070554W WO 2010009625 A1 WO2010009625 A1 WO 2010009625A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
detecting
suspicious
detection
item
Prior art date
Application number
PCT/CN2009/070554
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 成都市华为赛门铁克科技有限公司
Publication of WO2010009625A1 publication Critical patent/WO2010009625A1/zh

Links

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

Definitions

  • the present invention relates to the field of information security, and in particular, to a method and apparatus for computer file detection. Background technique
  • Active anti-virus mainly analyzes the behavior of the currently running process, monitors whether the running program has malicious behavior, and then gives the suspicious probability of the running program.
  • This detection method makes the detection of unknown viruses obtain a better recognition rate, but this method can only detect the running virus files, and it cannot be detected for static virus samples and static virus files.
  • virus files in the running state only account for about 40% or less of the total virus files, because a virus file will be saved in several different file paths, but only one copy is run at the same time; Unknown virus detection, static samples released by virus samples to other different folder locations and static virus files that are propagated to the local, such as via Web browsing, USB (Universal Serial BUS) devices, Emai, cannot be detected To.
  • Unknown virus detection static samples released by virus samples to other different folder locations and static virus files that are propagated to the local, such as via Web browsing, USB (Universal Serial BUS) devices, Emai, cannot be detected To.
  • the prior art virus-based active defense measures cannot detect static virus files, so only the prior art viruses are used. Active defense technology, some viruses will not be cleaned up, and the active defense of the virus cannot be fully realized. Summary of the invention
  • the technical problem to be solved by the embodiments of the present invention is to provide a method and a device for detecting a computer file, which can achieve defense against a static unknown virus.
  • Embodiments of the present invention provide a method for computer file detection, including the steps of:
  • Detecting the attributes of the file selecting suspicious detection items, the attributes including structural attributes and file attributes;
  • the embodiment of the invention further provides a device for detecting a computer file, comprising:
  • a detecting unit configured to detect an attribute of the file, and select a suspicious detection item, where the attribute includes a structural attribute and a file attribute;
  • An evaluation unit configured to assign a weight to the suspected detection item
  • a calculating unit configured to calculate a suspiciousness of the file by using a weight of the suspected detection item and an occurrence quantity of the same suspect detection item;
  • a comparison unit configured to compare the suspiciousness of the file with a preset suspicious standard, if the suspiciousness is greater than a preset suspicious standard, the file is a suspicious file, and if the suspiciousness is less than a preset suspicious standard, The file is a non-suspicious file.
  • the embodiment of the invention detects the structural attribute and the file attribute of the file, selects a suspicious detection item, and assigns a weight to the suspicious detection item, counts the number of occurrences of the same suspicious detection item, and then calculates the detected file.
  • Suspiciousness according to the preset rules to determine whether the file is a suspicious file, compared to the prior art to achieve active defense against static unknown viruses; improve the detection probability of unknown viruses, strengthen the defense against unknown viruses.
  • FIG. 1 is a flowchart of a method for detecting a computer file according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a device for detecting a computer file according to an embodiment of the present invention. detailed description
  • the embodiment of the invention provides a method and a device for detecting a computer file, which are used for implementing active defense against a static virus.
  • a suspicious detection item is selected, and the weight of each detection item is assigned to the detection item weight, and the weight and the same suspicious detection item are utilized.
  • the number of occurrences is calculated to determine the suspiciousness of the detected file, and it is determined whether the file is infected with a virus based on the calculated suspiciousness.
  • the embodiment of the invention implements active defense against static viruses by detecting static files.
  • the user of the operating terminal chooses to use the computer file detecting device provided by the embodiment of the present invention to start detecting whether the file in the terminal is infected with a virus, the user enters the computer file detecting method step provided by the embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for detecting a computer file according to an embodiment of the present invention.
  • Step 101 Detect the validity of the file
  • the validity of the files is first detected after opening the file, preventing time spent on detecting invalid files.
  • the embodiment of the present invention takes the detection of a word file as an example.
  • the validity of the detection file is mainly determined by detecting whether the e_magic item in the image DOS header (IMAGE_D0S_HEADER) structure in the file structure attribute is equal to a preset value, such as IMAGE_DOS_SIGNATURE, if it is not equal, it is an invalid executable file (PE file); Equivalence finds the location of the image NT header (IMAGE_NT_HEADER) according to the address pointed to by the e_lfanew item in the image DOS header structure in the structure attribute, and compares whether the PE file identifier (Signature) item in the NT header structure is equal to "PE00", if equal It is considered to be a valid PE file; otherwise, the display information indicates that the file is not a valid PE structure file, then the file is invalid; this step detects that the file is a valid PE structure file. If it is detected that the opened file is a valid file, step 102
  • Step 102 Detect structural attributes of the file
  • the structure properties of the detection file include: Detecting the image in the Attributes of the DOS header; Detecting the image header (IMAGE_FILE_HEADER); Detecting the optional image header (IMAGE_0PTI0NAL_HEADER); Detecting the segment header (IMAGE_SECTI0N_HEADER).
  • the detection of the structure attribute in the DOS header is as follows:
  • the detection image headers are as follows:
  • this item Normally, the value of this item is mostly 4, and if the value of this item is less than 3, it is considered to be a suspicious file.
  • the items in the optional image header are as follows:
  • This item of suspicious file is not equal to the starting address of any segment, ie: not in any segment. Or the starting address is abnormal. Under Win32 under normal circumstances, the starting address is mostly: 0x10000000, 0x10000000, 0x00400000. If it is not these values, it is considered suspicious.
  • This item of suspicious file is not equal to the starting address of any segment, ie: not in any segment, or the value of this item is small. At 0x400, it is considered suspicious.
  • Viruses and some illegal programs often set this to 0 when modifying the PE file format, while files compiled by normal compilers have correct values. If this is 0, it is considered suspicious.
  • PE files are also included in the resource segment:
  • the resource segment of a normal file generally stores the icon of the file, the bitmap related to the file, the version information, and the like. If it appears in the resource segment, it will appear as MZ (MZ is the first two characters of the executable file. The corresponding hexadecimal is 0x4D
  • 0x5A Use the binary view tool to open a file with an exe suffix to view the PE file of the logo, which may be a virus to a large extent. At runtime, the virus will release the PE files in this section.
  • the value of Virtual Address in the I-segment image header is greater than 0 and less than 0x48 is considered suspicious.
  • Size is larger than the size of the file to be tested or less than 0x0c, it is considered suspicious
  • IMAGE_0PTI0NAL_HEADER32->DataDirectory [9] VirtualAddress greater than 0 and less than 0x48 is considered suspicious.
  • IMAGE_0PTI0NAL_HEADER32->DataDirectory [l l] Such as: IMAGE_0PTI0NAL_HEADER32->DataDirectory [l l] .
  • Size is larger than the size of the file to be tested or less than 0x20 is considered suspicious;
  • IMAGE_0PTI0NAL_HEADER32->DataDirectory [12] Such as: IMAGE_0PTI0NAL_HEADER32->DataDirectory [12] .
  • Size is larger than the size of the file to be tested is considered suspicious;
  • the detection segment image header IMAGE_SECTION_HEADER is as follows:
  • IMAGE_SECTION_HEADER items When detecting the IMAGE_SECTION_HEADER items, first locate the segment table (SECTION TABLE), and then perform the detection of the IMAGE_SECTION_HEADER items after positioning. After one IMAGE_SECTION_HEADER test is completed, locate the next IMAGE_SECTION_HEADER item, if there is no next IMAGE_SECT The 10N_HEADER item ends the detection of the IMAGE_SECTION_HEADER item; if the next IMAGE_SECTION_HEADE item is located, the next IMAGE_SECT 10N_HEADER item is continuously detected.
  • the block has a certain offset in the disk file. If this entry is set to zero, it is considered suspicious.
  • the size of the block in the disk file If the value of a segment in the block table is zero, the file structure is abnormal and considered suspicious.
  • This field is a set of flags indicating the block attributes. The sum of multiple flags is the Characteristics value. Here are some common flags:
  • IMAGE—SCN—CNT —UNIINITIALIZED—DATE contains uninitialized data
  • Characteristics Value: C0000040h 40000000h
  • 80000000h 00000040h Indicates that the block is readable, writable, and contains initialized data.
  • step 103 After detecting the structural attributes of the file, go to step 103.
  • Step 103 Detect a file attribute of the file
  • the file attributes of the detection file include: detecting file resources, detecting file general attributes, and detecting file version information.
  • the details of the detection file attributes are as follows:
  • File General Properties For suspicious files, file general properties are usually hidden.
  • the general attributes of the file in the embodiment of the present invention refer to information such as a file extension, a file size, a file storage location, and a file creation time.
  • File name For suspicious files, the file name may be changed.
  • the virus is often disguised as ie X p 0 rer, svchost, etc. with special symbols such as ( ) [] ⁇ .
  • Resource information for files For suspicious files or virus files, there is generally no resource information.
  • Copyright information of files Generally, there is no normal copyright information for suspicious files or virus files.
  • Entry characteristics of each segment For suspicious files or virus files, there is a jump instruction at the entry of the segment.
  • the structural attributes of the detection file and the file attributes of the file are in no particular order, and the items of the structural attributes of the specific detection file and the file attributes of the detection file are not in any order.
  • Step 104 Select a suspicious detection item
  • Suspicious detections are selected according to the rules described in steps 102 and 103.
  • Step 105 Assign a weight to the suspected detection item
  • the corresponding weight of the detection item is given according to the weight of the detection item in the entire structure attribute and the file attribute.
  • Step 106 count the number of occurrences of the same suspicious item
  • SECTION TABLE may have multiple files in the file, loop detection of each detection item in each SECTION TABLE. Each detection item exists in each SECTION TABLE, accumulating the suspiciousness of multiple identical detection items. Therefore, perform this step to count the weights of the same suspicious item.
  • Step 107 Calculate the suspiciousness of the file
  • Suspiciousness of the file number of suspicious items 1 detected * weight 1 + detection 2 suspicious number * weight 2 + detection 3 suspicious number * weight 3 + . . .
  • Each detection item corresponds to a weight, and after calculating the suspiciousness of the obtained file, step 108 is performed.
  • Step 108 Compare the suspiciousness of the file with the preset suspicious standard
  • the general preset suspicious criterion is 20, when the suspiciousness of the calculation file exceeds or equals 20, step 109 is performed; the above calculation results in a file having a suspiciousness of 56, that is, step 109 is performed; if the suspiciousness of the above file is less than 20,
  • the file is considered to be a normal file and is not infected with a virus.
  • Step 109 Display a suspicious file, and display the file as a suspicious file
  • the calculated file suspiciousness is greater than the preset suspicious standard, the suspicious file is displayed, and the corresponding file is suspiciously displayed. file.
  • the computer file detecting device provided by the embodiment of the present invention starts the detection of the next file, and if all the files selected by the terminal user are detected, the terminal user is prompted to complete the detection, and all the detected suspicious are displayed. A file that reaches the preset suspiciousness.
  • the detection abnormality of the file structure attribute and the file attribute may be updated according to the continuous update of the ordinary file or the virus file, and the present invention is implemented.
  • the structural attributes of the file and all the items of the file attributes and the detection abnormal conditions corresponding to all the items may be determined by a person skilled in the art according to the specific situation, and the details of the abnormality of all the detection items are not described herein. .
  • the calculated file suspiciousness is greater than the preset suspicious standard, the suspicious file is displayed, and the file is displayed as a suspicious file. It is convenient for the end user to know the files that may be infected with the virus for active defense.
  • An apparatus embodiment for applying the method for computer file detection provided by the embodiment of the present invention is provided as follows.
  • FIG. 2 is a device diagram of computer file detection according to an embodiment of the present invention.
  • the apparatus for detecting a computer file provided by the embodiment of the present invention includes:
  • the detecting unit 110 is configured to detect an attribute of the file, and select a suspicious detection item, where the attribute includes a structural attribute and a file attribute;
  • An assignment unit 120 configured to assign a weight to the suspected detection item
  • the statistical unit 130 is configured to count the number of occurrences of the same suspected detection item
  • the calculating unit 140 is configured to calculate the suspiciousness of the file by using the weight of the suspected detection item and the number of occurrences of the same suspect detection item;
  • the comparing unit 150 is configured to compare the suspiciousness of the file with a preset suspicious standard. If the suspiciousness is greater than a preset suspicious standard, the file is a suspicious file, and if the suspiciousness is less than a preset suspicious standard, Then the file is not Suspected documents.
  • the computer file detecting apparatus After detecting the suspicious file, the computer file detecting apparatus provided by the embodiment of the present invention further includes:
  • the display unit 160 is configured to display the suspicious file when the file is a suspicious file, and display the file as a suspicious file.
  • the device for detecting computer files further includes:
  • the file detecting unit 170 is configured to detect whether the opened file is valid. If the result of the detection is valid, the detecting by the detecting unit 110 is continued; if the result of the detecting is invalid, the detecting process is ended.
  • the computer file detecting apparatus When detecting the structural attribute of the file, if the file structure attribute has a plurality of SECTION items, the computer file detecting apparatus provided by the embodiment of the present invention further includes:
  • the locating unit 180 is configured to locate a segment table of the file structure attribute when detecting the file structure attribute.
  • the computer file detecting method and apparatus provided by the embodiments of the present invention can be used as a separate detecting tool, or can be used in combination with the current anti-virus software. In the data flow detection, the file transmitted by the file is captured and restored, and then the restored file is detected by using the computer file detection method provided by the embodiment of the present invention.
  • HTTP Hypertext Transfer Protocol
  • the computer file detection method provided by the embodiment of the present invention detects whether the file is a suspicious file.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Virology (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

说 明 书
一种计算机文件检测的方法及装置 本申请要求于 2008年 7月 24 日提交中国专利局、 申请号为 200810135013. 4、 发明名 称为 "一种计算机文件检测的方法及装置" 的中国专利申请的优先权, 其全部内容通过引 用结合在本申请中。 技术领域
本发明涉及信息安全领域, 尤其涉及一种计算机文件检测的方法及装置。 背景技术
目前, 在业界出现了未知计算机病毒主动防御技术, 标志着反病毒技术由被动向主动 方向发展。 主动反病毒主要是对当前运行的进程进行行为分析, 监测运行的程序是否有恶 意的行为, 进而给出运行的程序的可疑概率。 这种检测方式使得未知病毒的检测取得了较 好的识别率, 但这种方式只能检测到运行着的病毒文件, 对于静态的病毒样本和静态病毒 文件则无法检测到。经实践证明, 处于运行状态的病毒文件只占总病毒文件的 40%左右甚至 更少, 由于一个病毒文件会在几个不同的文件路径下保存, 但是同时运行的只有一个副本; 基于行为判定的未知病毒检测, 由病毒样本释放到其他多个不同文件夹位置的静态样本和 例如通过 Web浏览、 USB (Universal Serial BUS, 通用串行总线)设备、 Emai l传播到本地 的静态病毒文件则无法检测到。
在对现有技术的研究和实践过程中, 发明人发现现有技术存在以下问题: 现有技术基 于行为检测的病毒主动防御措施不能检测到处于静态的病毒文件, 因此只使用现有技术的 病毒主动防御技术, 会出现部分病毒清除不干净的现象, 不能完全实现病毒的主动防御。 发明内容
本发明实施例要解决的技术问题是提供一种计算机文件检测的方法及装置, 能够实现 对静态未知病毒的防御。
本发明实施例提供一种计算机文件检测的方法, 包括步骤:
检测文件的属性, 选出可疑的检测项, 所述属性包括结构属性和文件属性;
为所述可疑的检测项赋予权值, 统计同一可疑的检测项的出现数量;
使用预置的可疑的检测项的权值和所述同一可疑的检测项的出现数量计算所述文件的 可疑度, 若所述可疑度大于或等于预置可疑标准, 则所述文件为可疑文件, 若所述可疑度 小于所述预置可疑标准, 则所述文件为非可疑文件。
本发明实施例还提供一种计算机文件检测的装置, 包括:
检测单元, 用于检测文件的属性, 选择可疑的检测项, 所述属性包括结构属性和文件 属性;
赋值单元, 用于为所述可疑的检测项赋予权值;
统计单元, 用于统计同一个可疑的检测项的出现数量;
计算单元, 用于使用所述可疑的检测项的权值和所述同一个可疑的检测项的出现数量 计算得出所述文件的可疑度;
比较单元, 用于将所述文件的可疑度与预置可疑标准比较, 若所述可疑度大于预置可 疑标准, 则所述文件是可疑文件, 若所述可疑度小于预置可疑标准, 则所述文件为非可疑 文件。
本发明实施例检测文件的结构属性和文件属性, 选出可疑的检测项, 并为所述可疑的 检测项赋予权值, 统计同一个可疑的检测项的出现数量, 然后计算得出被检测文件的可疑 度, 根据预置的规则确定该文件是否是可疑文件, 相对于现有技术实现对静态未知病毒的 主动防御; 提高未知病毒的检测概率, 加强了对未知病毒的防御。 附图说明
图 1是本发明实施例提供的计算机文件检测的方法流程图;
图 2是本发明实施例提供的计算机文件检测的装置示意图。 具体实施方式
本发明实施例提供了一种计算机文件检测的方法及装置, 用于实现对静态病毒的主动 防御。
本发明实施例通过对静态的文件的结构属性和文件属性进行检测, 选出可疑的检测项, 根据每个检测项的权重赋于该检测项权值, 利用该权值和同一个可疑检测项的出现数量计 算得出被检测文件的可疑度, 根据计算出的可疑度确定该文件是否被感染了病毒。 本发明 实施例通过对静态文件的检测, 实现对静态病毒的主动防御。
当操作终端的用户选择利用本发明实施例提供的计算机文件检测装置开始检测终端中 文件是否被感染了病毒, 开始进入本发明实施例提供的计算机文件检测方法步骤中。
请参阅图 1是本发明实施例提供的计算机文件检测的方法流程图。 开始检测时, 首先打开文件并读取文件, 然后执行歩骤 101。
步骤 101、 检测文件的有效性;
为加快文件的检测速度, 在打开文件后首先检测文件的有效性, 防止在无效的文件上 花费时间进行检测。
本发明实施例以检测 word文件为例。 检测文件的有效性主要通过检测文件结构属性中 的映像 DOS 头 ( IMAGE_D0S— HEADER ) 结构中 e_magic 项是否等于一预设值, 例如 IMAGE_DOS_SIGNATURE, 若不相等则是无效可执行文件 (PE文件); 若相等则根据结构属性 中的映像 DOS头结构中 e_lfanew项指向的地址找到映像 NT头 ( IMAGE_NT_HEADER) 所在位 置, 比较映像 NT头结构中的 PE文件标识 (Signature) 项是否等于 "PE00", 若相等则 认为是有效的 PE文件; 否则显示信息表示该文件不是有效的 PE结构的文件, 则该文件是 无效的; 该步骤检测文件是有效的 PE结构文件。 若检测打开的文件是有效的文件, 执行步 骤 102, 若检测打开的文件是无效文件, 直接结束检测。
步骤 102、 检测文件的结构属性;
检测文件的结构属性包括: 检测结构属性中的映像 DOS 头中各项; 检测映像文件头 ( IMAGE_FILE_HEADER) 各项; 检测可选映像头 ( IMAGE_0PTI0NAL_HEADER) 各项; 检测段 映像头 (IMAGE_SECTI0N_HEADER) 各项。
其中, 检测结构属性中的映像 DOS头中各项具体如下:
结构属性中的映像 DOS头中 e_lfanew项
如果该项的数值超出待检测文件长度或小于 0x10, 则认为是可疑的。
其中, 检测映像文件头各项具体如下:
映像文件头中 Number Of Sections项;
正常情况下该项的数值多为 4, 如果该项的数值小于 3则认为是可疑文件。
其中, 检测可选映像头中各项具体如下:
段映像头中的 Base Of Code 项;
可疑文件此项的数值不等于任一段的起始地址, 即: 不在任一段中。 或起始地址异常, 正常情况下在 Win32 下, 起始地址多为: 0x10000000、 0x10000000、 0x00400000。 若不是 这些数值则认为是可疑的。
若此项的数值等于某一段的起始地址, 但该段的段名 (IMAGE_SECTI0N_HEADER中 Name 项) 如果不是常见的 ". text"、 ". rsrc"则认为是可疑的。
段映像头中的 BaseOfData项;
可疑文件此项的数值不等于任一段的起始地址, 即: 不在任一段中, 或此项的数值小 于 0x400, 则认为是可疑的。
若此项的数值等于某一段的起始地址, 但该段的段名 (IMAGE_SECTION_HEADER中 Name 项) 如果不是常见的 ". data"也认为是可疑的。
段映像头中 ImageBase项;
若此项的数值大于 0x20000000则认为是可疑的。
段映像头中 FileAlignment项;
若此项的数值不等于 0x200则认为是可疑的。
段映像头中 Checksum项;
病毒及一些非法程序, 在修改 PE文件格式时, 常将此项置 0, 而正常编译器编译的文 件有正确的数值。 若此项为 0, 则认为是可疑的。
段映像头中 Import table的 VirtualAddress禾口 Size项;
如: IMAGE_0PT 10NAL_HEADER32 -) DataDirectory [1] . Size的数值大于 0且小于 0x28 则认为是可疑的;
段映像头中 Resource项;
另外还有其他文件的结构上的异常, 例如: 资源段中又包含有 PE文件:
普通文件的资源段一般存放文件的图标、 文件相关的位图、 版本信息等内容。 如果发 现在资源段中又出现了以 MZ为 (MZ为可执行文件的开头两个字符。 对应十六进制为 0x4D
0x5A。 用二进制查看工具打开一个 exe后缀的文件即可查看) 标志的 PE文件, 则很大程度 上可能是病毒了。 在运行时病毒会把此段中的 PE文件释放出来。
段映像头中 Relocation table的 Virtual Address禾卩 Size项
如: I段映像头中 Virtual Address的值大于 0且小于 0x48则认为是可疑的。
如: Size的数值大于待测文件大小或小于 0x0c则认为是可疑的;
IMAGE_0PTI0NAL_HEADER32中 TLS table的 VirtualAddress禾口 Size项
如: IMAGE_0PTI0NAL_HEADER32->DataDirectory [9] . VirtualAddress 大于 0 且小于 0x48, 则认为是可疑的。
IMAGE_0PTI0NAL_HEADER32中 Boundlmport 表的 VirtualAddress和 Size项
如: IMAGE_0PTI0NAL_HEADER32->DataDirectory [l l] . Size的数值大于待测文件大小或 小于 0x20则认为是可疑的;
IMAGE_0PTI0NAL_HEADER32中 IAT表的 VirtualAddress和 Size项
如: IMAGE_0PTI0NAL_HEADER32->DataDirectory [12] . Size的数值大于待测文件大小则 认为是可疑的; 其中, 检测段映像头 IMAGE_SECTION_HEADER各项具体如下:
需要说明的是: 检测 IMAGE_SECTION_HEADER 各项时, 首先要定位至段表 (SECTION TABLE), 定位后进行 IMAGE_SECTION_HEADER各项的检测, 一个 IMAGE_SECTION_HEADER各 项检测完毕后, 定位下一个 IMAGE_SECTION_HEADER项, 若无下一个 IMAGE_SECT 10N_HEADER 项,则结束 IMAGE_SECTION_HEADER各项的检测;若定位到下一个 IMAGE_SECTION_HEADE项, 继续检测下一个 IMAGE_SECT 10N_HEADER各项。
IMAGE_SECTION_HEADER中 Name 项:
这是一个 8 位 ASCII , 多以 " . " 开头; 常见段名: " . text ", " . data. "、 " . code ", ". rsrc"、 ". reloc"。 . text 存放指令代码, . data存放初始化的数据, . idata包含其他 外来 DLL的函数及数据信息, 即输入表, . rsrc存放模块的全部资源数据, . reloc存放基 地址重定位表, . edata存放文件的输出表。 可疑文件和病毒文件常使用一些无规则的命名 来定义这些常见的段名。 如: "PS斋腌 " "渤 @ " 或者直接为空字符, 则认为是可疑的。
段映像头 中 Pointer To RawData项;
该块在磁盘文件中有一定的偏移, 若此项被置零, 则认为是可疑的。
IMAGE—SECT I0N_HEADER 中 Size Of RawData项;
该块在磁盘文件中所占的大小, 如果块表中某段此项值为零, 说明该文件结构异常, 认为是可疑的。
IMAGE_SECT I 0N_HEADER 中 Characteristics 项;
即: 段属性。 该项是判断是否可疑的重要标志。 该字段是一组指出块属性的标志, 多 个标志求和即为 Characteristics值, 如下是一些常见的标志:
字段值 用途
IMAGE— — SCN— — CNT— —CODE 00000020h 包含执行代码
丄 MAGE— _SCN_ _CNT_ —厦 TIAL丄 ΖΕϋ— _ϋΑΊΈ 包含已初始化的数据
00000040h
IMAGE— —SCN— —CNT— —UNINITIALIZED—DATE 包含未初始化的数据
00000080h
IMAGE— —SCN— —MEM— —DISCARDABLE 02000000h 可被丢弃
IMAGE— —SCN— —MEM— —SHARED lOOOOOOOh 共享块
IMAGE— —SCN— —MEM— —EXECUTE 20000000h 可执行, 常与 00000020同时使用
IMAGE— —SCN— —MEM— —READ 40000000h 可读
IMAGE— —SCN— —MEM— —WRITE 80000000h 可写 如: Characteristics 值: C0000040h = 40000000h | 80000000h 00000040h 表示 该块可读、 可写, 含已初始化数据。
常见的有可写标志的段名: . data 、 DATA, BSS、 . tls、 . idata、 . adata。 如果某段有 可写标志, 而又不是常见的这些段名, 就比较可疑了。
例如: 某段的 Characteristics值为 80000000h, 表示可写, 但其 Name不是以上有可 写标志的段名, 则认为是可疑的。
检测了文件的结构属性后, 执行步骤 103。
步骤 103、 检测文件的文件属性;
检测文件的文件属性包括: 检测文件资源, 检测文件常规属性, 检测文件版本信息。 检测文件属性的各项具体如下:
文件常规属性: 对于可疑文件, 文件常规属性通常会被隐藏。 为了描述方便, 本发明 实施例文件常规属性是指文件的扩展名、 文件的大小、 文件的存储位置、 文件的创建时间 等信息。
文件名: 对于可疑文件, 文件名可能会被改变, 病毒经常伪装成 ieXp0rer、 svchost 等并且带有( ) [] 〜等特殊符号。
文件的资源信息: 对于可疑文件或病毒文件, 一般不会有资源信息。
文件的版权信息: 对于可疑文件或病毒文件, 一般不会有正常的版权信息。
各段的入口特征: 对于可疑文件或病毒文件, 在段的入口含有跳转指令。
需要说明的是, 检测文件的结构属性和文件的文件属性不分先后顺序, 且具体检测文 件的结构属性的各项和检测文件的文件属性的各项也不分先后顺序。
步骤 104、 选出可疑的检测项;
根据步骤 102和步骤 103中所述的规则, 选出可疑的检测项。
步骤 105、 为可疑的检测项赋予权值;
根据检测项在整个结构属性和文件属性中的权重赋予检测项相应的权值。
如下表举例说明各检测项权值: 检测项 权值
IMAGE_DOS_HEADER中 e_lfanew项 15
IMAGE_FILE_HEADER中 NumberOfSections项 2
IMAGE_0PTI0NAL_HEADER32中的 BaseOfCode 项 5
IMAGE_0PTI0NAL_HEADER32中的 BaseOfData 项 5
IMAGE_0PTI0NAL_HEADER32中 ImageBase项 3
IMAGE_0PTI0NAL_HEADER32中 FileAlignment项 5
IMAGE_0PTI0NAL_HEADER32中 Checksum项 5
IMAGE_0PTI0NAL_HEADER32->DataDirectory [l] . VirtualAddress项 5
IMAGE_0PTI0NAL_HEADER32->DataDirectory [l] . Size项 5
IMAGE_0PTI0NAL_HEADER32_〉Da DirecLory [5] . V丄 rLimlAddress项 5
IMAGE_0PTI0NAL_HEADER32->DataDirectory [5] . Size项 5
IMAGE_SECT I 0N_HEADER中 Name 项 7 步骤 106、 统计同一个可疑项的出现数量;
SECTION TABLE在文件中可能会有多个,循环检测每个 SECTION TABLE中的各个检测项。 每个检测项在各个 SECTION TABLE 都存在, 将多个同一个检测项的可疑度累加。 因此执行 该步骤, 统计同一个可疑项的权值。
步骤 107、 计算文件的可疑度;
计算公式如下:
文件的可疑度 =检测项 1出现可疑的数量 *权值 1 +检测项 2出现可疑的数量 *权 值 2 +检测项 3出现可疑的数量 * 权值 3 + . . . 。
每个检测项对应一个权值, 计算获得文件的可疑度后, 执行步骤 108。
如: 在某个文件中以下各个检测项符合可疑条件。
IMAGE_D0S_HEADER中 e_lfanew项, 数量 1个
IMAGE_FILE_HEADER中 NumberOfSections项, 数量 1个
IMAGE_0PTI0NAL_HEADER32中的 BaseOfCode 项, 数量 1个
IMAGE_0PTI0NAL_HEADER32种的 BaseOfData 项, 数量 1个
IMAGE_0PTI0NAL_HEADER32中 FileAlignment项, 数量 1个
IMAGE_0PTI0NAL_HEADER32中 Checksum项, 数量 1个
IMAGE_0PTI0NAL_HEADER32->DataDirectory [l] . Size项, 数量 1个 IMAGE_SECTION_HEADER中 Name 项, 数量 2个
则该文件的可疑度 = 15 + 2 + 5 + 5 + 5 + 5 + 5 + 2 * 7 = 56
步骤 108、 将文件的可疑度与预置可疑标准比较;
一般预置可疑标准是 20, 当计算文件的可疑度超过或等于 20时, 执行步骤 109; 上述 计算得到文件的可疑度是 56, 即执行步骤 109; 若计算得到上述文件的可疑度小于 20, 则 认为该文件是正常的文件, 未被感染病毒。
步骤 109、 显示可疑文件, 并显示该文件是可疑文件;
为方便终端用户得知可能被感染病毒的文件, 以进行采取主动的防御, 本发明实施例 在计算得到的文件可疑度大于预置的可疑标准, 显示该可疑文件, 并对应显示该文件是可 疑文件。
至此, 对于一个文件的检测完毕, 本发明实施例提供的计算机文件检测装置开始下一 个文件的检测, 若检测完终端用户选中的所有文件, 提示终端用户检测完毕, 并全部显示 所有检测到的可疑度达到预置可疑度的文件。 另外, 需要说明的是, 本发明实施例计算机 文件检测的方法步骤 102、 103中描述对文件结构属性和文件属性的检测异常状况可以根据 普通文件或病毒文件的不断更新而进行更新, 本发明实施例对此不做限制; 另外, 文件的 结构属性和文件属性的所有各项以及所有各项对应的检测异常状况, 本领域技术人员可以 根据具体情况判断所有检测项的异常状况, 在此不赘述。
本发明实施例在计算得到的文件可疑度大于预置的可疑标准, 显示该可疑文件, 并对 应显示该文件是可疑文件。 方便终端用户得知可能被感染病毒的文件, 以进行采取主动的 防御。
如下提供应用本发明实施例提供的计算机文件检测的方法的装置实施例。
请参阅图 2是本发明实施例提供的计算机文件检测的装置图。
如图所示, 本发明实施例提供的计算机文件检测的装置包括:
检测单元 110, 用于检测文件的属性, 选择可疑的检测项, 所述属性包括结构属性和文 件属性;
赋值单元 120, 用于为所述可疑的检测项赋予权值;
统计单元 130, 用于统计同一个可疑的检测项的出现数量;
计算单元 140,用于使用所述可疑的检测项的权值和所述同一个可疑的检测项的出现数 量计算得出所述文件的可疑度;
比较单元 150, 用于将所述文件的可疑度与预置可疑标准比较, 若所述可疑度大于预置 可疑标准, 则所述文件是可疑文件, 若所述可疑度小于预置可疑标准, 则所述文件为非可 疑文件。
检测到可疑的文件后, 本发明实施例提供的计算机文件检测装置还包括:
显示单元 160, 用于在所述文件是可疑文件时, 显示所述可疑文件, 并显示所述文件是 可疑文件。
另外, 为减少检测无效文件的检测时间, 加快检测速度, 所述计算机文件检测的装置 还包括:
文件检测单元 170, 用于检测打开的文件是否有效, 若检测的结果为有效, 则继续检测 单元 110的检测; 若检测的结果为无效, 则结束检测流程。
在检测文件的结构属性时, 若文件结构属性存在多个 SECTION项, 本发明实施例提供 的所述计算机文件检测装置还包括:
定位单元 180, 用于在检测所述文件结构属性时, 定位所述文件结构属性的段表。 本发明实施例提供的计算机文件检测方法及装置可以作为单独的检测工具, 也可以与 目前的杀毒软件结合使用。 也可以在数据流查毒中, 抓取文件传输的报文并做还原, 然后 对还原出来的文件使用本发明实施例提供的计算机文件检测方法检测。
例:目前互联网上大多数病毒以超文本传输协议(HTTP, Hypertext, Transfer Protocol) 方式下载至本地然后运行; 可以对 HTTP协议数据流抓包并做还原后, 得到病毒传送的原文 件, 之后使用本发明实施例提供的计算机文件检测方法检测是否为可疑文件。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程, 是可以通过 计算机程序来指令相关的硬件来完成, 所述的程序可存储于一计算机可读取存储介质中, 该程序在执行时, 可包括如上述各方法的实施例的流程。 其中, 所述的存储介质可为磁碟、 光盘、只读存储记忆体(Read-Only Memory, ROM)或随机存储记忆体(Random Access Memory, RAM) 等。
以上对本发明所提供的一种病毒防御的方法及装置进行了详细介绍, 对于本领域的一 般技术人员, 依据本发明实施例的思想, 在具体实施方式及应用范围上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求 书
1、 一种计算机文件检测的方法, 其特征在于, 包括步骤:
检测文件的属性, 选出可疑的检测项, 所述属性包括结构属性和文件属性; 为所述可疑的检测项赋予权值, 统计同一可疑的检测项的出现数量;
使用预置的可疑的检测项的权值和所述同一可疑的检测项的出现数量计算所述文件的 可疑度, 若所述可疑度大于或等于预置可疑标准, 则所述文件为可疑文件, 若所述可疑度 小于所述预置可疑标准, 则所述文件为非可疑文件。
2、 根据权利要求 1所述的计算机文件检测的方法, 其特征在于, 所述为所述可疑的检 测项赋予权值包括: 依据所述检测项的权重比例赋予相应的权值。
3、 根据权利要求 1所述的计算机文件检测的方法, 其特征在于, 所述使用所述权值和 所述同一个可疑的检测项的出现数量计算得出所述文件的可疑度包括:
同一个可疑的检测项的出现数量乘以所述可疑的检测项的权值, 然后将各检测项的结 果相加, 获得所述文件的可疑度。
4、 根据权利要求 1所述的计算机文件检测的方法, 其特征在于, 若所述文件是可疑文 件, 则显示所述可疑文件, 并显示所述文件是可疑文件。
5、 根据权利要求 1所述的计算机文件检测的方法, 其特征在于, 所述检测文件的属性 之前, 还包括:
打开文件后, 检测所述文件是否有效, 若所述文件有效, 则执行后续步骤; 若所述文 件无效, 则结束检测。
6、 根据权利要求 1至 5任一项所述的计算机文件检测的方法, 其特征在于, 所述检测 所述文件的结构属性包括:
检测映像 DOS头各项; 或,
检测映像文件头各项; 或,
检测可选映像头各项; 或,
检测段映像头各项。
7、 根据权利要求 6所述的计算机文件检测的方法, 其特征在于, 所述检测段映像头各 项包括步骤:
定位段表;
检测一个所述段表中段映像头各项;
所述一个段表中段映像头各项检测完毕后, 定位下一个段表, 若所述一个段是最后一 个段 , 则结束段表部分的检测; 若所述段表不是最后一个段表, 则对当前段表, 检测所述 段映像头各项。
8、 根据权利要求 7所述的计算机文件检测的方法, 其特征在于, 所述检测所述文件的 文件属性包括:
检测文件资源信息, 检测文件常规属性, 检测文件版本信息。
9、 一种计算机文件检测的装置, 其特征在于, 所述装置包括:
检测单元, 用于检测文件的属性, 选择可疑的检测项, 所述属性包括结构属性和文件 属性;
赋值单元, 用于为所述可疑的检测项赋予权值;
统计单元, 用于统计同一个可疑的检测项的出现数量;
计算单元, 用于使用所述可疑的检测项的权值和所述同一个可疑的检测项的出现数量 计算得出所述文件的可疑度;
比较单元, 用于将所述文件的可疑度与预置可疑标准比较, 若所述可疑度大于预置可 疑标准, 则所述文件是可疑文件, 若所述可疑度小于预置可疑标准, 则所述文件为非可疑 文件。
10、 根据权利要求 9 所述的计算机文件检测的装置, 其特征在于, 所述计算机文件检 测装置还包括:
显示单元, 用于在所述文件是可疑文件时, 显示所述可疑文件, 并显示所述文件是可 疑文件。
11、 根据权利要求 9 所述的计算机文件检测的装置, 其特征在于, 所述计算机文件检 测的装置还包括:
文件检测单元, 用于检测打开的文件是否有效, 若检测的结果为有效, 则所述检测单 元开始检测文件的属性; 若检测的结果为无效, 则结束检测。
12、 根据权利要求 9至 11任一项所述的计算机文件检测的装置, 其特征在于, 所述计 算机文件检测装置还包括:
定位单元, 用于在检测所述文件结构属性时, 定位所述文件结构属性的段表。
PCT/CN2009/070554 2008-07-24 2009-02-26 一种计算机文件检测的方法及装置 WO2010009625A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 200810135013 CN101329711B (zh) 2008-07-24 2008-07-24 一种计算机文件检测的方法及装置
CN200810135013.4 2008-07-24

Publications (1)

Publication Number Publication Date
WO2010009625A1 true WO2010009625A1 (zh) 2010-01-28

Family

ID=40205516

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/070554 WO2010009625A1 (zh) 2008-07-24 2009-02-26 一种计算机文件检测的方法及装置

Country Status (2)

Country Link
CN (1) CN101329711B (zh)
WO (1) WO2010009625A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102647421A (zh) * 2012-04-09 2012-08-22 北京百度网讯科技有限公司 基于行为特征的web后门检测方法和装置
JP2018032418A (ja) * 2011-02-15 2018-03-01 ウェブルート インク. マルウェアに対処するための方法及び装置
US10803170B2 (en) 2005-06-30 2020-10-13 Webroot Inc. Methods and apparatus for dealing with malware

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329711B (zh) * 2008-07-24 2011-04-06 成都市华为赛门铁克科技有限公司 一种计算机文件检测的方法及装置
CN101795267B (zh) * 2009-12-30 2012-12-19 成都市华为赛门铁克科技有限公司 病毒检测方法、装置和网关设备
CN102034043B (zh) * 2010-12-13 2012-12-05 四川大学 基于文件静态结构属性的恶意软件检测新方法
CN101984450B (zh) * 2010-12-15 2012-10-24 北京安天电子设备有限公司 恶意代码检测方法和系统
CN102024113B (zh) * 2010-12-22 2012-08-01 北京安天电子设备有限公司 快速检测恶意代码的方法和系统
CN102592103B (zh) * 2011-01-17 2015-04-08 中国电信股份有限公司 文件安全处理方法、设备及系统
CN102075583A (zh) * 2011-01-30 2011-05-25 杭州华三通信技术有限公司 一种http请求报文处理方法及其设备
CN104732142B (zh) * 2011-06-27 2017-12-12 北京奇虎科技有限公司 一种文件解锁的方法及装置
CN103136473B (zh) * 2011-11-29 2017-07-04 姚纪卫 检测计算机病毒的方法和装置
CN103136474B (zh) * 2011-11-29 2017-07-04 姚纪卫 检测文件的方法和装置
CN102624547A (zh) * 2011-12-31 2012-08-01 成都市华为赛门铁克科技有限公司 一种即时通信上网行为管理的方法、装置与系统
CN102768717B (zh) * 2012-06-29 2015-01-21 腾讯科技(深圳)有限公司 恶意文件检测的方法及装置
CN103353930B (zh) * 2012-12-21 2016-09-07 北京安天电子设备有限公司 一种防范感染式病毒感染的方法和装置
CN104978381A (zh) * 2014-10-28 2015-10-14 哈尔滨安天科技股份有限公司 一种基于反汇编进行恶意样本检测的方法及系统
CN107330329A (zh) * 2017-06-30 2017-11-07 北京金山安全管理系统技术有限公司 应用文件的鉴定方法及装置
CN108985063A (zh) * 2018-07-13 2018-12-11 南方电网科学研究院有限责任公司 一种恶意代码混淆检测方法、系统、计算机设备、介质
CN109492399B (zh) * 2019-01-17 2022-02-01 腾讯科技(深圳)有限公司 风险文件检测方法、装置及计算机设备
CN110648118A (zh) * 2019-09-27 2020-01-03 深信服科技股份有限公司 一种鱼叉邮件检测方法、装置、电子设备及可读存储介质
CN112380538A (zh) * 2020-11-10 2021-02-19 广东电力信息科技有限公司 互联网信息风险提示方法及监测系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581088A (zh) * 2003-08-06 2005-02-16 华为技术有限公司 一种防止计算机病毒的方法及装置
EP1760620A2 (en) * 2005-08-16 2007-03-07 EEye Digital Security Methods and Systems for Detection of Forged Computer Files
CN101329711A (zh) * 2008-07-24 2008-12-24 成都市华为赛门铁克科技有限公司 一种计算机文件检测的方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581088A (zh) * 2003-08-06 2005-02-16 华为技术有限公司 一种防止计算机病毒的方法及装置
EP1760620A2 (en) * 2005-08-16 2007-03-07 EEye Digital Security Methods and Systems for Detection of Forged Computer Files
CN101329711A (zh) * 2008-07-24 2008-12-24 成都市华为赛门铁克科技有限公司 一种计算机文件检测的方法及装置

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHEN,YUELING ET AL.: "Computer Viruses Detection Method Based on Program Behavior.", JOURNAL OF QINGDAO UNIVERSITY (NATURAL SCIENCE EDITION)., vol. 19, no. 2, June 2006 (2006-06-01), pages 63 - 64 *
DAI,MIN ET AL.: "Trojan Horse Detection Model Based on File's Static Attributes.", COMPUTER ENGINEERING., vol. 32, no. 6, March 2006 (2006-03-01), pages 198 - 200 *
HUANG, WEI ET AL.: "An Approach Detecting Virus in the Environment of Win32.", COMPUTER TECHNOLOGY AND APPLICATION EVOLVEMENT 2008., July 2008 (2008-07-01), pages 1148 - 1151 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10803170B2 (en) 2005-06-30 2020-10-13 Webroot Inc. Methods and apparatus for dealing with malware
US11379582B2 (en) 2005-06-30 2022-07-05 Webroot Inc. Methods and apparatus for malware threat research
JP2018032418A (ja) * 2011-02-15 2018-03-01 ウェブルート インク. マルウェアに対処するための方法及び装置
US10574630B2 (en) 2011-02-15 2020-02-25 Webroot Inc. Methods and apparatus for malware threat research
CN102647421A (zh) * 2012-04-09 2012-08-22 北京百度网讯科技有限公司 基于行为特征的web后门检测方法和装置
CN102647421B (zh) * 2012-04-09 2016-06-29 北京百度网讯科技有限公司 基于行为特征的web后门检测方法和装置

Also Published As

Publication number Publication date
CN101329711B (zh) 2011-04-06
CN101329711A (zh) 2008-12-24

Similar Documents

Publication Publication Date Title
WO2010009625A1 (zh) 一种计算机文件检测的方法及装置
US11188650B2 (en) Detection of malware using feature hashing
US8341743B2 (en) Detection of viral code using emulation of operating system functions
JP6715292B2 (ja) 機械学習を用いる悪意のあるファイルを検出するシステムおよび方法
EP2169582B1 (en) Method and apparatus for determining software trustworthiness
RU2589862C1 (ru) Способ обнаружения вредоносного кода в оперативной памяти
EP2513836B1 (en) Obfuscated malware detection
US7617534B1 (en) Detection of SYSENTER/SYSCALL hijacking
US7568233B1 (en) Detecting malicious software through process dump scanning
US7779472B1 (en) Application behavior based malware detection
US9015814B1 (en) System and methods for detecting harmful files of different formats
TW518463B (en) Computer immune system and method for detecting unwanted code in a computer system
JP5793764B2 (ja) マルウェアの誤検出を低減する方法及び装置
US20110277033A1 (en) Identifying Malicious Threads
US7210040B2 (en) Detection of suspicious privileged access to restricted computer resources
RU2624552C2 (ru) Способ обнаружения вредоносных файлов, исполняемых с помощью стековой виртуальной машины
US9804948B2 (en) System, method, and computer program product for simulating at least one of a virtual environment and a debugging environment to prevent unwanted code from executing
WO2012107255A1 (en) Detecting a trojan horse
TW201020845A (en) Monitor device, monitor method and computer program product thereof for hardware
JP2007280013A (ja) 情報処理装置による通信を制御する方法およびプログラム
WO2012063458A1 (ja) 出力制御装置、出力制御装置用のプログラムを記憶するコンピュータ読み取り可能な媒体、出力制御方法および出力制御システム
CN108028843B (zh) 保护计算机实现的功能的递送的方法、系统和计算设备
US9177146B1 (en) Layout scanner for application classification
US8756695B1 (en) Analysis of binary code
US8490195B1 (en) Method and apparatus for behavioral detection of malware in a computer system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09799941

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11/07/2011)

122 Ep: pct application non-entry in european phase

Ref document number: 09799941

Country of ref document: EP

Kind code of ref document: A1