Skip to content

Commit

Permalink
Merge branch 'dev' into defender-toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Aug 5, 2023
2 parents 0ae7793 + 6fa63b3 commit 1fce737
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 107 deletions.
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"yaml.customTags": [
"!run: mapping",
"!registryKey: mapping",
"!registryValue: mapping",
"!appx: mapping",
"!file: mapping",
"!service: mapping",
"!scheduledTask: mapping",
"!taskKill: mapping",
"!systemPackage: mapping",
"!cmd: mapping",
"!powerShell: mapping",
"!writeStatus: mapping"
],
}
1 change: 1 addition & 0 deletions src/playbook/Configuration/tweaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ features:
- tweaks\performance\disable-background-apps.yml
- tweaks\performance\extend-cache.yml
- tweaks\performance\no-search-invalid-shortcuts.yml
- tweaks\performance\disable-fth.yml

# -------------------------------------------------------------------------- #
# performance\system #
Expand Down
17 changes: 17 additions & 0 deletions src/playbook/Configuration/tweaks/performance/disable-fth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Disable Fault Tolerant Heap (FTH)
description: FTH is a feature in Windows 7+ that applies mitigations (non-CPU related) to applications that repeatedly crash to prevent further crashes, but when the FTH is active for a certain application, there's a performance hit.
privilege: TrustedInstaller
actions:
# https://devblogs.microsoft.com/oldnewthing/20120125-00/?p=8463
# Document listed as only affected in Windows 7, is also in 7+
# https://docs.microsoft.com/en-us/windows/win32/win7appqual/fault-tolerant-heap
# https://www.3dcadworld.com/windows-7-fault-tolerant-heap-prevents-crashing/

- !registryValue:
path: 'HKLM\SOFTWARE\Microsoft\FTH'
value: 'Enabled'
data: '0'
type: REG_DWORD
# Reset FTH entries
- !run: {exe: 'rundll32.exe', args: 'fthsvc.dll,FthSysprepSpecialize'}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /t REG_DWORD /d "3" /f > nul
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverrideMask" /t REG_DWORD /d "3" /f > nul

:: Rename Spectre and Meltdown updates
ren !windir!\System32\mcupdate_GenuineIntel.dll mcupdate_GenuineIntel.old
ren !windir!\System32\mcupdate_AuthenticAMD.dll mcupdate_AuthenticAMD.old

:: Disable Fault Tolerant Heap (FTH)
:: https://docs.microsoft.com/en-us/windows/win32/win7appqual/fault-tolerant-heap
:: Document listed as only affected in Windows 7, is also in 7+
reg add "HKLM\SOFTWARE\Microsoft\FTH" /v "Enabled" /t REG_DWORD /d "0" /f > nul

:: Disable Structured Exception Handling Overwrite Protection (SEHOP)
:: Exists in ntoskrnl strings, keep for now
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableExceptionChainValidation" /t REG_DWORD /d "1" /f > nul
Expand All @@ -42,24 +33,18 @@ for /l %%a in (0,1,9) do (
)

:: Fix Valorant with mitigations disabled - enable CFG
for %%a in (valorant valorant-win64-shipping vgtray vgc) do (
PowerShell -NoP -C "Set-ProcessMitigation -Name %%a.exe -Enable CFG" > nul
)
set "enableCFGApps=valorant valorant-win64-shipping vgtray vgc"
PowerShell -NoP -C "foreach ($a in $($env:enableCFGApps -split ' ')) {Set-ProcessMitigation -Name $a`.exe -Enable CFG}" > nul

:: Set Data Execution Prevention (DEP) only for operating system components
:: https://docs.microsoft.com/en-us/windows/win32/memory/data-execution-prevention
:: https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set#verification-settings
bcdedit /set nx OptIn > nul

:: Apply mask to kernel
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "MitigationAuditOptions" /t REG_BINARY /d "!mitigation_mask!" /f > nul
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "MitigationOptions" /t REG_BINARY /d "!mitigation_mask!" /f > nul

:: Disable virtualization-based protection of code integrity
:: https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d "0" /f > nul

:: Disable Data Execution Prevention (DEP)
:: It may be needed to enable it for FACEIT, Valorant and other anti-cheats
:: https://docs.microsoft.com/en-us/windows/win32/memory/data-execution-prevention
PowerShell -NoP -C "Set-ProcessMitigation -System -Disable DEP, EmulateAtlThunks"
bcdedit /set nx AlwaysOff > nul

:: Disable file system mitigations
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v "ProtectionMode" /t REG_DWORD /d "0" /f > nul

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ wmic cpu get name | findstr "AMD" > nul && (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /t REG_DWORD /d "64" /f > nul
)

