Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 36 ยท Memory Forensics

Strings and Artifacts in Memory

Learn to extract ASCII and UTF-16 strings from a memory dump, search them with regular expressions for URLs, IP addresses and e-mails, and judge how reliable memory artifacts are.

Structured analysis (process lists, connection tables) needs the right symbols and a healthy image. String searching needs nothing but bytes, which makes it the most robust technique in memory forensics. Even from a damaged or unknown image you can pull out readable text: URLs a browser visited, commands typed into a shell, file paths, chat fragments, e-mail addresses and sometimes passwords. This lesson builds a string extractor and a pattern searcher, then explains how to place a string in context, which is where the real analysis happens.

What the strings tool does

The classic strings utility scans a file and prints every run of at least N printable characters (default 4). Two encodings matter:

  • ASCII / UTF-8: one byte per character.
  • UTF-16LE: two bytes per character with a zero byte between ASCII letters, the native text format on Windows.

A search that covers only ASCII misses most Windows strings, as we saw in bits, bytes and hex. Always extract both.

TEXT
$ strings -a -n 8 mem.raw > ascii.txt
$ strings -a -el -n 8 mem.raw > utf16le.txt

The sample commands show the two passes (-el means 16-bit little-endian). They are not run here, and file names are made up.

Build a string extractor

The stand-in below does the same job over a small made-up memory image that mixes binary noise, ASCII text and UTF-16 text.

Python Extract ASCII and UTF-16 strings

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Each hit carries its offset. Record it: the offset lets you return to the exact location, and tools can map a physical offset back to the process that owned the page.

Searching with patterns

Once you have strings, regular expressions pull out interesting types: IPv4 addresses, URLs, e-mail addresses, Windows paths, long Base64 blobs, registry keys. The next program searches a made-up block of extracted strings.

Python Regex search for indicators

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The IPs shown (203.0.113.x and 198.51.100.x) come from ranges reserved for documentation, so they never point at a real machine, which is why textbooks use them.

A found indicator is a lead. 203.0.113.45 in a browser's memory might be a legitimate visit or a malicious download. You then look it up in network logs, DNS records and threat-intelligence data.

Where strings come from

Context turns a string into evidence. A URL could be:

  • In a browser process's memory: the user (or a script) visited it.
  • In a mail client or an office document: a link that was shown or clicked.
  • In a malware process: a command-and-control address.
  • In free (unallocated) memory: remains of a process that has ended, or just data from a web page cached long ago.
  • In the memory of a security tool: a blocklist entry, which means nothing about this machine.

Tools help: windows.vadyarascan (YARA over a process's address space), windows.strings (Volatility 3 maps each string to the process and virtual address), windows.cmdline, windows.netscan (connections), windows.filescan (file objects), windows.hashdump and windows.registry.* plugins. In Volatility 3 you can supply the string output and have it attribute each hit to a process.

Memory artifacts you can often recover

  • Command history of shells (cmd.exe console buffers, bash history in memory).
  • Browser content: URLs, form data, page text, and in-memory cookies.
  • Network buffers: parts of unencrypted traffic.
  • Clipboard and chat messages.
  • Registry hives loaded in memory, including keys never written to disk.
  • Credentials (hashes, tickets, cached tokens) and encryption keys. Handling them has legal and ethical weight: treat them as sensitive evidence, and only extract them if authorised.

Judging reliability

Memory is messy. Questions to ask about a string:

  1. Which process owned it, and is that process connected to the incident?
  2. Is it in allocated or free memory? Free memory means older, residual data.
  3. Is it consistent with other evidence? Compare with disk, logs and network captures.
  4. Could it be there for an innocent reason? Antivirus signatures, documentation text and cached web pages all contain suspicious strings.
  5. Could it be planted? An attacker may spray decoy strings, so one string alone is never a conclusion.

A scoring helper

Analysts often prioritise hits. The stand-in below counts how often each indicator appears and which "process" owned it, then ranks them, imitating the first look at hundreds of hits.

Python Rank indicator hits by number of owners

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Indicators appearing in an unusual process such as svchost.exe plus an unknown executable (upd.exe) deserve more attention than one that appears only in a browser.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why search a Windows memory image for UTF-16 strings as well as ASCII?

    Windows APIs and structures use UTF-16LE, with a zero byte after each ASCII letter.
  2. 2. Why record the offset of every string hit?

    Offsets make the finding reproducible and allow attribution to a process or memory region.
  3. 3. A URL appears in a memory string. What is it?

    Strings are leads; context decides what they mean.
  4. 4. What are 203.0.113.0/24 and 198.51.100.0/24 used for?

    They are reserved for examples (TEST-NET-3 and TEST-NET-2).

Summary

  • String searching works on any image, even when structured analysis fails.
  • Extract both ASCII and UTF-16LE strings and keep each hit's offset.
  • Regular expressions find IPs, URLs, e-mails, paths and registry keys quickly.
  • A string's value depends on its owner process, whether the memory was free and corroboration elsewhere.
  • Handle recovered credentials and keys as sensitive evidence within your authorisation.

Next: Memory injection indicators