From: Gianni Tedesco <gianni@ecsc.co.uk>
To: "B. James Phillippe" <bryanxms@ecst.csuchico.edu>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: SYN cookies security bugfix?
Date: 08 Nov 2001 08:32:46 +0000 [thread overview]
Message-ID: <1005208367.20435.0.camel@lemsip> (raw)
In-Reply-To: <Pine.LNX.4.31.0111072116350.8925-100000@uranus.terran>
In-Reply-To: <Pine.LNX.4.31.0111072116350.8925-100000@uranus.terran>
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
On Thu, 2001-11-08 at 05:20, B. James Phillippe wrote:
> Hello,
>
> I received a forwarded message from SuSE regarding a security vulnerability
> with respect to randomization of the ISN for SYN cookies - or something to
> that effect. I have not been able to find the patch which addresses this
> problem; if anyone can point me towards it, I would be appreciative.
Hi,
Think this is the patch you want - (backported it from 2.4.14 to 2.4.9).
--
// Gianni Tedesco <gianni@ecsc.co.uk>
"Every great advance in natural knowledge has involved
the absolute rejection of authority." -- Thomas H. Huxley
[-- Attachment #2: syncookie-fix.diff --]
[-- Type: text/x-patch, Size: 2571 bytes --]
diff -urN linux.orig/include/net/sock.h linux/include/net/sock.h
--- linux.orig/include/net/sock.h Wed Aug 15 22:21:32 2001
+++ linux/include/net/sock.h Wed Nov 7 14:24:36 2001
@@ -416,6 +416,8 @@
unsigned int keepalive_time; /* time before keep alive takes place */
unsigned int keepalive_intvl; /* time interval between keep alive probes */
int linger2;
+
+ unsigned long last_synq_overflow;
};
diff -urN linux.orig/net/ipv4/syncookies.c linux/net/ipv4/syncookies.c
--- linux.orig/net/ipv4/syncookies.c Wed May 16 18:31:27 2001
+++ linux/net/ipv4/syncookies.c Wed Nov 7 14:23:54 2001
@@ -9,7 +9,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * $Id: syncookies.c,v 1.14 2001/05/05 01:01:55 davem Exp $
+ * $Id: syncookies.c,v 1.17 2001/10/26 14:55:41 davem Exp $
*
* Missing: IPv6 support.
*/
@@ -23,8 +23,6 @@
extern int sysctl_tcp_syncookies;
-static unsigned long tcp_lastsynq_overflow;
-
/*
* This table has to be sorted and terminated with (__u16)-1.
* XXX generate a better table.
@@ -53,7 +51,9 @@
int mssind;
const __u16 mss = *mssp;
- tcp_lastsynq_overflow = jiffies;
+
+ sk->tp_pinfo.af_tcp.last_synq_overflow = jiffies;
+
/* XXX sort msstab[] by probability? Binary search? */
for (mssind = 0; mss > msstab[mssind + 1]; mssind++)
;
@@ -78,14 +78,11 @@
* Check if a ack sequence number is a valid syncookie.
* Return the decoded mss if it is, or 0 if not.
*/
-static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
+static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
{
__u32 seq;
__u32 mssind;
- if ((jiffies - tcp_lastsynq_overflow) > TCP_TIMEOUT_INIT)
- return 0;
-
seq = ntohl(skb->h.th->seq)-1;
mssind = check_tcp_syn_cookie(cookie,
skb->nh.iph->saddr, skb->nh.iph->daddr,
@@ -126,8 +123,8 @@
if (!sysctl_tcp_syncookies || !skb->h.th->ack)
goto out;
- mss = cookie_check(skb, cookie);
- if (!mss) {
+ if (time_after(jiffies, sk->tp_pinfo.af_tcp.last_synq_overflow + TCP_TIMEOUT_INIT) ||
+ (mss = cookie_check(skb, cookie)) == 0) {
NET_INC_STATS_BH(SyncookiesFailed);
goto out;
}
@@ -178,7 +175,7 @@
opt &&
opt->srr ? opt->faddr : req->af.v4_req.rmt_addr,
req->af.v4_req.loc_addr,
- sk->protinfo.af_inet.tos | RTO_CONN,
+ RT_CONN_FLAGS(sk),
0)) {
tcp_openreq_free(req);
goto out;
next prev parent reply other threads:[~2001-11-08 8:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-08 5:20 SYN cookies security bugfix? B. James Phillippe
2001-11-08 8:32 ` Gianni Tedesco [this message]
2001-11-08 12:32 ` Alan Cox
2001-11-08 22:00 ` test SYN cookies (was Re: SYN cookies security bugfix?) Ed L Cashin
2001-11-10 22:04 ` Ed L Cashin
2001-11-10 22:34 ` Alan Cox
2001-11-11 5:17 ` Ed L Cashin
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=1005208367.20435.0.camel@lemsip \
--to=gianni@ecsc.co.uk \
--cc=bryanxms@ecst.csuchico.edu \
--cc=linux-kernel@vger.kernel.org \
/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