Fixing CVE-2023-48795

pmeunier
Nov 23, 2023, 11:45 AM
VJIXIN4TVZX2ZELE3H5PVZIO6JIG7JZ3UKEJC7TAUYLOPW6GOGOQC

Dependencies

  • [2] ZQT6ZVJE Fix broken links in crate metadata
  • [3] UHAEQPZU Support ecdsa-sha2-nistp256 keys for authentication
  • [4] EUHO3DAZ Send a SSH_MSG_EXT_INFO with server-sig-algs when the client indicates they support extensions by sending ext-info-c. This allows modern clients that don't do ssh-rsa anymore because of sha1 to still use RSA keys with sha2.
  • [5] 7FRJYUI6 Reboot because of a bad change
  • [6] Y5HHIQXV Wait for the connection to be encrypted in `connect`
  • [7] 2WEO7OZL Version updates: getting rid of anyhow + moving to Tokio 1.0
  • [8] WXZWQLGL Correct negotiation without OpenSSL
  • [9] MFMCIUMJ Fixing authentication with RSA

Change contents

  • edit in thrussh/src/sshbuffer.rs at line 27
    [5.166325]
    [5.166325]
    pub strict: bool,
  • edit in thrussh/src/sshbuffer.rs at line 37
    [5.166503]
    [5.166503]
    strict: false,
  • edit in thrussh/src/session.rs at line 70
    [5.174049]
    [5.174049]
    if self.write_buffer.strict {
    self.write_buffer.seqn = Wrapping(0);
    }
  • edit in thrussh/src/session.rs at line 419
    [5.185762]
    [5.185762]
    pub nonstrict_packets_received: bool,
  • edit in thrussh/src/session.rs at line 433
    [5.186086]
    [5.186086]
    nonstrict_packets_received: false,
  • edit in thrussh/src/session.rs at line 448
    [5.186564]
    [5.186564]
    nonstrict_packets_received: false,
  • edit in thrussh/src/server/mod.rs at line 619
    [5.223082]
    [5.223082]
    nonstrict_packets_received: false,
  • replacement in thrussh/src/server/mod.rs at line 646
    [5.223854][5.223854:223899]()
    Some(Kex::KexInit(kexinit)) => {
    [5.223854]
    [5.223899]
    Some(Kex::KexInit(mut kexinit)) => {
    // Two cases: either we already know the algorithm,
    // meaning that this is a re-keying. Or we don't
    // meaning this is the initial KEXINIT packet.
    //
    // In all other cases, this is an error.
  • edit in thrussh/src/server/mod.rs at line 653
    [5.223969]
    [5.223969]
    let nonstrict_received = kexinit.nonstrict_packets_received;
  • replacement in thrussh/src/server/mod.rs at line 660
    [5.224254][5.224254:224294]()
    return Ok(session);
    [5.224254]
    [5.224294]
    if session.common.write_buffer.strict && nonstrict_received {
    return Err(Error::KexInit.into())
    }
  • replacement in thrussh/src/server/mod.rs at line 664
    [5.224319][5.224319:224496]()
    // Else, i.e. if the other side has not started
    // the key exchange, process its packets by simple
    // not returning.
    [5.224319]
    [5.224496]
    kexinit.nonstrict_packets_received = true;
  • edit in thrussh/src/server/mod.rs at line 681
    [4.1352][5.224889:224925](),[5.224889][5.224889:224925]()
    return Ok(session);
  • edit in thrussh/src/server/mod.rs at line 694
    [5.225404][5.225404:225440]()
    return Ok(session);
  • edit in thrussh/src/server/mod.rs at line 697
    [5.225529][5.225529:225565]()
    return Ok(session);
  • edit in thrussh/src/server/kex.rs at line 34
    [5.226766]
    [5.226766]
    write_buffer.strict = algo.strict_kex;
  • edit in thrussh/src/negotiation.rs at line 36
    [4.1423]
    [5.269535]
    pub strict_kex: bool,
  • replacement in thrussh/src/negotiation.rs at line 57
    [3.15373][3.15373:15406]()
    kex: &[kex::CURVE25519],
    [3.15373]
    [3.15406]
    kex: &[kex::CURVE25519, kex::STRICT],
  • replacement in thrussh/src/negotiation.rs at line 71
    [3.15809][3.15809:15842]()
    kex: &[kex::CURVE25519],
    [3.15809]
    [3.15842]
    kex: &[kex::CURVE25519, kex::STRICT],
  • replacement in thrussh/src/negotiation.rs at line 80
    [5.270122][5.270122:270155]()
    kex: &[kex::CURVE25519],
    [5.270122]
    [5.270155]
    kex: &[kex::CURVE25519, kex::STRICT],
  • replacement in thrussh/src/negotiation.rs at line 89
    [5.260][5.260:293]()
    kex: &[kex::CURVE25519],
    [5.260]
    [5.293]
    kex: &[kex::CURVE25519, kex::STRICT],
  • replacement in thrussh/src/negotiation.rs at line 97
    [5.270416][5.270416:270449]()
    kex: &[kex::CURVE25519],
    [5.270416]
    [3.16168]
    kex: &[kex::CURVE25519, kex::STRICT],
  • edit in thrussh/src/negotiation.rs at line 178
    [4.1623]
    [5.272078]
    let client_supports_strict = Self::select(&[kex::STRICT], kex_string).is_some();
    let server_supports_strict = Self::select(&[kex::STRICT], kex_string).is_some();
  • edit in thrussh/src/negotiation.rs at line 243
    [4.1706]
    [5.274587]
    strict_kex: client_supports_strict && server_supports_strict
  • edit in thrussh/src/kex.rs at line 48
    [5.308346]
    [4.1791]
    pub const STRICT: Name = Name("kex-strict-c-v00@openssh.com");
  • edit in thrussh/src/client/mod.rs at line 1000
    [5.365830]
    [5.365830]
    nonstrict_packets_received: false,
  • replacement in thrussh/src/client/mod.rs at line 1114
    [5.369605][5.369605:369646]()
    Some(Kex::KexInit(kexinit)) => {
    [5.369605]
    [5.369646]
    Some(Kex::KexInit(mut kexinit)) => {
  • edit in thrussh/src/client/mod.rs at line 1119
    [5.369794]
    [5.369794]
    let nonstrict_received = kexinit.nonstrict_packets_received;
  • edit in thrussh/src/client/mod.rs at line 1126
    [5.370070]
    [5.370070]
    if session.common.write_buffer.strict && nonstrict_received {
    return Err(Error::KexInit.into())
    }
  • edit in thrussh/src/client/mod.rs at line 1130
    [5.370104]
    [5.370104]
    } else {
    kexinit.nonstrict_packets_received = true;
    session.common.kex = Some(Kex::KexInit(kexinit))
  • edit in thrussh/src/client/kex.rs at line 28
    [5.382499]
    [5.382499]
    write_buffer.strict = algo.strict_kex;
  • replacement in README.md at line 23
    [2.601][5.442203:442349](),[5.442203][5.442203:442349]()
    Thrussh has a full disclosure vulnerability policy.
    Please do NOT attempt to report any security vulnerability in this code privately to anybody.
    [2.601]
    Thrussh has a responsible disclosure vulnerability policy. Please contact [contact@pijul.org](mailto:contact@pijul.org) if you have identified a security issue.