WO2024071461A1 - 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치 - Google Patents

난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치 Download PDF

Info

Publication number
WO2024071461A1
WO2024071461A1 PCT/KR2022/014433 KR2022014433W WO2024071461A1 WO 2024071461 A1 WO2024071461 A1 WO 2024071461A1 KR 2022014433 W KR2022014433 W KR 2022014433W WO 2024071461 A1 WO2024071461 A1 WO 2024071461A1
Authority
WO
WIPO (PCT)
Prior art keywords
javascript
executing
server
library
detection method
Prior art date
Application number
PCT/KR2022/014433
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 PCT/KR2022/014433 priority Critical patent/WO2024071461A1/ko
Priority to KR1020227033623A priority patent/KR102494837B1/ko
Publication of WO2024071461A1 publication Critical patent/WO2024071461A1/ko

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/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • 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

  • This specification relates to a method and device for detecting and decoding JavaScript that has been obfuscated and difficult for humans to interpret.
  • Methods of distributing malicious files using malware containing obfuscated JavaScript are generally detected by creating obfuscated signatures, but the detection rate is low, and in the case of JavaScript with behavioral analysis bypass technology applied, it cannot be detected through behavioral analysis.
  • methods for detecting obfuscated JavaScript include static inspection and dynamic inspection methods.
  • a static scan is a test that determines whether a file is malicious by extracting and analyzing the data contained in the file without executing it. For example, it can be performed through anti-virus products.
  • Static inspection e.g., signature
  • obfuscated JavaScript can result in various obfuscation patterns with a single JavaScript, so each must be responded to through a signature and can only respond to known files, making it difficult to increase the detection rate.
  • Dynamic inspection is a inspection that executes a file to be inspected, records and analyzes behavioral data to determine whether malicious behavior patterns are observed. For example, inspection is performed in an isolated execution environment using sandbox (virtual machine) technology. You can monitor its behavior by executing the target file. Dynamic scanning for obfuscated JavaScript can detect suspicious behavior in non-executable files by executing obfuscated JavaScript. However, to evade behavioral detection, attackers execute obfuscated JavaScript to delay execution (e.g., act at a specified time, act after a certain period of time) before the decrypted original script causes malicious behavior, and detect the behavioral analysis environment. The behavioral analysis of dynamic inspection can be bypassed using various circumvention techniques, such as evasion and evasion.
  • the purpose of this specification is to propose a method and device for securing and diagnosing the original text of JavaScript included in non-executable files to increase the detection rate over existing static/dynamic detection methods.
  • One aspect of the present disclosure provides a method for a server to detect JavaScript, comprising: executing a process of an application associated with a non-executable file; detecting JavaScript included in the non-executable file based on the process of the application program; executing the JavaScript and debugging a host process for executing the JavaScript; determining, based on the host process, whether a library for executing the JavaScript is loaded; Setting a break point at the address of a function referenced to execute the JavaScript, based on the library being loaded; and extracting the original text of the JavaScript based on execution of the breakpoint. It includes, and the JavaScript may be obfuscated JavaScript.
  • the step of extracting the original text of the JavaScript may be based on a data extraction policy set in the register.
  • the host process may include Wscript.exe.
  • setting the break point may be based on the library being loaded into the host process.
  • the library may include Jscript.dll.
  • breakpoint may be set at the address of a function referenced to execute the JavaScript within the library.
  • the function referenced to execute the JavaScript may include the ScrFncObj::CALL function.
  • performing a static check on the original text of the JavaScript may further include.
  • a server for detecting JavaScript comprising: a communication unit; Memory; and a processor that functionally controls the communication unit and the memory, wherein the processor executes a process of an application program related to a non-executable file and, based on the process of the application program, executes a Java program included in the non-executable file. Detect a script, execute the JavaScript, debug a host process for executing the JavaScript, and, based on the host process, load a library for executing the JavaScript.
  • the original text of the JavaScript is extracted, and the JavaScript may be obfuscated JavaScript.
  • the detection rate can be increased compared to existing static/dynamic detection methods by securing and diagnosing the original text of JavaScript included in a non-executable file.
  • 1 is a block diagram for explaining an electronic device related to this specification.
  • Figure 2 is a diagram showing a server or client related to this specification.
  • Figure 3 is an example of abnormal input that can be applied to this specification
  • Figure 4 is an embodiment of a server to which this specification can be applied.
  • Figure 5 is an example of the original text of decrypted JavaScript to which this specification can be applied.
  • unit refers to a software or hardware component, and the “unit” performs certain roles. However, “wealth” is not limited to software or hardware.
  • the “copy” may be configured to reside on an addressable storage medium and may be configured to run on one or more processors.
  • part refers to software components, such as object-oriented software components, class components, and task components, processes, functions, properties, procedures, Includes subroutines, segments of program code, drivers, firmware, microcode, circuits, data, databases, data structures, tables, arrays, and variables.
  • the functionality provided within the components and “parts” may be combined into smaller numbers of components and “parts” or may be further separated into additional components and “parts”.
  • unit may be implemented with a processor and memory.
  • processor should be interpreted broadly to include general purpose processors, central processing units (CPUs), microprocessors, digital signal processors (DSPs), controllers, microcontrollers, state machines, etc.
  • processor may refer to an application-specific integrated circuit (ASIC), programmable logic device (PLD), field programmable gate array (FPGA), etc.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • FPGA field programmable gate array
  • processor refers to a combination of processing devices, for example, a combination of a DSP and a microprocessor, a combination of a plurality of microprocessors, a combination of one or more microprocessors in combination with a DSP core, or any other such combination of configurations. It may also refer to
  • memory should be interpreted broadly to include any electronic component capable of storing electronic information.
  • the terms memory include random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), programmable read-only memory (PROM), erasable-programmable read-only memory (EPROM), electrical may refer to various types of processor-readable media, such as erasable PROM (EEPROM), flash memory, magnetic or optical data storage, registers, etc.
  • RAM random access memory
  • ROM read-only memory
  • NVRAM non-volatile random access memory
  • PROM programmable read-only memory
  • EPROM erasable-programmable read-only memory
  • electrical may refer to various types of processor-readable media, such as erasable PROM (EEPROM), flash memory, magnetic or optical data storage, registers, etc.
  • EEPROM erasable PROM
  • flash memory magnetic or optical data storage, registers, etc.
  • non-executable file refers to a file that does not execute on its own, as opposed to an executable file or executable file.
  • non-executable files may be document files such as PDF files, Hangul files, Word files, image files such as JPG files, video files, JavaScript files, HTML files, etc., but are not limited thereto.
  • 1 is a block diagram for explaining an electronic device related to this specification.
  • the electronic device 100 includes a wireless communication unit 110, an input unit 120, a sensing unit 140, an output unit 150, an interface unit 160, a memory 170, a control unit 180, and a power supply unit 190. ), etc. may be included.
  • the components shown in FIG. 1 are not essential for implementing an electronic device, so the electronic device described in this specification may have more or fewer components than the components listed above.
  • the wireless communication unit 110 is used between the electronic device 100 and the wireless communication system, between the electronic device 100 and another electronic device 100, or between the electronic device 100 and an external server. It may include one or more modules that enable wireless communication between the devices. Additionally, the wireless communication unit 110 may include one or more modules that connect the electronic device 100 to one or more networks.
  • This wireless communication unit 110 may include at least one of a broadcast reception module 111, a mobile communication module 112, a wireless Internet module 113, a short-range communication module 114, and a location information module 115. .
  • the input unit 120 includes a camera 121 or an image input unit for inputting an image signal, a microphone 122 or an audio input unit for inputting an audio signal, and a user input unit 123 for receiving information from a user, for example. , touch keys, push keys (mechanical keys, etc.). Voice data or image data collected by the input unit 120 may be analyzed and processed as a user's control command.
  • the sensing unit 140 may include one or more sensors for sensing at least one of information within the electronic device, information on the surrounding environment surrounding the electronic device, and user information.
  • the sensing unit 140 includes a proximity sensor (141), an illumination sensor (142), a touch sensor, an acceleration sensor, a magnetic sensor, and a gravity sensor.
  • G-sensor gyroscope sensor
  • motion sensor RGB sensor
  • IR sensor infrared sensor
  • fingerprint scan sensor ultrasonic sensor
  • optical sensors e.g., cameras (see 121)), microphones (see 122), battery gauges, environmental sensors (e.g., barometers, soil hygrometers, thermometers, radiation detection sensors) , a heat detection sensor, a gas detection sensor, etc.), and a chemical sensor (e.g., an electronic nose, a healthcare sensor, a biometric sensor, etc.).
  • the electronic device disclosed in this specification can utilize information sensed by at least two of these sensors by combining them.
  • the output unit 150 is for generating output related to vision, hearing, or tactile sense, and includes at least one of a display unit 151, an audio output unit 152, a haptip module 153, and an optical output unit 154. can do.
  • the display unit 151 can implement a touch screen by forming a layered structure or being integrated with the touch sensor. This touch screen functions as a user input unit 123 that provides an input interface between the electronic device 100 and the user, and can simultaneously provide an output interface between the electronic device 100 and the user.
  • the interface unit 160 serves as a passageway for various types of external devices connected to the electronic device 100.
  • This interface unit 160 connects devices equipped with a wired/wireless headset port, an external charger port, a wired/wireless data port, a memory card port, and an identification module. It may include at least one of a port, an audio input/output (I/O) port, a video input/output (I/O) port, and an earphone port.
  • the electronic device 100 may perform appropriate control related to the connected external device.
  • the memory 170 stores data supporting various functions of the electronic device 100.
  • the memory 170 may store a plurality of application programs (application programs) running on the electronic device 100, data for operating the electronic device 100, and commands. At least some of these applications may be downloaded from an external server via wireless communication. Additionally, at least some of these applications may be present on the electronic device 100 from the time of shipment for basic functions of the electronic device 100 (e.g., incoming and outgoing calls, receiving and sending functions). Meanwhile, the application program may be stored in the memory 170, installed on the electronic device 100, and driven by the control unit 180 to perform an operation (or function) of the electronic device.
  • control unit 180 In addition to operations related to the application program, the control unit 180 typically controls the overall operation of the electronic device 100.
  • the control unit 180 can provide or process appropriate information or functions to the user by processing signals, data, information, etc. input or output through the components discussed above, or by running an application program stored in the memory 170.
  • control unit 180 may control at least some of the components examined with FIG. 1 in order to run an application program stored in the memory 170. Furthermore, the control unit 180 may operate at least two of the components included in the electronic device 100 in combination with each other in order to run the application program.
  • the power supply unit 190 receives external power and internal power under the control of the control unit 180 and supplies power to each component included in the electronic device 100.
  • This power supply unit 190 includes a battery, and the battery may be a built-in battery or a replaceable battery.
  • At least some of the components may cooperate with each other to implement operation, control, or a control method of an electronic device according to various embodiments described below. Additionally, the operation, control, or control method of the electronic device may be implemented on the electronic device by running at least one application program stored in the memory 170.
  • a server or cloud server or client may include an electronic device 100, and the electronic device 100 may be collectively referred to as a terminal.
  • the terminal can communicate with an external server (or cloud server) or client by being connected to a network.
  • Figure 2 is a diagram showing a server or client related to this specification.
  • a server or cloud server
  • client may include a control unit 200 and a communication unit 230.
  • the control unit 200 may include a processor 210 and a memory 220.
  • the processor 210 may execute instructions stored in the memory 220.
  • the processor 210 can control the communication unit 230.
  • Memory 220 may include cache memory.
  • the processor 210 may control the operation of the server or client based on instructions stored in the memory 220.
  • a server or client may include one processor or may include multiple processors. When a server or client includes a plurality of processors, at least some of the plurality of processors may be located physically spaced apart from each other. Additionally, the server or client is not limited to this and may be implemented in various known ways.
  • the communication unit 230 may include one or more modules that enable wireless communication between a server or client and a wireless communication system, between a server or client and another server or client, or between a server or client and an external server (terminal). there is. Additionally, the communication unit 210 may include one or more modules that connect servers or clients to one or more networks.
  • the control unit 200 may control at least some of the components of the server or client to run the application program stored in the memory 220. Furthermore, the control unit 200 may operate at least two of the components included in the server or client in combination with each other to run the application program.
  • the server may include a reversing engine or/and a CDR engine that provides a CDR service.
  • the reversing engine is an analysis/diagnosis engine that automates the reverse engineering (reversing) process for non-executable files. This is called reverse engineering, and through this, the server can learn about the principles and structure of the software by going all the way to the assembly level, a language that allows computers to execute software without source code. Using this, the server can learn about the structure of general software (e.g., msoffice, pdf), malicious code behavior, and how to exploit vulnerabilities.
  • general software e.g., msoffice, pdf
  • a reversing engine can perform the following steps:
  • File analysis This is the step of analyzing the appearance of the non-executable file itself (e.g., properties, author, creation date, file type). Similar to a general anti-virus program, it is possible to diagnose maliciousness using only the information of the non-executable file itself. You can.
  • Static analysis This is a step to extract and analyze data in non-executable files to determine whether they are normal or malicious. Non-executable files are not executed, but internal data is extracted and compared and analyzed according to the file structure to diagnose maliciousness. there is. This can be suitable for macros, URL extraction analysis, etc.
  • Dynamic analysis This is a step to determine whether it is malicious by analyzing its behavior while executing and monitoring non-executable files. It is easy to detect malicious behavior using normal functions such as macros, hyperlinks, and DDE.
  • Debugging analysis This is the step of analyzing vulnerabilities, exploits, etc. by executing and debugging non-executable files. It detects vulnerabilities in the application using the body of the document, tables, fonts, pictures, etc., including macros, hyperlinks, and DDE. It is suitable for
  • the reversing engine may include a debugging engine that can be used for debugging analysis.
  • the debugging engine can diagnose vulnerabilities that occur in the document input, processing, and output stages by using the debugging mode during the viewing process of non-executable files.
  • a vulnerability refers to taking advantage of errors, bugs, etc. that occur when an application receives unexpected values from the code (logic) developed by the application developer. Through the vulnerability, an attacker can cause denial of service due to abnormal termination, etc. Malicious document actions such as remote code execution can be performed.
  • the debugging engine may include a debugger.
  • a debugger is a tool for reverse engineering and can refer to a program or process that can break point another target program at the assembly level.
  • the CDR engine provides CDR services.
  • the CDR service is a solution that disassembles non-executable files, removes malicious or unnecessary files, and creates new files by keeping the content as identical as possible to the original.
  • CDR refers to a service that disarms and reconstructs the content in a document to create a safe document and provide it to customers.
  • the file subject to detoxification may be any non-executable file. Examples of non-executable files include Word files, Excel files, PowerPoint files, Hangul files, and PDF files.
  • Content subject to detoxification may be active content. Examples of active content include macros, hyperlinks, and Object Linking and Embedding (OLE).
  • Figure 3 is an example of abnormal input that can be applied to this specification.
  • the application when the application receives an abnormal value (for example, when the input value exceeds the normal range of 2) through a non-executable file, the execution flow is changed to something unintentional by the developer, resulting in a vulnerability.
  • the debugging engine automatically debugs the document viewing process, sets breakpoints at specific points related to vulnerabilities, checks specific values related to input values, and determines whether the input value causes a vulnerability or not, thereby diagnosing whether it is malicious.
  • the debugging engine can identify non-executable files and start debugging by running an application to view them.
  • the debugging engine checks whether the module is the target of analysis, and if so, can set a breakpoint at the specified address.
  • a malicious non-executable file may terminate the application if certain conditions, such as the version of the application or the operating system environment, are not met, or may have branching points that branch to a flow in which no malicious action occurs.
  • the server is analyzed by an analyst in advance and breakpoints can be set at branch points that have this possibility.
  • the server can set conditions in relation to the branch point that can continue to run the application without terminating it or lead to a flow in which malicious actions can occur.
  • the server can detect vulnerabilities according to detection logic and then store the results in an analysis report.
  • the automated reversing engine included in the server automatically performs and analyzes the above-mentioned steps, and can diagnose and block malicious non-executable files through diagnostic algorithms researched and developed by analysts.
  • Figure 4 is an embodiment of a server to which this specification can be applied.
  • the server may include a non-executable file and an application program (eg, MSOFFICE, Hancom Office, etc.) for executing the non-executable file.
  • an application program eg, MSOFFICE, Hancom Office, etc.
  • non-executable files may contain obfuscated JavaScript.
  • Obfuscation is a technique that consumes a lot of analysis resources by making executable code or script difficult to understand. For example, a rule to detect the command “cmd.exe /c calc” that runs a calculator in Windows can be set to detect if cmd and calc are in the string. These detection rules cannot detect if the obfuscated command is “C ⁇ m ⁇ D ⁇ %2E ⁇ E ⁇ x ⁇ e ⁇ %20 ⁇ / ⁇ c ⁇ %20 ⁇ C ⁇ a ⁇ L ⁇ C” .
  • the server creates an isolated virtual environment (Virtual Machine) for malware analysis and can detect obfuscated JavaScript.
  • the virtual environment may include a Windows operating system.
  • the server executes the process of the application program related to the non-executable file in debugging mode (S4010).
  • the server can use the CreateProcess API to run a process to open a non-executable file that is subject to analysis of an application in debugging mode (DEBUG_ONLY_THIS_PROCESS). Through this, the server can receive debug events from the application process.
  • the server can use the CreateProcess API to run an application process by setting the “DEBUG_ONLY_THIS_PROCESS” flag.
  • the server detects JavaScript included in the non-executable file based on the application process (S4020). For example, a server can detect (obfuscated) JavaScript based on the application's process being loaded into memory. More specifically, the server can detect JavaScript if the extension of the program executed by the application process is JS.
  • the server executes JavaScript and debugs the host process for executing JavaScript (S4030).
  • the server can run a file with the JS extension to debug the script execution host process, Wscript.exe.
  • Wscript.exe is a process that acts as a JavaScript execution host so that JavaScript (for example, Javascript, VBScript, etc.) can be executed in the Windows operating system.
  • the server determines whether a library for executing JavaScript is loaded based on the host process (S4040). For example, the server can check whether Jscript.dll, a JavaScript execution engine, is loaded within the Wscript.exe process. More specifically, when the server runs JavaScript through Wscript.exe, jscript.dll is loaded, and when Vbscript is executed, Vbscript.dll is loaded. Through this, each script engine is loaded and JavaScript can be executed.
  • Jscript.dll a JavaScript execution engine
  • the server sets a break point at the address of the function referenced to execute JavaScript (S4050). For example, the server can set a breakpoint at the address (offset) of the ScrFncObj::CALL function in Jscript.dll. For this purpose, the server may have the address of a function referenced to execute JavaScript set.
  • the server extracts the original text of the JavaScript based on the execution of the breakpoint point (S4060). For example, the server may extract deobfuscated JavaScript code with a defined data extraction policy (e.g., extracting the original text of the script from memory pointed to by an EBX register (Extended Base address Register)) when the host process passes a breakpoint.
  • the original text can be extracted. More specifically, based on the data extraction policy, the server secures the “original script size” at address EBX-1 (the address of the EBX register minus 4), and obtains the “original script size” previously obtained from the memory address indicated by the EBX register. ” You can extract and save the original JavaScript.
  • the server performs a static check on the original text of JavaScript (S4070).
  • the server performs a static check on the extracted original text, so the detection rate can be increased compared to a static check for obfuscated JavaScript, and the detection rate can be increased by securing the original text before the dynamic check bypass technology is executed.
  • Figure 5 is an example of the original text of decrypted JavaScript to which this specification can be applied.
  • the server can decrypt the obfuscated JavaScript and extract the original text of the JavaScript.
  • the offset of the breakpoint set by the server is address 0x75C58276 (5020), which may be the execution point of the ScrFncObj::CALL function.
  • the server may have an offset of the breakpoint previously analyzed by the analyst set. If Jscript.dll is loaded when starting debugging in the debugging engine, the server can load the set offset value and set a breakpoint.
  • the address of the ScrFncObj::CALL function may vary depending on the version of Jscript.dll, so it may be set differently and updated according to preliminary analysis by the analyst.
  • the server can secure the original text of the JavaScript by extracting data of the previously confirmed size from the memory pointed to by the EBX register (0x03F9004C (5010)), and save the obtained original text of the JavaScript as a file to use the detection policy (e.g. For example, it is possible to detect maliciousness by comparing it with a signature).
  • Computer-readable media includes all types of recording devices that store data that can be read by a computer system. Examples of computer-readable media include HDD (Hard Disk Drive), SSD (Solid State Disk), SDD (Silicon Disk Drive), ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc. It also includes those implemented in the form of carrier waves (e.g., transmission via the Internet). Accordingly, the above detailed description should not be construed as restrictive in all respects and should be considered illustrative. The scope of this specification should be determined by reasonable interpretation of the appended claims, and all changes within the equivalent scope of this specification are included in the scope of this specification.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Technology Law (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

본 명세서는 서버가 자바스크립트를 탐지하는 방법에 있어서, 비실행 파일과 관련된 응용프로그램의 프로세스를 실행하고, 상기 응용프로그램의 프로세스에 근거하여, 상기 비실행 파일에 포함된 자바스크립트를 탐지하며, 상기 자바스크립트를 실행하고, 상기 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅하고, 상기 호스트 프로세스에 근거하여, 상기 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단하며, 상기 라이브러리가 로드된 것에 근거하여, 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정하고, 상기 브레이크 포인트의 지점이 실행된 것에 근거하여, 상기 자바스크립트의 원문을 추출하며, 상기 자바스크립트는 난독화된 자바스크립트 일 수 있다.

Description

난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치
본 명세서는 사람이 해석하기 어렵게 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 장치에 관한 것이다.
난독화 자바스크립트가 포함된 악성코드를 이용한 악성 파일 유포 방법은 일반적으로 난독화 시그니처를 만들어 탐지하지만 탐지율이 낮으며, 행위 분석 우회 기술이 적용된 자바스크립트의 경우에는 행위 분석을 통해서 탐지되지 못한다.
보다 자세하게, 난독화 된 자바스크립트를 탐지하기 위한 방법은 정적 검사, 동적 검사 방법이 있다.
정적 검사란, 검사 대상 파일을 실행시키지 않고 파일이 갖고 있는 데이터를 추출, 분석하여 악성 여부를 판별하는 검사로서, 예를 들어, 안티 바이러스 제품들을 통해 수행될 수 있다. 난독화 자바스크립트에 대한 정적 검사(예를 들어, 시그니처)는 하나의 자바스크립트로 다양한 난독화 패턴이 나올 수 있어, 시그니처를 통해 각각 대응해야하고 알려진 파일에 대해서만 대응할 수 있어 탐지율을 높이기 어렵다.
동적 검사란, 검사 대상 파일을 실행시켜 행위 데이터를 기록, 분석하여 악의적 행위 패턴을 보이는지 판별하는 검사로서, 예를 들어, 샌드박스(가상머신, Virtual Machine) 기술을 이용하여 격리된 실행 환경에서 검사 대상 파일을 실행시켜 행위를 모니터링할 수 있다. 난독화 자바스크립트에 대한 동적 검사는 난독화 자바스크립트를 실행하여 비실행 파일의 의심스러운 행위를 탐지할 수 있다. 그러나 공격자는 행위 탐지를 회피하기 위해, 난독화 된 자바 스크립트를 실행하여 복호화 된 원문 스크립트가 악성 행위를 일으키기 전에 실행 지연(예를 들어, 지정된 시간에 동작, 일정 시간 후 동작), 행위 분석 환경 탐지 및 회피 등 다양한 우회 기술을 사용하여 동적 검사의 행위 분석을 우회할 수 있다.
본 명세서의 목적은, 비실행 파일에 포함된 자바스크립트의 원문을 확보하고 진단하여 기존의 정적/동적 탐지 방법보다 탐지율을 높이기 위한 방법 및 장치를 제안한다.
본 명세서가 이루고자 하는 기술적 과제들은 이상에서 언급한 기술적 과제들로 제한되지 않으며, 언급되지 않은 또 다른 기술적 과제들은 이하의 명세서의 상세한 설명으로부터 본 명세서가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.
본 명세서의 일 양상은, 서버가 자바스크립트를 탐지하는 방법에 있어서, 비실행 파일과 관련된 응용프로그램의 프로세스를 실행하는 단계; 상기 응용프로그램의 프로세스에 근거하여, 상기 비실행 파일에 포함된 자바스크립트를 탐지하는 단계; 상기 자바스크립트를 실행하고, 상기 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅하는 단계; 상기 호스트 프로세스에 근거하여, 상기 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단하는 단계; 상기 라이브러리가 로드된 것에 근거하여, 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정하는 단계; 및 상기 브레이크 포인트의 지점이 실행된 것에 근거하여, 상기 자바스크립트의 원문을 추출하는 단계; 를 포함하며, 상기 자바스크립트는 난독화된 자바스크립트 일 수 있다.
또한, 상기 자바스크립트의 원문을 추출하는 단계는 레지스터에 설정된 데이터 추출 정책에 근거할 수 있다.
또한, 상기 호스트 프로세스는 Wscript.exe를 포함할 수 있다.
또한, 상기 브레이크 포인트(break point)를 설정하는 단계는 상기 호스트 프로세스에 상기 라이브러리가 로드되는 것에 근거할 수 있다.
또한, 상기 라이브러리는 Jscript.dll을 포함할 수 있다.
또한, 상기 브레이크 포인트는 상기 라이브러리 내의 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 설정될 수 있다.
또한, 상기 자바스크립트를 실행하기 위해 참조되는 함수는 ScrFncObj::CALL 함수를 포함할 수 있다.
또한, 상기 자바스크립트의 원문에 대해 정적 검사를 수행하는 단계; 를 더 포함할 수 있다.
본 명세서의 또 다른 일 양상은, 자바스크립트를 탐지하기 위한 서버에 있어서, 통신부; 메모리; 및 상기 통신부 및 상기 메모리를 기능적으로 제어하는 프로세서;를 포함하고, 상기 프로세서는 비실행 파일과 관련된 응용프로그램의 프로세스를 실행하고, 상기 응용프로그램의 프로세스에 근거하여, 상기 비실행 파일에 포함된 자바스크립트를 탐지하며, 상기 자바스크립트를 실행하고, 상기 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅하고, 상기 호스트 프로세스에 근거하여, 상기 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단하며, 상기 라이브러리가 로드된 것에 근거하여, 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정하고, 상기 브레이크 포인트의 지점이 실행된 것에 근거하여, 상기 자바스크립트의 원문을 추출하며, 상기 자바스크립트는 난독화된 자바스크립트일 수 있다.
본 명세서의 실시예에 따르면, 비실행 파일에 포함된 자바스크립트의 원문을 확보하고 진단하여 기존의 정적/동적 탐지 방법보다 탐지율을 높일 수 있다.
본 명세서에서 얻을 수 있는 효과는 이상에서 언급한 효과로 제한되지 않으며, 언급하지 않은 또 다른 효과들은 아래의 기재로부터 본 명세서가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.
도 1은 본 명세서와 관련된 전자 기기를 설명하기 위한 블록도이다.
도 2는 본 명세서와 관련된 서버 또는 클라이언트를 나타내는 도면이다.
도 3은 본 명세서에 적용될 수 있는 비정상 입력의 예시이다
도 4는 본 명세서가 적용될 수 있는 서버의 일 실시예이다.
도 5는 본 명세서가 적용될 수 있는 복호화된 자바스크립트의 원문의 예시이다.
본 명세서에 관한 이해를 돕기 위해 상세한 설명의 일부로 포함되는, 첨부 도면은 본 명세서에 대한 실시예를 제공하고, 상세한 설명과 함께 본 명세서의 기술적 특징을 설명한다.
이하, 첨부된 도면을 참조하여 본 명세서에 개시된 실시예를 상세히 설명하되, 도면 부호에 관계없이 동일하거나 유사한 구성요소는 동일한 참조 번호를 부여하고 이에 대한 중복되는 설명은 생략하기로 한다. 이하의 설명에서 사용되는 구성요소에 대한 접미사 "모듈" 및 "부"는 명세서 작성의 용이함만이 고려되어 부여되거나 혼용되는 것으로서, 그 자체로 서로 구별되는 의미 또는 역할을 갖는 것은 아니다. 또한, 본 명세서에 개시된 실시예를 설명함에 있어서 관련된 공지 기술에 대한 구체적인 설명이 본 명세서에 개시된 실시예의 요지를 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다. 또한, 첨부된 도면은 본 명세서에 개시된 실시예를 쉽게 이해할 수 있도록 하기 위한 것일 뿐, 첨부된 도면에 의해 본 명세서에 개시된 기술적 사상이 제한되지 않으며, 본 명세서의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.
제1, 제2 등과 같이 서수를 포함하는 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되지는 않는다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다.
어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.
단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다.
본 명세서에서, "포함한다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.
또한, 명세서에서 사용되는 "부"라는 용어는 소프트웨어 또는 하드웨어 구성요소를 의미하며, "부"는 어떤 역할들을 수행한다. 그렇지만 "부"는 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. "부"는 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서 "부"는 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로 코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들 및 변수들을 포함한다. 구성요소들과 "부"들 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 "부"들로 결합되거나 추가적인 구성요소들과 "부"들로 더 분리될 수 있다.
또한, 본 명세서의 일 실시예에 따르면 "부"는 프로세서 및 메모리로 구현될 수 있다. 용어 "프로세서"는 범용 프로세서, 중앙 처리 장치 (CPU), 마이크로프로세서, 디지털 신호 프로세서 (DSP), 제어기, 마이크로제어기, 상태 머신 등을 포함하도록 넓게 해석되어야 한다. 몇몇 환경에서는, "프로세서"는 주문형 반도체 (ASIC), 프로그램가능 로직 디바이스 (PLD), 필드 프로그램가능 게이트 어레이 (FPGA) 등을 지칭할 수도 있다. 용어 "프로세서"는, 예를 들어, DSP 와 마이크로프로세서의 조합, 복수의 마이크로프로세서들의 조합, DSP 코어와 결합한 하나 이상의 마이크로프로세서들의 조합, 또는 임의의 다른 그러한 구성들의 조합과 같은 처리 디바이스들의 조합을 지칭할 수도 있다.
용어 "메모리"는 전자 정보를 저장 가능한 임의의 전자 컴포넌트를 포함하도록 넓게 해석되어야 한다. 용어 메모리는 임의 액세스 메모리 (RAM), 판독-전용 메모리 (ROM), 비-휘발성 임의 액세스 메모리 (NVRAM), 프로그램가능 판독-전용 메모리 (PROM), 소거-프로그램가능 판독 전용 메모리 (EPROM), 전기적으로 소거가능 PROM (EEPROM), 플래쉬 메모리, 자기 또는 광학 데이터 저장장치, 레지스터들 등과 같은 프로세서-판독가능 매체의 다양한 유형들을 지칭할 수도 있다. 프로세서가 메모리로부터 정보를 판독하고/하거나 메모리에 정보를 기록할 수 있다면 메모리는 프로세서와 전자 통신 상태에 있다고 불린다. 프로세서에 집적된 메모리는 프로세서와 전자 통신 상태에 있다.
본 명세서에서 사용되는 "비실행 파일"이란 실행 파일 또는 실행 가능한 파일과 반대되는 개념으로서 자체적으로 실행되지 않는 파일을 의미한다. 예를 들어, 비실행 파일은 PDF 파일, 한글 파일, 워드 파일과 같은 문서 파일, JPG 파일과 같은 이미지 파일, 동영상 파일, 자바 스크립트 파일, HTML 파일 등이 될 수 있으나, 이에 한정되지 않는다.
아래에서는 첨부한 도면을 참고하여 실시예에 대하여 본 명세서가 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그리고 도면에서 본 개시를 명확하게 설명하기 위해서 설명과 관계없는 부분들은 생략될 수 있다.
도 1은 본 명세서와 관련된 전자 기기를 설명하기 위한 블록도이다.
상기 전자 기기(100)는 무선 통신부(110), 입력부(120), 센싱부(140), 출력부(150), 인터페이스부(160), 메모리(170), 제어부(180) 및 전원 공급부(190) 등을 포함할 수 있다. 도 1에 도시된 구성요소들은 전자 기기를 구현하는데 있어서 필수적인 것은 아니어서, 본 명세서 상에서 설명되는 전자 기기는 위에서 열거된 구성요소들 보다 많거나, 또는 적은 구성요소들을 가질 수 있다.
보다 구체적으로, 상기 구성요소들 중 무선 통신부(110)는, 전자 기기(100)와 무선 통신 시스템 사이, 전자 기기(100)와 다른 전자 기기(100) 사이, 또는 전자 기기(100)와 외부서버 사이의 무선 통신을 가능하게 하는 하나 이상의 모듈을 포함할 수 있다. 또한, 상기 무선 통신부(110)는, 전자 기기(100)를 하나 이상의 네트워크에 연결하는 하나 이상의 모듈을 포함할 수 있다.
이러한 무선 통신부(110)는, 방송 수신 모듈(111), 이동통신 모듈(112), 무선 인터넷 모듈(113), 근거리 통신 모듈(114), 위치정보 모듈(115) 중 적어도 하나를 포함할 수 있다.
입력부(120)는, 영상 신호 입력을 위한 카메라(121) 또는 영상 입력부, 오디오 신호 입력을 위한 마이크로폰(microphone, 122), 또는 오디오 입력부, 사용자로부터 정보를 입력받기 위한 사용자 입력부(123, 예를 들어, 터치키(touch key), 푸시키(mechanical key) 등)를 포함할 수 있다. 입력부(120)에서 수집한 음성 데이터나 이미지 데이터는 분석되어 사용자의 제어명령으로 처리될 수 있다.
센싱부(140)는 전자 기기 내 정보, 전자 기기를 둘러싼 주변 환경 정보 및 사용자 정보 중 적어도 하나를 센싱하기 위한 하나 이상의 센서를 포함할 수 있다. 예를 들어, 센싱부(140)는 근접센서(141, proximity sensor), 조도 센서(142, illumination sensor), 터치 센서(touch sensor), 가속도 센서(acceleration sensor), 자기 센서(magnetic sensor), 중력 센서(G-sensor), 자이로스코프 센서(gyroscope sensor), 모션 센서(motion sensor), RGB 센서, 적외선 센서(IR 센서: infrared sensor), 지문인식 센서(finger scan sensor), 초음파 센서(ultrasonic sensor), 광 센서(optical sensor, 예를 들어, 카메라(121 참조)), 마이크로폰(microphone, 122 참조), 배터리 게이지(battery gauge), 환경 센서(예를 들어, 기압계, 토양습도계, 온도계, 방사능 감지 센서, 열 감지 센서, 가스 감지 센서 등), 화학 센서(예를 들어, 전자 코, 헬스케어 센서, 생체 인식 센서 등) 중 적어도 하나를 포함할 수 있다. 한편, 본 명세서에 개시된 전자 기기는, 이러한 센서들 중 적어도 둘 이상의 센서에서 센싱되는 정보들을 조합하여 활용할 수 있다.
출력부(150)는 시각, 청각 또는 촉각 등과 관련된 출력을 발생시키기 위한 것으로, 디스플레이부(151), 음향 출력부(152), 햅팁 모듈(153), 광 출력부(154) 중 적어도 하나를 포함할 수 있다. 디스플레이부(151)는 터치 센서와 상호 레이어 구조를 이루거나 일체형으로 형성됨으로써, 터치 스크린을 구현할 수 있다. 이러한 터치 스크린은, 전자 기기(100)와 사용자 사이의 입력 인터페이스를 제공하는 사용자 입력부(123)로써 기능함과 동시에, 전자 기기(100)와 사용자 사이의 출력 인터페이스를 제공할 수 있다.
인터페이스부(160)는 전자 기기(100)에 연결되는 다양한 종류의 외부 기기와의 통로 역할을 수행한다. 이러한 인터페이스부(160)는, 유/무선 헤드셋 포트(port), 외부 충전기 포트(port), 유/무선 데이터 포트(port), 메모리 카드(memory card) 포트, 식별 모듈이 구비된 장치를 연결하는 포트(port), 오디오 I/O(Input/Output) 포트(port), 비디오 I/O(Input/Output) 포트(port), 이어폰 포트(port) 중 적어도 하나를 포함할 수 있다. 전자 기기(100)에서는, 상기 인터페이스부(160)에 외부 기기가 연결되는 것에 대응하여, 연결된 외부 기기와 관련된 적절할 제어를 수행할 수 있다.
또한, 메모리(170)는 전자 기기(100)의 다양한 기능을 지원하는 데이터를 저장한다. 메모리(170)는 전자 기기(100)에서 구동되는 다수의 응용 프로그램(application program 또는 애플리케이션(application)), 전자 기기(100)의 동작을 위한 데이터들, 명령어들을 저장할 수 있다. 이러한 응용 프로그램 중 적어도 일부는, 무선 통신을 통해 외부 서버로부터 다운로드 될 수 있다. 또한 이러한 응용 프로그램 중 적어도 일부는, 전자 기기(100)의 기본적인 기능(예를 들어, 전화 착신, 발신 기능, 메시지 수신, 발신 기능)을 위하여 출고 당시부터 전자 기기(100)상에 존재할 수 있다. 한편, 응용 프로그램은, 메모리(170)에 저장되고, 전자 기기(100) 상에 설치되어, 제어부(180)에 의하여 상기 전자 기기의 동작(또는 기능)을 수행하도록 구동될 수 있다.
제어부(180)는 상기 응용 프로그램과 관련된 동작 외에도, 통상적으로 전자 기기(100)의 전반적인 동작을 제어한다. 제어부(180)는 위에서 살펴본 구성요소들을 통해 입력 또는 출력되는 신호, 데이터, 정보 등을 처리하거나 메모리(170)에 저장된 응용 프로그램을 구동함으로써, 사용자에게 적절한 정보 또는 기능을 제공 또는 처리할 수 있다.
또한, 제어부(180)는 메모리(170)에 저장된 응용 프로그램을 구동하기 위하여, 도 1과 함께 살펴본 구성요소들 중 적어도 일부를 제어할 수 있다. 나아가, 제어부(180)는 상기 응용 프로그램의 구동을 위하여, 전자 기기(100)에 포함된 구성요소들 중 적어도 둘 이상을 서로 조합하여 동작시킬 수 있다.
전원공급부(190)는 제어부(180)의 제어 하에서, 외부의 전원, 내부의 전원을 인가받아 전자 기기(100)에 포함된 각 구성요소들에 전원을 공급한다. 이러한 전원공급부(190)는 배터리를 포함하며, 상기 배터리는 내장형 배터리 또는 교체가능한 형태의 배터리가 될 수 있다.
상기 각 구성요소들 중 적어도 일부는, 이하에서 설명되는 다양한 실시 예들에 따른 전자 기기의 동작, 제어, 또는 제어방법을 구현하기 위하여 서로 협력하여 동작할 수 있다. 또한, 상기 전자 기기의 동작, 제어, 또는 제어방법은 상기 메모리(170)에 저장된 적어도 하나의 응용 프로그램의 구동에 의하여 전자 기기 상에서 구현될 수 있다.
본 명세서에서 서버(또는 클라우드 서버) 또는 클라이언트는 전자기기(100)를 포함할 수 있으며, 전자기기(100)는 단말로 통칭될 수 있다.
단말은 외부 서버(또는 클라우드 서버) 또는 클라이언트와 네트워크로 연결되어 통신할 수 있다.
도 2는 본 명세서와 관련된 서버 또는 클라이언트를 나타내는 도면이다.
본 명세서에서 서버(또는 클라우드 서버) 또는 클라이언트는 제어부(200) 및 통신부(230)를 포함할 수 있다. 제어부(200)는 프로세서(210) 및 메모리(220)를 포함할 수 있다. 프로세서(210)는 메모리(220)에 저장된 명령어들을 수행할 수 있다. 프로세서(210)는 통신부(230)를 제어할 수 있다. 메모리(220)는 캐시(cache) 메모리를 포함할 수 있다.
프로세서(210)는 메모리(220)에 저장된 명령어에 기초하여 서버 또는 클라이언트의 동작을 제어할 수 있다. 서버 또는 클라이언트는 하나의 프로세서를 포함할 수 있고, 복수의 프로세서를 포함할 수 있다. 서버 또는 클라이언트가 복수의 프로세서를 포함하는 경우, 복수의 프로세서 중 적어도 일부는 물리적으로 이격된 거리에 위치할 수 있다. 또한, 서버 또는 클라이언트는 이에 한정되지 않고 알려진 다양한 방식으로 구현될 수 있다.
통신부(230)는, 서버 또는 클라이언트와 무선 통신 시스템 사이, 서버 또는 클라이언트와 다른 서버 또는 클라이언트 사이, 또는 서버 또는 클라이언트와 외부서버(단말) 사이의 무선 통신을 가능하게 하는 하나 이상의 모듈을 포함할 수 있다. 또한, 통신부(210)는, 서버 또는 클라이언트를 하나 이상의 네트워크에 연결하는 하나 이상의 모듈을 포함할 수 있다.
제어부(200)는 메모리(220)에 저장된 응용 프로그램을 구동하기 위하여, 서버 또는 클라이언트의 구성요소들 중 적어도 일부를 제어할 수 있다. 나아가, 제어부(200)는 상기 응용 프로그램의 구동을 위하여, 서버 또는 클라이언트에 포함된 구성요소들 중 적어도 둘 이상을 서로 조합하여 동작 시킬 수 있다.
본 명세서에서 서버는 리버싱 엔진 또는/및 CDR 서비스를 제공하는 CDR 엔진을 포함할 수 있다.
리버싱(Reversing) 엔진
리버싱 엔진이란, 비실행 파일에 대한 리버스 엔지니어링(리버싱) 과정을 자동화 한 분석/진단 엔진이다. 이는 역공학이라고 불리며, 이를 통해 서버는 소스코드가 없는 소프트웨어를 컴퓨터가 실행할 수 있는 언어인 어셈블리단까지 들어가 소프트웨어의 원리 및 구조에 대해 알 수 있다. 이를 이용하여 서버는 일반적인 소프트웨어(예를 들어, msoffice, pdf) 구조, 악성코드 행위, 취약점 악용 방법 등을 알 수 있다.
예를 들어, 리버싱 엔진은 다음의 단계를 수행할 수 있다.
1.파일 분석: 비실행 파일 자체의 외관(예를 들어, 속성, 작성자, 작성 날짜, 파일 타입)을 분석하는 단계로서, 일반 백신 프로그램과 유사하게 비실행 파일 자체의 정보만으로 악성여부를 진단할 수 있다.
2.정적 분석: 비실행 파일 내의 데이터를 추출, 분석해서 정상, 악성 여부를 판별하는 단계로서, 비실행 파일은 실행하지 않고 파일 구조에 맞게 내부 데이터를 추출하여 비교 분석하여 악성여부를 진단할 수 있다. 이는 매크로, URL 추출 분석 등에 적합할 수 있다.
3.동적 분석: 비실행 파일을 실행하고 모니터링하면서 행위를 분석하여 악성 여부를 판별하는 단계로서, 매크로, 하이퍼링크, DDE 등 정상기능을 이용한 악성 행위를 탐지하기에 용이하다.
4.디버깅 분석: 비실행 파일을 실행하고 디버깅하여 취약점, 익스플로잇 등을 분석하는 단계로서, 매크로, 하이퍼링크, DDE를 포함하여 문서 내 본문, 표, 폰트, 그림 등을 이용한 응용프로그램의 취약점을 탐지하기에 적합하다.
리버싱 엔진은 디버깅 분석에 사용될 수 있는 디버깅 엔진을 포함할 수 있다. 디버깅 엔진은 비실행 파일의 열람 과정을 디버깅 모드를 이용하여 문서 입력, 처리, 출력단계에서 발생하는 취약점을 진단할 수 있다. 여기서 취약점이란, 응용프로그램이 응용프로그램의 개발자가 개발한 코드(로직)에서 예상하지 못한 값을 입력 받았을 때, 발생하는 오류, 버그 등을 이용하는 것으로서, 공격자는 취약점을 통해 비정상 종료로 인한 서비스 거부, 원격 코드 실행 등의 악성 문서 행위를 실행할 수 있다.
디버깅 엔진은 디버거를 포함할 수 있다. 디버거는 리버스 엔지니어링을 하기 위한 도구로 다른 대상 프로그램을 어셈블리 레벨에서 Break Point를 할 수 있는 프로그램, 프로세스를 의미할 수 있다.
CDR 엔진(Contents Disarm and Reconstruction engine)
CDR 엔진은 CDR 서비스를 제공한다. CDR 서비스는 비실행 파일을 분해해 악성 파일 또는 불필요한 파일을 제거하고, 콘텐츠는 원본과 최대한 동일하게 하여, 새로운 파일을 만드는 솔루션이다.
즉, CDR은 문서 내의 콘텐츠를 무해화(Disarm, 無害化)하고, 재조합(Reconstruction)하여 안전한 문서를 만들어 고객에게 제공하는 서비스를 의미한다. 여기서, 무해화 대상 파일은 비실행 파일 일체일 수 있다. 비실행 파일로는 워드 파일, 엑셀 파일, 파워포인트 파일, 한글 파일, PDF 파일을 예로 들 수 있다. 무해화 대상 콘텐츠는 액티브 콘텐츠일 수 있다. 액티브 콘텐츠로는 매크로, 하이퍼링크, 객체연결삽입(Object Linking and Embedding, OLE)을 예로 들 수 있다.
도 3은 본 명세서에 적용될 수 있는 비정상 입력의 예시이다.
도 3을 참조하면, 응용프로그램은 비실행 파일을 통해, 비정상적인 값(예를 들어, 입력값이 정상범위인 2를 초과하는 경우)을 입력 받는 경우, 개발자가 의도하지 않은 실행흐름으로 변경되어 취약점이 동작될 수 있다. 디버깅 엔진은 문서 열람 과정을 자동 디버깅하여 취약점과 관련된 특정 지점에 브레이크 포인트를 설정하고 입력값과 관련된 특정값을 확인하여 입력값이 취약점을 일으키는 값인지 아닌지 판별하여 악성 여부를 진단할 수 있다.
보다 자세하게, 디버깅 엔진은 비실행 파일을 확인하고 이를 열람하기 위한 응용프로그램을 실행하여 디버깅을 시작할 수 있다. 비실행 파일을 열람하는 과정에서 문서 행위와 관련된 모듈이 로드 되면, 디버깅 엔진은 해당 모듈이 분석 대상 모듈인지 확인하고, 분석 대상이라면 지정된 주소에 브레이크 포인트를 설정할 수 있다.
예를 들어, 악성 비실행 파일은 응용프로그램의 버전이나 운영체제 환경 등의 특정 조건이 만족하지 않으면 응용프로그램을 종료하거나 아무런 악성 행위가 발생하지 않는 흐름으로 분기하는 분기 지점들을 가질 수 있다. 서버는 사전에 분석가에 의해 분석되어 이러한 가능성을 가지는 분기 지점에 브레이크 포인트를 설정할 수 있다.
또한, 서버는 해당 분기 지점과 연관되어, 응용프로그램을 종료하지 않고 계속 실행하거나 악성 행위가 발생할 수 있는 흐름으로 유도할 수 있는 조건들을 설정할 수 있다.
응용프로그램의 프로세스 실행 중 해당 브레이크 포인트 지점에서 프로세스가 멈춘 경우, 서버는 탐지 로직에 따라 취약점 여부를 탐지한 후, 결과를 분석 리포트에 저장하는 단계를 수행할 수 있다.
서버에 포함된 자동화 리버싱 엔진은 전술한 단계들을 자동으로 수행하면서 분석하여 분석가가 연구, 개발한 진단 알고리즘을 통해, 악성 비실행 파일을 진단하고 차단할 수 있다.
도 4는 본 명세서가 적용될 수 있는 서버의 일 실시예이다.
도 4를 참조하면, 서버는 비실행 파일 및 비실행 파일을 실행시키기 위한 응용프로그램(예를 들어, MSOFFICE, 한컴오피스 등)을 포함할 수 있다. 예를 들어, 비실행 파일은 난독화된 자바스크립트를 포함할 수 있다.
난독화는 실행 가능한 코드 또는 스크립트를 이해하기 어렵게 만들어 많은 분석 리소스를 소모하게 만드는 기술이다. 예를 들어, 윈도우에서 계산기 실행시키는 명령어 “cmd.exe /c calc”을 탐지하기 위한 룰은 문자열 안에 cmd 와 calc가 있으면 탐지하도록 설정될 수 있다. 이러한 탐지 룰은 난독화된 명령어가 ”C^m^D^%2E^E^x^e^%20^/^c^%20^C^a^L^C”인 경우, 탐지할 수 없다.
이러한 문제를 해결하기 위해, 본 명세서에서 서버는 악성코드 분석을 위해 격리된 가상환경(Virtual Machine)을 생성하여, 난독화된 자바스크립트를 탐지할 수 있다. 예를 들어, 가상환경은 윈도우 운영체제를 포함할 수 있다.
서버는 디버깅(debugging) 모드로 비실행 파일과 관련된 응용프로그램의 프로세스를 실행한다(S4010). 예를 들어, 서버는 CreateProcess API를 이용하여 디버깅 모드(DEBUG_ONLY_THIS_PROCESS)로 응용프로그램의 분석 대상 비실행 파일을 열기 위한 프로세스를 실행할 수 있다. 이를 통해, 서버는 응용프로그램 프로세스의 디버그 이벤트를 수신 받을 수 있다.
보다 자세하게, 서버는 CreateProcess API를 이용하여 응용프로그램 프로세스를 “DEBUG_ONLY_THIS_PROCESS” 플래그를 줘서 실행할 수 있다.
서버는 응용프로그램의 프로세스에 근거하여, 비실행 파일에 포함된 자바스크립트를 탐지한다(S4020). 예를 들어, 서버는 메모리에 적재된 응용프로그램의 프로세스에 근거하여, (난독화된) 자바스크립트를 탐지할 수 있다. 보다 자세하게, 서버는 응용프로그램의 프로세스가 실행하는 프로그램의 확장자가 JS인 경우, 자바스크립트를 탐지할 수 있다.
서버는 자바스크립트를 실행하고, 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅한다(S4030). 예를 들어, 서버는 확장자가 JS인 파일을 실행하여 스크립트 실행 호스트 프로세스인 Wscript.exe를 디버깅할 수 있다. Wscript.exe는 윈도우 운영체제에서 자바스크립트(예를 들어, Javascript, VBScript 등)를 실행할 수 있도록 자바스크립트 실행 호스트 역할을 수행하는 프로세스이다.
서버는 호스트 프로세스에 근거하여, 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단한다(S4040). 예를 들어, 서버는 Wscript.exe 프로세스 안에 자바스크립트 실행 엔진인 Jscript.dll이 로드되는지를 확인할 수 있다. 보다 자세하게, 서버는 Wscript.exe을 통해, 자바스크립트를 실행하면 jscript.dll이 로드되고, Vbscript를 실행하면 Vbscript.dll이 로드되며, 이를 통해, 각 스크립트 엔진이 로드되고 자바스크립트는 실행될 수 있다.
서버는 라이브러리가 로드된 것에 근거하여, 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정한다(S4050). 예를 들어, 서버는 Jscript.dll 내의 ScrFncObj::CALL 함수의 주소(오프셋)에 브레이크 포인트를 설정할 수 있다. 이를 위해, 서버는 자바스크립트를 실행하기 위해 참조되는 함수의 주소가 설정되어 있을 수 있다.
서버는 브레이크 포인트의 지점이 실행된 것에 근거하여, 자바스크립트의 원문을 추출한다(S4060). 예를 들어, 서버는 호스트 프로세스가 브레이크 포인트의 지점을 지날 때 정의된 데이터 추출 정책 (예를 들어, EBX 레지스터(Extended Base address Register)가 가리키는 메모리에서 스크립트 원문 추출)으로 난독화가 해제된 자바스크립트의 원문을 추출할 수 있다. 보다 자세하게, 데이터 추출 정책에 근거하여, 서버는 EBX-1 번지(EBX 레지스터에서 4를 뺀 주소)에 있는 “원문 스크립트 크기”를 확보하고, EBX 레지스터가 가리키는 메모리 주소에서 앞서 확보한 “원문 스크립트 크기” 만큼 원문 자바스크립트를 추출하여 저장할 수 있다.
서버는 자바스크립트의 원문에 대해서 정적 검사를 수행한다(S4070).
본 명세서에서 서버는 추출된 원문에 대해 정적 검사를 수행하므로, 난독화된 자바스크립트에 대한 정적 검사보다 탐지율을 높일 수 있고, 동적 검사 우회 기술이 실행되기 전에 원문을 확보하여 탐지율을 높일 수 있다.
도 5는 본 명세서가 적용될 수 있는 복호화된 자바스크립트의 원문의 예시이다.
도 5를 참조하면, 서버는 난독화된 자바스크립트를 복호화하여, 자바스크립트의 원문을 추출할 수 있다.
예를 들어, 서버가 설정한 브레이크 포인트의 오프셋은 0x75C58276 번지(5020)로 이는 ScrFncObj::CALL 함수의 실행 지점일 수 있다. 이를 위해, 서버는 분석가가 사전에 분석한 브레이크 포인트의 오프셋이 설정되어 있을 수 있다. 서버는 디버깅엔진에서 디버깅을 시작할 때 Jscript.dll이 로드되었다면, 설정된 오프셋 값을 불러와 브레이크 포인트를 설정할 수 있다. 또한, ScrFncObj::CALL 함수의 주소는 Jscript.dll의 버전에 따라 달라질 수 있어 분석가에 의한 사전 분석에 따라 다르게 설정될 수 있고, 업데이트 될 수 있다.
서버는 EBX 레지스터 주소(5010)에서 4를 뺀 번지(예를 들어, 0x03F9004C - 4 = 0x03F90048 )에 저장된 “원문 스크립트 크기” (0xD716)를 확인할 수 있다. 서버는 EBX 레지스터(0x03F9004C(5010))가 가리키는 메모리에서 앞서 확인한 크기만큼의 데이터를 추출하여 자바스크립트의 원문을 확보할 수 있고, 확보된 자바 스크립트 원문을 파일로 저장하여, 이를 탐지 정책(예를 들어, 시그니처)과 비교하여 악성 여부를 탐지할 수 있다.
전술한 본 명세서는, 프로그램이 기록된 매체에 컴퓨터가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 매체는, 컴퓨터 시스템에 의하여 읽혀 질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 컴퓨터가 읽을 수 있는 매체의 예로는, HDD(Hard Disk Drive), SSD(Solid State Disk), SDD(Silicon Disk Drive), ROM, RAM, CD-ROM, 자기 테이프, 플로피 디스크, 광 데이터 저장 장치 등이 있으며, 또한 캐리어 웨이브(예를 들어, 인터넷을 통한 전송)의 형태로 구현되는 것도 포함한다. 따라서, 상기의 상세한 설명은 모든 면에서 제한적으로 해석되어서는 아니되고 예시적인 것으로 고려되어야 한다. 본 명세서의 범위는 첨부된 청구항의 합리적 해석에 의해 결정되어야 하고, 본 명세서의 등가적 범위 내에서의 모든 변경은 본 명세서의 범위에 포함된다.
또한, 이상에서 서비스 및 실시 예들을 중심으로 설명하였으나 이는 단지 예시일 뿐 본 명세서를 한정하는 것이 아니며, 본 명세서가 속하는 분야의 통상의 지식을 가진 자라면 본 서비스 및 실시 예의 본질적인 특성을 벗어나지 않는 범위에서 이상에 예시되지 않은 여러 가지의 변형과 응용이 가능함을 알 수 있을 것이다. 예를 들어, 실시 예들에 구체적으로 나타난 각 구성 요소는 변형하여 실시할 수 있는 것이다. 그리고 이러한 변형과 응용에 관계된 차이점들은 첨부한 청구 범위에서 규정하는 본 명세서의 범위에 포함되는 것으로 해석되어야 할 것이다.

Claims (9)

  1. 서버가 자바스크립트를 탐지하는 방법에 있어서,
    비실행 파일과 관련된 응용프로그램의 프로세스를 실행하는 단계;
    상기 응용프로그램의 프로세스에 근거하여, 상기 비실행 파일에 포함된 자바스크립트를 탐지하는 단계;
    상기 자바스크립트를 실행하고, 상기 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅하는 단계;
    상기 호스트 프로세스에 근거하여, 상기 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단하는 단계;
    상기 라이브러리가 로드된 것에 근거하여, 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정하는 단계; 및
    상기 브레이크 포인트의 지점이 실행된 것에 근거하여, 상기 자바스크립트의 원문을 추출하는 단계;
    를 포함하며,
    상기 자바스크립트는 난독화된 자바스크립트인, 탐지방법.
  2. 제1항에 있어서,
    상기 자바스크립트의 원문을 추출하는 단계는
    레지스터에 설정된 데이터 추출 정책에 근거하는, 탐지방법.
  3. 제2항에 있어서,
    상기 호스트 프로세스는
    Wscript.exe를 포함하는, 탐지방법.
  4. 제2항에 있어서,
    상기 브레이크 포인트(break point)를 설정하는 단계는
    상기 호스트 프로세스에 상기 라이브러리가 로드되는 것에 근거하는, 탐지방법.
  5. 제4항에 있어서,
    상기 라이브러리는
    Jscript.dll을 포함하는, 탐지방법.
  6. 제4항에 있어서,
    상기 브레이크 포인트는
    상기 라이브러리 내의 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 설정되는, 탐지방법.
  7. 제6항에 있어서,
    상기 자바스크립트를 실행하기 위해 참조되는 함수는
    ScrFncObj::CALL 함수를 포함하는, 탐지방법.
  8. 제6항에 있어서,
    상기 자바스크립트의 원문에 대해 정적 검사를 수행하는 단계;
    를 더 포함하는, 탐지방법.
  9. 자바스크립트를 탐지하기 위한 서버에 있어서,
    통신부;
    메모리; 및
    상기 통신부 및 상기 메모리를 기능적으로 제어하는 프로세서;를 포함하고,
    상기 프로세서는
    비실행 파일과 관련된 응용프로그램의 프로세스를 실행하고, 상기 응용프로그램의 프로세스에 근거하여, 상기 비실행 파일에 포함된 자바스크립트를 탐지하며, 상기 자바스크립트를 실행하고, 상기 자바스크립트를 실행하기 위한 호스트(host) 프로세스를 디버깅하고, 상기 호스트 프로세스에 근거하여, 상기 자바스크립트를 실행하기 위한 라이브러리(library)가 로드(load)되는 지를 판단하며, 상기 라이브러리가 로드된 것에 근거하여, 상기 자바스크립트를 실행하기 위해 참조되는 함수의 주소에 브레이크 포인트(break point)를 설정하고, 상기 브레이크 포인트의 지점이 실행된 것에 근거하여, 상기 자바스크립트의 원문을 추출하며, 상기 자바스크립트는 난독화된 자바스크립트인, 서버.
PCT/KR2022/014433 2022-09-27 2022-09-27 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치 WO2024071461A1 (ko)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/KR2022/014433 WO2024071461A1 (ko) 2022-09-27 2022-09-27 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치
KR1020227033623A KR102494837B1 (ko) 2022-09-27 2022-09-27 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/KR2022/014433 WO2024071461A1 (ko) 2022-09-27 2022-09-27 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치

Publications (1)

Publication Number Publication Date
WO2024071461A1 true WO2024071461A1 (ko) 2024-04-04

Family

ID=85225379

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2022/014433 WO2024071461A1 (ko) 2022-09-27 2022-09-27 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치

Country Status (2)

Country Link
KR (1) KR102494837B1 (ko)
WO (1) WO2024071461A1 (ko)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110289582A1 (en) * 2009-08-03 2011-11-24 Barracuda Networks, Inc. Method for detecting malicious javascript
KR20120070018A (ko) * 2010-12-21 2012-06-29 한국인터넷진흥원 후킹 기법을 이용한 난독화 자바 스크립트 자동해독 및 악성 웹 사이트 탐지 방법
KR20160081584A (ko) * 2014-12-31 2016-07-08 주식회사 시큐아이 익스플로잇 탐지 방법 및 장치
KR101646096B1 (ko) * 2016-01-21 2016-08-05 시큐레터 주식회사 메모리 분석을 통한 비실행 파일의 악성 여부 검사 방법 및 장치

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110289582A1 (en) * 2009-08-03 2011-11-24 Barracuda Networks, Inc. Method for detecting malicious javascript
KR20120070018A (ko) * 2010-12-21 2012-06-29 한국인터넷진흥원 후킹 기법을 이용한 난독화 자바 스크립트 자동해독 및 악성 웹 사이트 탐지 방법
KR20160081584A (ko) * 2014-12-31 2016-07-08 주식회사 시큐아이 익스플로잇 탐지 방법 및 장치
KR101646096B1 (ko) * 2016-01-21 2016-08-05 시큐레터 주식회사 메모리 분석을 통한 비실행 파일의 악성 여부 검사 방법 및 장치

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
AHEMT BALCI: "Malware Reverse Engineering Handbook", NATO CCDCOE, 1 July 2020 (2020-07-01), XP093151966, Retrieved from the Internet <URL:https://ccdcoe.org/uploads/2020/07/Malware_Reverse_Engineering_Handbook.pdf> *

Also Published As

Publication number Publication date
KR102494837B1 (ko) 2023-02-06

Similar Documents

Publication Publication Date Title
EP3506139B1 (en) Malware detection in event loops
US9383934B1 (en) Bare-metal computer security appliance
Carmony et al. Extract Me If You Can: Abusing PDF Parsers in Malware Detectors.
US7665138B2 (en) Detecting method and architecture thereof for malicious codes
WO2013168913A1 (ko) 비실행 파일 검사 장치 및 방법
JP4938576B2 (ja) 情報収集システムおよび情報収集方法
WO2013168951A1 (ko) 악성 파일 검사 장치 및 방법
CN107408176A (zh) 恶意对象的执行剖析检测
WO2023229063A1 (ko) 무해화(disarming) 동작에서 차이점(delta) 추출 방식을 이용한 원본 파일 백업 공간을 효율화하는 방법 및 이를 위한 장치
US20190114421A1 (en) Just in time memory analysis for malware detection
US10645099B1 (en) Malware detection facilitated by copying a memory range from an emulator for analysis and signature generation
Botacin et al. The other guys: automated analysis of marginalized malware
WO2014042344A1 (ko) 디버그 이벤트를 이용한 악성 쉘 코드 탐지 장치 및 방법
WO2023229066A1 (ko) 리버싱 엔진 기반의 문서 행위를 판단하기 위한 방법 및 이를 위한 장치
WO2018194196A1 (ko) Elf 파일의 난독화 적용 여부의 탐지 및 보안성 평가를 위한 방법 및 시스템
Ying et al. Cjspector: A novel cryptojacking detection method using hardware trace and deep learning
US8707433B1 (en) Fake exception handler detection
WO2014077614A1 (en) Anti-malware system, method of processing data in the same, and computing device
WO2011002146A2 (ko) 악성코드 탐지시스템 및 방법
WO2014168406A1 (ko) 메모리 보호기능 우회 공격 진단 장치 및 방법
WO2023229065A1 (ko) 리버싱 엔진과 cdr 엔진을 활용한 악성 비실행 파일 차단 방법 및 장치
WO2024071461A1 (ko) 난독화 된 자바스크립트를 탐지하고 복호화하기 위한 방법 및 이를 위한 장치
WO2024063171A1 (ko) 자식 프로세스의 악성 행위를 검사하기 위한 방법 및 이를 위한 장치
WO2016190485A1 (ko) 데이터 무단 엑세스 차단 방법 및 그 기능이 구비된 컴퓨팅 장치
WO2024071451A1 (ko) Ocr 기술을 이용하여 비실행 파일의 악성 매크로를 탐지하기 위한 방법 및 이를 위한 장치

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: 22961064

Country of ref document: EP

Kind code of ref document: A1