Skip to content

Conversation

@avnes
Copy link
Contributor

@avnes avnes commented Jan 6, 2022

In the Secure Shell (SSH) protocol, host keys are used to verify the identity of remote hosts. Accepting unknown host keys may leave the connection open to man-in-the-middle attacks.

Do not accept unknown host keys. In particular, do not set the default missing host key policy for the Paramiko library to either AutoAddPolicy or WarningPolicy. Both of these policies continue even when the host key is unknown. The default setting of RejectPolicy is secure because it throws an exception when it encounters an unknown host key.

Reference: https://cwe.mitre.org/data/definitions/295.html

In the Secure Shell (SSH) protocol, host keys are used to verify the identity of remote hosts. Accepting unknown host keys may leave the connection open to man-in-the-middle attacks. Do not accept unknown host keys. In particular, do not set the default missing host key policy for the Paramiko library to either AutoAddPolicy or WarningPolicy. Both of these policies continue even when the host key is unknown. The default setting of RejectPolicy is secure because it throws an exception when it encounters an unknown host key. Reference: https://cwe.mitre.org/data/definitions/295.html Signed-off-by: Audun Nes <audun.nes@gmail.com>
@avnes avnes force-pushed the hotfix/fix-unsecure-ssh-connection branch from f32dbfc to 5de1360 Compare January 6, 2022 13:57
milas added a commit to milas/docker-py that referenced this pull request Jul 27, 2022
Fix & enable SSH integration test suite. This also adds a new test for connecting to unknown hosts when using the Python SSH implementation (Paramiko). Currently, this is `xfail` because we allow this. See docker#2932 for more info. Because of the above, some of the config/static key files have been moved around and adjusted. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Copy link
Contributor

@milas milas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Tested locally against SSH integration tests including a new test specifically for this - see #3012.

@milas milas merged commit d929864 into docker:master Jul 27, 2022
milas added a commit to milas/docker-py that referenced this pull request Jul 27, 2022
Fix & enable SSH integration test suite. This also adds a new test for connecting to unknown hosts when using the Python SSH implementation (Paramiko). See docker#2932 for more info. Because of the above, some of the config/static key files have been moved around and adjusted. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
milas added a commit that referenced this pull request Jul 27, 2022
Fix & enable SSH integration test suite. This also adds a new test for connecting to unknown hosts when using the Python SSH implementation (Paramiko). See #2932 for more info. Because of the above, some of the config/static key files have been moved around and adjusted. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
@milas milas added this to the 6.0.0 milestone Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants