
IATelligence is a Python script that will extract the IAT of a PE file and request GPT to get more information about the API and the ATT&CK matrix related
IATelligence는 PE 파일에서 Import Address Table(IAT)을 추출하고 OpenAI의 GPT-3 모델을 사용하여 파일이 가져온 각 Windows API에 대한 세부 정보를 제공하는 Python 스크립트입니다. 이 스크립트는 또한 관련 MITRE ATT&CK 기술을 검색하고 해당 API가 공격자에 의해 어떻게 사용될 수 있는지 설명합니다.
또한 파일의 해시를 표시하고 GPT-3 요청 비용을 추정합니다. IATelligence는 GPT-3를 악성코드 분석에 사용하고 IAT를 기반으로 악성코드의 동작을 빠르게 평가하기 위한 개념 증명입니다.
아래는 얻을 수 있는 결과의 빠른 예시입니다. IAT의 크기에 따라 요청 시간이 더 오래 걸릴 수 있습니다.

이 도구를 실행하려면 OpenAI API에 액세스해야 하며, 그런 다음 스크립트를 수정하여 자신의 API를 추가해야 합니다.
# Authenticate with the OpenAI API
openai.api_key = ""
또한 요구 사항(requirements)을 설치해야 합니다.
pip install -r requirements.txt
도구를 실행하려면 스크립트 인수로 PE 파일을 지정하기만 하면 됩니다.
python iatelligence.py sample.exe
스크립트는 요청의 예상 비용뿐만 아니라 해시도 계산합니다.
[+] IAT Request from the file: .\sample.exe
[+] 33 functions will be requested to GPT!
[+] MD5: 2f82623f9523c0d167862cad0eff6806
[+] SHA1: 5d77804b87735e66d7d1e263c31c4ef010f16153
[+] SHA256: 9c2c8a8588fe6db09c09337e78437cb056cd557db1bcf5240112cbfb7b600efb
[+] Imphash: 8eeaa9499666119d13b3f44ecd77a729
[!] Estimated cost of requests: $0.0693
결과는 표로 확인할 수 있습니다. 아래는 일부 발췌한 내용입니다.
+------------------------------------------+-----------------------------+------------------------------------------+
| Libraries | API | GPT Verdict |
+------------------------------------------+-----------------------------+------------------------------------------+
| SHELL32.dll | ShellExecuteW | The purpose of this API, ShellExecuteW, |
| | | is to launch an application or open a |
| | | file in the Windows operating system. It |
| | | is associated with MITRE ATT&CK |
| | | technique T1218 - Execution Through |
| | | Module Load. This technique involves |
| | | using shell32.dll to execute malicious |
| | | code without directly invoking the |
| | | executable file itself, which can help |
| | | attackers evade detection and gain |
| | | access to systems. |
| | | |
| KERNEL32.dll | GetCurrentThreadId | The purpose of this API is to retrieve |
| | | the identifier of the calling thread. It |
| | | is associated with MITRE ATT&CK |
| | | technique T1155 - Thread Execution, |
| | | which involves creating and running |
| | | threads within a process or code |
| | | injection into an existing thread. The |
| | | GetCurrentThreadId() function allows |
| | | attackers to identify and target |
| | | specific threads for malicious |
| | | activities. |
| | | |
| KERNEL32.dll | GetSystemTimeAsFileTime | The purpose of this API is to retrieve |
| | | the current system time as a file time |
| | | format. It is associated with the MITRE |
| | | ATT&CK technique T1124 - System Time |
| | | Discovery, which is used by adversaries |
| | | to gain insight into when certain |
| | | activities occurred or are scheduled to |
| | | occur. This allows them to perform |
| | | timing-based attacks and evade |
| | | detection. |
| | | |
| KERNEL32.dll | GetTickCount | The purpose of this API is to retrieve |
| | | the number of milliseconds since Windows |
| | | was started. It is associated with MITRE |
| | | ATT&CK technique T1082 - System Time |
| | | Discovery, which involves an adversary |
| | | querying system information to gain |
| | | insight into file and system times or to |
| | | determine valid accounts. This can be |
| | | used for various malicious activities |
| | | such as enumeration, credential dumping, |
| | | and lateral movement. |
| | | |
| KERNEL32.dll | RtlCaptureContext | The purpose of this API is to capture |
| | | the Context Record of a thread in order |
| | | to provide information about its state. |
| | | This can be used for debugging, logging |
| | | or other purposes. The associated MITRE |
| | | ATT&CK technique is T1113 - Process |
| | | Injection, as this API can be used to |
| | | inject code into a running process. |
| | | |
| KERNEL32.dll | GetCurrentProcessId | The purpose of this API is to retrieve |
| | | the current process identifier (PID) for |
| | | a process running on Windows. This can |
| | | be used to identify which processes are |
| | | currently active and running on a |
| | | system. It is associated with MITRE |
| | | ATT&CK technique T1057 - Process |
| | | Discovery, as it allows an adversary to |
| | | gain knowledge about the processes that |
| | | are running on a system. |
| | | |
| KERNEL32.dll | RtlVirtualUnwind | The purpose of this API is to provide an |
| | | unwinding mechanism that can be used to |
| | | traverse the stack frames of a program. |
| | | It is associated with the MITRE ATT&CK |
| | | technique called "Stack Walking" |
| | | (T1063). This technique involves using |
| | | APIs like RtlVirtualUnwind() to walk |
| | | through the stack frames, which can help |
| | | attackers gain access to sensitive |
| | | information or bypass security controls. |
| | | |
| KERNEL32.dll | UnhandledExceptionFilter | The purpose of this API is to provide an |
| | | exception handler for unhandled |
| | | exceptions in the Windows operating |
| | | system. It is associated with the MITRE |
| | | ATT&CK technique T1136 - Create or |
| | | Modify System Process, as it allows a |
| | | program to be able to handle unexpected |
| | | events that may occur during its |
| | | execution. |
OpenAI의 GPT-3를 사용하여 PE 파일에서 가져온 Windows API를 분석하는 비용은 IAT의 크기에 따라 달라질 수 있습니다. 개별 요청 비용은 비싸지 않지만, 더 큰 파일의 경우 총 비용이 빠르게 누적될 수 있습니다. 스크립트가 제공하는 예상 비용은 근사치이며 달라질 수 있습니다.
스크립트의 설계상 분석이 API 하나씩 수행되므로 프로세스가 느려질 수 있습니다. 분석 진행 상황을 표시하기 위해 진행률 표시줄이 표시됩니다.
GPT-3는 언어 모델이므로 결과가 항상 정확하지 않을 수 있다는 점을 유의해야 합니다. 또한 스크립트는 관련 MITRE ATT&CK 기술에 대한 세부 정보를 맥락 없이 제공하므로, 악성코드 분석가가 해당 정보를 신중하게 검토해야 합니다.
Twitter: @fr0gger_