Threat model

Status: current for 0.1.0. This model covers the file readers, the report writers, the PowerShell exporter, and remote collection. Review it whenever an input format, output format, collection method, or dependency changes. The exporter and mishpat collect have not been run against a real domain, a real domain controller, or a real WinRM endpoint, so the controls that concern them are tested against stand-ins only. See Limitations.

What the tool protects

  • The operator’s data. Group Policy exports hold account and group SIDs, security filtering, WMI queries, script commands, registry values, and the structure of the directory. Bundles also hold every file of each GPO backup. Reports hold the same details.

  • Credentials. Remote collection needs an account that can open a remoting session and read GPOs. Its password must not leak.

  • The domain controllers and the directory. Collection must never change them, and the account it uses must not be more powerful than needed.

  • The integrity of results. Reviewers and change boards rely on a report as a record of what changed. A report that hides a gap is worse than one that is short.

  • The operator’s machine. The tool processes files and network replies that may come from systems or people the operator does not fully trust.

  • The supply chain. Users install release artifacts built by this project’s pipeline, and run a script from them against a domain.

Trust boundaries

  1. Input files enter the tool. They are untrusted: Get-GPOReport files, Backup-GPO folders, and export bundles. This includes a bundle that the exporter wrote, because the computer it ran on may be compromised, and a backup folder that someone else made.

  2. The exporter’s environment is where the script runs: an administration workstation or a domain controller. The script reads the directory and SYSVOL there, and it writes GPO backups to a temporary folder under $env:TEMP for a short time.

  3. The remote collection channel carries the exporter script to a domain controller and lines of the bundle back to the operator’s machine. Replies are untrusted.

  4. Secret providers return a password to mishpat collect.

  5. Output files leave the tool and are opened in browsers, spreadsheets, and review systems.

  6. Release artifacts leave the build pipeline and are installed by users.

Threats and controls (STRIDE)

The Status column says whether each control is in place today. Branch rules depend on repository settings, which are applied outside the code.

Category

Threat

Control

Status

Spoofing

A tampered release artifact is installed in place of the real one.

Releases are built only by the release workflow from a commit on main, with a pinned, hash-verified build backend. The release has a published SHA256SUMS file and a software bill of materials. Build provenance attestations are added once the repository is public. The PowerShell exporter ships inside the package, so the same checks cover it.

In place (attestations when public)

Spoofing

A fake server answers mishpat collect and returns false exports, or receives the credentials.

HTTPS on port 5986 is the default and always verifies the certificate chain against the system’s roots or the authorities in --ca-file. No option turns verification off. --server must be a fully qualified DNS name, so the certificate and the Kerberos service name are checked against it. An IP address or bare host name is refused. Plain HTTP is accepted only with message encryption required.

In place; tested against a simulated client only

Spoofing

A report is presented as describing inputs it was not built from.

Reports and the manifest record the size and SHA-256 of both inputs.

In place

Tampering

A crafted report or backup file changes results or crashes the tool.

XML is parsed with the standard library’s pyexpat parser. A DOCTYPE or an entity declaration is refused, so no entity is ever declared, expanded, or fetched. The file size (256 MiB) and the element nesting (64 levels) are limited. mishpat decodes the bytes itself and ignores the encoding the file declares. Registry.pol readers check every size and offset before use. An element that breaks the rules becomes a problem that makes the comparison incomplete. It is never skipped without a trace. Every difference links to the source it was read from.

In place

Tampering

A hostile backup folder or bundle tries to read or write outside its own tree, or to make mishpat exhaust memory or time.

A backup folder is read only through the names the operating system lists, links are not followed, folders are searched four levels deep, and a file larger than 64 MiB is not read. A bundle is never written to disk: its files are held in memory. Each path in a bundle must be relative, with no ., .., :, \, or control character, at most 512 characters, unique without regard to case, and not inside another file. Each file’s size and SHA-256 must match its line. A bundle may hold at most 100,000 files and 1 GiB of file bytes, and a line at most 89,482,584 bytes. JSON lines are checked strictly: repeated names, NaN, unpaired surrogates, and nesting deeper than 8 levels are refused. A line or file that fails is a problem, and the comparison is incomplete.

In place, with residual risk below

Tampering

An export is changed after collection.

The trailer holds the file count and a SHA-256 of every byte before it. A cut-short, damaged, or edited file is reported as a problem. The hash detects accidental damage and careless edits. It does not stop a deliberate forger, who can edit the file and compute the hash again. Keep exports in your evidence system, and compare the hash with the one you recorded at collection.

In place (detects accidents, not a forger)

Tampering

A malicious or compromised domain controller returns crafted data through mishpat collect.

