Re: [Sip] Using TLS in the first hop - Bug in RFC 5630

Iñaki Baz Castillo <ibc@aliax.net> Thu, 15 September 2011 14:23 UTC

Return-Path: <ibc@aliax.net>
X-Original-To: sip@ietfa.amsl.com
Delivered-To: sip@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 53E1E21F8B38 for <sip@ietfa.amsl.com>; Thu, 15 Sep 2011 07:23:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.349
X-Spam-Level:
X-Spam-Status: No, score=-2.349 tagged_above=-999 required=5 tests=[AWL=-0.272, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, J_CHICKENPOX_62=0.6, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NCYx1NZBgRsG for <sip@ietfa.amsl.com>; Thu, 15 Sep 2011 07:23:13 -0700 (PDT)
Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com [209.85.216.172]) by ietfa.amsl.com (Postfix) with ESMTP id 44BAE21F8B37 for <sip@ietf.org>; Thu, 15 Sep 2011 07:23:13 -0700 (PDT)
Received: by qyk32 with SMTP id 32so5090738qyk.10 for <sip@ietf.org>; Thu, 15 Sep 2011 07:25:25 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.229.62.103 with SMTP id w39mr938863qch.292.1316096724880; Thu, 15 Sep 2011 07:25:24 -0700 (PDT)
Received: by 10.229.79.207 with HTTP; Thu, 15 Sep 2011 07:25:24 -0700 (PDT)
In-Reply-To: <3EBDBBCF-C3F3-4C64-B010-4F275B0A5A96@edvina.net>
References: <CALiegfkNfJ7McZAA=a5ajYVzYtmAjC_KQdK1P_ez2L1dia5v2g@mail.gmail.com> <CFFC2869-C704-423E-974D-3F4B93145BBB@edvina.net> <CALiegfnh2C3GNddnneepcVsGgtOd1pSDBVC3uH72S1KaVT_jHg@mail.gmail.com> <3EBDBBCF-C3F3-4C64-B010-4F275B0A5A96@edvina.net>
Date: Thu, 15 Sep 2011 16:25:24 +0200
Message-ID: <CALiegfkKSHiEWF5+Lz5FBEawNc6ST1s3+MLYeBnUJedFjxQoDw@mail.gmail.com>
From: =?UTF-8?Q?I=C3=B1aki_Baz_Castillo?= <ibc@aliax.net>
To: "Olle E. Johansson" <oej@edvina.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: sip@ietf.org
Subject: Re: [Sip] Using TLS in the first hop - Bug in RFC 5630
X-BeenThere: sip@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Session Initiation Protocol <sip.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/sip>, <mailto:sip-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/sip>
List-Post: <mailto:sip@ietf.org>
List-Help: <mailto:sip-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/sip>, <mailto:sip-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 15 Sep 2011 14:23:14 -0000

2011/9/15 Olle E. Johansson <oej@edvina.net>et>:
> This means thet the request URI of the ACK will be using SIPS, and then section 8.1.1.8 comes into play
> and requires the other side to also use a SIPS uri in their contact.
>
> In this case, both UAs need a TLS certificate.

No, that's incorrect. I show two call flows in which TLS is just used
by one of the enpoints.



CASE 1)
- Alice uses TLS.
- Bob uses UDP.
- Proxy/registrar does loose-routing.
- Alice calls Bob, Bob answers and later Bob hangs up.


F1 INVITE Alice -> SIP Proxy (transport TLS)

INVITE sip:bob@atlanta.com SIP/2.0
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bK56sdasks
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 70
Contact: <sips:alice@93.12.40.105:20565;transport=tcp>
Content-Type: application/sdp


F2 100 Trying SIP Proxy -> Alice (transport TLS)

SIP/2.0 100 Trying
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bK56sdasks
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE


F3 INVITE SIP Proxy -> Carol (transport UDP)

