Skip to content

Commit

Permalink
Mitigate CVE-2023-48795 by removing chacha20-poly1305 ssh cipher
Browse files Browse the repository at this point in the history
[#186872602]
  • Loading branch information
selzoc committed Feb 8, 2024
1 parent 8a6bade commit 202056e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions modules/BOSH.SSH/BOSH.SSH.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,19 @@ AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
$result | Should -BeLike "#*#*"
}

It "Disables the chacha20-poly1305 cipher to mitigate CVE-2023-48795" {

Mock Get-Content {
@"
# Ciphers and keying
#RekeyLimit default none
"@
} -ModuleName BOSH.SSH

$result = Modify-DefaultOpenSSHConfig -ConfigPath "some/path/sshd_config_default"

Assert-MockCalled Get-Content -Times 1 -ModuleName BOSH.SSH -Scope It -ParameterFilter { $Path -like "*sshd_config_default" }
$result | Should -BeLike "*#RekeyLimit default none`r`n# Disable cipher to mitigate CVE-2023-48795`r`nCiphers -chacha20-poly1305@openssh.com`r`n"
}

}
3 changes: 2 additions & 1 deletion modules/BOSH.SSH/BOSH.SSH.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ function Modify-DefaultOpenSSHConfig

$ModifiedConfig = Get-Content $ConfigPath `
| %{$_ -replace ".*Match Group administrators.*", "#$&"} `
| %{$_ -replace ".*AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys.*", "#$&" }
| %{$_ -replace ".*AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys.*", "#$&" } `
| %{$_ -replace "#RekeyLimit default none", "$&`r`n# Disable cipher to mitigate CVE-2023-48795`r`nCiphers -chacha20-poly1305@openssh.com`r`n"}

return $ModifiedConfig
}

0 comments on commit 202056e

Please sign in to comment.