windows_hardening

windows_hardening

全面强化Windows系统安全的开源工具

HardeningKitty是一个开源的Windows系统安全加固工具,可审核系统配置并根据预定义标准进行加固。支持CIS、Microsoft和BSI等多个安全基准,适用于Windows 10/11和Server版本。提供'HailMary'模式快速应用安全设置,还可创建组策略。该项目旨在帮助IT专业人员全面提升Windows系统安全性,包含完整的安全基准列表和详细使用说明。

HardeningKittyWindows安全加固PowerShell安全基准配置审计Github开源项目

HardeningKitty and Windows Hardening

Introduction

The project started as a simple hardening list for Windows 10. After some time, HardeningKitty was created to simplify the hardening of Windows. Now, HardeningKitty supports guidelines from Microsoft, CIS Benchmarks, DoD STIG and BSI SiSyPHuS Win10. And of course my own hardening list.

This is a hardening checklist that can be used in private and business environments for hardening Windows 10. The checklist can be used for all Windows versions, but in Windows 10 Home the Group Policy Editor is not integrated and the adjustment must be done directly in the registry. For this, there is the HailMary mode from HardeningKitty.

The settings should be seen as security and privacy recommendation and should be carefully checked whether they will affect the operation of your infrastructure or impact the usability of key functions. It is important to weigh security against usability.

The project started with the creation of a simple hardening checklist for Windows 10. The focus has shifted to the audit of various well-known frameworks / benchmarks with the development of HardeningKitty. Meanwhile, various CIS benchmarks and Microsoft Security Baselines are supported. With the development of the HailMary mode, it will also be possible to apply settings of any hardening checklist on a Windows system.

HardeningKitty

HardeningKitty supports hardening of a Windows system. The configuration of the system is retrieved and assessed using a finding list. In addition, the system can be hardened according to predefined values. HardeningKitty reads settings from the registry and uses other modules to read configurations outside the registry.

The script was developed for English systems. It is possible that in other languages the analysis is incorrect. Please create an issue if this occurs.

Signed Version

The development of HardeningKitty happens in this repository. In the repository of scip AG is a stable version of HardeningKitty that has been signed with the code signing certificate of scip AG. This means that HardeningKitty can also be run on systems that only allow signed scripts.

How To Run

Run the script with administrative privileges to access machine settings. For the user settings it is better to execute them with a normal user account. Ideally, the user account is used for daily work.

Download HardeningKitty and copy it to the target system (script and lists). Then HardeningKitty can be imported and executed:

PS C:\tmp> Import-Module .\HardeningKitty.psm1 PS C:\tmp> Invoke-HardeningKitty -EmojiSupport =^._.^= _( )/ HardeningKitty 0.9.0-1662273740 [*] 9/4/2022 8:54:12 AM - Starting HardeningKitty [*] 9/4/2022 8:54:12 AM - Getting user information [*] Hostname: DESKTOP-DG83TOD [*] Domain: WORKGROUP ... [*] [*] 9/4/2022 8:54:12 AM - Starting Category Account Policies [😺] ID 1103, Store passwords using reversible encryption, Result=0, Severity=Passed [😺] ID 1100, Account lockout threshold, Result=10, Severity=Passed [😺] ID 1101, Account lockout duration, Result=30, Severity=Passed ... [*] 9/4/2022 8:54:12 AM - Starting Category User Rights Assignment [😿] ID 1200, Access this computer from the network, Result=BUILTIN\Administrators;BUILTIN\Users, Recommended=BUILTIN\Administrators, Severity=Medium ... [*] 9/4/2022 8:54:14 AM - Starting Category Administrative Templates: Printer [🙀] ID 1764, Point and Print Restrictions: When installing drivers for a new connection (CVE-2021-34527), Result=1, Recommended=0, Severity=High [🙀] ID 1765, Point and Print Restrictions: When updating drivers for an existing connection (CVE-2021-34527), Result=2, Recommended=0, Severity=High ... [*] 9/4/2022 8:54:19 AM - Starting Category MS Security Guide [😿] ID 2200, LSA Protection, Result=, Recommended=1, Severity=Medium [😼] ID 2201, Lsass.exe audit mode, Result=, Recommended=8, Severity=Low ... [*] 9/4/2022 8:54:25 AM - HardeningKitty is done [*] 9/4/2022 8:54:25 AM - Your HardeningKitty score is: 4.82. HardeningKitty Statistics: Total checks: 325 - Passed: 213, Low: 33, Medium: 76, High: 3.

How To Install

First create the directory HardeningKitty and for every version a sub directory like 0.9.2 in a path listed in the PSModulePath environment variable.

Copy the module HardeningKitty.psm1, HardeningKitty.psd1, and the lists directory to this new directory.