:: Rename Spectre and Meltdown updates
ren !windir!\System32\mcupdate_GenuineIntel.old mcupdate_GenuineIntel.dll > nul 2>&1
ren !windir!\System32\mcupdate_AuthenticAMD.old mcupdate_AuthenticAMD.dll > nul 2>&1

:: Enable Fault Tolerant Heap (FTH)
:: https://docs.microsoft.com/en-us/windows/win32/win7appqual/fault-tolerant-heap
:: Document listed as only affected in Windows 7, is also in 7+
reg add "HKLM\SOFTWARE\Microsoft\FTH" /v "Enabled" /t REG_DWORD /d "1" /f > nul

:: Enable Structured Exception Handling Overwrite Protection (SEHOP)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableExceptionChainValidation" /t REG_DWORD /d "0" /f > nul

Expand All @@ -53,11 +44,7 @@ for /l %%a in (0,1,9) do (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "MitigationAuditOptions" /t REG_BINARY /d "!mitigation_mask!" /f > nul
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "MitigationOptions" /t REG_BINARY /d "!mitigation_mask!" /f > nul

:: Set Virtualization Based Protection Of Code Integrity to default
:: https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d "1" /f > nul

:: Enable Data Execution Prevention (DEP)
:: Enable Data Execution Prevention (DEP) always
:: https://docs.microsoft.com/en-us/windows/win32/memory/data-execution-prevention
bcdedit /set nx AlwaysOn > nul

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\FTH]
"Enabled"=dword:00000000
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\FTH]
"Enabled"=dword:00000001
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /f > nul 2>&1
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverrideMask" /f > nul 2>&1

:: Rename Spectre and Meltdown updates
ren !windir!\System32\mcupdate_GenuineIntel.old mcupdate_GenuineIntel.dll > nul 2>&1
ren !windir!\System32\mcupdate_AuthenticAMD.old mcupdate_AuthenticAMD.dll > nul 2>&1

:: Enable Fault Tolerant Heap (FTH)
:: https://docs.microsoft.com/en-us/windows/win32/win7appqual/fault-tolerant-heap
:: Document listed as only affected in Windows 7, is also in 7+
reg add "HKLM\SOFTWARE\Microsoft\FTH" /v "Enabled" /t REG_DWORD /d "1" /f > nul

:: Enable Structured Exception Handling Overwrite Protection (SEHOP)
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableExceptionChainValidation" /f > nul 2>&1

Expand All @@ -30,9 +21,9 @@ reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "Mi
:: https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /f > nul 2>&1

:: Enable Data Execution Prevention (DEP) for system components only
:: Set Data Execution Prevention (DEP) only for operating system components
:: https://docs.microsoft.com/en-us/windows/win32/memory/data-execution-prevention
:: https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set
:: https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set#verification-settings
bcdedit /set nx OptIn > nul

:: Enable file system mitigations
Expand Down
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions src/playbook/playbook.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Name>defender-disable</Name>
</RadioOption>
</Options>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/placeholder"/>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/security/#defender"/>
</RadioPage>
<RadioPage IsRequired="true" DefaultOption="mitigations-default" Description="Disabling mitigations reduces security, yet improves performance only on older CPUs.">
<TopLine Text="You can change this later in the Atlas folder."/>
Expand All @@ -51,7 +51,7 @@
<Name>mitigations-disable</Name>
</RadioOption>
</Options>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/configuration/#mitigations"/>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/security/#mitigations"/>
</RadioPage>
<RadioPage IsRequired="true" DefaultOption="vbs-disable" Description="Enabling Core Isolation protects important parts of Windows, but it reduces performance.">
<TopLine Text="You can change this later in Windows Security."/>
Expand All @@ -65,7 +65,7 @@
<Name>vbs-default</Name>
</RadioOption>
</Options>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/configuration/#core-isolation"/>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/security/#core-isolation"/>
</RadioPage>
<CheckboxPage IsRequired="true" Description="Select the miscellaneous options that you would like to use, which you can change later.">
<Options>
Expand Down Expand Up @@ -110,7 +110,7 @@
<GradientBottomColor>#E38A84</GradientBottomColor>
</RadioImageOption>
</Options>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/placeholder"/>
<BottomLine Text="Learn more" Link="https://docs.atlasos.net/getting-started/post-installation/software/web-browsers"/>
</RadioImagePage>
<RadioPage IsRequired="true" DependsOn="browser-librewolf" DefaultOption="librewolf-winupdater" Description="Please select how you would like LibreWolf to be installed.">
<TopLine Text="Chocolatey needs manual updates, unlike normal."/>
Expand Down

0 comments on commit 1fce737

Please sign in to comment.