VeriSigma
Menu

Module 07 of 12

Searching with Lightgrep

Saved, citable searches across every layer of an image, from decoded text down to slack and unallocated clusters. How to read a hit by where it was found, and how to write patterns that don't bury you in noise.

Objectives

What you will be able to do

  1. Create, run and save a formal search over the layers you choose.
  2. Read a hit using its layer, encoding and offset.
  3. Write patterns Lightgrep will accept, and keep false positives down.
  4. Turn a hit into a finding with a citation someone else can rerun.
  5. Compare keyword search over an index with a scan of raw bytes.

Knowledge check

Try this before you read

Pick an answer and write one sentence on why. The explanation appears once you have. Come back to it after the key ideas and see whether your reasoning changed.

A search for a project codename returns one hit, in unallocated space on the desktop image. What can you say?

Show the answer

Answer: The codename's bytes are on the disk; when, by whom and in what file are not yet known

A hit in unallocated space establishes that the bytes are on the disk. That is all. To go further, rebuild the context: what surrounds the bytes, any structure you can recognize, the file they were part of. Ignoring the hit is as much a mistake as reading too much into it.

Key ideas

One idea at a time

  1. A search you can cite

    Typing in the command bar only filters the current view. A formal search is a saved object with a name. It runs over the entire case, its results persist, and a report can cite it. It holds one or more patterns, each a literal or a regular expression with its own case setting, plus the layers to search, a status, and the names of whoever wrote and ran it. Rerun it on unchanged evidence and the same hits come back with the same identities, so findings that cite them remain valid. Edit the patterns or layers and it drops back to draft until it runs again, so the results on screen always belong to the definition beside them.

  2. Six layers

    Half the layers are text VeriSigma has already decoded: file and folder names and paths, extracted document text, and the parsed fields of artifacts and timeline events. Those searches are quick. The other half are byte scans: the contents of allocated files, file slack, and unallocated clusters. Here Lightgrep reads raw bytes and tests every pattern in every encoding you selected, all in one pass. That is how it turns up text in formats nothing has decoded and in clusters that belong to no file.

    The six search layers, and what a hit in each can showDECODED TEXT · FASTNames and pathsExtracted textArtifacts and eventsRAW BYTES · BYTE-LEVEL SCANRaw contentsin the file nowSlackleft by an earlier file in the clusterUnallocatedon the disk at some time, nothing moreweaker hit, more context neededEvery hit records its layer, offset and encoding.
    The six search layers, and what a hit in each can show.
  3. What a hit means depends on where it is

    Each hit records where it was found (layer, evidence item, file if there is one, byte offset), what matched (text and pattern), and the encoding. Look at all of them before deciding what you have. A hit inside a file's contents means the text is part of that file now; work out which part of the file holds it and whether the program that owns the file would display it. In slack, the text belongs to whatever used that cluster before, or to this file before it got smaller, so it is not part of the file as it stands. In unallocated space, a hit shows only that the bytes reached the disk at some point. Who wrote them, when and in what file all need context: neighboring bytes, a structure you recognize, the file they came from.

  4. Search the encoding Windows wrote

    One word can be many byte sequences. Windows keeps most of its own strings as UTF-16LE, where ABC becomes 41 00 42 00 43 00, and a UTF-8 search will miss every one of them. For text produced by Windows or a Windows program, search UTF-8 and UTF-16LE together. Lightgrep supports more than a hundred encodings, and adding encodings to a search costs very little.

  5. Patterns that find what you mean

    Lightgrep's dialect is close to PCRE, with some forensic extras. \zhh stands for a raw byte in any encoding, so \z50\z4B\z03\z04 matches a ZIP header. Character classes combine by intersection, difference and symmetric difference with &&, -- and ~~, and \p{...} selects Unicode properties. Missing on purpose: anchors, word boundaries, lookaround and backreferences, since a byte stream has no lines or words. \d and \w cover ASCII only; reach for \p{Nd} or \p{L} when the text may be in another script. Practical habits: begin with the literal string and loosen it only with reason; cap repetition with [^"]{1,64} instead of .*; anchor on context, as in password=[^&\s]{4,64}, since a bare password turns up in every help file; try the pattern on data whose answer you know; and look at the hit count before opening a single hit.

  6. Go to the hit before you cite it

    Never cite a hit you have not examined. Open the file in Files at the hit's offset, or read the bytes around an unallocated hit, and work out what the text belongs to. Then cite three things: the hit, the search by name, and the time of its last run, so a reader can repeat it. Formal searches and Omega rules share one engine and one pattern syntax, so a pattern proven here can be dropped into a rule unchanged.

  7. Validation lab

    Known-answer keywords

    Begin with planted terms whose locations on the images are already known. Search for each with Lightgrep in VeriSigma and with the second tool's keyword search, and note which tool finds which term in allocated files, in UTF-16LE text, in slack and in unallocated space. Every miss gets an explanation: a layer the tool skipped, an encoding it didn't try, or text missing from its index.

Scope

Before you move on

Could you explain each item on the left to a colleague without looking back? If not, reread that idea. The right-hand list is where this module stops.

What this covers

  • Formal searches and their saved results
  • The six layers and what a hit means in each
  • Encodings, especially UTF-16LE
  • Lightgrep pattern syntax and false-positive control
  • Taking a hit into a finding

What it does not

  • Recovering whole files from unallocated space
  • Every Lightgrep extension and all hundred-plus encodings
  • Rules that combine patterns with other tests (The Omega Rule Language)

Have a matter that turns on evidence like this? VeriSigma examinations are quoted at a fixed fee.

Request a fixed-fee quote