Using Hashes to Verify Evidence Integrity
An evidence technician calls an incident responder with a problem. The suspicious executable they collected from a payroll workstation has one recorded hash. The copy in the analysis environment has another. The transfer system reports that the file arrived successfully, and nobody recalls changing it. A team member suggests using the newer value and moving on. After all, the file is still there and it opens normally in the analysis software.
That would erase the very question the integrity check was meant to raise. Before anyone relies on this artifact to explain an intrusion, the team needs to establish what was measured, when it was measured, and why the two measurements disagree. The file could have changed while being collected. Someone might have copied a different file with a familiar name. The transfer might have failed silently. Or the comparison might involve two different objects, such as a compressed evidence package and the executable taken out of it. None of those possibilities can be settled by choosing the hash that looks more convenient.
A cryptographic hash is a way to create a compact measurement from the contents of data. Give the same bytes to the same hashing algorithm, and it produces the same result. Change the bytes, and a secure algorithm is overwhelmingly likely to produce a different result. The hash is not a description of what the program does. It is not the file's name, creation date, or location. It answers the narrower question of whether the measured content matches content measured earlier.
When you return to the topic after listening, the independent CCOA study guide from Bare Metal Cyber can help you distinguish an integrity measurement from a claim about where evidence originated. Treat the examples as opportunities to explain exactly what has been established, rather than as exercises in memorizing the name of a command. For now, picture the two payroll-file copies and the disagreement that brought the investigation to a stop.
That narrow purpose makes hashing useful in investigations. A responder can measure an artifact before a handoff, and the receiving analyst can measure it again. If both use the same algorithm on the same bytes, matching values provide strong evidence that the content stayed the same across that handoff. If the values disagree, the team has found something worth investigating before interpreting the file. The quality of that conclusion depends on knowing which source and which copy each value represents.
The commonly used algorithm in this kind of work is SHA-256. It produces a fixed-length digest, even when the source file is enormous. You do not have to read its long string of characters aloud, memorize it, or calculate it by hand. The important choice is to use the same identified algorithm at both points of comparison, record the complete output accurately, and protect the reference value from untracked changes. A different algorithm produces a different kind of result; comparing those outputs as though they were interchangeable would tell the team nothing.
On a Windows system, two built-in approaches an analyst may encounter are CertUtil and the PowerShell Get-FileHash command. Both can calculate the same secure digest for a readable file. In a practical assessment, you may need to recognize which file is being measured and which algorithm was selected. But the investigative skill is not the ability to recite punctuation in a command. It is recognizing that a value generated from the correct artifact can be checked independently against a known reference, and recognizing when a tool's result does not answer the question you were given.
Return to the payroll workstation. The initial responder says the file was measured before it was copied. That sounds reassuring, but the record contains only a filename and a hash. There is no time, source-system identifier, or collection note. On the workstation, two directories contain files with the same name. One is an installer cached by a legitimate management agent. The other is an unexpected executable in a user's download area. The team has learned something more serious than a formatting mistake: it cannot yet prove which object the first value measured.
An investigator should preserve the original entry, not edit it to match the current copy. The next action is to establish the source location, collection method, and available history. If the original system is still available and safe to inspect under the response plan, the technician can confirm which file was selected. If the source is unavailable, the uncertainty belongs in the case record. The analysis copy can still contain useful evidence, but the team must not claim an unbroken, independently verified transfer that its records cannot support.
Suppose the location is confirmed. The responder now remembers that the source file was part of an active updater process. A file being written while it is read may not present a stable set of bytes. Its contents can change between an early measurement and a later copy, and some acquisition methods may encounter changing content during collection. Repeated hashes of the same live path may disagree for that reason. That does not automatically indicate an attacker tampered with the evidence after collection. It indicates that the time and state of the source are relevant to the claim the team wants to make.
The treatment changes for a stable forensic acquisition. When a system is collected using a controlled, documented method, the collection record can associate the resulting image or file with a particular source and acquisition interval. A verification measurement taken from the preserved copy can then be compared with the relevant acquisition reference. The original source need not remain accessible forever for the preserved copy to be useful, but the collection method and its limitations must be clear. Hashing cannot repair a poorly documented acquisition after the fact.
The next distinction is subtle and frequently misunderstood. A match establishes content consistency between the things that were measured. It does not establish that either thing was trustworthy in the first place. An attacker could place a malicious executable on a server, and every subsequent copy might match it perfectly. The successful hash check would say that the malicious bytes traveled unchanged. It would not convert the file into approved software.
The same logic applies to a claimed official download. If a vendor publishes a digest through a trusted channel and a downloaded package matches it, that supports the conclusion that the package has the content represented by that reference. If the attacker controls both the package and the webpage showing the digest, the match is much less reassuring. The comparison is only as meaningful as the provenance of the reference value. Trust in the measurement and trust in the source are separate questions.
This is a good point for an optional practice follow-up. In Bare Metal Cyber's Cyber Challenge, an integrity scenario is most useful when you explain why a correct match still leaves questions about source and authorization, or why a mismatch demands investigation rather than a convenient retry. The value lies in defending your conclusion from the evidence available, especially when several answers sound technically plausible.
Digital signatures add another dimension. A digital signature can help connect signed content to the holder of a signing key and show whether the signed data has changed, when the certificate and validation conditions are properly evaluated. A plain hash does not identify a signer. Even a valid signature does not guarantee that software is harmless or that the signer intended every later use. Signing credentials can be compromised, and legitimate programs can be abused. In an incident, an analyst may need both a content measurement and separate evidence about origin and behavior.
There is also a difference between the integrity of a file and the history of its custody. Picture two analysts who independently receive byte-for-byte identical copies of the payroll executable. Both calculate matching hashes. One copy came through the documented evidence repository with named handlers and access records. The other arrived in an untracked personal message. The matching values say something useful about the content, but they do not explain who handled the second copy, whether its source was correctly identified, or why it was transmitted that way. A chain-of-custody record exists to address those handling questions.
A strong case record therefore preserves more than the digest. It ties the measurement to a source identifier or evidence item, a collection or verification point, the algorithm, the operator, and the relevant time. It records transfers and the people or systems authorized to handle the artifact. When practical, investigators protect the reference measurements separately from the files being examined. Working from controlled copies also reduces the chance that analysis will alter the preserved source. The objective is to allow someone who was not present to understand exactly what the integrity check supports.
Now imagine a different disagreement. The technician measured a compressed archive containing five exported logs. The analyst extracted the logs and measured one of them. Those values do not have to match. The archive is a different collection of bytes from its extracted member. Rebuilding an archive from the same visible files can also change the archive's digest because packaging details may differ. Before calling a hash mismatch corruption, identify the object each value actually describes.
Forensic disk images introduce a similar distinction. A digest of an acquired data stream describes that stream. A digest of an individual recovered document describes only that document's contents. An evidence container may have its own metadata and packaging. There is no universal rule that all three measurements should be identical. An investigator should be able to say whether the comparison concerns the acquisition as a whole, a preserved container, or one extracted artifact. That explanation is more useful than a long list of numbers without labels.
Consider the opposite situation. Two files in different folders have matching content hashes, but one is named payroll-update and the other is named staff-report. If they contain identical bytes, the different names do not normally change a content-only hash. File names, paths, and filesystem timestamps are separate context. The match may help reveal duplicates or rename activity, but it cannot alone show which file was launched, who placed it there, or whether either copy was used. Those questions require execution, identity, and file-system evidence.
This becomes important when the investigation turns to malware identification. A threat-intelligence report may associate a particular hash with a known malicious sample. An exact match to a reliable reference can be a strong investigative lead for those specific bytes. A different hash does not establish that the file is benign. Recompiling or slightly altering malware typically changes the digest while preserving its purpose. Analysts therefore combine exact-hash searches with observations about execution, persistence, and network behavior. You will build those connections in the upcoming malware lesson.
What should the team do if a mismatch remains unexplained after checking object identity, source state, and transfer records? Preserve both observed values and the sequence in which they were obtained. Check whether the available stable copies can be independently measured and whether a documented earlier reference survives. Determine if the artifact can still be analyzed with a stated limitation, or whether another acquisition is necessary. If the artifact is central to a high-consequence conclusion, unresolved integrity uncertainty may narrow what the report can responsibly claim.
Do not turn the integrity process into a hunt for two numbers that agree. If an operator retries enough times without recording failures, the final matching pair may conceal an intermittent read problem, a changing source, or confusion over paths. Repeat a measurement only as part of a controlled investigation into the discrepancy, with the new observation added to the record. A reliable explanation is often more valuable than an apparently neat result.
In a performance-based task, the same thinking still applies even when the interface is unfamiliar. Establish what the question asks you to verify. Identify the exact source or destination object. Confirm the algorithm, compare the measurements of the intended objects, and determine what follows from the result. If an access restriction prevents reading the file, that is an authorization or collection problem, not an invitation to weaken safeguards indiscriminately. The goal is an accurate measurement made through an approved method.
Return one last time to the payroll case. The technician eventually finds that the first hash belonged to the legitimate cached installer; the analysis copy was taken from the user download directory. The two files had similar names and different contents. The mismatch did its job. It interrupted an unsupported chain of assumptions and exposed a collection error before the organization used the wrong artifact to explain the incident. The team preserves the error in its notes, verifies the correct source, and reconstructs the handoff from that point onward. Nothing about the earlier mistake is magically erased.
Hashing gives investigators a precise instrument, but precision must stay attached to the right question. A matching digest supports consistency of measured bytes. A verified signature can add evidence about signing identity. Provenance identifies where an artifact came from, and custody records describe its handling. None of those alone establishes what an executable did on a compromised system. Keep those claims separate, and you can use a very simple calculation to protect the credibility of a much larger investigation.