> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/binary-exploitation/malware-analysis/basic-static-malware-analysis.md). Agents can also search and read this documentation through its [MCP server](https://notes.cavementech.com/pentesting-quick-reference/~gitbook/mcp).

# Basic Static Malware Analysis

## 1. Identify File type

The file command in Kali Linux is a utility used to determine the type of a file by examining its content and providing information about its format. It helps identify the file's data type, such as whether it is a text file, an image, an executable binary, or an archive

```
file myfile.txt
```

### Windows Utilities&#x20;

<mark style="color:blue;">**Get the first few hex bytes using following software and then match it to check the file type from the reference sites.**</mark>

Hxd Hex Editor

{% embed url="<https://mh-nexus.de/en/hxd/>" %}

Exeinfo PE

{% embed url="<http://www.exeinfo.byethost18.com/?i=1>" %}
&#x20;
{% endembed %}

PE Studio

{% embed url="<https://www.winitor.com/download>" %}
A very good tool to perform most of the actions
{% endembed %}

CFF explorer

{% embed url="<https://ntcore.com/?page_id=388>" %}

### Reference for identifying file types

{% embed url="<https://www.garykessler.net/library/file_sigs.html>" %}

## 2. Identify File Signature

{% embed url="<https://www.virustotal.com/>" %}

{% embed url="<https://www.hybrid-analysis.com/>" %}

## 3. Obfuscation/ Packing

To hide the code from antiviruses and Analysis

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2F92dGKuSll5qdkleGTaPe%2Fimage.png?alt=media&amp;token=8d774f9c-d6d7-4238-a24a-7f8623778c10" alt=""><figcaption></figcaption></figure>

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2Fgzthjcqb7Ht0ng25fuDs%2Fimage.png?alt=media&amp;token=d582e0ae-6105-4d6a-93ec-4912cb5dbc66" alt=""><figcaption></figcaption></figure>

Entropy is the main indication of packing. It involves mostly measuring bits.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FlE7GKK3rlvJku80FGbPE%2Fimage.png?alt=media&amp;token=89db59b3-b5f2-468b-af67-d5e53d1c9918" alt=""><figcaption><p>measured from 1-8</p></figcaption></figure>

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FXh5ATnVgYri3noCT0XzC%2Fimage.png?alt=media&amp;token=6b15137d-7eca-4194-960e-d912b8159732" alt=""><figcaption></figcaption></figure>

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FOSB6gVmWFeX3CIzoJvpM%2Fimage.png?alt=media&amp;token=4729c8bc-fcb5-48bf-9685-81414ac6c3e9" alt=""><figcaption></figcaption></figure>

## 4. Strings

### Tools

* PE Studio (let you organize by size and hints)
* strings&#x20;

## Other Useful tools

olevba. Analysis Macros in office documents.

{% embed url="<https://github.com/decalage2/oletools/wiki/olevba>" %}

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FW8e1dxcXvNBVzeqjaZDS%2Fimage.png?alt=media&amp;token=877abf76-c572-4e2b-8fcd-692e263fc33d" alt=""><figcaption></figcaption></figure>

## Sandboxes

{% embed url="<https://app.any.run/>" %}
online very good
{% endembed %}
