Module 18 · Malware Analysis · Lesson 53 of 75

Static analysis: hashes, strings and the PE file

Learn what a file can tell you before you run it: its hashes, readable strings, Windows PE headers, imported functions and signs of packing.

In this lesson · about 40 minutes

  • Fingerprint a sample with hashes and look it up safely
  • Pull strings and spot URLs, commands and suspicious API calls
  • Read PE headers, imports, sections and entropy to detect packing

1. Fingerprint it

Compute MD5, SHA-1 and SHA-256 and search the hash (not the file) on threat-intelligence services such as VirusTotal or MalwareBazaar. A known hash can save hours. Fuzzy hashes (ssdeep, TLSH) and imphash (a hash of the import table) find similar samples even when a single byte has changed.

2. Identify the file type

Do not trust the extension. file and tools such as Detect It Easy read the magic bytes: MZ for Windows executables, 7F 45 4C 46 (ELF) for Linux, PK for zip-based Office files, %PDF for PDFs.

3. Strings

strings (and FLOSS, which also decodes obfuscated strings) shows readable text: URLs, IPs, file paths, registry keys, ransom notes, user agents, error messages and command lines.

4. The PE format (Windows executables)

  • Headers: compile timestamp (can be faked), whether it is an EXE or DLL, 32 or 64 bit.
  • Sections: .text (code), .data, .rdata, .rsrc (resources, sometimes hiding a second payload).
  • Imports: the Windows functions it uses. These are strong clues:
ImportsSuggests
VirtualAllocEx, WriteProcessMemory, CreateRemoteThreadProcess injection
InternetOpenUrl, URLDownloadToFile, WinHttpSendRequestDownloading or talking to a server
RegSetValueEx with a Run key stringPersistence at logon
CryptEncrypt, BCryptEncrypt plus file enumerationPossible ransomware
SetWindowsHookEx, GetAsyncKeyStateKeylogging
IsDebuggerPresentAnti-analysis

5. Packing and obfuscation

Packers compress or encrypt the real code, which only appears in memory at run time. Signs: very few imports (often just LoadLibrary and GetProcAddress), section names such as UPX0, and high entropy (close to 8.0 bits per byte means the data looks random, as compressed or encrypted data does). Some packers, like UPX, can be unpacked with a single command; others need dynamic analysis.

Tools

PEStudio, PE-bear, Detect It Easy, CFF Explorer (Windows); file, strings, pefile (Python), capa (names capabilities like "inject thread") on REMnux.

Hands-on lab (simulated terminal)

Lab: triage a suspicious attachment

You have the file from the phishing email in your REMnux VM, renamed to invoice.bin. Do not run it. Output is simulated.

Step 1 of 5. Type each command and press Enter. Nothing runs on your computer.

Lab: triage a suspicious attachment

1. Compute the file's SHA-256 hash.

analyst@remnux:~/samples$

Check your understanding0 of 4 correct

Question 1

1.Which import trio suggests process injection?

Question 2

2.A section with entropy 7.9 out of 8 most likely holds...

Question 3

3.Why search a hash instead of uploading the file?

Question 4

4.What do the magic bytes MZ mean?

Quiz score: 0 of 4

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.