HotCakeX / Harden-Windows-Security

Harden Windows Safely, Securely using Official Supported Microsoft methods and proper explanation | Always up-to-date and works with the latest build of Windows | Provides tools and Guides for Personal, Enterprise, Government and Military security levels | Read The Rationale https://github.com/HotCakeX/Harden-Windows-Security/blob/main/Rationale.md
https://hotcakex.github.io
MIT License
1.84k stars 143 forks source link
1st-party-security applicationcontrol bitlocker defender encryption enterprise-security firewall-configuration harden module operation-system-security powershell powershell-script proactive security security-hardening tpm2 wdac windows windows11 windowsdefender
![Big Yummy Donut](https://raw.githubusercontent.com/HotCakeX/.github/main/Pictures/Gifs/dripwelcome1.gif)![Big Yummy Donut](https://raw.githubusercontent.com/HotCakeX/.github/main/Pictures/Gifs/donuts.gif)![Big Yummy Donut](https://raw.githubusercontent.com/HotCakeX/.github/main/Pictures/Gifs/dripwelcome2.gif)
# Harden Windows Security | A New Threat to Malware ## Harden Windows Safely, Securely, Only With Official Microsoft Methods
PowerShell Gallery Version (including pre-releases) PowerShell Gallery Version (including pre-releases)
X Share button .NET Badge PowerShell Badge Visual Studio Badge

Hardening Categories rotating colorful thing How To Use rotating colorful thing Features rotating colorful thing Related rotating colorful thing Trust rotating colorful thing Support rotating colorful thing Security Recommendations rotating colorful thing Resources rotating colorful thing License rotating colorful thing Wiki rotating colorful thing Basic FAQs rotating colorful thing Roadmap

horizontal super thin rainbow RGB line

[!IMPORTANT]\ Click/Tap on Each of the Items Below to Access Them on This GitHub Repository

Indicator for App Control for Business Resources App Control for Business Resources

Indicator for The WDACConfig Module for App Control for Business The WDACConfig Module for App Control for Business

Indicator for the Rationale Behind This GitHub Repository Read the Rationale Behind This GitHub Repository

horizontal super thin rainbow RGB line


[!NOTE]\ Windows by default is secure and safe, this repository does not imply nor claim otherwise. Just like anything, you have to use it wisely and don't compromise yourself with reckless behavior and bad user configuration; Nothing is foolproof. This repository only uses the tools and features that have already been implemented by Microsoft in Windows OS to fine-tune it towards the highest security and locked-down state, using well-documented, supported, recommended and official methods. Continue reading for comprehensive info.


How To UseHowToUseIcon

GitHub logo pink SVG Start The Harden Windows Security Using GUI (Graphical User Interface)

(irm 'https://raw.githubusercontent.com/HotCakeX/Harden-Windows-Security/main/Harden-Windows-Security.ps1')+'P'|iex


PowerShell icon Pink Install the Harden Windows Security Module from PowerShell Gallery

Check the documentation and How to use

Click/Tap here for commands ```powershell Install-Module -Name 'Harden-Windows-Security-Module' -Force ``` ```powershell Protect-WindowsSecurity -GUI ``` ```powershell Confirm-SystemCompliance ``` ```powershell Unprotect-WindowsSecurity ```


Harden Windows Security App Demo


horizontal super thin rainbow RGB line


Requirements RequirementsIcon

Requirements item PowerShell (latest version), Install it from 🛍️ Microsoft Store or using Winget: Winget install Microsoft.PowerShell

Requirements item Any device that meets the Windows 11 hardware and Virtualization Based Security requirements.

Requirements item Virtualization technology and Secure Boot enabled in your UEFI settings. Official guide - How to enable Secure Boot on: HP - Lenovo - Dell.

Requirements item No 3rd party AV installed.

Requirements item Latest available version of Windows installed.

[!TIP]\ Restart your device after applying the hardening measures.


Harden-Windows-Security is a PowerShell module


Features FeaturesIcon

Features Item Everything always stays up-to-date with the newest proactive security measures that are industry standards and scalable.

Features Item Everything is in clear text, nothing hidden, no 3rd party executable or pre-compiled binary is involved.

Features Item No Windows functionality is removed/disabled against Microsoft's recommendations.

Features Item All of the links and sources are from official Microsoft websites, straight from the source. No bias, No FUD, No misinformation and definitely No old obsolete methods. That's why there are no links to 3rd party news websites, forums, made up blogs/articles, and such.

With the following exceptions | Link Count| Link | Reason | |:----:|:-----------------------------:|:----------------------------------------------------------:| | 1 | Intel website | i7 13700k product page | | 1 | state.gov | List of State Sponsors of Terrorism | | 1 | orpa.princeton.edu | OFAC Sanctioned Countries | | 2 | Wikipedia | TLS - providing additional information | | 1 | UK Cyber Security Centre | TLS - providing additional information | | 1 | Security.Stackexchange Q&A | TLS - providing additional information | | 1 | browserleaks.com/tls | TLS - Browser test | | 1 | clienttest.ssllabs.com | TLS - Browser test | | 1 | scanigma.com/knowledge-base | TLS - providing additional information | | 1 | cloudflare.com/ssl/reference/ | TLS - providing additional information | | 1 | github.com/ssllabs/research/ | TLS - providing additional information | | 1 | Wayback Machine | Providing additional information about Edge Browser |

Features Item The module primarily uses Group policies, the Microsoft recommended way of configuring Windows. It also uses PowerShell cmdlets where Group Policies aren't available, and finally uses a few registry keys to configure security measures that can neither be configured using Group Policies nor PowerShell cmdlets. This is why the module doesn't break anything or cause unwanted behavior.

Features Item This Readme page lists all of the security measures applied by the module.

Features Item When a hardening measure is no longer necessary because it's applied by default by Microsoft on new builds of Windows, it will also be removed from the module in order to prevent any problems and because it won't be necessary anymore.

Features Item The module can be run infinite number of times, it's made in a way that it won't make any duplicate changes.

Features Item Applying these hardening measures makes your PC compliant with Microsoft Security Baselines and Secured-core PC specifications (provided that you use modern hardware that supports the latest Windows security features) - See what makes a Secured-core PC - Check Device Guard category for more info

Secured-core – recommended for the most sensitive systems and industries like financial, healthcare, and government agencies. Builds on the previous layers and leverages advanced processor capabilities to provide protection from firmware attacks.

Features Item Since I originally created this repository for myself and people I care about, I always maintain it to the highest possible standard.

Features Item If you have multiple accounts on your device, you only need to apply the hardening measures 1 time with Admin privileges, that will make system-wide changes. Then you can optionally run the module, without Admin privileges, for each standard user to apply the Non-Admin category.


[!WARNING]\ For your own security, exercise caution when considering any other 3rd-party tools, programs, or scripts claiming to harden or modify Windows OS in any way. Verify their legitimacy thoroughly before use and after each release. Avoid blind trust in 3rd party Internet sources. Additionally, if they don't adhere to the rules mentioned above, they can cause system damage, unknown issues, and bugs.


💡 (back to top)

Harden-Windows-Security is a PowerShell module

Hardening CategoriesHardeningCategoriesIcon

From Top to bottom in order:



| Indicator| Description | |:--------:|:-----------------------------:| | Rotating pink checkmark denoting registry or cmdlet | Security measure is applied using PowerShell cmdlets or Registry | | Blue Check mark denoting Group Policy | Security measure is applied using Group Policies | | Rotating green checkmark denoting CSP | [CSP](https://learn.microsoft.com/en-us/windows/configuration/provisioning-packages/how-it-pros-can-use-configuration-service-providers) for the security measure | | Rotating green checkmark denoting Subcategory | Sub-category - prompts for additional confirmation |

💡 (back to top)


horizontal super thin rainbow RGB line


Microsoft Security BaselinesMicrosoftSecurityBaseline

Microsoft Security Baselines - Harden Windows Security

Blue Check mark denoting Group Policy A security baseline is a group of Microsoft-recommended configuration settings that explains their security implications. These settings are based on feedback from Microsoft security engineering teams, product groups, partners, and customers.

Continue reading in the official documentation

Optional Overrides for Microsoft Security Baselines


Blue Check mark denoting Group Policy Highly recommended to apply these overrides, the module will ask you whether you want to apply them or not. Use Optional Overrides when applying the hardening measures on Azure VMs.

💡 (back to categories)


horizontal super thin rainbow RGB line


Microsoft 365 Apps Security BaselinesMicrosoft365AppsSecurityBaselines

Microsoft 365 Apps Security Baselines - Harden Windows Security GitHub repository

Blue Check mark denoting Group Policy The security baseline for Microsoft 365 Apps for enterprise is published twice a year, usually in June and December.

More info in Microsoft Learn

Microsoft Security Baselines Version Matrix

💡 (back to categories)


horizontal super thin rainbow RGB line


Microsoft DefenderWindowsDefenderIcon

Microsoft Defender Cloud Protection features and abilities



















































[!TIP]\ Performance analyzer for Microsoft Defender Antivirus

💡 (back to categories)


horizontal super thin rainbow RGB line


Attack surface reduction rulesASRrulesIcon

Attack surface reduction rules - Harden Windows Security GitHub repository

Blue Check mark denoting Group Policy Attack surface reduction rules target certain software behaviors, such as: Rotating green checkmark denoting CSP CSP

Such software behaviors are sometimes seen in legitimate applications. However, these behaviors are often considered risky because they are commonly abused by attackers through malware. Attack surface reduction rules can constrain software-based risky behaviors and help keep your organization safe.

Reducing your attack surface means protecting your devices and network, which leaves attackers with fewer ways to perform attacks. Configuring attack surface reduction rules in Windows can help!

[!TIP]\ all 19 available Attack Surface Reduction rules shown in the official chart will be enabled. The Harden Windows Security application also allows you to individually configure each Attack Surface Reduction rule.

💡 (back to categories)


horizontal super thin rainbow RGB line


Bitlocker SettingsBitlockerIcon

Bitlocker Settings - Harden Windows Security



[!IMPORTANT]\ AMD Zen 2 and 3 CPUs have a vulnerability in them, if you use one of them, make sure your Bitlocker Startup PIN is at least 16 characters long (max is 20).








Refer to this official documentation about the countermeasures of Bitlocker

💡 (back to categories)


horizontal super thin rainbow RGB line


Device GuardDeviceGuardIcon

Device Guard Category - Harden Windows Security GitHub repository











[!TIP]\ Most of the Device Guard and Virtualization-Based Security features are Automatically enabled by default on capable and modern hardware. The rest of them will be enabled and configured to the most secure state after you apply the Microsoft Security Baselines and the Harden Windows Security policies.


[!IMPORTANT]\ About UEFI Lock

UEFI locked security measures are rooted in Proof of Physical Presence and they can't be disabled by modifying Group Policy, registry keys or other Administrative tasks. The only way to disable UEFI locked security measures is to have physical access to the computer, reboot and access the UEFI settings, supply the credentials to access the UEFI, turn off Secure Boot, reboot the system and then you will be able to disable those security measures with Administrator privileges.


[!NOTE]\ Device Protection in Windows Security Gives You One of These 4 Hardware Scores

  1. Standard hardware security not supported
    • This means that your device does not meet at least one of the requirements of Standard Hardware Security.

  2. Your device meets the requirements for Standard Hardware Security.

  3. Your device meets the requirements for Enhanced Hardware Security

  4. Your device has all Secured-core PC features enabled

💡 (back to categories)


horizontal super thin rainbow RGB line


TLS SecurityTLSIcon

TLS Security - Harden Windows Security repository GitHub


Changes made by this category only affect things that use Schannel SSP: that includes IIS web server, built-in inbox Windows apps and some other programs supplied by Microsoft, including Windows network communications, but not 3rd party software that use portable stacks like Java, nodejs, python or php.

If you want to read more: Demystifying Schannel

[!NOTE]\ This category checks whether Battle.net client is installed on the system and if it is then includes TLS_RSA_WITH_AES_256_CBC_SHA as an additional cipher suite in the policy due to a known issue. The way Battle.net client is detected is by checking the presence of Battle.net.exe or Battle.net Launcher.exe in C:\Program Files (x86)\Battle.net\ folder.





TLS_CHACHA20_POLY1305_SHA256
TLS_AES_256_GCM_SHA384
TLS_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256


nistP521
curve25519
NistP384
NistP256
curve25519
NistP256
NistP384

Read more in this Wiki post

💡 (back to categories)


horizontal super thin rainbow RGB line


Lock ScreenLockScreenIcon

An AI generated picture of a girl working in a server farm in Lock Screen Category












💡 (back to categories)


horizontal super thin rainbow RGB line


User Account ControlUACIcon

User Account Control - Harden Windows Security






💡 (back to categories)


horizontal super thin rainbow RGB line


Windows FirewallFirewallIcon

Windows Firewall - Harden Windows Security GitHub repository






💡 (back to categories)


horizontal super thin rainbow RGB line


Optional Windows FeaturesOptionalFeaturesIcon

Optional Windows Features - Harden Windows Security GitHub repository




💡 (back to categories)


horizontal super thin rainbow RGB line


Windows NetworkingNetworkingIcon

Windows Networking - Harden Windows Security GitHub repository
















💡 (back to categories)


horizontal super thin rainbow RGB line


Miscellaneous ConfigurationsMiscellaneousIcon

Miscellaneous Configurations - Harden Windows Security


















💡 (back to categories)


horizontal super thin rainbow RGB line


Windows Update ConfigurationsWindowsUpdate

Windows Update - Harden Windows Security GitHub repository


Windows updates are extremely important. They always should be installed as fast as possible to stay secure and if a reboot is required, it should be done immediately. Threat actors can weaponize publicly disclosed vulnerabilities the same day their POC (Proof-Of-Concept) is released..

In Windows by default, devices will scan daily, automatically download and install any applicable updates at a time optimized to reduce interference with usage, and then automatically try to restart when the end user is away.

The following policies the module configures make sure the default behavior explained above is tightly enforced.









💡 (back to categories)


horizontal super thin rainbow RGB line


Edge Browser configurationsEdgeBrowser

Edge Browser configurations - Harden Windows Security GitHub repository











TLS_RSA_WITH_AES_256_CBC_SHA  Reason: NO Perfect Forward Secrecy, CBC, SHA1
TLS_RSA_WITH_AES_128_CBC_SHA  Reason: NO Perfect Forward Secrecy, CBC, SHA1
TLS_RSA_WITH_AES_128_GCM_SHA256  Reason: NO Perfect Forward Secrecy
TLS_RSA_WITH_AES_256_GCM_SHA384  Reason: NO Perfect Forward Secrecy
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA  Reason: CBC, SHA1
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA  Reason: CBC, SHA1


Due to security reasons, many policies cannot be used when you are signed into Edge browser using personal Microsoft account. This module does not use any of those policies. When those policies are applied, they are ignored by the browser and edge://policy/ shows an error for them.



💡 (back to categories)


horizontal super thin rainbow RGB line


Certificate Checking CommandsCertificateIcon

Certificate Checking Commands - Harden Windows Security


Rotating pink checkmark denoting registry or cmdlet In this category, the module downloads and runs sigcheck64.exe from Sysinternals, then lists valid certificates not rooted to the Microsoft Certificate Trust List in the User and Machine certificate stores. Except for some possible Microsoft certificates, Windows insider builds certificates or certificates that have your own computer's name, which are perfectly safe and should not be deleted, All other certificates that will be listed should be treated as dangerous and removed from your system immediately.

💡 (back to categories)


horizontal super thin rainbow RGB line


Country IP BlockingCountryIPBlockingIcon

Country IP Blocking - Harden Windows Security GitHub repository


Rotating pink checkmark denoting registry or cmdlet The module uses the newest range of IPv4 and IPv6 addresses of State Sponsors of Terrorism and OFAC Sanctioned Countries, directly from official IANA sources repository, then creates 2 rules (inbound and outbound) for each list in Windows firewall, completely blocking connections to and from those countries.

Once you have those Firewall rules added, you can use this method to see if any of the blocked connections were from/to those countries.

[!NOTE]\ Threat actors can use VPN, VPS etc. to mask their originating IP address and location. So don't take this category as the perfect solution for network protection.

💡 (back to categories)


horizontal super thin rainbow RGB line


Downloads Defense Measures Downloads Defense Measures icon

Downloads Defense Measures - Harden Windows Security GitHub repository


Rotating pink checkmark denoting registry or cmdlet To combat the threat of more sophisticated malware, a preemptive measure is taken by creating and deploying a WDAC policy on the system. This policy blocks the execution of executables and other potentially harmful file types in the Downloads folder, using the WDACConfig module.

This policy defends the system from malware that can launch itself automatically after being downloaded from the Internet. The user must ensure the file's safety and explicitly transfer it to a different folder before running it.

The WDAC policy employs a wildcard pattern to prevent any file from running in the Downloads folder. Additionally, it verifies that the system downloads folder in the user directory matches the downloads folder in the Edge browser's settings. If there is a discrepancy, a warning message is displayed on the console.


Rotating pink checkmark denoting registry or cmdlet Rotating green checkmark denoting Subcategory Creates a custom WDAC policy that blocks the execution of the following executables:

They are insecure, unsandboxed script hosts that pose a security risk.


All of the policies can be easily removed using the Unprotect-WindowsSecurity or Remove-WDACConfig cmdlets.

💡 (back to categories)


horizontal super thin rainbow RGB line


Non-Admin CommandsNonAdminIcon

Non-Admin Commands - Harden Windows Security GitHub repository


You don't need Admin privileges to run this category, because no system-wide changes is made. Changes in this category only apply to the current user account that is running the PowerShell session.









💡 (back to categories)


horizontal super thin rainbow RGB line


RelatedRelatedIcon

An AI generated picture of a cat girl working in a server farm


Azure DevOps Repository (mirror) bullet list item Azure DevOps Repository (mirror)

Harden Windows Security website bullet list item Harden Windows Security website

Official global IANA IP block for each country bullet list item Official global IANA IP block for each country

Windows Security Blog bullet list item Windows Security Blog

WinSecureDNSMgr bullet list item WinSecureDNSMgr

Privacy, Anonymity and Compartmentalization bullet list item Privacy, Anonymity and Compartmentalization


horizontal super thin rainbow RGB line


TrustTrustIcon

Trust The Harden Windows Security GitHub Repository

How can you 100% trust this repository and know that nothing shady is going on?

This repository uses effective methods that make it easy to verify:


[!TIP]\ All files in this repository are zipped and automatically submitted to VirusTotal for scanning. Any available packages in the last release is also directly uploaded for scanning. It is done through a GitHub Action that is triggered every time a release is made or a PR is merged. Find the history of the uploaded files in my Virus Total profile.

💡 (back to top)


horizontal super thin rainbow RGB line


SupportSupportIcon

Support Section - Harden Windows Security Repository

If you have any questions, requests, suggestions etc If you have any questions, requests, suggestions etc. about this GitHub repository and its content, please open a new discussion or Issue.

Reporting a vulnerability on this GitHub repository Reporting a vulnerability on this GitHub repository.

SpyNetGirl aka HotCakeX Outlook Email Address I can also be reached privately at: spynetgirl@outlook.com


💡 (back to top)


horizontal super thin rainbow RGB line


Security RecommendationsSecurityRecommendationIcon

Windows Security Recommendations - Harden Windows Security GitHub Repository










Get-Content <Path-To-File> -stream zone.identifier






💡 (back to top)


horizontal super thin rainbow RGB line


ResourcesResourcesIcon

A beautiful pink laptop Windows 11, located on the table with coffee on the side

💡 (back to top)


horizontal super thin rainbow RGB line


RoadmapRoadmapIcon

The Harden Windows Security Repository Roadmap


💡 (back to top)


horizontal super thin rainbow RGB line


LicenseLicenseFreeIcon

Using MIT License. Free information without any paywall or things of that nature. The only mission of this GitHub repository is to give all Windows users accurate, up to date and correct facts and information about how to stay secure and safe in dangerous environments, and to stay not one, but Many steps, ahead of threat actors.

Credits

Harden-Windows-Security is a PowerShell module


GitHub profile and icon Lastfm profile and icon Spotify profile and icon StackExchange profile and icon Steam profile and icon Twitch profile and icon Website and icon X profile and icon Xbox profile and icon YouTube profile and icon Reddit profile and icon Rockstar Social Club profile and icon Uplay profile and icon Microsoft Tech Community profile and icon OutLook Email address and icon Orcid profile and icon Medium profile and icon Facebook profile and icon MVP profile and icon

Harden-Windows-Security is a PowerShell module

💡 (back to top)