INVITE sip:bob@77.123.45.23:5060 SIP/2.0
Via: SIP/2.0/UDP 100.100.100.100;branch=z9hG4bKhjhjqw32c
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bK56sdasks
Record-Route: <sip:100.100.100.100;transport=udp>,
  <sips:100.100.100.100;transport=tcp>
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sips:alice@93.12.40.105:20565;transport=tcp>
Content-Type: application/sdp


F4 200 OK Carol -> SIP Proxy (transport UDP)

SIP/2.0 200 OK
Via: SIP/2.0/UDP 100.100.100.100;branch=z9hG4bKhjhjqw32c
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bK56sdasks
Record-Route: <sip:100.100.100.100;transport=udp>,
  <sips:100.100.100.100;transport=tcp>
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sip:bob@77.123.45.23:5060;transport=udp>
Content-Type: application/sdp


F5 200 OK SIP Proxy -> Alice (transport TLS)

SIP/2.0 200 OK
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bK56sdasks
Record-Route: <sip:100.100.100.100;transport=udp>,
  <sips:100.100.100.100;transport=tcp>
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sip:bob@77.123.45.23:5060;transport=udp>
Content-Type: application/sdp


F6 ACK Alice -> SIP Proxy (transport TLS)

ACK sip:bob@77.123.45.23:5060;transport=udp SIP/2.0
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bKhgqqp090
Route: <sips:100.100.100.100;transport=tcp>,
  <sip:100.100.100.100;transport=udp>
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 ACK
Max-Forwards: 70


F7 ACK SIP Proxy -> Carol (transport UDP)

ACK sip:bob@77.123.45.23:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 100.100.100.100;branch=z9hG4bKhwpoc80zzx
Via: SIP/2.0/TLS 93.12.40.105:20565;branch=z9hG4bKhgqqp090
From: sip:alice@atlanta.com;tag=asdyka899
To: sip:bob@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 ACK
Max-Forwards: 69


F8 BYE Carol -> SIP Proxy (transport UDP)

BYE sips:alice@93.12.40.105:20565;transport=tcp SIP/2.0
Via: SIP/2.0/UDP 77.123.45.23;branch=z9hG4bKbiuiansd001
Route: <sip:100.100.100.100;transport=udp>,
  <sips:100.100.100.100;transport=tcp>
From: sip:bob@atlanta.com;tag=bmqkjhsd
To: sip:alice@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE
Max-Forwards: 70


F9 BYE SIP Proxy -> Alice (transport TLS)

BYE sips:alice@93.12.40.105:20565;transport=tcp SIP/2.0
Via: SIP/2.0/TLS 100.100.100.100;branch=z9hG4bKmma01m3r5
Via: SIP/2.0/UDP 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:bob@atlanta.com;tag=bmqkjhsd
To: sip:alice@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE
Max-Forwards: 69


F10 200 OK Alice -> SIP Proxy (transport TLS)

SIP/2.0 200 OK
Via: SIP/2.0/TLS 100.100.100.100;branch=z9hG4bKmma01m3r5
Via: SIP/2.0/UDP 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:bob@atlanta.com;tag=bmqkjhsd
To: sip:alice@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE


F11 200 OK SIP Proxy -> Carol (transport UDP)

SIP/2.0 200 OK
Via: SIP/2.0/UDP 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:bob@atlanta.com;tag=bmqkjhsd
To: sip:alice@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE







CASE 2)
- Alice uses TLS.
- Bob uses UDP.
- Proxy/registrar does loose-routing.
- Bob calls Alice, Alice answers and later Alice hangs up.


F1 INVITE Bob -> SIP Proxy (transport UDP)

INVITE sip:alice@atlanta.com SIP/2.0
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bK56sdasks
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 70
Contact: <sip:bob@77.123.45.23:5060;transport=udp>
Content-Type: application/sdp


F2 100 Trying SIP Proxy -> Bob (transport TLS)

SIP/2.0 100 Trying
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bK56sdasks
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE


F3 INVITE SIP Proxy -> Alice (transport TLS)