The reply is treated as untrusted input, like any file. Each line must be one line of ASCII text. The first line must be a valid export header, and every later line must be a file line, the structure line, or the end line, with at most one structure line and nothing after the end line. After collection, the end line’s file count and hash must match what arrived. The published file is then read by the same strict reader as any other bundle. A controller can still lie about what its own directory and SYSVOL hold. The comparison cannot detect that.

In place, with residual risk below

Tampering

Collection changes a domain controller or the directory.

The exporter only reads. A test checks that the script calls no command other than a fixed list of read-only ones, and none of the commands that change Group Policy or the directory. Backup-GPO writes only into a new folder under $env:TEMP. The script reads the directory with ADSI searches and writes only the file you name. mishpat collect sends the packaged script and runs it with fixed parameters.

In place; tested with PowerShell 7 and stand-ins only

Tampering

A failed or interrupted run leaves a partial file or overwrites good evidence.

Report files go to private temporary files first, and the manifest is written last. Without --force, a file is placed only if its name is free. With --force, old files are moved aside and restored if any step fails. A remote collection streams into a private temporary file, checks the end line, and only then publishes the file, with the same no-clobber rule. On failure the temporary file is deleted. mishpat compare refuses, even with --force, to publish a report or manifest file that is an input (same path, symbolic link, or hard link) or that would sit inside an input folder, so no input is replaced or changed; mishpat collect does the same for its CA file and secret file. The exporter writes a temporary file next to -OutFile, moves it into place only after the end line is written, and deletes it on failure.

In place

Tampering

A malicious change enters the code base.

Pull requests only, a required passing check, resolved conversations, no force pushes to main, signed-off commits, and actions pinned to full commit hashes.

In place (branch rules need settings)

Repudiation

A user cannot show which inputs and rules produced a report.

Reports record the tool version, the generation time, the name, kind, size, and SHA-256 of both inputs, and the options used. The manifest does the same for every output file. SOURCE_DATE_EPOCH makes the output byte-for-byte repeatable.

In place

Repudiation

A crash is mistaken for a normal result in a pipeline.

Unexpected errors exit with code 4, distinct from a result that needs a look (1), a usage error (2), and an input or collection error (3).

In place

Information disclosure

The collection password leaks through the command line, logs, output files, or errors.

--secret takes a reference, not a password. The password is read at start-up from an environment variable, file, keyring, Vault, AWS Secrets Manager, or Azure Key Vault. It is never written to a file. mishpat remembers every secret it resolves and removes it, in its plain, URL-encoded, JSON-escaped, and quoted forms, from every error before printing, because an authentication library may put the credential in its own error text. Errors from Vault, AWS, and Azure name only the exception type. The user name form is checked before the secret is read.

In place, with residual risk below

Information disclosure

The credentials cross the network in a form that can be stolen.

HTTPS is the default and verifies the server. Over plain HTTP, mishpat requires message encryption. Only Kerberos, Negotiate, and NTLM are offered. None sends the password to the server. Basic, which sends the password itself, and CredSSP, which delegates the account’s reusable credentials to the server, are not offered.

In place; tested against a simulated client only

Information disclosure

Reports and bundles expose sensitive content to the wrong people.

Files are created readable only by the current user on Linux and macOS, and are never silently overwritten. Fixtures are synthetic, and secret scanning runs on every change and across the full history. Reports never show a Group Policy Preferences stored password (cpassword): readers replace it with a fingerprint keyed for the run, and outputs show (hidden stored password). Other values are shown as the input holds them, so a secret that someone put in a policy, such as a script parameter, a logon script argument, or a registry value, appears in the report. A bundle holds every file of each backup, including any cpassword. Treat reports and bundles as sensitive.

Stored passwords hidden; other values not masked

Information disclosure

GPO backups left in a temporary folder on the exporter’s computer.

The exporter writes each backup to a new folder under $env:TEMP with a random name, and removes the folder, with every file in it, when the GPO has been read, even if something fails. If the folder cannot be removed, the script warns and names it.

In place, with residual risk below

Information disclosure

The tool sends data over the network.

mishpat compare has no network code. mishpat collect connects only to the controller you name and to the secret provider you name. The exporter script contacts the directory it reads and sends no data anywhere else. No telemetry.

In place

Denial of service

An oversized or hostile input exhausts memory or time.

The limits in the row on hostile backup folders and bundles. A bundle is read line by line. Problems and differences are not capped, so a hostile input can make a large report.

Partly in place: see residual risks

Denial of service

A hostile server sends unbounded data or never answers.

Each line is limited to 89,482,584 bytes. The connection times out after 30 seconds. If the server sends no line for --timeout seconds, mishpat stops the script and deletes the partial file. A collection has no limit on its total size. Collect only from controllers you trust.

Partly in place: no limit on total size

