g4bri-3l3/HostBadger
About
Windows host hardening auditor and remediation tool in PowerShell: CIS, DISA STIG, Essential Eight checks, reversible fixes, optional AI analysis
AI & Machine LearningMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original _.--""--._
.' | | '.
/ | | \ HostBadger
| (o)| |(o) | Windows host hardening
| | | |
\ '.__.' /
'._ \/ _.'
'--..--'
Watch the walkthrough · Open the demo report (no install: it is one HTML file of a synthetic fleet) · Site

Summary
HostBadger audits the security settings of Windows machines and tells you what is weak. It works in two steps. A single PowerShell script takes a read-only snapshot of a host. The analyzer then reads the snapshots offline and writes an HTML report, a findings CSV and, if you want it, JSON Lines for a SIEM. Hand it one snapshot or a folder with hundreds and you get the whole fleet in one report, or one report per host.
- 247 checks and about 1,700 settings: 234 hand-written checks plus 1475 DISA STIG registry rules, with the CIS Windows 11 benchmark as the baseline, and the drivers matched against 2,198 known vulnerable or malicious driver files (LOLDrivers). The vectors of the attacks reported between 2022 and 2026 are mapped to the checks that look for what each one needs: recent attacks.
- Collect anywhere, analyze anywhere: the collector is one
.ps1file, with no module and no prompt, that runs as SYSTEM or as an administrator through any tool that can run a PowerShell script on your hosts (an EDR's live response such as CrowdStrike Falcon RTR, an RMM, Configuration Manager or Intune scripts, a Group Policy startup script, PowerShell remoting) and takes about 15 seconds per host. - Read only: it changes nothing and starts nothing, and it makes no network
call unless you ask for one:
-CheckUpdates(the Windows Update service searches for missing updates),-KevOnline(downloads the CISA KEV catalog, www.cisa.gov),-DriversOnline(downloads the LOLDrivers catalog, www.loldrivers.io),-EolOnline(downloads software lifecycle data, endoflife.date),-ChocoOnline(downloads program versions, community.chocolatey.org),-CveOnline(downloads CVEs and EPSS scores, services.nvd.nist.gov and epss.empiricalsecurity.com),-ExtensionsOnline(downloads the list of browser extensions removed from the stores, raw.githubusercontent.com),-ExploitsOnline(downloads the Metasploit and Exploit-DB references, raw.githubusercontent.com and gitlab.com) and-SendToAI(Gemini). Each one is named where it is offered.Test-HostBadgerSafety.ps1proves the rest from the code. - Honest about gaps: what could not be read is listed as not evaluated, never as clean.
- Nothing to install: Windows PowerShell 5.1 or PowerShell 7.
- Windows 10, Windows 11 and Windows Server: every host gets the general checks and the STIGs of Defender, Firewall, Edge, Chrome, Firefox and Office (when installed); a Windows 10 host also gets the Windows 10 STIG and a Windows 11 host the Windows 11 STIG. The CIS rule numbers are those of the host's own benchmark: Windows 11, Windows 10, Windows Server 2022, 2019 or 2016 (other versions keep the Windows 11 numbers). A Windows Server 2016, 2019, 2022 or 2025 host gets its own STIG, the domain controller or the member server rules by role (other server versions get no Windows STIG); its user rights are judged against the member server or domain controller list of the CIS Server benchmark.
It reads what a host actually does, which is not always what policy says it should.
Features
Security areas
- Credential protection: LSASS protection, Credential Guard, memory integrity (HVCI), WDigest, cached logons, LM/NTLM settings, anonymous access.
- Microsoft Defender and EDR: real-time protection, tamper protection, signatures, exclusions, PUA, Network Protection, behavior monitoring, cloud protection, the 3 standard and 13 more attack surface reduction rules, and which EDR agent each host runs.
- Disk and boot: BitLocker on system and data volumes, TPM-only protectors, Secure Boot.
- Network exposure: SMB and LDAP signing, SMBv1, LLMNR, NetBIOS, firewall profiles and logging, risky listeners, legacy SSL/TLS protocols and weak ciphers.
- Remote access: RDP, NLA and RDP policy, WinRM authentication.
- Local accounts and UAC: built-in accounts, local administrators, LAPS, password and lockout policy, user rights, UAC settings.
- Privilege escalation: writable service and task programs, unquoted paths, AlwaysInstallElevated, autoruns, Point and Print (PrintNightmare), folders of the machine PATH and program install folders that users can write.
- Logging and audit: advanced audit policy, command-line auditing, PowerShell script block, module and transcription logging, log sizes.
- Patching and lifecycle: Windows update age, end of support and, if you
ask for it (
-CheckUpdates), the updates that Windows Update reports as missing, rated by Microsoft severity. - Installed software: the Programs and Features list of every host, shown in
the report with pie charts by publisher; with the CISA KEV catalog (
-KevFileor-KevOnline) each program that matches a product with vulnerabilities known to be exploited becomes a lead to verify (the catalog has no version ranges, so the match is by vendor and product name only). Releases past their end of support (Flash, Java 6/7, old Office, Exchange and SQL Server, Python, Node.js, .NET, old Visual C++ runtimes) are flagged from a lifecycle table, no download needed. With-EolOnline(or-EolFile) the dates come from endoflife.date (MIT), which adds Oracle Java, Eclipse Temurin, PowerShell 7, VirtualBox and Wireshark, judges each SQL Server instance on its service pack and its latest cumulative update or GDR build (read from the engine filesqlservr.exe), and flags programs behind the latest release of their line (software_outdated: Python 3.12.1 when 3.12.9 has been out for months, a Firefox, Chrome or Notepad++ that stopped updating). A release counts only if it came out before the snapshot and more than-SoftwareGraceDays(30) earlier. With-ChocoOnline(or-ChocoFile) the same check covers 7-Zip, VLC, Git for Windows, GIMP, WinSCP, PuTTY, FileZilla, KeePass, Audacity, Mullvad VPN, OBS Studio and AnyDesk, from the versions and publication dates of their Chocolatey community packages (the same list is asked for whatever the hosts have, so the requests say nothing about them). With-CveOnline(or-CveFile)software_cvelists the known vulnerabilities of the installed version of Python, Node.js, .NET, Notepad++, PowerShell 7, VirtualBox, Wireshark, 7-Zip, VLC, Git, GIMP, WinSCP, PuTTY, FileZilla, KeePass, Audacity, Mullvad VPN and AnyDesk: the CVEs of each product come from the NVD CVE API (asked for by product, never by version) and their version ranges are judged locally; each finding gives the count, the highest CVSS score, the CVEs in CISA KEV and the highest EPSS score (probability of exploitation), and names the release that fixes them all. NVD has a backlog of CVEs without version data, so the newest ones can be missing. About 2.5 minutes without an NVD API key (NVD_API_KEYmakes it faster). With-ExploitsOnline(or-ExploitFile) the same findings also note which of those CVEs have a ready Metasploit module or an Exploit-DB entry, to patch the exploited ones first: a prioritization signal like KEV and EPSS, kept as references only (the module name and the Exploit-DB id, never exploit code), and a ready Metasploit exploit module raises the finding to High. The two reference lists are downloaded whole (raw.githubusercontent.com and gitlab.com), the same whatever the hosts have, so the requests reveal nothing. - Vulnerable and malicious drivers: the SHA-256 of every kernel driver file
is matched against the LOLDrivers catalog
(Apache License 2.0) of drivers used in "bring your own vulnerable driver"
attacks. A known malicious driver is Critical, a loaded vulnerable one High.
The match is by exact hash, so a fixed version of the same driver does not
match. A copy of the catalog ships in
data\vulnerable-drivers.json(rebuilt bytools\Convert-LolDrivers.ps1);-DriversOnlinedownloads a fresh one. The Microsoft vulnerable driver blocklist turned off is a finding too. - Browser extensions: the extensions of Chrome, Edge, Brave, Vivaldi,
Chromium and Firefox in every user profile, matched against the extensions
the stores removed as malware, spyware or adware and against the ones
documented as malicious; extensions loaded in developer mode or from a file,
extensions that can read every site, and, with
-AllowedExtensions, the ones the organization did not approve. See "Browser extensions" below. - Smaller doors: Print Spooler on servers with no printer, Linux
distributions under WSL and Hyper-V or Windows Sandbox on workstations (out
of the EDRs sight), unsigned Office add-ins, credentials saved in Credential
Manager (counted), attack surface reduction exclusions, shadow copies or
System Restore turned off, Windows Hello keys without a TPM, firewall rules
that let in programs from user folders and, with the collectors
-NamedPipes, vendor named pipes everyone can write to. - System hardening: autoplay, automatic logon, screen lock, SmartScreen and the other CIS Windows 11 baseline settings.
Compliance
DISA STIG, 1475 registry rules across fourteen products, one finding per rule that differs (a setting that is not configured counts, as the STIG asks):
Product STIG release Rules Windows 10 V3R6 137 Windows 11 V2R7 133 Windows Server 2025 (domain controller / member server) V1R1 94 / 94 Windows Server 2022 (domain controller / member server) V2R8 99 / 102 Windows Server 2019 (domain controller / member server) V3R8 98 / 102 Windows Server 2016 (domain controller / member server) V2R10 98 / 102 Microsoft Defender Antivirus V2R8 67 Windows Defender Firewall V2R2 38 Microsoft Edge V2R5 53 Google Chrome V2R11 40 Mozilla Firefox V6R7 43 Microsoft Office 365 ProPlus V3R5 127 Adobe Acrobat Reader DC Continuous V2R1 26 Adobe Acrobat Pro DC Continuous V2R1 22 Severity follows the STIG category (CAT I High, CAT II Medium, CAT III Low). A server gets the domain controller or the member server rules of its version, by role. Browser, Office and Acrobat rules apply only when the product is installed, and Office rules are per-user policies, judged on the user profiles loaded when the snapshot was taken. Rules that need an organization decision (a banner text, an approved URL list) are not judged. The data comes from the processed files of Microsoft PowerSTIG (MIT) and the DISA releases;
tools\Convert-PowerStigData.ps1rebuilds it.CIS Windows 11 Enterprise benchmark v3.0.0: rule numbers in the findings, taken from the MIT-licensed ansible-lockdown/Windows-11-CIS role. On Windows 10 and on Windows Server 2022, 2019 and 2016 the same findings quote the rule of that version's CIS benchmark (Windows 10 Enterprise v3.0.0, Server 2022 and 2019 v4.0.0, Server 2016 v3.0.0; domain controller or member server variant), from
data\cis-map.json.NIS2 in Italy (ACN basic measures), only when asked for (
-Nis2Acn; the guided menu asks, since it matters only to organizations in Italy): the requirements of the basic security measures of the Agenzia per la Cybersicurezza Nazionale (Determinazione 379907/2025, D.Lgs. 138/2024: Allegato 1 for soggetti importanti, Allegato 2 for soggetti essenziali) that a host shows, such as credentials (PR.AA-01), least privilege (PR.AA-05), encryption (PR.DS-01, PR.DS-02), updates (PR.PS-02), logs (PR.PS-04), remote access and firewall (PR.IR-01) and malware protection (DE.CM-09), each tied to the checks that give evidence about it and quoted in ACN's wording (data\acn-nis2-measures.json, rebuilt bytools\Convert-AcnMeasures.ps1from the spreadsheets ACN publishes). The dashboard lists the requirements with a finding against them and those that could not be judged. Governance, plans, inventories, backups, MFA, training and incident handling are not visible from a host: this is evidence for an assessment, not a compliance verdict.Compliance charts at the top of the report: how much of the STIG and of the CIS-based checks the hosts meet.
-HideCisand-HideStigtake those findings out of the report listing (the CSV and JSON Lines keep them) and-SkipStigleaves the STIG rules out altogether.COVERAGE.mdlists every check with its severity, MITRE technique, CIS rule and whether a fix script exists.
Reporting and fixing
- Dashboard first: score ring, DISA STIG compliance per product and
release, CIS-based compliance, the ACSC Essential Eight maturity level each
strategy reaches from the requirements a host shows (ASD model, November
2023, listed in
COVERAGE.md; an upper bound, since MFA, backups, central logging and scanning cadence are not visible from a host), with-Nis2Acnthe NIS2 ACN basic measures with a finding against them, categories and top risks, for the fleet or one host picked in a selector. - HTML report with scores per host (A to F), pie charts (severity,
category, grades, compliance, software, and local accounts: enabled
administrators versus standard users and disabled accounts), findings grouped
by check, a fix script under each fixable check, filters and a
not evaluated section; CSV and JSON Lines for a SIEM with stable
finding ids. Every CIS and STIG finding shows the value found on the
host next to the value the framework requires (for example found "not
configured", required "1"), in the report table, the CSV and the JSON Lines.
Every check also says what an attacker can do with it ("Attacks it
enables": NTLM relay to SMB, credential dumping, privilege escalation to
SYSTEM...), in the report, the
AttacksCSV column and theattacksJSON Lines field. The checks with a well-known offensive-tool association also name the tools attackers use against them (Responder, Mimikatz, Impacket, NetExec, PowerUp...), threat-informed context for defenders to expect and detect, in the report, theToolsCSV column and thetoolsJSON Lines field. - One report per host with
-PerHost, or one fleet report. - Comparison with an earlier run (new and resolved findings) and accepted risks with an owner and an expiry.
- Score trend over many runs (
-History): each host's score at every snapshot, drawn in the Hosts table with the change since the previous one. - Large fleets: hosts analyzed several at once (
-Threads), with the same result as one at a time. - Remediation scripts (
-OutRemediation): one setting, the expected value, previewed by default, with a rollback file. The analyzer never runs them; the guided menu can apply this machine's own script after showing it and asking for YES (menu 6), and put the values back (menu 7); the window does the same with Fix this machine in its Fix tab, after a preview and a warning. - Remediation profiles (
-RemediationProfile Essential | Recommended | Strict): a ready-made hardening level on top of the fixes of the findings, each setting quoting its CIS rule or Essential Eight requirement, from "safe on any machine, nothing the user notices" (Essential leaves out CTRL+ALT+DEL, hiding the last user name, screen lock, extra prompts and the Xbox services) to CIS Level 2 plus opinionated hardening and the removal of preinstalled apps. What cannot be undone is marked NOT REVERSIBLE before you apply it. - Optional AI summary with Gemini: host names, accounts, paths and addresses are replaced by tokens first and a leak check refuses to send if one survives. You choose whether the STIG findings go too (there can be hundreds per host, and a prompt that large may time out).
- Guided menu (
Start-HostBadger.ps1) for collecting, analyzing, the AI step and the safety review, with global settings (menu 8) that save the answers a run would ask every time. - Window (
Start-HostBadgerGui.ps1): the same steps as a form in the style of the report, the findings of a report browsable by category in a Results tab, links to everything a run wrote and a check for a newer HostBadger on GitHub (andgit pull --ff-onlyin a git clone). - Logs: every analysis writes
<report>.lognext to the report (the settings of the run, then everything it printed), and every menu sessionoutput\hostbadger-menu_<time>.log(the questions, the answers typed and what the collection and the analysis printed). Passwords and the Gemini key are typed hidden and never reach a log.-NoLog/-OutLogchange it.
How it compares
HostBadger sits next to the tools below, not in place of them. The table is a summary of their public documentation as of October 2026: check the vendors' own pages before relying on it, especially for licensing and editions.
| HostBadger | HardeningKitty | Microsoft Policy Analyzer (SCT) | DISA SCC | CIS-CAT Pro | Tenable Nessus / Qualys Policy Compliance | Microsoft Defender Vulnerability Management | |
|---|---|---|---|---|---|---|---|
| License | MIT, free | MIT, free | Free | Free | Commercial (CIS SecureSuite) | Commercial | Commercial (Defender for Endpoint / add-on) |
| Focus | Windows host hardening | Windows host hardening | GPO and local policy against Microsoft baselines | DISA STIG through SCAP | CIS benchmarks | Vulnerabilities and compliance, many platforms | Endpoint vulnerabilities and configuration |
| CIS benchmarks | Yes: Windows 10/11 and Server 2016-2022 rule numbers | Yes: Windows 10/11, Server 2012 R2-2025 lists | No (Microsoft baselines) | No | Yes, full | Yes | Add-on |
| DISA STIG | Registry rules only (1,475, fourteen products) | Some lists (Windows 10, Server 2019, Defender, Firewall) | No | Yes, full SCAP content | Check with CIS | Yes | Add-on |
| Microsoft security baselines | Partly, through CIS/STIG overlap | Yes | Yes | No | No | Yes | Yes |
| Italian NIS2 rules (ACN basic measures, Determinazione 379907/2025) | Yes, opt-in (-Nis2Acn): the measures a host gives evidence for, in ACNs wording |
No | No | No | No | Check with the vendor (generic NIS2 mappings, not the ACN measures) | Check with the vendor |
| ACSC Essential Eight | Maturity level per strategy, from what a host shows | No | No | No | No | Check with the vendor | No |
| MITRE ATT&CK and the attacks a finding enables | Every check | No | No | No | No | Partly | Partly |
| Signs of persistence and tampering | Load points, hidden services and tasks, RID hijack, replaced accessibility tools, suppressed event logs, hosts redirects, added root CAs, remote access tools, malicious browser extensions | No | No | No | No | Partly | Through Defender for Endpoint (EDR), not the configuration view |
| Checks across the fleet | Shared local administrator passwords, duplicate machine SIDs, configuration drift within a role | No | No | No | No | No | No |
| Software and vulnerabilities | End of support, behind latest release, CVEs by installed version with CVSS, KEV and EPSS (about 20 mapped products), vulnerable drivers | No | No | No | No | Yes, full CVE scanning | Yes |
| Collection | One read-only script, through any tool that runs a .ps1 (EDR, RMM, SCCM/Intune, GPO, remoting) | Run on the host | Local or exported GPOs | Local or remote | Local or remote | Agent or credentialed scan | Defender sensor |
| Offline analysis of saved snapshots | Yes | No | Yes (GPO backups) | No | No | No | No (cloud) |
| Fleet report | HTML, CSV, JSON Lines | Per host (CSV) | Per comparison | Per host | Yes | Console | Console |
| Value found next to value required | Yes | Yes | Yes | Yes | Yes | Yes | Partly |
| Fixes | Reversible scripts with rollback, plus optional hardening, debloat and telemetry profiles; applied only on the local machine, from the guided menu after YES or the window after a preview | Can apply the settings (HailMary), GPO export | No | No | No | No | Recommendations |
| Interface | Guided console menu and a window (WPF), or plain parameters | PowerShell module | Window | Window | Window and command line | Web console | Web portal |
| AI summary | Optional (Gemini), names tokenized and a leak check before anything is sent | No | No | No | No | Vendor cloud AI, licensed separately | Microsoft Security Copilot, licensed separately |
| What the code can do, checked from the code | Yes (Test-HostBadgerSafety.ps1) |
No | No | No | No | No | No |
The pieces
| Script | Runs on | Needs | Produces |
|---|---|---|---|
Collect-HostSnapshot.ps1 |
each Windows host | SYSTEM or a local administrator (a standard user works, with gaps) | hostsnapshot_<host>_<time>.zip |
HostBadger.ps1 |
anywhere | nothing (a Gemini key only for the optional AI step) | HTML, CSV and JSONL report for one host or a fleet |
Start-HostBadger.ps1 |
anywhere | nothing | a menu that runs the collector and the analyzer for you |
Start-HostBadgerGui.ps1 |
anywhere | nothing | the same steps in a window, plus a check for a newer HostBadger |
Test-HostBadgerSafety.ps1 |
anywhere | nothing | proof, read from the code, that the collector only reads |
It runs on Windows PowerShell 5.1 or PowerShell 7, and there is nothing to
install: clone the repository, or download the zip, and run the scripts. From
the PowerShell Gallery (Install-Module HostBadger) the same scripts come with
a command each; see Quick start.
If you are not sure where to start, run .\Start-HostBadger.ps1. It is a
small menu: collect this machine, analyze a file, a zip or a folder, analyze
with an AI summary, run the safety review. At the start it says whether it runs
as administrator; if not, it marks the options that need it and offers to
restart itself elevated (Windows asks you to confirm). It stays in the shell you
started it from when it can: with Windows sudo set to inline it runs there;
otherwise it opens a Windows Terminal tab if you are in Windows Terminal, else a
PowerShell window that stays open at the end. The catalogs an analysis
downloads (CISA KEV, LOLDrivers, endoflife.date, Chocolatey, NVD/EPSS, browser
extensions) are kept
next to the report, and the next analysis offers the newest kept copy as the
default, with its date, or a fresh download; a kept copy over a week old is
downloaded again on Enter. When you analyze, it looks for snapshots by
itself (in a snapshots folder, then in the current folder) and lets you take
them all or pick one by number. It can also write one remediation script per
host (previewing until -Apply, with a rollback), and, as administrator,
remediate this machine: it collects and analyzes it (not with debloat and
telemetry only, which depend on its role alone), shows what the fix script
would change, creates a System Restore point where Windows has one and applies
it only after you type YES; another option puts the values back from the
rollback file. It asks for a remediation profile (Essential, Recommended,
Strict, or none for only the safe fixes of the findings). Preinstalled apps
(games, consumer apps, antivirus trials) can be removed there too, one group
at a time on an explicit yes. When an
analysis is done it offers to open the report in your default browser. If you
stop it halfway (Ctrl+C, a closed window), the next start offers to resume
with the answers already given; passwords and keys are asked again, and a
remediation is never resumed (it says whether anything changed and offers the
restore).
The answers that are the same at every run can be saved once with Global
settings (menu 8, in output\hostbadger-settings.json): report folder, DISA
STIG and CIS, each catalog (by default the kept copy if under a week old else
a download; or the kept copy whatever its age, a download every run, or none),
JSON Lines, remediation
scripts, exceptions file, allowed administrators, expected EDR, the AI step
(ask, no, dry run, send, confirm first) and, for a collection, snapshot folder,
file ACLs, missing updates (the Windows Update service contacts the WSUS
server or Microsoft Update) and encryption. When the file exists, each run asks
once whether to use them; with yes those questions are skipped, and the
analysis still lists every answer before it runs, so one can be changed for
that run. Passwords and the Gemini key are never saved; the CSV to compare
with is asked every time.
The window
.\Start-HostBadgerGui.ps1 does the same as the menu in a window (WPF, part
of Windows; nothing to install), in three tabs: Analyze (the form, the
outputs and the log), Fix (what the fix scripts change, and Fix this
machine) and Results (the findings of the last report). The form of
Analyze is on the left, on one page:
- What to analyze: this machine (a read-only snapshot is collected, then analyzed: folder, file ACLs, missing updates naming the WSUS server or Microsoft Update it contacts, encryption) or snapshots already collected (it proposes the newest snapshot of the snapshot folder; File... or Folder... to choose others, and a folder is analyzed host by host, the newest snapshot of each). Collect and analyze (or Analyze) runs it and changes nothing.
- Report: where to save the new report, STIG and CIS, JSON Lines, one report per host (written only when the run has two hosts or more), NIS2 ACN measures, and Also save a fix script for each host: one script per host next to the report, with the changes chosen in the Fix tab, nothing applied (for other hosts: copy each to its host and run it there).
- Catalogs: each offers the newest kept copy when there is one, the copy shipped with HostBadger (LOLDrivers, browser extensions, the lifecycle table: used offline), a download now, or not used for the catalogs HostBadger does not ship. Unless Settings says otherwise, a kept copy under a week old is selected, else the download.
- Your organization: allowed administrators, expected EDR, approved remote tools and extensions, exceptions and policy files, an earlier CSV to compare with.
The Fix tab chooses what the fixes change: one level (only the safe fixes of the findings, Essential, Recommended, Strict, or none of them), each with what it changes, plus two independent options: Debloat (the preinstalled apps and the unused consumer services and components) and Disable telemetry (the privacy and telemetry settings of every level). Strict includes both. The same choices go into the fix scripts Analyze saves when the Report option asks for them. Fix this machine, at the bottom of the tab, collects and analyzes this machine whatever source the Analyze tab has (a collection of this machine made in the window less than 30 minutes before, with the same collection options, is used again, and so is its analysis when the choices have not changed; with No fix of the findings nothing is collected: debloat and telemetry depend only on the role of the machine), then previews its fix script in the log (on the right of the tab, the same as the one of Analyze); a panel above the button gives the number of changes and of those NOT REVERSIBLE, and only its Apply button applies them, while the log can still be read (starting another step withdraws it; administrator, else it offers to restart as administrator; System Restore point first in Windows PowerShell 5.1, rollback file next to the script, linked in Outputs, with the command that undoes it).
The header has Settings, the Safety review and Check for updates. Restart as admin reopens the window elevated in the same folder (Windows asks to confirm), with the settings, the kept catalogs and the choices of the form as they were. Collecting this machine without administrator rights opens a warning first (the checks that need them come out not evaluated): Yes restarts as administrator, No goes on anyway. The status line under the buttons names the step the run is at (a download, a host being analyzed, the report being built). Stop, next to Analyze and to Fix this machine, stops the running step (what would have followed it is not run; stopping fixes being applied asks first). Closing the window while a step runs asks first (a fix stopped halfway leaves part of its changes).
On the right, Outputs links the last report (and the per-host ones), its run log, CSV, JSON Lines, fix scripts, AI prompt and answer, the report folder, the last snapshot and the settings file; at the start it shows the newest report of the report folder, which "Open the last report" opens. Below it is the log of the running step. After an analysis a question offers the AI summary (Settings can turn it off); AI: dry run writes the prompt and AI: send to Gemini sends it, both without analyzing again (the analysis stays in the window's memory until the next one, never on disk). The line under them names the report the summary goes into; Other report... picks an earlier one. With no analysis in memory the buttons ask which existing report to use: its findings are read back from it and the summary is added to it, nothing is analyzed or downloaded. Its snapshot must still be reachable (the one chosen in the form, the snapshot folder or the report's folder), because the names replaced with tokens come from it. Once the report is final a last question offers to open it in your browser: right after the AI question when no summary is asked for, and after the AI step when one is, since that step writes its section into the same file. Outputs and Open the last report open it again at any time.
Results opens by itself when an analysis is done (not when the fixes of
this machine follow: the window stays on the log of their preview). It reads
the CSV the analysis writes next to the report, so it works for an earlier
report too (Other report...; a per-host report has no CSV, choose the
report of the run). It opens on the Overview, read from a JSON block the
report carries (<script type="application/json" id="hostbadger-summary">,
never run by the browser): the score badge (the lowest of the hosts, or the
host chosen), a table of the hosts (score and grade, findings by severity,
checks not evaluated, when and as whom collected; a host name chooses that
host), for one host its operating system, EDR, programs, missing-updates
source and the checks not evaluated with the reason, then the CIS-based and
DISA STIG pass rates, Essential Eight maturity (per host, or the lowest level
of the fleet), the NIS2 ACN measures, the comparison with an earlier run and
what it resolved, the accepted exceptions, the fix scripts written and the AI
summary. A report written before HostBadger 2.0 kept that block has only the
findings. Below the Overview the categories (Antivirus, Credential
Protection, Software...), each with its number of findings and a square of the
colour of its worst one; in the middle the table of the findings (sorted by
severity, any column sorts); on the right the details of the one chosen: what
was found, the value on the host and the one expected, why it matters, how an
attacker uses it, how to fix it, the CIS rule, MITRE ATT&CK, and the fix
script of that host when one was written. Above them: the host (with several),
a search (Ctrl+F; every word must match), one box per severity with its count,
and the CIS-based and DISA STIG findings, which start as the form shows them in
the report. The charts stay in the HTML report (Open the HTML report).
Settings holds what is the same at every run, in the same
output\hostbadger-settings.json as menu 8: snapshot and report folders, the
Gemini model and the number of attempts, whether the DISA STIG findings go to
Gemini, what each catalog proposes (kept copy if under a week old else a
download, the default; kept copy whatever its age, a download every run, never), and the encryption of a new
snapshot. The Gemini and NVD API keys are kept for the window, or, if you tick
Remember, as the GEMINI_API_KEY / NVD_API_KEY environment variables of
your Windows account; a key is never written in the settings file. Each run
also saves the choices of the form there, so the window opens as you left it
(and the guided menu, with its global settings, uses the same choices).
Check for updates asks GitHub for the newest HostBadger. In a git clone
it runs git fetch origin and compares with origin/main; Update then
runs git pull --ff-only origin main, offered only on the main branch with
no local changes, after you confirm. Outside a git clone it reads the version
of HostBadger.ps1 on the main branch (one GET to raw.githubusercontent.com)
and tells you if a newer one is out. Check for updates each time the window
opens in Settings (off by default) runs the same check at every start, and
installs nothing by itself. Nothing else in the window uses the network unless
you ask for a download or the AI step.
Quick start
On one host, as administrator:
.\Collect-HostSnapshot.ps1 # C:\Windows\Temp\HostBadger\hostsnapshot_<host>_<time>.zip
.\HostBadger.ps1 -Snapshot C:\Windows\Temp\HostBadger -OutHtml report.html
Or from the PowerShell Gallery, if you would rather install than clone:
Install-Module HostBadger -Scope CurrentUser
New-HostSnapshot # the collector, as administrator
Invoke-HostBadger -Snapshot C:\Windows\Temp\HostBadger -OutHtml report.html
Invoke-HostBadger -Snapshot (Get-HostBadgerPath 'examples\fleet') # a synthetic fleet to look at first
Copy-Item (Get-HostBadgerPath 'Collect-HostSnapshot.ps1') . # the one file to put on your hosts
The module is these same scripts with a command for each entry point
(Invoke-HostBadger, New-HostSnapshot, which answers to
Collect-HostSnapshot too, Start-HostBadger, Start-HostBadgerGui,
Test-HostBadgerSafety, New-SyntheticHostSnapshot), plus
Get-HostBadgerPath to reach a file inside it. Each command runs its script
file in process, so nothing about a run changes. Everything below names the
scripts: read .\HostBadger.ps1 as Invoke-HostBadger if you installed the
module.
On many hosts, use whatever already runs scripts on them. The collector is one
file and every parameter is optional, so any tool that can run a .ps1 as
SYSTEM or as an administrator will do: an EDR's live response, an RMM, a
Configuration Manager or Intune script, a Group Policy startup script,
PowerShell remoting. Each host writes its snapshot to
C:\Windows\Temp\HostBadger (or to -OutDir, for example a share the computer
accounts can write to); collect the files, put them in one folder and analyze
them together.
With PowerShell remoting (WinRM), from an administrator's machine:
$s = New-PSSession -ComputerName (Get-Content .\hosts.txt)
Invoke-Command -Session $s -FilePath .\Collect-HostSnapshot.ps1
foreach ($x in $s) { Copy-Item -FromSession $x -Path 'C:\Windows\Temp\HostBadger\hostsnapshot_*' -Destination .\snapshots\ }
Remove-PSSession $s
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html
Through CrowdStrike Real Time Response (upload Collect-HostSnapshot.ps1 as a
cloud script first):
runscript -CloudFile="Collect-HostSnapshot" -Timeout=600
get C:\Windows\Temp\HostBadger\hostsnapshot_<host>_<time>.zip
Or with PSFalcon on a host group, and then analyze all the zips together:
Invoke-FalconRtr -Command runscript -Argument '-CloudFile="Collect-HostSnapshot" -Timeout=600' -GroupId <id>
# fetch the zips (get / Invoke-FalconRtr -Command get), then:
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -OutJsonl fleet.jsonl
If a host has several snapshots, the newest one wins.
For a fleet, add -PerHost to get one report per host next to the fleet report
(fleet_<HOST>.html, each with only that host's findings). The guided menu
(Start-HostBadger.ps1) offers it, on by default, whenever the folder holds
snapshots of more than one host.
Encrypted snapshots
A snapshot describes the host in detail, and it waits in a temp folder and in
the file store of whatever tool fetched it. The collector can encrypt it: the output is then
hostsnapshot_<host>_<time>.hbx, the zip is built in memory, and nothing is
written in clear. Two ways:
# A password: AES-256 with an HMAC-SHA256, keys from PBKDF2 (600,000 rounds of SHA-256).
runscript -CloudFile="Collect-HostSnapshot" -CommandLine="-EncryptPassword 'long passphrase'" -Timeout=600
# A certificate (CMS, AES-256): only its public key is needed on the host, as a .cer file
# put there first, or the thumbprint of a certificate deployed to the machine store.
runscript -CloudFile="Collect-HostSnapshot" -CommandLine="-EncryptCertificate C:\Windows\Temp\hostbadger.cer" -Timeout=600
A password given on a command line is kept in the command history or log of
the tool that ran it (EDR, RMM, deployment job); a
certificate leaves no secret on the host or in any log, so it is the better
choice for a fleet. HostBadger.ps1 reads .hbx files like zips: it asks for
the password (or takes -SnapshotPassword, a SecureString), and opens a
certificate snapshot with the private key from the certificate store or from
-SnapshotPfx (its password is asked for, or -SnapshotPfxPassword). A wrong
password or a changed file is reported and that snapshot is skipped. The guided
menu asks for encryption when it collects (no encryption unless you choose it). Deriving the
key takes about 3 seconds per snapshot on Windows PowerShell 5.1 (well under one
on PowerShell 7).
If PowerShell won't run the scripts
On many machines Windows PowerShell refuses to run .ps1 files, because the
execution policy is Restricted, AllSigned or RemoteSigned. You don't have to
change the policy of the machine. Start the script in a PowerShell process that
skips the policy, for that run only:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Start-HostBadger.ps1
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Collect-HostSnapshot.ps1 # from an elevated window
With PowerShell 7 it is the same, with pwsh instead of powershell.exe. In a
window that is already open you can also run
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass, which lasts until
you close the window.
A few things worth knowing:
-ExecutionPolicy Bypassapplies to that one process and changes nothing on the machine.Get-ExecutionPolicy -Listshows which policy is in force.- If Group Policy sets the policy (it shows as MachinePolicy or UserPolicy in that list), the flag can't override it. Ask whoever manages the policy, or have the scripts signed.
- Files that come from the internet carry a "downloaded" mark, and Windows can
ask about them or block them. After you extract the zip, run
Get-ChildItem .\HostBadger -Recurse -Filter *.ps1 | Unblock-File. You can also unblock the zip itself before extracting (right-click, Properties, Unblock). - Through an EDR's live response none of this applies, because the platform
runs the cloud script itself. Other tools differ: Configuration Manager (its
"PowerShell execution policy" client setting) and Intune (its script
signature check option) decide it themselves, a Group Policy
startup script or a scheduled job can call
powershell.exe -NoProfile -ExecutionPolicy Bypass -File Collect-HostSnapshot.ps1, and PowerShell remoting with-FilePathsends the script text, so no file on the host is subject to the policy. - The execution policy is a safety net against accidents, not a security
boundary. Before you run anything as administrator, see what the scripts can
do with
.\Test-HostBadgerSafety.ps1.
Domain-joined hosts
Run the collector on a domain member, a member server or a domain controller the same way as on a standalone machine, elevated or as SYSTEM. What to expect:
- The collector reads the local state only. It makes no LDAP query and no call to a domain controller, and it never enumerates domain users or groups.
- The role (workstation, server, domain controller) comes from
Win32_ComputerSystem.DomainRoleand decides which checks apply. The snapshot also records whether the host is part of a domain. - Domain accounts and groups in the local Administrators group are listed with
their SID and a
DOMAIN/Namepath. Use that form in-AllowedAdmins. - Settings pushed by Group Policy are seen as the values in force on the host
(registry,
secedit,auditpol), not as GPO objects. - A GPO can set the execution policy (see above), and AppLocker or WDAC can
block the script. A section that fails, for instance for lack of rights, is
recorded in
meta.collectionErrorsand its checks are listed as not evaluated. - The snapshot holds real host, domain and account names. Keep it out of the repository.
What HostBadger checks
| Area | Checks | What's in it |
|---|---|---|
| Credential Protection | 28 | LSASS protection (RunAsPPL), Credential Guard (and Credential Guard turned on without the UEFI lock), WDigest cleartext, cached logons, LM hash storage, LM/NTLMv1, anonymous SAM enumeration, Kerberos RC4, CredSSP (CVE-2018-0886), credentials delegated to any server, DSRM logon, passwords left in answer files, Group Policy Preferences or PowerShell history. From the CIS baseline: NTLM session security, anonymous share enumeration, Everyone includes anonymous, PKU2U and NULL session fallback, automatic logon (High when the password is stored). |
| Antivirus and EDR | 20 | Defender real-time protection, the antimalware service itself stopped, tamper protection, signature age, every exclusion (High when it is broad or writable by users: a drive, a profile, Temp, a script extension, powershell.exe), threats set to allow, Microsoft's three standard ASR rules and the others, Controlled Folder Access, brute-force and remote encryption protection. From CIS: Network Protection, PUA blocking, SmartScreen, Enhanced Phishing Protection. EDR agents: one that is installed but stopped (High), the one you expect missing (High), no known EDR at all (Low on a workstation, Medium on a server). |
| Disk and Boot | 11 | BitLocker on the OS volume (High on workstations), TPM without a PIN, fixed data volumes, weak encryption methods, the BitLocker policy, standby with an unlocked disk, the recovery environment on a disk that unlocks itself, shadow copies disabled, Secure Boot, test signing and legacy BIOS. |
| Network Exposure | 38 | SMBv1, SMB signing on server and client, SMB encryption, LLMNR, NetBIOS, mDNS, WPAD, firewall profiles that are off or allow everything in, dropped packet logging, risky listeners (Telnet, FTP, TFTP, SNMP, VNC, databases, caches, WinRM over HTTP on workstations), port forwarding rules (netsh portproxy), WebDAV reachable, a hosts file redirect, a system proxy, a root certificate or a trusted publisher someone added, shares writable by Everyone, insecure Wi-Fi profiles, legacy SCHANNEL protocols and ciphers. From CIS: insecure SMB guest logons, LDAP client and server signing with channel binding, anonymous shares and pipes, the domain secure channel, clear-text SMB passwords, WinRM Basic, Digest and unencrypted traffic, the SMBv1 client driver, IP source routing and ICMP redirects. |
| Remote Access | 6 | RDP without NLA, RDP on workstations, WinRM trusting any host, session shadowing without consent, remote access and RMM tools (with -AllowedRemoteTools). From CIS: RDP security layer, encryption, password prompt, drive redirection. |
| Local Accounts | 20 | The built-in Administrator, Guest, extra members of local Administrators, accounts that may have an empty password, passwords that never expire, enabled accounts nobody has used for months, hidden account names, RID hijacking, members of the privileged built-in groups, LAPS (Windows or legacy), UAC off or silent, LocalAccountTokenFilterPolicy, Administrator protection. From CIS: blank passwords over the network, ForceGuest, UAC secure desktop and the other UAC options, the local password and lockout policy, Guests and local accounts denied remote logon. |
| Privilege Escalation | 18 | Services, privileged scheduled tasks and machine-wide autoruns whose program (High) or folder (Medium) can be written by low-privileged users, folders of the machine PATH users can write or create (High), programs installed in a folder users can write (Medium), unquoted service paths, service permissions, vulnerable drivers (LOLDrivers) and the Microsoft blocklist, named pipes writable by Everyone, AlwaysInstallElevated, Point and Print, Print Spooler on DCs. From CIS: user rights held by more principals than the Level 1 baseline allows, with the member server and domain controller lists on servers (debug, act as part of the OS, load drivers and a few more are High). |
| Persistence | 17 | WMI event subscriptions, IFEO debuggers and SilentProcessExit monitors, DLL load points inside trusted processes (AppInit, LSA packages, print monitors and processors, netsh helpers, time providers, .NET profiler, AeDebug), credential capture through a network provider, hidden services and tasks (Tarrask), a task parked among Windows' own with another author, logon scripts, all-user PowerShell profiles, Office hooks and add-ins, SSH authorized_keys, BITS jobs, replaced accessibility binaries, autostart command lines that download or decode, and a command pasted into the Run dialog or the address bar (ClickFix, FileFix). |
| Logging | 12 | The 16 audit subcategories the CIS benchmark expects (matched by GUID, so any language works), command lines in event 4688, PowerShell script block, module and transcription logging, the PowerShell 2.0 downgrade engine, Security log size, event logging silenced while the audit policy still reads as correct, NTLM auditing, Windows Event Forwarding, Sysmon. |
| Patching | 7 | A Windows build and edition that is out of support or about to be, no Windows update installed within the threshold, updates pending (with -CheckUpdates), a reboot overdue, Automatic Updates turned off by policy, and updates taken from a WSUS server over http. |
| System Hardening | 35 | Application control (WDAC or AppLocker) and a code integrity policy that names the security agent, exploit protection and the VBS settings, Office macro settings and trusted locations a user or an attacker can fill, browser session protection turned off by policy, PowerShell Constrained Language Mode, .NET 3.5, IE11, WSL, developer mode, Recall, sudo, script files that run on open, programs running from removable media. From CIS: AutoPlay and AutoRun, inactivity lock, logon message, last user shown, SEHOP, safe DLL search, and the services the baseline wants disabled. |
| Software | 9 | Installed products matched against the CISA KEV catalog and the NVD (by CPE, with EPSS and public exploit references), products out of support or behind their release line (endoflife.date, Chocolatey), preinstalled bloatware, and browser extensions: known-malicious ids, sideloaded ones, broad permissions, and those outside -AllowedExtensions. |
COVERAGE.md has the full list with severity, MITRE technique,
CIS rule and whether the check comes with a fix script.
Checks know the role of the host (workstation, server or domain controller).
Credential Guard and cached logons don't apply to DCs. The Print Spooler is
judged on DCs (spooler_on_dc) and, as the CIS server benchmarks' one service
rule, on member servers (Level 2, Low: a print server needs it). SMB signing is
High on a DC and Medium elsewhere.
An unencrypted OS volume is High on a workstation and Medium on a server.
Recent attacks 2022-2026
The vectors behind the attacks and research most reported between 2022 and
2026, and the checks that look for the condition each one needs on a host. A
check does not detect the attack: it reports the setting it needs, or the trace
it leaves. Only the checks that look for that condition count: a check that
would make the vector easier or worse, but is not what it needs (Controlled
Folder Access off next to "ransomware cleared the way back", say), is listed as
context in the report and never marks a host exposed on its own. The full table,
including the context checks and the vectors HostBadger deliberately says
nothing about and why, is in
COVERAGE.md and the mapping itself in
data\recent-attacks.json.
| Attack or vector | Years | Checks |
|---|---|---|
| ClickFix and FileFix paste-and-run lures | 2024-26 | run_dialog_payload |
Port forwarding for pivoting (netsh portproxy) |
2023-26 | network_port_proxy |
| Infostealers reading the browser session store | 2024-26 | browser_cookie_protection_off |
| Bring your own vulnerable driver (BYOVD) | 2022-26 | vulnerable_driver_present, driver_blocklist_off, boot_integrity_weakened |
| An application control policy used to stop the EDR | 2024-26 | app_control_policy_suspect |
| Coercion and NTLM relay (PetitPotam and successors) | 2021-26 | ldap_server_signing_off, smb_server_signing_not_required |
| Updates taken over http from a WSUS server | 2015-26 | wsus_insecure_transport |
| BitLocker bypass through the recovery environment | 2024-26 | winre_bitlocker_exposure, bitlocker_tpm_only |
| A task parked among Windows' own, or hidden (Tarrask) | 2022-26 | scheduled_task_masquerade, scheduled_task_hidden |
| Office macros as the way in (trusted locations, unsigned macros) | 2022-26 | office_trusted_location_risky, office_macro_settings_weak |
| Turning the antivirus off before the payload | 2022-26 | defender_service_disabled, defender_tamper_off, defender_exclusion |
| Reuse of a local account nobody watches | 2022-26 | local_account_dormant, local_admin_password_shared, laps_not_configured |
| Bootkits that run before Windows (BlackLotus and successors) | 2023-26 | secure_boot_ca_2023_missing, secure_boot_off, boot_integrity_weakened |
| Active Directory Certificate Services abuse (ESC1 to ESC16) | 2021-26 | adcs_ca_weak_config |
| PsExec-style lateral movement and service installs | 2022-26 | service_install_suspicious, remote_registry_running, restrict_remote_sam_missing |
| Cloud keys and tokens stolen from developer profiles | 2024-26 | developer_secrets_on_disk |
Attack paths
The same findings read the other way round: not one weakness at a time, but the
chains they form. data\attack-paths.json ties each stage of a chain (initial
access, execution, privilege escalation, defence evasion, credential access,
lateral movement, persistence, impact) to the checks that look for the condition
that stage needs, and the dashboard draws the chain stage by stage, for the
fleet and for each host.
A stage is filled when a check of it reports that condition on the host,
grey when nothing about it could be judged (a check not evaluated, or turned
off by -PolicyFile: never counted as clean), and plain when every judged check
of it is clean. A chain is drawn for one host, the worst of those in view,
because the stages of several hosts put together would show a chain that none of
them has.
A complete chain means every stage has an enabling condition on that single host. That is evidence worth acting on, not proof that anyone walked it: a snapshot shows configuration, not behaviour. A chain with a clean stage is not a guarantee either. Nothing here changes the hardening score, and no check exists only for a chain: the panel is a reading of the findings the checks already produced.
| Chain | Stages | Judged on |
|---|---|---|
| Paste-and-run lure to credential theft | access, execution, evasion, credentials, lateral | workstation, server |
| Macro document to persistence | access, execution, persistence | workstation, server |
| Standard user to SYSTEM | privilege escalation, evasion, credentials, persistence | all |
| Vulnerable driver to the kernel and the security agent | privilege escalation, evasion, credentials | all |
| Name resolution relay to lateral movement | access, credentials, lateral | all |
| Exposed remote service to session takeover | access, credentials, lateral | all |
| Stolen laptop to the data on the disk | access, credentials | workstation |
| Browser extension to the session cookies | access, credentials | workstation, server |
| Ransomware with the brakes off | evasion, impact | all |
| Domain controller taken from the network | access, credentials, lateral | domain controller |
| Known-vulnerable software to code on the host | access, execution, evasion | all |
| Anonymous access to a local administrator account | access, credentials, lateral | all |
| Print spooler to SYSTEM | privilege escalation, persistence, evasion | all |
| Secrets left on the disk to a privileged account | credentials, privilege escalation, lateral | all |
| Removable media to execution | access, execution, persistence | workstation, server |
Where to break it. A chain holds only while every stage of it stays open, so one stage is enough to break it. For every chain complete on the host it is drawn for, the report names the stage that is cheapest to close: first a stage whose reported checks all have a fix script, then the one with the fewest checks to settle, then the earliest stage of the chain. That stage is outlined in the drawing and the panel says what closing it costs; the other open stages are listed as they were, because the cheapest stage is where to start, not the only one that matters.
Every stage with its checks is in
COVERAGE.md, and the JSON Lines host summary
carries attack_paths_complete, attack_paths_partial, attack_paths_judged,
attack_paths_total, attack_paths_open_stages, attack_paths_break
(<chain>:<stage>) and attack_paths_break_checks.
EDR agents
HostBadger reads the list of services, which the collector already collects,
and recognises the agents of the well-known EDR and endpoint protection
products: CrowdStrike Falcon, SentinelOne, Microsoft Defender for Endpoint,
VMware Carbon Black, Palo Alto Cortex XDR, Sophos Intercept X, Trend Micro
(Apex One and Deep Security), Trellix / FireEye / McAfee ENS, ESET, Symantec /
Broadcom, Elastic Defend, Cybereason, Cylance, Bitdefender GravityZone and
Huntress. The Hosts table of the report and the host_summary lines of the JSON
Lines say which one each host runs.
- An agent that is installed but whose service is not running is High. The host is blind, and a stopped agent is what an attacker leaves behind.
- With
-ExpectedEdr CrowdStrike(or several names), a host that doesn't have that product is High. This is the check that matters in practice, because it finds the hosts that your SOC doesn't see. - Without it, a host with no known EDR at all is reported: Low on a
workstation, Medium on a server or a domain controller. Microsoft Defender
Antivirus alone doesn't count as EDR. Defender for Endpoint counts once it is
onboarded, which is when its
Senseservice runs.
A product is found by the name of its main service, or by the display name of a
service. If yours isn't recognised, name its service with
-ExtraEdrServices MyAgentService. -ExpectedEdr also takes any other text,
which is then looked for in the service names.
The service names come from the vendors' documentation and common practice, and
vendors rename them between versions. If a host that runs an EDR is reported as
having none, compare its service name with the list in lib\Checks.ps1
($script:EdrProducts) and add it with -ExtraEdrServices. HostBadger doesn't
check that an agent is healthy, up to date or talking to its console. It only
knows that a service is there and running.
Remote access tools
AnyDesk, TeamViewer, RustDesk, ScreenConnect, Splashtop, LogMeIn, GoTo, Atera,
NinjaOne, Chrome Remote Desktop, VNC servers, Radmin, DameWare, NetSupport,
MeshCentral and the other tools in $script:RemoteAccessTools are found by
service and by installed program. Name the ones the organization approves with
-AllowedRemoteTools TeamViewer,ScreenConnect and only the others are
reported, as Medium. Without the list every tool found is Low, to be verified.
Browser extensions
The collector reads the extension list of Chrome, Edge, Brave, Vivaldi and
Chromium (Secure Preferences / Preferences of every profile) and of Firefox
(extensions.json) for every user folder on the host: id, name, version, on or
off, where it came from (store, file, unpacked in developer mode, pushed by
policy, unsigned) and what it may read (permissions, host permissions, content
scripts). Nothing is opened in the browser and no page is visited.
browser_extension_malicious: the id is on the list of extensions removed from the Chrome Web Store, Edge Add-ons or Firefox Add-ons. High for malware, spyware or a critical vulnerability, Medium for adware, hijacking or unwanted software, Low for the other reasons and for an extension switched off in every profile. The list ships indata\malicious-extensions.json: the malicious_extension_sentry list (malext.io, updated daily) and Wladimir Palant's list of potentially malicious extensions.-ExtensionsOnlinedownloads the current store list (one GET from raw.githubusercontent.com) and keeps a copy next to the report;-ExtensionsFilereuses that copy or amalicious_extensions_detailed.csvyou downloaded yourself.tools\Convert-MaliciousExtensions.ps1rebuilds the shipped file.browser_extension_sideloaded: loaded in developer mode, from a file outside a store, or unsigned (Firefox). Medium.browser_extension_not_allowed: with-AllowedExtensions(ids or names, wildcards allowed), every extension not on the list and not pushed by policy. Medium.browser_extension_broad_access: without a list, an extension that can read every site, with the sensitive APIs it also uses (cookies, scripting, web requests, native messaging...). Low, to be verified.
An extension found in several profiles is one finding that names each browser, user and profile.
Fleet checks
Some problems show only across hosts, so they are judged once every host is analyzed (a run with a single host has none):
- the same local account with its password set at the same second on several hosts (one image or one script set it, so it is the same password: High);
- the same machine SID on several hosts (cloned without Sysprep: Medium);
- the settings where a host differs from at least 80% of the hosts with its role, in a fleet of five or more (Low, left out of the score).
The CIS baseline
34 of the checks follow a rule from the CIS Microsoft Windows 11 Enterprise
Benchmark v3.0.0. The rule number shows up in the finding, in the report and
in the cis field of the JSON Lines.
Most of them read registry values and nothing else. They judge a value only when it is set, with a few exceptions where the Windows default is itself the problem (AutoPlay, the logon screen, the inactivity lock, the anonymous share restriction).
HostBadger is not a CIS conformance scanner. The benchmark has several hundred rules and HostBadger reads a part of them. It covers the local password and lockout policy and the Level 1 user rights, but only a few of the administrative templates.
Windows 10, servers and domain controllers have their own benchmarks, with
other rule numbers. On Windows 10 a finding quotes the CIS Microsoft Windows 10
Enterprise Benchmark v3.0.0; on Windows Server 2022 and 2019 the CIS
Microsoft Windows Server 2022 / 2019 Benchmark v4.0.0, on Server 2016 the
v3.0.0 of its benchmark: the domain controller or the member server variant,
by the host's role, with that benchmark's profile level. Other versions
(Windows Server 2025, 2012 R2) keep the Windows 11 numbers. The
cis_benchmark field of the JSON Lines (and the CisBenchmark column of the
CSV) names the benchmark. The expected values the checks use are the same in
these benchmarks for every setting HostBadger reads; one exception is handled
(a domain controller needs the LSARPC, NETLOGON and SAMR pipes open to
anonymous users). A rule with no counterpart in the host's benchmark
(BitLocker on a server, for instance) is quoted as Windows 11 x.y.z, never
with a guessed number.
User rights and the deny logon rights follow the member server and domain controller lists of the server benchmark (for example, a domain controller also expects Authenticated Users and ENTERPRISE DOMAIN CONTROLLERS on network logon, and only Administrators may add workstations to the domain: CIS Server 2.2.5, which Windows grants to every authenticated user by default). The local password and lockout policy is not judged on domain controllers, where it is the domain policy; the CIS list of services to disable is the workstation one.
A few rules exist only in the server benchmarks and have their own checks: on domain controllers the Zerologon exception list, refused machine account password changes, Server Operators scheduling tasks and LDAP signing and channel binding (2.3.5.x); on servers the shutdown button on the logon screen, unlocking without a domain controller and the Windows LAPS password expiration protection, the minimum SMB dialect and SMB client encryption (18.6.7.1, 18.6.8.2), Defender exclusions hidden from local users and scanned on a quick scan (18.10.43.13.1, 18.10.43.17), the Remote Desktop per-session temporary folders and single-session limit (18.10.57.3.x), the Mark of the Web on files copied from insecure sources (18.10.29.2), the App Installer / winget restrictions (18.10.18.x), the default IPv6 DNS servers and Internet Explorer feed Basic authentication (18.6.4.3, 18.10.58.2) and the LDAP client encryption requirement (2.3.11.8); and on domain controllers the ROCA-vulnerable Windows Hello for Business key validation and NTLM-in-domain auditing (18.9.39.1, 2.3.11.13). On a server that is not 2022, 2019 or 2016 they quote the Server 2022 number; so does the Windows LAPS rule on Server 2016, whose benchmark still covers legacy LAPS.
The rule numbers and expected values come from the MIT-licensed
ansible-lockdown/Windows-11-CIS
role; the mapping to the other benchmarks (data\cis-map.json, built by
tools\Convert-CisMapping.ps1) from the
Windows-10-CIS,
Windows-2022-CIS,
Windows-2019-CIS and
Windows-2016-CIS roles
(MIT): two rules are the same setting when they write the same registry value,
or, without one, when they have the same title.
Design rules
- Read only. The collector reads the registry, CIM classes, the Defender,
SMB, firewall, BitLocker, local account and scheduled task cmdlets, and file
ACLs (
Get-Acl), and it reads each driver file to compute its SHA-256 (Get-FileHash), and the Authenticode signer of the DLLs and programs Windows starts from a load point (LSASS, the print spooler, netsh, network, credential and time providers, print processors, ServiceDlls, the .NET profiler, the crash debugger, the logon screen tools) and of Office COM add-ins, withGet-AuthenticodeSignature. Of a network provider DLL and of an LSA notification package it also reads the export table, by parsing the file's bytes, to tell whether the DLL registersNPLogonNotifyorInitializeChangeNotifyand so is handed passwords: the DLL itself is never loaded. It reads the recovery environment's own configuration file (System32\Recovery\ReAgent.xml, noreagentccall) and the date ofwinre.wimwhere that file is reachable, and the bytes of the App Control policies in force (System32\CodeIntegrity) to keep only the file names their rules mention: no policy is parsed as a policy, applied or changed. It lists the BITS jobs withGet-BitsTransfer -AllUsersand, as SYSTEM, reads the F value of each SAM account (its RID), never the password hashes. Setup answer files, Group Policy Preferences files and PowerShell histories are read to count the passwords they hold, authorized_keys files to count the keys, and the Credential Manager folders to count the saved credential files: no password, key, credential or history line is kept. Only with-NamedPipesit opens each named pipe for reading for a moment to read its permissions and, through the one P/Invoke it compiles (GetNamedPipeServerProcessId, kernel32), the process that exposes it (nothing is sent or read through the pipe). That call is read-only and is the only compiled C# the safety review allows, in the collector alone. It reads the audit policy withauditpol /backupand the local security policy withsecedit /export, each into a temporary file that is deleted right away. It never uses/configureor/import. When the registry does not let it read a service's permissions (a run without administrator rights), it askssc.exe sdshow, which only prints them. It changes no setting and starts no process. Network traffic exists only when you ask for it, and the address is named each time: the Windows Update Agent's own search (-CheckUpdates, the WSUS server set by policy or Microsoft Update), one GET of the CISA KEV catalog (www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json,-KevOnline), one GET of the LOLDrivers catalog (www.loldrivers.io/api/drivers.json,-DriversOnline), one GET of the endoflife.date lifecycle data (endoflife.date/api/v1/products/full,-EolOnline), GETs of the Chocolatey package versions (community.chocolatey.org/api/v2/,-ChocoOnline), GETs of the NVD CVE API (services.nvd.nist.gov,-CveOnline, by product, withNVD_API_KEYas a header when set) and one GET of the FIRST EPSS file (epss.empiricalsecurity.com,-CveOnline), one GET of the list of browser extensions removed from the stores (raw.githubusercontent.com/toborrm9/malicious_extension_sentry/main/malicious_extensions_detailed.csv,-ExtensionsOnline), one GET each of the Metasploit module metadata (raw.githubusercontent.com/rapid7/metasploit-framework) and the Exploit-DB index (gitlab.com/exploit-database/exploitdb,-ExploitsOnline) and the Gemini call (-SendToAI). The code that sends or downloads lives inlib\AI.ps1only.Test-HostBadgerSafety.ps1checks all this from the code and fails on any command that is not on its reviewed list. The regression suite runs it on the real code and on a tampered copy. - An encrypted snapshot is never in clear on disk. With
-EncryptPasswordor-EncryptCertificatethe zip is built in memory and only the.hbxis written; the snapshot records which mode was used, never the password. - STIG values are a fixed list. The
stigsection reads the 514 registry values ofdata\stig-catalog.json(embedded in the collector, which stays one file) from HKLM and from the HKU hives of users who are signed in. It reads nothing else and loads no hive.tools\Convert-PowerStigData.ps1rebuilds both from PowerSTIG files you download yourself; it never touches the network. - A gap is never an all-clear. Each section is collected on its own. If
one fails (a standard user can't read BitLocker, Defender exclusions or the
audit policy, for example) the failure is written into the snapshot, and
every check that needs that section is listed in the report as not
evaluated for that host. The same happens when Defender is in passive mode
because another antivirus is primary, when ACLs were skipped with
-SkipAcl, and when Device Guard status can't be read. - Deterministic. Every age (patches, signatures, passwords, support dates) is counted from the moment of collection, not from today. The same snapshot always gives the same findings.
- Secrets stay on the host. The privilege escalation checks need the
command lines of services, tasks and Run keys. Anything that looks like a
password argument (
-p,/password:,pwd=and so on) is masked before the snapshot is written. Even so, a snapshot describes the host in detail, so treat it as confidential.
The report
- The top has cards: the grade of the host, or for a fleet the number of hosts, the average score and the weakest host, plus findings by severity.
- Incomplete coverage lists each check that was not evaluated, on which hosts and why.
- Protection against recent attacks takes the vectors of 2022-2026 from
data/recent-attacks.jsonand says, for each, whether a check that looks for the condition it needs reports something: the hosts it is exposed on, the hosts where none of its checks could be judged, and the rest. Each row opens on what the vector needs, the checks that fired and the ones that could not be judged. Exposed means the condition is on the host, or that it left a trace there, not that the attack happened; "nothing found" is not a guarantee either, andCOVERAGE.mdlists the kinds of attack a configuration snapshot cannot see at all. - Hosts shows role, OS and build, when it was collected, whether it ran as SYSTEM, administrator or a standard user, and the score and counts.
- Further down you find a summary by category, the findings grouped by check (why it matters, how to fix it, a MITRE link and one row per host and object), the comparison with a previous run, accepted risks, and a table of every finding that you can filter.
The score of a host is 100 × e−penalty/100. Each triggered check adds a weight for its worst severity (Critical 20, High 8, Medium 3, Low 1), and the Low checks add 10 at most, so many minor gaps do not sink a host. Any Critical caps the score at 35, and any High at 65. The score measures exposure: the DISA STIG rules (and the Brave adaptation of the Chrome STIG) are compliance with a policy baseline and are shown on their own, as compliance per product, not in the score. A KEV name match on a program that the CVE data already judged by its version is listed but not counted twice. A STIG value that no policy sets is still a finding, at Low, when the snapshot shows the setting in effect is the compliant one (firewall profiles, Defender protection and signature age).
examples/demo_report.html is a full report on the synthetic fleet in
examples/fleet/. It has five hosts: a neglected workstation, a hardened
server, a managed laptop, a domain controller, and a host collected as a
standard user with Defender in passive mode.
Options
.\HostBadger.ps1 -Snapshot <files|zips|folders>
[-OutDir .\output] # default output folder; a bare -Out* name lands here
[-OutHtml report.html] [-OutCsv findings.csv] [-OutJsonl siem.jsonl]
[-CompareTo previous_findings.csv] # new and resolved findings
[-History .\output\hostbadger-history.csv] # keep every run's score per host: the report shows how each host moved
[-Threads 0] # hosts analyzed at once: 0 = up to 4 from 16 hosts, 1 = one at a time
[-ExceptionsFile exceptions.json] # accepted risks, with an owner and an expiry
[-PolicyFile policy.json] # your organization's policy: the checks it turns off
[-AllowedAdmins 'CORP/Workstation Admins', 'S-1-5-21-...-1105']
[-MaxPatchAgeDays 45] [-MaxSignatureAgeDays 7] [-SupportWarningDays 90]
[-MaxCachedLogonsWorkstation 4] [-MaxCachedLogonsServer 1] [-MinSecurityLogKB 196608]
[-DormantAccountDays 180] # days without a logon before an enabled local account counts as dormant
[-ExpectedEdr CrowdStrike] [-ExtraEdrServices MyAgentService] # the EDR every host should run; services to count as an agent
[-AllowedRemoteTools TeamViewer,ScreenConnect] # approved remote access tools: the others are Medium
[-AllowedExtensions 'cjpalhdlnbpafiamejdnhcphjbkeiagm','Bitwarden*'] # approved browser extensions (ids or names): the others are Medium
[-OutRemediation .\fixes] # one remediate_<host>.ps1 per host, with a rollback file
[-RemediationProfile Recommended] [-RemediationDebloat] [-RemediationPrivacy] # add a hardening profile (Essential, Recommended, Strict), debloat (preinstalled apps, unused consumer services and components) and/or the privacy and telemetry settings to those scripts
[-PerHost] # also one HTML report per host: <report>_<HOST>.html
[-SkipStig] # leave out the DISA STIG checks (about 1,400 registry rules)
[-KevFile known_exploited_vulnerabilities.json] | [-KevOnline] # match installed software to the CISA KEV catalog (-KevOnline downloads it from www.cisa.gov)
[-DriversFile drivers.json] | [-DriversOnline] # a LOLDrivers catalog you have, or a fresh one (-DriversOnline downloads it from www.loldrivers.io)
[-EolFile r_eol.json] | [-EolOnline] [-SoftwareGraceDays 30] # software lifecycle data (-EolOnline downloads it from endoflife.date): current end-of-support dates and software_outdated
[-ChocoFile r_choco.json] | [-ChocoOnline] # program versions from community.chocolatey.org (7-Zip, VLC, Git, GIMP, WinSCP, PuTTY...) for software_outdated
[-CveFile r_cve.json] | [-CveOnline] # CVEs from services.nvd.nist.gov and EPSS scores from epss.empiricalsecurity.com, for software_cve
[-ExploitFile r_exploits.json] | [-ExploitsOnline] # Metasploit and Exploit-DB references for the CVEs above (raw.githubusercontent.com, gitlab.com); a ready Metasploit exploit raises the finding to High
[-ExtensionsFile r_extensions.json] | [-ExtensionsOnline] # browser extensions removed from the stores (-ExtensionsOnline downloads them from raw.githubusercontent.com)
[-Nis2Acn] # Italy: add the NIS2 basic security measures of ACN (Determinazione 379907/2025) to the report and JSON Lines
[-SnapshotPassword <SecureString>] [-SnapshotPfx <file.pfx> [-SnapshotPfxPassword <SecureString>]] # open encrypted .hbx snapshots (asked for when missing)
[-HideCis] [-HideStig] # keep those findings out of the HTML listing (CSV and JSON Lines keep them)
[-AiIncludeStig] # also send the STIG findings to Gemini (large prompt, may time out)
[-SendToAI [-AiConfirm]] [-AiDryRun prompt.txt] [-AiReport report.html] [-ApiKey <key>] [-Model gemini-3.8-flash] [-AiMaxAttempts 3]
[-OutLog run.log] | [-NoLog] # run log, default <report>.log next to the report
.\Collect-HostSnapshot.ps1 [-OutDir <folder>] [-NoZip] [-SkipAcl] [-CheckUpdates] # -CheckUpdates: the Windows Update service searches for missing updates (network)
[-EncryptPassword <text> | -EncryptCertificate <.cer file or thumbprint>] # write an encrypted .hbx, nothing in clear
[-NamedPipes] # also read who may write to each named pipe (each is opened for a moment)
An exception (see examples/exceptions.example.json) has a type, a host
and an object (* matches anything), a reason, an owner and an
expires date. Once an exception has expired it is ignored and listed, so the
finding comes back.
A policy (see examples/policy.example.json) is the other way round: it says
which checks do not apply to your organization at all, for every host and with
no expiry. A check it turns off is not run, does not count in the score or in
the CIS and Essential Eight panels (a requirement judged only by that check is
not shown as met), and is listed in the report with the policy's name and the
reason; the JSON Lines host summary names it in policy_disabled_checks.
Names may use * ("stig_*" turns every DISA STIG product off), and a name
that matches no check stops the run, so a typo cannot leave a check on
unnoticed. The guided menu keeps a policy file in the global settings (menu 8)
and shows it before every analysis.
{ "name": "Contoso baseline",
"disabledChecks": [ { "check": "bloatware_installed", "reason": "consumer apps allowed" }, "stig_firefox" ] }
-CompareTo matches findings by check, host and object. A host that is
missing from this run is not counted as resolved. It just wasn't collected.
-History keeps the score of every run: one CSV line per host and snapshot
(host, collection time, score, grade, the counts by severity, the checks not
evaluated, the HostBadger version). The file is created when missing and
shared by every run that names it; a snapshot analyzed again replaces its own
line, and each host keeps its newest 100. With an earlier score in it, the
Hosts table of the report gets a Trend column (a line of the score over the
runs, the change since the previous snapshot), the window's overview a Change
column, and the JSON Lines host summary score_previous,
score_previous_collected, score_change and score_history_points. The
guided menu and the window keep it next to their reports
(hostbadger-history.csv). A file whose first line is not the history header
is left alone.
Large fleets: with 16 hosts or more the hosts are analyzed several at once
(up to 4; -Threads sets the number, -Threads 1 turns it off), on Windows
PowerShell 5.1 and PowerShell 7 alike. Each worker loads the checks once, and
the result is the same file for file as one host at a time. Everything after
the per-host checks (fleet checks, scores, CSV, JSON Lines, the report) grows
with the number of findings, not with hosts times findings.
Fix scripts
Under each check in Findings by check, the report shows a Fix script
whenever the check has a safe, standard fix. It is plain PowerShell with a Copy
button. COVERAGE.md tells you which checks have one.
If several hosts need the same changes, they share one script. A note says
how many of the check's findings the script covers. For every setting the
script prints "old -> new", and it changes nothing until you set
$Apply = $true. An Undo line tells you how to go back: put the old value
back, or remove the value if it was not set before.
A fix gets a script only when all of this is true:
- it is a single setting, and the value is the one the benchmark or Microsoft expects;
- you can undo it;
- nobody has to make a choice for it (no banner text, no list of allowed administrators);
- it doesn't depend on hardware, a firewall rule or the directory.
On a neglected workstation that covers about 60% of the findings: LSA, NTLM, SMB, LDAP, WinRM, RDP, UAC, AutoPlay, the logon screen, Windows Update, SmartScreen, event log size, PowerShell logging, SEHOP and the IP stack; SMB signing, SMB encryption and SMBv1; CredSSP (CVE-2018-0886) and WPAD; LDAP signing and channel binding on a domain controller; Defender real-time protection, PUA and Network Protection; the firewall profiles; the PowerShell 2.0 engine; the Guest account; the WebClient (WebDAV) service; and the Print Spooler on a domain controller or on a server that has no printer.
LSASS protection (RunAsPPL) deliberately has no fix script: the value the
benchmark asks for sets a UEFI variable, so removing the registry value again
does not turn it off. It is in the Strict remediation profile instead, printed
as NOT REVERSIBLE.
If you roll fixes out with scripts, you can also ask for one file per host, with all of that host's fixes and a rollback file:
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -OutRemediation .\fixes
# on a pilot host, in Windows PowerShell 5.1 as administrator:
.\remediate_WKS-ACCT-017.ps1 # preview: shows every change, changes nothing
.\remediate_WKS-ACCT-017.ps1 -Apply # offers a System Restore point, applies, and writes rollback_WKS-ACCT-017_<time>.json
.\remediate_WKS-ACCT-017.ps1 -Apply -RestorePoint # no console (RMM, EDR job): makes the restore point without asking
.\remediate_WKS-ACCT-017.ps1 -Restore .\rollback_WKS-ACCT-017_<time>.json -Apply # undo
The snippets in the report also preview by default and show "old -> new". What only the per-host file adds is the rollback file and the check on the computer name. That file:
- Previews by default. Nothing changes without
-Apply. The preview reads the current value of every setting and says either "already set" or "would set A -> B". - Keeps a way back. Before each change, the old value (or the fact that
there was none) goes into a rollback file. The file is rewritten after every
change, so even an interrupted run can be undone.
-Restoreputs the values back and removes the ones the script created. Before the first change,-Applyoffers a System Restore point when it runs at a console (Enter makes it);-RestorePointmakes it without asking and-NoRestorePointskips it. With no console and neither switch it says so and goes on, so an unattended run never waits. Windows has no System Restore on servers or in PowerShell 7, and makes at most one point a day: the rollback file is the way back in every case, the restore point is the way back for what the rollback file cannot undo (a removed app). When System Protection is off (the default on many new and virtual machines), Windows refuses the point with "service disabled": at a console the script, and menu 6, offer to turn it on for the system drive first. - Checks where it runs. It stops if the computer name is not the one in
the snapshot (
-IgnoreHostNameoverrides that), and it refuses-Applywithout administrator rights. - Can be run twice. A second run changes nothing.
- Is easy to read. Every line is a call to one of seven helper functions
at the top of the same file. There is no download, no hidden code and
nothing gets deleted. The regression suite checks that, and it also runs the
registry part for real in a private branch of
HKCU: preview, apply, apply again, restore.
The collector and the analyzer never run these scripts: they only write text
and stay read-only. The one exception is the guided menu's "Remediate this
machine" (Start-HostBadger.ps1, option 6, as administrator): it runs this
machine's own script, after showing what it would change and asking you to type
YES, with a System Restore point first where Windows has one (a snapshot of this
machine already taken can be used instead of collecting again); option 7 puts the
values back from the rollback file. Test-HostBadgerSafety.ps1 allows the
commands it needs (restore point, removing preinstalled Store apps) in that file
only, and lists them. The same file may also restart itself as administrator
(Start-Process -Verb RunAs, after asking; Windows confirms) and nothing else
may start a process.
Some fixes are left out on purpose, and for those the report keeps the written remediation:
- banner text and the list of allowed administrators, which are your call;
- password and lockout policy, which affect your users;
- services to disable, unquoted service paths, NetBIOS, ASR rules, audit policy and Defender exclusions, which can break software;
- BitLocker, Credential Guard and LSA protection, which depend on hardware, recovery keys, drivers and a restart;
- LAPS, which needs the directory;
- user rights, local administrators, scheduled tasks and autoruns;
- Secure Boot and an unsupported Windows, which need an upgrade.
Remediation profiles
The fixes above answer the findings one by one and stay within "one setting, reversible, no decision". A profile is the other way round: a fixed list of settings you choose as a whole, added to the same per-host script (and to menu 6, which asks for it; menu 8 keeps a default):
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -OutRemediation .\fixes -RemediationProfile Recommended
| Profile | On top of the fixes of the findings |
|---|---|
| Essential | CIS Level 1 and Essential Eight Maturity Level One settings that are safe on any machine: consumer experiences and Remote Assistance off, required diagnostic data only, Xbox, SSDP, UPnP and other unused services disabled, Internet Explorer 11 removed |
| Recommended | Essential, plus the rest of CIS Level 1 that fits a managed machine and Essential Eight Maturity Level Two: the 13 CIS attack surface reduction rules in block mode, Cortana and widgets off, SSH server, hotspot, IIS and FTP services disabled on workstations |
| Strict | Recommended, plus CIS Level 2, Essential Eight Maturity Level Three (LSA protection, .NET 3.5 and PowerShell 2.0 removed) and opinionated hardening: three more ASR rules, outbound firewall rules for the download tools (certutil, mshta, wscript, cscript, regsvr32, wmic, bitsadmin, hh), script files opened as text, Windows Script Host off, the telemetry services and scheduled tasks, Windows Fax and Scan, Work Folders, Steps Recorder and Math Recognizer removed (optional Windows capabilities: the rollback adds them back from Windows Update), and the removal of preinstalled apps (games, Bing apps, Copilot, the new Outlook, personal Teams, Phone Link, Quick Assist, third-party trials, Dell and Samsung extras) |
Each line of the script names the setting, the tier and the rule it comes from
(data\remediation-profiles.json; CIS rule numbers and values from the
MIT-licensed ansible-lockdown Windows-11-CIS role). Settings are filtered by the
host's role, and the script still reads every value first and skips what is
already set or not installed. -RemediationDebloat adds the debloat, with or
without a profile: the removal of the preinstalled apps and the unused consumer
services and components (Xbox services, Windows Media Player sharing, Maps,
Retail Demo, Windows Insider, PushToInstall, Windows Fax and Scan, Work
Folders, Steps Recorder, Math Recognizer; debloat: true in the catalog); -RemediationPrivacy adds the
privacy and telemetry settings of every tier (diagnostic data, speech and
input personalization, feedback, error reporting, activity upload, cloud
search and search highlights, news and interests, the DiagTrack service, and
the Customer Experience Improvement Program, Compatibility Appraiser,
Feedback and Family Safety scheduled tasks, which the rollback enables
again). The two together, with no
profile, plus -RemediationOnlyProfile (which leaves the safe fixes of the
findings out), are "debloat and telemetry only" (choice D in menu 6): no
hardening setting at all. A setting where a lower value is stricter
(diagnostic data) is never raised: the script leaves a stricter value alone. -RemediationNoApps leaves the app removals out even with
Strict or -RemediationDebloat: menu 6 uses it, lists the apps it finds on
the machine and removes them all on Enter (or asks group by group), then
proposes a restart (type YES to restart at once).
A profile embodies choices: Strict turns off Bluetooth, location, Windows Subsystem for Linux and Windows Script Host, which some people need. Some changes cannot be undone by the rollback file (an app removed comes back only from the Microsoft Store; LSA protection sets a UEFI lock): the preview marks them NOT REVERSIBLE and counts them, and menu 6 creates a System Restore point first. Left out of every profile on purpose: services whose loss breaks a core function (Print Spooler, Server, Remote Desktop, WinRM, push notifications) and the virtualization-based security settings that set a UEFI lock. Try a profile on a pilot machine before a rollout.
Keep in mind that Group Policy or Intune can put a setting back, so for managed machines fix it there. Several fixes need a restart, and the script says which. A few change behaviour (NTLMv1 clients, unsigned SMB peers), so preview, read the line and try it on one host first.
The AI step (Gemini)
This is optional and off by default. After the report is written, HostBadger can ask Gemini for an executive summary, a remediation plan grouped in work packages, quick wins, what to monitor in the meantime (with event IDs), the hosts to work on first, PowerShell snippets for the routine fixes, and the findings re-ranked by how exploitable they are across the fleet. The model writes on top of the findings. It never decides what a finding is.
$env:GEMINI_API_KEY = '<key>'
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -AiDryRun prompt.txt # see exactly what would go out, send nothing
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -SendToAI -AiConfirm # read the prompt first, then answer y/N
.\HostBadger.ps1 -Snapshot .\snapshots\ -OutHtml fleet.html -SendToAI # unattended
.\HostBadger.ps1 -AiReport fleet.html -Snapshot .\snapshots\ -SendToAI # on a report already written: nothing analyzed or downloaded
The launcher offers the same thing right after it writes the report.
Getting and setting the API key
Go to aistudio.google.com/api-keys, sign in with a Google account and click Create API key.
Give the key to HostBadger through the
GEMINI_API_KEYenvironment variable, in one of two ways:# for this window only (it is gone when you close the window) $env:GEMINI_API_KEY = "your-key-here" # for good, for your user account [Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your-key-here", "User")A variable set the second way only takes effect in new windows, not in the one that set it.
Check it in a new window:
$env:GEMINI_API_KEYshould print the key. To remove it, run[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", $null, "User").
-ApiKey <key> works too, but then the key stays in your command history, so
prefer the variable. If the variable isn't set, the launcher asks for the key
and keeps it for that session only. HostBadger never writes the key to a file,
to a report or to the saved copy of the prompt. Keep it out of chats, tickets
and the repository as well.
How your data is protected:
- It's your choice. Without
-SendToAIor-AiDryRun, nothing is built and nothing is sent, and HostBadger never asks. The key comes from-ApiKeyor from theGEMINI_API_KEYenvironment variable (see below). - Tokens instead of names. Host names, FQDNs, domains, accounts, groups,
SIDs, paths, the names of services, tasks, autoruns and adapters, listener
processes and addresses are replaced by tokens like
HOST-1,USER-2andPATH-3. Names that are the same on every Windows machine (Administrator,Users, stock tools such aspowershell.exe) stay as they are. A path token carries the one fact the model needs, which is whether the location can be written by low-privileged users. The map from tokens to names never leaves your machine, and the real names come back only in your local report. - No error text. The collector's error messages are never sent. The model only learns that a check was not evaluated on a host.
- A second look. Before sending, the text is scanned again for every original name, domain suffix, SID, UNC path, drive path and IP address. If anything is left, nothing is sent.
- A small payload. It is the findings grouped by check (12 lines each), the host table, the coverage gaps and the comparison. It is never a snapshot.
- A copy of what went out.
<report>_ai_prompt.txtand<report>_ai_response.jsonare written next to the report, still pseudonymized. The token map is never written to disk. - Checking the answer. Anything about a check that didn't fire, and any host token the map doesn't know, is thrown away. The section is labelled as written by AI.
- How it connects. The key travels in a header, not in the URL.
HOSTBADGER_GEMINI_BASEURLpoints the call at an internal gateway. Timeouts and busy-server errors are retried (-AiMaxAttempts, and 0 means keep trying).Test-HostBadgerSafety.ps1fails on network code outsidelib\AI.ps1and on any address other than the Gemini endpoint. - When Gemini is overloaded. If the retries end on HTTP 503 (model
overloaded) or 429, a smaller model often gets through: run again with, for
example,
-Model gemini-3.5-flash-lite. Model names change over time; the current ones are listed on the Gemini models page.
The model is asked for defensive output only. The PowerShell snippets it suggests are just text in the report, and HostBadger never runs them.
SIEM export
-OutJsonl writes one JSON object per line. A finding has a stable
finding_id for each check, host and object, plus a status of new or
persisting when you use -CompareTo. found and expected hold the value
on the host and the value the CIS benchmark or the DISA STIG requires (null
when the check has no single value, such as the list of audit subcategories),
and cis_benchmark names the CIS benchmark the cis rule comes from. A resolved line says the finding has
gone. There is also one host_summary per host, with score, grade, counts,
not_evaluated_checks, policy_disabled_checks (turned off by -PolicyFile), whether it was collected as SYSTEM, with -History score_previous, score_previous_collected, score_change and score_history_points (null previous and change on a host's first run), and e8_levels
(the Essential Eight maturity level per strategy, null when a host cannot show
it) with e8_capped (strategies where a requirement of the next level could
not be judged), and, with -Nis2Acn, acn_unmet / acn_not_judged (the ACN basic measures
with a finding against them on that host, and those none of whose checks
could be judged, as PR.AA-01.2: measure and point). Fields are only ever
added, never renamed.
Testing
.\tests\Run-Regression.ps1 # also under: powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\tests\Run-Regression.ps1
.\tests\New-SyntheticHostSnapshot.ps1 -Scenario weak -OutFile .\weak.json # weak | hardened | laptop | dc | partial
The regression builds the synthetic fleet and checks:
- the exact number of findings per host (133 / 2 / 3 / 4 / 2) and that every check fires somewhere;
- the severity rules and the role rules;
- the "not evaluated" rule (22 checks on the partial host, none of them reported);
- determinism, zip input, duplicate hosts, old
{}lists, exceptions, comparison and JSON Lines; - the safety review, on the real code and on a tampered copy.
The AI step is tested end to end against a local mock endpoint. The test makes
sure no real name is in the request, the key is in a header, the prompt and
the reply are kept, invented checks are dropped, and nothing is sent without
-SendToAI or without a key.
Known limitations
- Effective settings only, no GPO comparison. Each host is judged on the settings it actually has. HostBadger doesn't read the GPOs, so it can't tell a setting that a GPO failed to apply from one that no GPO sets.
- The Windows lifecycle table. The end-of-servicing dates per build and
edition are built in (
lib\Common.ps1) and come from Microsoft's lifecycle pages. Check a date before you rely on it, and extend the table as releases ship. Hosts enrolled in Extended Security Updates are still reported as out of support. - Local security policy. The password and lockout policy and the user
rights are read with
secedit /export, which needs administrator or SYSTEM. Without it, those four checks are listed as not evaluated. What it reads is the effective local policy: domain accounts follow the domain policy, so the password and lockout checks speak for local accounts. The user rights are judged against the CIS benchmark of the host's role: workstations against Windows 11 (or 10), domain controllers and member servers against the domain-controller and member-server rules of the Windows Server benchmarks. - Audit policy. It is read with
auditpol /backup, which gives numeric values in any language. A snapshot from a host where only the localized text was available is judged on English text only. Other languages are skipped rather than guessed. - Writable programs. The ACL check looks at the program file and its
folder for Everyone, Users, Authenticated Users, Interactive and Domain
Users or Computers. For services it goes further: every folder above the
program, up to the drive root, is checked for ownership or
permission-changing rights held by a non-administrator
(
service_path_ancestor_control), and who may start a service whose folder is writable is read from its security descriptor (service_binary_writable). The same descriptor tells who may reconfigure a service (CHANGE_CONFIG,WRITE_DAC,WRITE_OWNER) or delete it (service_permissions_weak). None of this inspects the program's actual DLL imports, so it tells you who could plant a file there, not whether the program would load it; confirming that needs a tool like Process Monitor. Scheduled tasks and autoruns still only get the plain file-and-folder check. It does not cover per-user AlwaysInstallElevated. - Defender only. With a third-party antivirus, Defender runs in passive mode and its checks (the ones about Defender's own settings, such as real-time protection or ASR rules) are reported as not evaluated. The other product's settings are not inspected. The EDR inventory is a separate, independent check and does recognize 15 common vendors by service name regardless of Defender's state; see "EDR agents" above.
- DISA STIG: registry rules only. The STIG layer judges the rules that check a registry value. STIG rules about audit policy, user rights, account policy and other settings outside the registry are not judged as STIG findings; the CIS-based checks cover part of the same ground.
License
MIT, see LICENSE.
Data shipped in data\: the LOLDrivers catalog (Apache License 2.0);
extension IOC data from malext.io
(malicious_extension_sentry),
licensed under CC BY 4.0; Wladimir Palant's list of potentially malicious
extensions (CC0); CIS rule numbers and values from the MIT-licensed
ansible-lockdown roles.
Explore related projects
Loading…