PS C:\tmp> $Version = "0.9.2" PS C:\tmp> New-Item -Path $Env:ProgramFiles\WindowsPowerShell\Modules\HardeningKitty\$Version -ItemType Directory PS C:\tmp> Copy-Item -Path .\HardeningKitty.psd1,.\HardeningKitty.psm1,.\lists\ -Destination $Env:ProgramFiles\WindowsPowerShell\Modules\HardeningKitty\$Version\ -Recurse

For more information see Microsoft's article Installing a PowerShell Module.

How to Automatically Download and Install the Latest Release

You can use the script below to download and install the latest release of HardeningKitty.

Function InstallHardeningKitty() { $Version = (((Invoke-WebRequest "https://api.github.com/repos/0x6d69636b/windows_hardening/releases/latest" -UseBasicParsing) | ConvertFrom-Json).Name).SubString(2) $HardeningKittyLatestVersionDownloadLink = ((Invoke-WebRequest "https://api.github.com/repos/0x6d69636b/windows_hardening/releases/latest" -UseBasicParsing) | ConvertFrom-Json).zipball_url $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest $HardeningKittyLatestVersionDownloadLink -Out HardeningKitty$Version.zip Expand-Archive -Path ".\HardeningKitty$Version.zip" -Destination ".\HardeningKitty$Version" -Force $Folder = Get-ChildItem .\HardeningKitty$Version | Select-Object Name -ExpandProperty Name Move-Item ".\HardeningKitty$Version\$Folder\*" ".\HardeningKitty$Version\" Remove-Item ".\HardeningKitty$Version\$Folder\" New-Item -Path $Env:ProgramFiles\WindowsPowerShell\Modules\HardeningKitty\$Version -ItemType Directory Set-Location .\HardeningKitty$Version Copy-Item -Path .\HardeningKitty.psd1,.\HardeningKitty.psm1,.\lists\ -Destination $Env:ProgramFiles\WindowsPowerShell\Modules\HardeningKitty\$Version\ -Recurse Import-Module "$Env:ProgramFiles\WindowsPowerShell\Modules\HardeningKitty\$Version\HardeningKitty.psm1" } InstallHardeningKitty

Examples

Audit

The default mode is audit. HardeningKitty performs an audit, saves the results to a CSV file and creates a log file. The files are automatically named and receive a timestamp. Using the parameters ReportFile or LogFile, it is also possible to assign your own name and path.

The Filter parameter can be used to filter the hardening list. For this purpose the PowerShell ScriptBlock syntax must be used, for example { $_.ID -eq 4505 }. The following elements are useful for filtering: ID, Category, Name, Method, and Severity.

Invoke-HardeningKitty -Mode Audit -Log -Report

HardeningKitty can be executed with a specific list defined by the parameter FileFindingList. If HardeningKitty is run several times on the same system, it may be useful to hide the machine information. The parameter SkipMachineInformation is used for this purpose.

Invoke-HardeningKitty -FileFindingList .\lists\finding_list_0x6d69636b_user.csv -SkipMachineInformation

HardeningKitty uses the default list, and checks only tests with the severity Medium.

Invoke-HardeningKitty -Filter { $_.Severity -eq "Medium" }

Config

The mode config retrives all current settings of a system. If a setting has not been configured, HardeningKitty will use a default value stored in the finding list. This mode can be combined with other functions, for example to create a backup.

HardeningKitty gets the current settings and stores them in a report:

Invoke-HardeningKitty -Mode Config -Report -ReportFile C:\tmp\my_hardeningkitty_report.csv

Backup

Backups are important. Really important. Therefore, HardeningKitty also has a function to retrieve the current configuration and save it in a form that can be partially restored.

Disclaimer: HardeningKitty tries to restore the original configuration. This works quite well with registry keys and Hardening Kitty really tries its best. But the backup function is not a snapshot and does not replace a real system backup. It is not possible to restore the system 1:1 with HardeningKitty alone after HailMary. If this is a requirement, create an image or system backup and restore it.

The Backup switch specifies that the file is written in form of a finding list and can thus be used for the HailMary mode. The name and path of the backup can be specified with the parameter BackupFile.

Invoke-HardeningKitty -Mode Config -Backup

Please test this function to see if it really works properly on the target system before making any serious changes. A Schrödinger's backup is dangerous.

Non-Default Finding List

Note that if -FileFindingList is not specified, the backup is referred to the default finding list. Before deploying a specific list in HailMary mode, always create a backup referred to that specific list.

Invoke-HardeningKitty -Mode Config -Backup -BackupFile ".\myBackup.csv" -FileFindingList ".\list\{list}.csv"
Restoring a Backup

The Backup switch creates a file in form of a finding list, to restore the backup load it in HailMary mode like any find list:

Invoke-HardeningKitty -Mode HailMary -Log -Report -FileFindingList ".\myBackup.csv"

HailMary

The HailMary method is very powerful. It can be used to deploy a finding list on a system. All findings are set on this system as recommended in the list. With power comes responsibility. Please use this mode only if you know what you are doing. Be sure to have a backup of the system.

Invoke-HardeningKitty -Mode HailMary -Log -Report -FileFindingList .\lists\finding_list_0x6d69636b_machine.csv

Before HailMary is run, a finding list must be picked. It is important to check whether the settings have an influence on the stability and functionality of the system. Before running HailMary, a backup should be made.

Create a Group Policy (experimental)

Thanks to @gderybel, HardeningKitty can convert a finding list into a group policy. As a basic requirement, the Group Policy Management PowerShell module must be installed. At the moment only registry settings can be converted and not everything has been tested yet. A new policy is created, as long as it is not assigned to an object, no change is made to the system. Use it with care.

Invoke-HardeningKitty -Mode GPO -FileFindingList .\lists\finding_list_0x6d69636b_machine.csv -GPOName HardeningKitty-Machine-01

HardeningKitty Score

Each Passed finding gives 4 points, a Low finding gives 2 points, a Medium finding gives 1 point and a High Finding gives 0 points.

The formula for the HardeningKitty Score is (Points achieved / Maximum points) * 5 + 1.

Rating

ScoreRating CasualRating Professional
6😹 ExcellentExcellent
5😺 Well doneGood
4😼 SufficientSufficient
3😿 You should do betterInsufficient
2🙀 WeakInsufficient
1😾 BogusInsufficient

HardeningKitty Interface

@ataumo build a web based interface for HardeningKitty. The tool can be used to create your own lists and provides additional information on the hardening settings. The source code is under AGPL license and there is a demo site.

Last Update

HardeningKitty can be used to audit systems against the following baselines / benchmarks:

NameSystem VersionVersion
0x6d69636b Windows 10 (Machine)22H2
0x6d69636b Windows 10 (User)22H2
BSI SiSyPHuS Windows 10 hoher Schutzbedarf Domänenmitglied (Machine)18091.0
BSI SiSyPHuS Windows 10 hoher Schutzbedarf Domänenmitglied (User)18091.0
BSI SiSyPHuS Windows 10 normaler Schutzbedarf Domänenmitglied (Machine)18091.0
BSI SiSyPHuS Windows 10 normaler Schutzbedarf Domänenmitglied (User)18091.0
BSI SiSyPHuS Windows 10 normaler Schutzbedarf Einzelrechner (Machine)18091.0
BSI SiSyPHuS Windows 10 normaler Schutzbedarf Einzelrechner (User)18091.0
CIS Microsoft Windows 10 Enterprise (Machine)18091.6.1
CIS Microsoft Windows 10 Enterprise (User)18091.6.1
CIS Microsoft Windows 10 Enterprise (Machine)19031.7.1
CIS Microsoft Windows 10 Enterprise (User)19031.7.1
CIS Microsoft Windows 10 Enterprise (Machine)19091.8.1
CIS Microsoft Windows 10 Enterprise (User)19091.8.1
CIS Microsoft Windows 10 Enterprise (Machine)20041.9.1
CIS Microsoft Windows 10 Enterprise (User)20041.9.1
CIS Microsoft Windows 10 Enterprise (Machine)20H21.10.1
CIS Microsoft Windows 10 Enterprise (User)20H21.10.1
CIS Microsoft Windows 10 Enterprise (Machine)21H11.11.0
CIS Microsoft Windows 10 Enterprise (User)21H11.11.0
CIS Microsoft Windows 10 Enterprise (Machine)21H21.12.0
CIS Microsoft Windows 10 Enterprise (User)21H21.12.0
CIS Microsoft Windows 10 Enterprise (Machine)22H22.0.0
CIS Microsoft Windows 10 Enterprise (User)22H22.0.0
CIS Microsoft Windows 10 Enterprise (Machine)22H23.0.0
CIS Microsoft Windows 10 Enterprise (User)22H23.0.0
CIS Microsoft Windows 11 Enterprise (Machine)21H21.0.0
CIS Microsoft Windows 11 Enterprise (User)21H21.0.0
CIS Microsoft Windows 11 Enterprise (Machine)22H22.0.0
CIS Microsoft Windows 11 Enterprise (User)22H22.0.0
CIS Microsoft Windows 11 Enterprise (Machine)23H23.0.0
CIS Microsoft Windows 11 Enterprise (User)23H23.0.0
CIS Microsoft Windows Server 2012 R2 (Machine)R22.4.0
CIS Microsoft Windows Server 2012 R2 (User)R22.4.0
CIS Microsoft Windows Server 2012 R2 (Machine)R22.6.0
CIS Microsoft Windows Server 2012 R2 (User)R2

编辑推荐精选

TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI助手AI工具AI写作工具AI辅助写作蛙蛙写作学术助手办公助手营销助手
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

聊天机器人AI助手热门AI工具AI对话
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

下拉加载更多