* [PATCH v2] nf_conntrack_sip: extend request line validation
@ 2016-10-24 16:07 Ulrich Weber
2016-10-25 7:07 ` Marco Angaroni
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weber @ 2016-10-24 16:07 UTC (permalink / raw)
To: netfilter-devel; +Cc: kaber, marcoangaroni, pablo
on SIP requests, so a fragmented TCP SIP packet from an allow header starting with
INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Content-Length: 0
will not bet interpreted as an INVITE request. Also Request-URI must start with an alphabetic character.
Confirm with RFC 3261
Request-Line = Method SP Request-URI SP SIP-Version CRLF
Signed-off-by: Ulrich Weber <ulrich.weber@riverbed.com>
---
net/netfilter/nf_conntrack_sip.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 7700556..df773d6 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1436,9 +1436,12 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff,
handler = &sip_handlers[i];
if (handler->request == NULL)
continue;
- if (*datalen < handler->len ||
+ if (*datalen < handler->len + 2 ||
strncasecmp(*dptr, handler->method, handler->len))
continue;
+ if ((*dptr)[handler->len] != ' ' ||
+ !isalpha((*dptr)[handler->len+1]))
+ continue;
if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CSEQ,
&matchoff, &matchlen) <= 0) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nf_conntrack_sip: extend request line validation
2016-10-24 16:07 [PATCH v2] nf_conntrack_sip: extend request line validation Ulrich Weber
@ 2016-10-25 7:07 ` Marco Angaroni
2016-10-27 16:29 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Marco Angaroni @ 2016-10-25 7:07 UTC (permalink / raw)
To: Ulrich Weber; +Cc: netfilter-devel, kaber, Pablo Neira Ayuso
Hello,
2016-10-24 18:07 GMT+02:00 Ulrich Weber <ulrich.weber@riverbed.com>:
> on SIP requests, so a fragmented TCP SIP packet from an allow header starting with
> INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
> Content-Length: 0
>
> will not bet interpreted as an INVITE request. Also Request-URI must start with an alphabetic character.
>
> Confirm with RFC 3261
> Request-Line = Method SP Request-URI SP SIP-Version CRLF
>
> Signed-off-by: Ulrich Weber <ulrich.weber@riverbed.com>
Looks ok to me.
Acked-by: Marco Angaroni <marcoangaroni@gmail.com>
> ---
> net/netfilter/nf_conntrack_sip.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
> index 7700556..df773d6 100644
> --- a/net/netfilter/nf_conntrack_sip.c
> +++ b/net/netfilter/nf_conntrack_sip.c
> @@ -1436,9 +1436,12 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff,
> handler = &sip_handlers[i];
> if (handler->request == NULL)
> continue;
> - if (*datalen < handler->len ||
> + if (*datalen < handler->len + 2 ||
> strncasecmp(*dptr, handler->method, handler->len))
> continue;
> + if ((*dptr)[handler->len] != ' ' ||
> + !isalpha((*dptr)[handler->len+1]))
> + continue;
>
> if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CSEQ,
> &matchoff, &matchlen) <= 0) {
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] nf_conntrack_sip: extend request line validation
2016-10-25 7:07 ` Marco Angaroni
@ 2016-10-27 16:29 ` Pablo Neira Ayuso
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2016-10-27 16:29 UTC (permalink / raw)
To: Marco Angaroni; +Cc: Ulrich Weber, netfilter-devel, kaber
On Tue, Oct 25, 2016 at 09:07:23AM +0200, Marco Angaroni wrote:
> Hello,
>
> 2016-10-24 18:07 GMT+02:00 Ulrich Weber <ulrich.weber@riverbed.com>:
> > on SIP requests, so a fragmented TCP SIP packet from an allow header starting with
> > INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
> > Content-Length: 0
> >
> > will not bet interpreted as an INVITE request. Also Request-URI must start with an alphabetic character.
> >
> > Confirm with RFC 3261
> > Request-Line = Method SP Request-URI SP SIP-Version CRLF
> >
> > Signed-off-by: Ulrich Weber <ulrich.weber@riverbed.com>
>
> Looks ok to me.
>
> Acked-by: Marco Angaroni <marcoangaroni@gmail.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-27 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 16:07 [PATCH v2] nf_conntrack_sip: extend request line validation Ulrich Weber
2016-10-25 7:07 ` Marco Angaroni
2016-10-27 16:29 ` Pablo Neira Ayuso
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).