From: "MaxF (Code Review)" Date: Wed, 13 Aug 2025 14:01:34 +0000 In-Reply-To: References: Reply-To: max@...2606..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="3m0ef8MM+ts="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Check message id/acked ids too when doing sessionid cookie checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: flichtenheld , openvpn-devel --3m0ef8MM+ts= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/open= vpn/+/1067?usp=3Demail ) Change subject: Check message id/acked ids too when doing sessionid cookie = checks ...................................................................... Patch Set 5: (3 comments) Patchset: PS5: The change makes sense to me, just some small nitpicks. If you strongly pre= fer doing it this way, I'm willing to approve. File src/openvpn/mudp.c: http://gerrit.openvpn.net/c/openvpn/+/1067/comment/b8f6989e_8a8a01d2 : PS5, Line 163: msg(D_MULTI_MEDIUM, "Packet (%s) with invalid or= missing SID from %s", : packet_opcode_name(op), peer); This debug message may now be incorrect. The packet might have a valid SID,= but a wrong packet ID. File src/openvpn/ssl_pkt.c: http://gerrit.openvpn.net/c/openvpn/+/1067/comment/3d6e4bec_68a33598 : PS5, Line 518: /* Check if the packet ID of the packet or ACKED packet = is <=3D 1 */ : for (int i =3D 0; i < ack.len; i++) : { : /* This packet ACKs a packet that has a higher packe= t id than the : * ones expected in the three-way handshake, conside= r it as invalid : * for the session */ : if (ack.packet_id[i] > 1) : { : return false; : } : } : : if (!pkt_is_ack) : { : packet_id_type message_id; : /* Extract the packet ID from the packet */ : if (!reliable_ack_read_packet_id(&buf, &message_id)) : { : return false; : } : : /* similar check. Anything larger than 1 is not cons= idered part of the : * three-way handshake */ : if (message_id > 1) : { : return false; : } : } Maybe nitpicky, but this seems like scope creep for this function. Now chec= k_session_id_hmac() does more than checking the hmac. I'd prefer to extract= this check to its own function, or rename this one. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1067?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6752dcd5aff3e5cea2b439366479e86751a1c403 Gerrit-Change-Number: 1067 Gerrit-PatchSet: 5 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: MaxF Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Wed, 13 Aug 2025 14:01:34 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment --3m0ef8MM+ts= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

View = Change

3 comments:

  • Patchset:

    • Patch Set #5:

      The change makes sense to me, just some small n= itpicks. If you strongly prefer doing it this way, I'm willing to appro= ve.

  • File src/open= vpn/mudp.c:

    • Patch = Set #5, Line 163:

                  msg(D_MULTI_MEDIUM, "Pa=
      cket (%s) with invalid or missing SID from %s",
      pac= ket_opcode_name(op), peer);

      This debug message may now be incorre= ct. The packet might have a valid SID, but a wrong packet ID.

    =
  • File src/openvpn/ssl_pkt.c:

    • Patch Set #5, Line 5= 18:

          /* Check if the packet ID of the packet or ACKED p=
      acket  is <=3D 1 */
      for (int i =3D 0; i < ack.len; i++)
      = {
      /* This packet ACKs a packet that has a higher packet id than= the
      * ones expected in the three-way handshake, consider it as= invalid
      * for the session */
      if (ack.packet_id[i] &= gt; 1)
      {
      return false;
      }
      }
      <= br> if (!pkt_is_ack)
      {
      packet_id_type message_id;
      = /* Extract the packet ID from the packet */
      if (!reliable= _ack_read_packet_id(&buf, &message_id))
      {
      = return false;
      }

      /* similar check. Anything large= r than 1 is not considered part of the
      * three-way handshake */=
      if (message_id > 1)
      {
      return false= ;
      }
      }

      Maybe nitpicky, but this seems like scope= creep for this function. Now check_session_id_hmac() does more than checki= ng the hmac. I'd prefer to extract this check to its own function, or r= ename this one.

To view, visit change 1067. To unsubs= cribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6752dcd5aff3e5cea2b43936647= 9e86751a1c403
Gerrit-Change-Number: 1067
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: MaxF <max@...2606...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Comment-Date: Wed, 13 Aug 2025 14:01:34= +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
--3m0ef8MM+ts=--