Elevation of privilege

Input content runs as code: an XML external entity, formula injection in CSV, or script injection in HTML or Markdown.

The XML reader refuses a DOCTYPE and entity declarations, so it never expands or fetches anything. Every CSV cell that starts with a formula trigger, including the full-width forms, gets a leading apostrophe. HTML escapes every value and carries a content security policy that blocks scripts, network requests, and form submission. Markdown escapes every value and does not link addresses from the input. Control, format, bidirectional, zero-width, look-alike space, and lone surrogate characters appear as visible escapes in the terminal and in HTML, Markdown, and CSV. The code uses no eval, exec, or pickle.

In place

Elevation of privilege

The collection account is more powerful than needed.

The account needs the right to open a remoting session and to read the chosen GPOs and the directory, which by default means Administrators, or Remote Management Users plus read access to the GPOs. mishpat cannot ask for less. Use a dedicated account, grant it nothing else, protect it, and prefer a short-lived Kerberos ticket or a secret manager over a stored password. mishpat uses the account only to read.

Guidance; the rights are a Windows requirement

Elevation of privilege

The exporter script runs hostile code on a workstation or domain controller.

One readable PowerShell file with no modules of its own, shipped inside the package. Read it before you run it, and run it only from a verified release. mishpat collect sends the script that is in the installed package, not one fetched from elsewhere.

In place

Elevation of privilege

A compromised dependency or build step runs with broad permissions.

Reading files needs one runtime dependency, faithful-core, which has no dependencies of its own and is pinned to an exact version in pyproject.toml and uv.lock. Remote collection and the secret providers are optional extras with locked versions, vulnerability and license scanning, least-privilege workflow tokens, and workflow security analysis with zizmor.

In place

Hostile input

The two inputs that deserve the most care are a backup folder you did not make and a bundle you did not write. Both can be built by someone who wants to mislead the reviewer or to attack the machine that reads them.

  • To attack the machine. The preceding controls apply: no entity expansion, no path outside the tree, nothing written to disk from a bundle, strict size and shape limits, and no use of input as code.

  • To mislead the reviewer. A forged bundle can hold any GPO content, with a valid hash, because the hash is not a signature. The report is only as honest as the input. Take bundles from a source you trust, keep them in an evidence system, and record their SHA-256 at collection.

  • To hide a change. A hostile input can omit a part. mishpat reports what it could not read, such as a missing trailer, a failed hash, or a gap the exporter recorded. It cannot report what the input never said. A bundle that is complete and consistent but false looks complete.

Residual risks

  • A compromised controller can lie. The trailer hash and the certificate show that the file came whole from the server you named. They do not show that the controller is healthy or that its directory and SYSVOL are true. Someone who controls a controller can change what the exporter returns. Compare exports with a second source, such as another controller.

  • A tampered file can be made to match its hash. The bundle hash, the report hashes, and the manifest show consistency, not authorship. Authenticity is the job of the system that stores the files.

  • Memory. mishpat builds the whole element tree of a report in memory, and holds a bundle’s files in memory. The limits bound the size of an input, but memory use is a multiple of it. For a Registry.pol entry the multiple is large: a 41-byte entry takes about 5 KB of memory (about 120 times) and, when its value changed, about 760 bytes of JSON report. mishpat therefore reads at most 1,000,000 entries from one Registry.pol file (--max-pol-entries changes this) and records a problem for the rest, so the run is incomplete and exits 1. A report file is read with a limit on the elements held at once, because a small file of empty elements can build a tree of gigabytes, and a <GPOS> capture is read one GPO at a time. Do not read untrusted inputs on a machine that cannot spare the memory.

  • Folders are hashed whole. To fingerprint a folder input, mishpat reads every file under it, including files it never parses. Give it the backup folder or the backup root, not a parent folder that holds unrelated data.

  • Only stored passwords are masked. A Preferences cpassword never appears in a report, but a secret that someone typed into another setting, such as a script parameter, does. Check a report before you share it. A bundle always holds the original files, stored passwords included.

  • A temporary folder can survive a hard stop. If the exporter process is killed, or the computer loses power, the folder with the GPO backups under $env:TEMP stays. Remove folders named mishpat- followed by a GUID. The folder is created with the default access rules of that location.

  • The exporter and collection are untested against real systems. Treat the first runs in your environment as a pilot.

  • NTLM is weaker than Kerberos. mishpat offers it because some environments need it. Prefer Kerberos.

  • A secret file is not checked. file:PATH reads the first line of the file and does not check who can read it. Keep it readable only by you.

  • File permissions apply on Linux and macOS. mishpat sets no access rules on Windows. Check the access rules of the folder you write to.

  • Checksums and attestations protect users only if they verify them. Releasing shows how.