netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Ulrich Weber <ulrich.weber@riverbed.com>
Cc: netfilter-devel@vger.kernel.org, kaber@trash.net,
	Marco Angaroni <marcoangaroni@gmail.com>
Subject: Re: [PATCH] nf_conntrack_sip: check for trailing spaces
Date: Thu, 20 Oct 2016 20:17:32 +0200	[thread overview]
Message-ID: <20161020181732.GA10930@salvia> (raw)
In-Reply-To: <20161019082402.GA4575@gir>

Hi Ulrich,

Cc'ing Marco Angaroni.

On Wed, Oct 19, 2016 at 10:24:02AM +0200, Ulrich Weber wrote:
> on SIP requests, so a fragmented TCP SIP packet starting with
>  INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
>  Content-Length: 0
> 
> will not bet interpreted as an INVITE request.
> 
> Confirm with RFC 3261
>  Request-Line   =  Method SP Request-URI SP SIP-Version CRLF

Marco has missed your email, so I'm copying and pasting what he told
me wrt. to your patch:

My understanding is that Ulrich is referring to something like an
"Allow" header of a SIP message where the header name is part of a TCP
segment and the header value is part of the following TCP segment:

Allow: INVITE,ACK,CANCEL,OPTIONS,BYE

So I think the fix (check for a space after the method name) is
correct.
However maybe the check could be made more robust, because if you have
the fragmented "Allow" header containing the method names with a space
before comma (it's permitted by SIP grammar) like you see below, you
would again think that it's the first line of the SIP message:

Allow: INVITE , ACK , CANCEL , OPTIONS , BYE

Maybe it's worth checking two bytes after method name; the first byte
must be a space and the second must a alphanumeric character: the URI
following the method name has to start with "sip:" or "sips:" or some
other scheme, which starts for sure with an ALPHA character.

Request-Line   =  Method SP Request-URI SP SIP-Version CRLF
Request-URI    =  SIP-URI / SIPS-URI / absoluteURI
absoluteURI = scheme ":" ( hier-part / opaque-part )
scheme         =  ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

  reply	other threads:[~2016-10-20 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  8:24 [PATCH] nf_conntrack_sip: check for trailing spaces Ulrich Weber
2016-10-20 18:17 ` Pablo Neira Ayuso [this message]
2016-10-24 16:05   ` Ulrich Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161020181732.GA10930@salvia \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --cc=marcoangaroni@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=ulrich.weber@riverbed.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).