INVITE sips:alice@93.12.40.105:20565 SIP/2.0
Via: SIP/2.0/TLS 100.100.100.100;branch=z9hG4bKhjhjqw32c
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bK56sdasks
Record-Route: <sips:100.100.100.100;transport=tcp>,
  <sip:100.100.100.100;transport=udp>
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sip:bob@77.123.45.23:5060;transport=udp>
Content-Type: application/sdp


F4 200 OK Alice -> SIP Proxy (transport TLS)

SIP/2.0 200 OK
Via: SIP/2.0/TLS 100.100.100.100;branch=z9hG4bKhjhjqw32c
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bK56sdasks
Record-Route: <sips:100.100.100.100;transport=tcp>,
  <sip:100.100.100.100;transport=udp>
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sips:alice@93.12.40.105:20565;transport=tcp>
Content-Type: application/sdp


F5 200 OK SIP Proxy -> Bob (transport UDP)

SIP/2.0 200 OK
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bK56sdasks
Record-Route: <sips:100.100.100.100;transport=tcp>,
  <sip:100.100.100.100;transport=udp>
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 INVITE
Max-Forwards: 69
Contact: <sips:alice@93.12.40.105:20565;transport=tcp>
Content-Type: application/sdp


F6 ACK Bob -> SIP Proxy (transport UDP)

ACK sips:alice@93.12.40.105:20565;transport=tcp SIP/2.0
Via: SIP/2.0/TLS 77.123.45.23:5060;branch=z9hG4bKhgqqp090
Route: <sip:100.100.100.100;transport=udp>,
  <sips:100.100.100.100;transport=tcp>
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 ACK
Max-Forwards: 70


F7 ACK SIP Proxy -> Alice (transport TLS)

ACK sips:alice@93.12.40.105:20565;transport=tcp SIP/2.0
Via: SIP/2.0/TLS 100.100.100.100;branch=z9hG4bKhwpoc80zzx
Via: SIP/2.0/UDP 77.123.45.23:5060;branch=z9hG4bKhgqqp090
From: sip:bob@atlanta.com;tag=asdyka899
To: sip:alice@atlanta.com;tag=bmqkjhsd
Call-ID: asidkj3ss
CSeq: 1 ACK
Max-Forwards: 69


F8 BYE Alice -> SIP Proxy (transport TLS)

BYE sip:bob@77.123.45.23:5060;transport=udp SIP/2.0
Via: SIP/2.0/TLS 77.123.45.23;branch=z9hG4bKbiuiansd001
Route: <sips:100.100.100.100;transport=tcp>,
  <sip:100.100.100.100;transport=udp>
From: sip:alice@atlanta.com;tag=bmqkjhsd
To: sip:bob@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE
Max-Forwards: 70


F9 BYE SIP Proxy -> Bob (transport UDP)

BYE sip:bob@77.123.45.23:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 100.100.100.100;branch=z9hG4bKmma01m3r5
Via: SIP/2.0/TLS 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:alice@atlanta.com;tag=bmqkjhsd
To: sip:bob@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE
Max-Forwards: 69


F10 200 OK Bob -> SIP Proxy (transport UDP)

SIP/2.0 200 OK
Via: SIP/2.0/UDP 100.100.100.100;branch=z9hG4bKmma01m3r5
Via: SIP/2.0/TLS 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:alice@atlanta.com;tag=bmqkjhsd
To: sip:bob@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE


F11 200 OK SIP Proxy -> Alice (transport TLS)

SIP/2.0 200 OK
Via: SIP/2.0/TLS 77.123.45.23;branch=z9hG4bKbiuiansd001
From: sip:alice@atlanta.com;tag=bmqkjhsd
To: sip:bob@atlanta.com;tag=asdyka899
Call-ID: asidkj3ss
CSeq: 1201 BYE




These flows are inspired in real scenarios, so both are real and working flows.


-- 
Iñaki Baz Castillo
<ibc@aliax.net>