In my daily security work, I have analyzed plenty of phishing campaigns that delivered PDFs. One thing I kept noticing was that the individual files would often be slightly different, sometimes enough that every PDF had a unique SHA-256, yet underneath those differences the documents appeared to have a lot in common. The lure might change, a URL might point somewhere else, metadata could be different, or JavaScript and embedded content might be modified, but the way the PDF itself was constructed could look remarkably familiar. That raised an interesting question for me: could those structural similarities help identify PDFs produced by the same phishing infrastructure, toolchain, campaign, or perhaps even the same threat actor?

The Limits of Exact File Hashes

A conventional cryptographic hash cannot really answer that question. SHA-256 is designed to determine whether two files are exactly the same, and changing even one byte gives you a completely different hash. That is exactly what I want when establishing file identity, verifying integrity, or pivoting on a known artifact, but it means two closely related phishing documents can look completely unrelated when exact hashes are the primary pivot. Campaign operators do not need to rebuild a document from scratch to produce that separation. A changed URL, modified metadata field, different lure, altered script, rebuilt object stream, or newly embedded payload can be enough to produce a new file hash. The cryptographic hash is doing its job correctly; it is simply answering a narrower question than the one I am asking. SHA-256 tells me, “Have I seen this exact file before?” The question I wanted to explore was different: “Have I seen a PDF built like this before?”

A Second Kind of Fingerprint

I started thinking about whether PDF Security Engine could calculate a second kind of fingerprint, one based not on the precise bytes of the document, but on selected parts of its security-relevant architecture. If two PDFs use the same kinds of actions, execution triggers, annotations, embedded-file mechanisms, JavaScript storage, form structures, and other behavioral characteristics, perhaps that relationship should survive changes to the lure text, metadata, URLs, or payload content. That became PDF Structure Hashing and the first version of its canonicalization algorithm, PDFSE-STRUCT-v1. PDF Security Engine still calculates the normal SHA-256 of the file, along with hashes of extracted JavaScript and embedded payloads, because those remain important indicators. The structural hash does not replace them; it answers a different question and creates a different kind of pivot.

Canonicalizing the Security-Relevant Structure

PDFSE-STRUCT-v1 turns selected structural observations into a deterministic canonical representation. The canonical form records what mechanisms are present and how they are arranged, while deliberately excluding volatile values that would make closely related documents diverge.

For example, a page-open JavaScript mechanism can be reduced to canonical records such as:

ACTION|SCOPE=PAGE|TRIGGER=O|TYPE=JAVASCRIPT|STORAGE=PDFSTRING
JAVASCRIPT|TRIGGER=O|STORAGE=PDFSTRING|SIZE=1-64

The actual JavaScript is not included in the structural representation. Neither is its SHA-256. A different script can therefore produce the same structural fingerprint when the surrounding PDF architecture remains equivalent.

The same principle applies to external links. PDF Security Engine still reports a literal URL to the analyst because the destination is an important exact indicator. PDFSE-STRUCT-v1 records that a link annotation invokes a URI action rather than incorporating the destination itself. Two documents can therefore point to different domains while remaining structurally related.

Exact Indicators and Structural Indicators

Keeping those two forms of evidence separate was one of the most important design decisions. I wanted exact indicators and structural indicators to complement each other rather than compete with each other. The ordinary file hash tells me whether the complete document is byte-for-byte identical to another file. JavaScript and embedded-file hashes identify exact extracted artifacts, while literal URLs, filenames, metadata values, and destinations provide concrete indicators for investigation and threat-intelligence enrichment. The structural hash intentionally abstracts those values and tells me that the same kinds of mechanisms are present, with the same security-relevant arrangement, even if their content has changed.

This produces a useful analytical separation:

  • File SHA-256: exact identity of the complete PDF.
  • Artifact hashes: exact identity of extracted scripts or embedded payloads.
  • Literal indicators: URLs, filenames, metadata, and other values that can support investigation.
  • Structural hash: a deterministic fingerprint of selected security-relevant PDF architecture.

Each indicator answers a different question. Used together, they provide a much richer basis for comparison than any one indicator can provide on its own.

Using Structural Similarity During Campaign Analysis

This becomes particularly interesting during campaign analysis. Imagine receiving twenty phishing PDFs over several weeks. All twenty have different file hashes. The domains rotate, the lure text changes, and perhaps the embedded payloads are different. From the perspective of exact indicators, there may be little tying the documents together. But if seventeen of those PDFs share an unusual structural fingerprint, I now have another pivot worth investigating. I can compare delivery timing, sender patterns, attachment names, domains, hosting providers, JavaScript techniques, payload families, certificate details, mail infrastructure, and other available telemetry. The structural match does not prove a relationship, but it gives me a reason to perform that comparison instead of treating every document as an isolated event. It also works in the other direction. If nineteen files share the same broad lure but one PDF has a distinctly different structural fingerprint, that outlier may deserve separate attention. Perhaps it came from a different generator, added a new delivery mechanism, or belongs to an unrelated campaign that happens to use similar social engineering.

What a Structural Match Does Not Prove

I would not conclude from a matching structural hash alone that the same threat actor created two documents. The same commercial library, phishing kit, document generator, template, or automated service could produce the same pattern for multiple operators, and common authoring software can create recurring structures in completely legitimate documents. A structural hash is therefore not an attribution mechanism, a malware verdict, or proof of shared intent. It is a similarity signal whose value increases when it overlaps with independent evidence. A structural match becomes more interesting when the associated documents also share delivery infrastructure, sender behavior, domains, JavaScript techniques, payload families, hosting providers, campaign timing, or other threat intelligence. Conversely, a common structural fingerprint with no supporting overlap may simply identify a widely used toolchain.

Versioning the Algorithm Matters

The name PDFSE-STRUCT-v1 is deliberate. Structural hashing depends on the rules used to select, normalize, order, and serialize observations, and if those rules change, the resulting fingerprint may change even when the PDF does not. Versioning the canonicalization algorithm keeps that behavior explicit. A PDFSE-STRUCT-v1 value should only be compared directly with another PDFSE-STRUCT-v1 value. If a future version adds new structural features or changes normalization rules, it should identify itself separately rather than silently changing the meaning of existing hashes. That predictability is important if the output is used in case notes, detection engineering, historical datasets, automated workflows, or threat-intelligence platforms. The hash needs to be reproducible, but the definition of what was hashed also needs to remain understandable.

Another Piece of Evidence

The structural hash is not intended to answer, “Who did this?” It gives me another piece of evidence for asking, “What else looks like this, and what do those files have in common?” That is much closer to the problem I was trying to solve in the first place. Exact hashes remain essential for identifying known files and artifacts, while structural hashing adds a complementary way to find relationships that exact hashes are designed to miss. For phishing investigations, that can turn a collection of apparently unrelated PDFs into a more useful analytical question: different files, different indicators, but perhaps the same underlying method of construction.