@@ -89,6 +89,38 @@ if (Test-Path $sshAgentRegPath)
8989 Set-Acl $sshAgentRegPath $sshAgentAcl
9090}
9191
92+ # Create MitigationOptions registry key if it doesn't exist for RedirectionGuard
93+ $sshdMitigationRegPath = " HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sshd.exe"
94+ if (-not (Test-Path $sshdMitigationRegPath )) {
95+ New-Item - Path $sshdMitigationRegPath - Force | Out-Null
96+ Write-Host " Created registry key: $sshdMitigationRegPath "
97+ }
98+
99+ # Check if MitigationOptions value exists
100+ $mitigationValue = Get-ItemProperty - Path $sshdMitigationRegPath - Name " MitigationOptions" - ErrorAction SilentlyContinue
101+ if (-not $mitigationValue ) {
102+ # Create binary value: 19 bytes with 0x10 at the end (RedirectionGuard mitigation)
103+ $binaryData = [byte []](0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x10 )
104+ New-ItemProperty - Path $sshdMitigationRegPath - Name " MitigationOptions" - PropertyType Binary - Value $binaryData - Force | Out-Null
105+ Write-Host " Created registry value for sshd.exe to enable RedirectionGuard"
106+ }
107+
108+ # Create MitigationOptions registry key if it doesn't exist for RedirectionGuard
109+ $agentMitigationRegPath = " HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ssh-agent.exe"
110+ if (-not (Test-Path $agentMitigationRegPath )) {
111+ New-Item - Path $agentMitigationRegPath - Force | Out-Null
112+ Write-Host " Created registry key: $agentMitigationRegPath "
113+ }
114+
115+ # Check if MitigationOptions value exists
116+ $mitigationValue = Get-ItemProperty - Path $agentMitigationRegPath - Name " MitigationOptions" - ErrorAction SilentlyContinue
117+ if (-not $mitigationValue ) {
118+ # Create binary value: 19 bytes with 0x10 at the end (RedirectionGuard mitigation)
119+ $binaryData = [byte []](0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x10 )
120+ New-ItemProperty - Path $agentMitigationRegPath - Name " MitigationOptions" - PropertyType Binary - Value $binaryData - Force | Out-Null
121+ Write-Host " Created registry value for ssh-agent.exe to enable RedirectionGuard"
122+ }
123+
92124# Fix permissions for moduli file
93125$moduliPath = Join-Path $PSScriptRoot " moduli"
94126if (Test-Path $moduliPath - PathType Leaf)
0 commit comments