@@ -40,6 +40,20 @@ use std::path::{Path, PathBuf};
40
40
static BUNDLED_KEYS : & [ ( & str , & str , & str ) ] = & [
41
41
( "github.com" , "ssh-ed25519" , "AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" ) ,
42
42
( "github.com" , "ecdsa-sha2-nistp256" , "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=" ) ,
43
+ ( "github.com" , "ssh-rsa" , "AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" ) ,
44
+ ] ;
45
+
46
+ /// List of keys that public hosts have rotated away from.
47
+ ///
48
+ /// We explicitly distrust these keys as users with the old key in their
49
+ /// local configuration will otherwise be vulnerable to MITM attacks if the
50
+ /// attacker has access to the old key. As there is no other way to distribute
51
+ /// revocations of ssh host keys, we need to bundle them with the client.
52
+ ///
53
+ /// Unlike [`BUNDLED_KEYS`], these revocations will not be ignored if the user
54
+ /// has their own entries: we *know* that these keys are bad.
55
+ static BUNDLED_REVOCATIONS : & [ ( & str , & str , & str ) ] = & [
56
+ // Used until March 24, 2023: https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/
43
57
( "github.com" , "ssh-rsa" , "AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" ) ,
44
58
] ;
45
59
@@ -354,6 +368,16 @@ fn check_ssh_known_hosts(
354
368
} ) ;
355
369
}
356
370
}
371
+ for ( patterns, key_type, key) in BUNDLED_REVOCATIONS {
372
+ let key = base64:: decode ( key) . unwrap ( ) ;
373
+ known_hosts. push ( KnownHost {
374
+ location : KnownHostLocation :: Bundled ,
375
+ patterns : patterns. to_string ( ) ,
376
+ key_type : key_type. to_string ( ) ,
377
+ key,
378
+ line_type : KnownHostLineType :: Revoked ,
379
+ } ) ;
380
+ }
357
381
check_ssh_known_hosts_loaded ( & known_hosts, host, remote_key_type, remote_host_key)
358
382
}
359
383
0 commit comments