> For the complete documentation index, see [llms.txt](https://bob-mcd-team.gitbook.io/uefi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bob-mcd-team.gitbook.io/uefi/uefi-security/4.static-analysis.md).

# 4. 정적 분석 방법

여기서는 UEFI의 분석 방법에 대해서 설명한다. 일반적으로 분석 방법에는 크게 정적, 동적 분석 방법이 있고 UEFI에도 그대로 해당된다. 먼저 정적 분석 방법과 관련 툴에 대해 설명해보겠다.

먼저 정적 분석이란 소스 코드의 실행 없이 정적으로 프로그램의 버그를 찾는 분석 방법으로 동적 분석과는 분석 시점에서 큰 차이가 있다고 볼 수 있다. UEFI의 취약점을 정적 분석으로 찾기 위해서는 이미 알려진 취약점 유형을 숙지하고 있거나 UEFI Spec을 공부하여 새로운 취약점 유형을 찾는 노력이 필요하다.

다음으로 프로젝트를 진행하며 사용한 분석 툴에 대해 설명해 보겠다.

### [UEFITool](https://github.com/LongSoft/UEFITool)

UEFITool은 UEFI 펌웨어 이미지를 트리 구조로 파싱하여 이미지를 분석할 수 있는 GUI도구이다.

이미지를 덤프하여 넣는 것은 상관 없지만 공급업체별 펌웨어 업데이트 파일을 넣었을 때는 잘못 열리거나 전혀 열리지 않을 수도 있다. (예: 암호화된 HP업데이트 파일, Dell HDR 및 EXE파일 등)

<figure><img src="/files/Y0nh40fKjiWdlMF1kTd6" alt=""><figcaption></figcaption></figure>

위 사진은 덤프된 펌웨어 이미지를 넣었을 때 섹션별로 분석해주는 UEFITool의 모습이다.

UEFI의 구조를 분석하거나 원하는 모듈을 추출하고 싶을 때 유용한 분석 도구이다.

GUID 검색 기능도 있어서 GUID를 통해 검색 가능하다.

### [efiXplorer](https://github.com/binarly-io/efiXplorer)

먼저, Binarly.io에서 만든 IDA Pro용 플러그인인 efiXplorer가 제일 유명한 분석 툴이다.

이 플러그인의 제일 큰 기능은 Boot Service, Runtime Service, SMM Service, PEI Service, Protocol, GUID등을 자동으로 인식하고 수도 코드에 적용시켜 주는 것이다.

적용된 예시를 한 번 보자. 먼저 적용이 안된 모습이다.

<figure><img src="/files/K3JMtYrT3iMyPYJ8mZZY" alt=""><figcaption></figcaption></figure>

대충 봐도 분석이 힘들 것 같은 수도 코드가 나오는 것을 볼 수 있다.

하지만, efiXplorer를 적용시켜 준다면,

<figure><img src="/files/OCzJnZ5n56yLH6y6Qfp3" alt=""><figcaption></figcaption></figure>

다음과 같은 GUID, 서비스, 프로토콜등이 해석되어 디컴파일되는 모습을 확인 할 수 있다.

또한 efiXplorer에는 잘 알려진 취약점 패턴을 찾아주는 기능이 존재한다.

<figure><img src="/files/IPDzAVj3d4Szi5H1ypqr" alt=""><figcaption></figcaption></figure>

하지만 오탐일 확률도 높으니 무조건 맹신하지 말고 직접 확인하고 검증하는 과정이 필요하다.

### [Brick](https://github.com/assafcarlsbad/brick)

다음은 Sentinel-One에서 만든 Brick이라는 정적 분석 툴이다. 이 툴은 방금 소개한 efiXplorer을 기반으로 하는 툴로 이 툴은 UEFI를 분석하는 툴보다는 정적 취약점 스캐너의 일종이다.

이 툴은 잘 알려진 SMM취약점을 가지고 있는 SMM모듈을 대상으로 스캐닝을 하며 이 과정에서 efiXplorer가 사용된다. 툴을 실행하면 UEFI이미지에서 SMM모듈을 각각 IDA Python스크립트를 통해 분석을 하고 결과를 html파일로 출력해준다.

<figure><img src="/files/Ua1Q3O4JMs0P6cf4h6Ll" alt=""><figcaption><p><a href="https://github.com/assafcarlsbad/brick">https://github.com/assafcarlsbad/brick</a></p></figcaption></figure>

<figure><img src="/files/nb8C0vvKLyNjV9STosG7" alt=""><figcaption><p><a href="https://github.com/assafcarlsbad/brick">https://github.com/assafcarlsbad/brick</a></p></figcaption></figure>

또한 위의 efiXplorer에서 탐지하는 취약점도 같이 보여준다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bob-mcd-team.gitbook.io/uefi/uefi-security/4.static-analysis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
