From owner-freebsd-security@freebsd.org Wed Jan 17 17:24:52 2018 Return-Path: Delivered-To: freebsd-security@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F3ADE7C3DC for ; Wed, 17 Jan 2018 17:24:52 +0000 (UTC) (envelope-from toasty@dragondata.com) Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F069F78EEC for ; Wed, 17 Jan 2018 17:24:51 +0000 (UTC) (envelope-from toasty@dragondata.com) Received: by mail-io0-x22a.google.com with SMTP id 25so21680231ioj.9 for ; Wed, 17 Jan 2018 09:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dragondata.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pbbKIHH1WFALFy3cEiEzfjtr1/8pYEz+s3nU1MJXTvs=; b=PVX3cEQXckBwZ4EIrrfrm9IQu9cX6YyF6/h0KtDy5UKIrQ3t5znuPSSi55zPZOb10G bxc6BVxfgcZCU9y3KBe2ast5co9tY7RC2OV/fnDm4dzFN0DA4YU1MeynrEbP4Kip+Rcp AFj0GF2wA5QsMBewjeiX5pOnjCD6dLWZtxgJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pbbKIHH1WFALFy3cEiEzfjtr1/8pYEz+s3nU1MJXTvs=; b=b+5PZb1HbIggoTDj1+cxgAvbRU0B0jLRiUj61UYl5v+E0BpHsa3hRmlbr5l7HOHXFZ bAobaQtc7A5qLnLigRM8MjroYc4mITBYTPLjJXiT4z7Gv5K8HzkWQ8Owb7nQSjBucSTk YXoodQDIWvmJDPCGWtlYB3+5FiMe6+pgfpw6W6l8IuEE5Y1pyearyBCVxT+xY+H3+yB7 tLJCPUD9XGKDhomJuWkRi2o4ZqaGLI79OZSlzAkKnAkpKUkrgRCutjM5qHiqi/RjZAxH Yg/lRex/sbU2pKBnIin2YRs/Xo5ndBgXZY9psNYxm7ZpA+x3DNjoy4OSSPAc6L9e5gy7 MOFQ== X-Gm-Message-State: AKwxytedMHjN//HXgd5EAOby06i7DE4ZB+aLQXQryKiFQNQAgBt9Ubiv 1rHx0kHLiV2kCmM/6c6m6eHz9RMNJyo= X-Google-Smtp-Source: ACJfBovE0vIf8ey1/rBPZrcYkB1848vgIGZnIJnnrgy1oc4kRXpZX6sjG8iTEyEnv1P+gWxFptqRig== X-Received: by 10.107.136.68 with SMTP id k65mr20964636iod.145.1516209891145; Wed, 17 Jan 2018 09:24:51 -0800 (PST) Received: from unassigned.v6.your.org ([2001:4978:1:45:7d12:36f7:8059:da7b]) by smtp.gmail.com with ESMTPSA id k75sm2711480iod.27.2018.01.17.09.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 09:24:50 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: Need FreeBSD-SA-00:52(TCP uses weak initial sequence numbers) latest patch From: Kevin Day In-Reply-To: Date: Wed, 17 Jan 2018 11:24:48 -0600 Cc: FreeBSD-security@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <7E7F9FCF-BA42-4B3C-871E-2DDC1229D14D@dragondata.com> References: <20180111171545.GC68137@fc.opsec.eu> To: Brahmanand Reddy X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2018 17:24:52 -0000 I think the confusion here is that your test program below has a bug - = your RST packet is invalid so it's not closing the socket on the other = side. If you look at how a normal RST is generated normally: 17:13:42.626365 IP src.26057 > dst.22: Flags [S], seq 472216885, win = 65535, length 0 17:13:42.626504 IP dst.22 > src.26057: Flags [S.], seq 3592434473, ack = 472216886, win 65535, length 0 17:13:42.626512 IP src.26057 > dst.22: Flags [R], seq 472216886, win 0, = length 0 Notice that the third packet (the RST packet) uses the sequence number = that the SYN had plus 1. Your program is using the SYNACK packet's = sequence number in the RST, which would look like this instead: 17:13:42.626365 IP src.26057 > dst.22: Flags [S], seq 472216885, win = 65535, length 0 17:13:42.626504 IP dst.22 > src.26057: Flags [S.], seq 3592434473, ack = 472216886, win 65535, length 0 17:13:42.626512 IP src.26057 > dst.22: Flags [R], seq 3592434473, win 0, = length 0 The dst system is treating this as an invalid RST packet because the = sequence number is incorrect and completely ignoring it, leaving the = socket still half open. When you send the SYN2 packet with the same = source and destination port, and the dst system still has the socket = open, it's going to repeat the same SYNACK back to you. If you change your program to send a RST with a sequence of the initial = SYN plus 1, you'll actually reset the connection and see the behavior = you're looking for. You're seeing the same ISN because your RST isn't = closing the connection on the other side, so the dst system is still = trying to open the original socket. > On Jan 11, 2018, at 7:20 PM, Brahmanand Reddy = wrote: >=20 > Hi Kurt, >=20 > Thanks lot responding my mail, >=20 > Please explain why you think this should be an issue for FreeBSD 10.2 = ? >=20 > Currently i am using 10.2 and 10.4, i found this = problem/vulnerability > still exist using below script >=20 > #!/usr/local/bin/python > from scapy.all import * >=20 > # VARIABLES > src =3D str(input('IP SRC: ')) > dst =3D str(input('IP DST: ')) >=20 > sport =3D random.randint(1024,65535) > dport =3D int(input("DST PORT: ")) >=20 >=20 > # SYN > ip=3DIP(src=3Dsrc,dst=3Ddst) > = SYN=3DTCP(sport=3Dsport,dport=3Ddport,flags=3D'S',seq=3Drandom.randint(102= 4,1048576), > ack=3D0) > SYNACK=3Dsr1(ip/SYN) > print('Seq1 Number is :',SYNACK[TCP].seq) =3D=3D> Seq1 >=20 > # RST > RST=3DTCP(sport=3Dsport, dport=3Ddport, flags=3D'R', seq=3DSYNACK.ack, = ack=3D0) > send(ip/RST) >=20 > #SYN > = SYN2=3DTCP(sport=3Dsport,dport=3Ddport,flags=3D'S',seq=3Drandom.randint(10= 24,1048576), > ack=3D0) > SYNACK2=3Dsr1(ip/SYN2) > print('Seq2 Number is :',SYNACK2[TCP].seq) = =3D=3D> > same ISN number i observed/receiving. >=20 > I mean seq1=3Dseq2, TCP ISN reusing. >=20 > i think the patch is available on 10.4 on wards, but i dint found > exactly/similar patch from https://www.freebsd.org/security/patches/ >=20 > It could be great to confirm what is the corresponding latest patch = this > problem would be solved. Kindly correct me anything i am missing. >=20 >=20 > Sincerely, > Brahma >=20 >=20 >=20 >=20 > On Thu, Jan 11, 2018 at 10:45 PM, Kurt Jaeger wrote: >=20 >> Hi! >>=20 >>> Please share the corresponding FreeBSD-SA-00:52(*TCP uses weak = initial >>> sequence numbers*) latest patch. >>>=20 >>> the original problem reported on : >>> https://www.freebsd.org/security/advisories/FreeBSD- >> SA-00%3A52.tcp-iss.asc >>=20 >> That's a security annoucement for FreeBSD 3.x to 5.x. >>=20 >> Please explain why you think this should be an issue for FreeBSD 10.2 = ? >>=20 >> And, by the way: FreeBSD 10.2 is a old, no-longer supported version. >>=20 >> https://www.freebsd.org/releases/ >>=20 >> lists which versions are still supported. >>=20 >> -- >> pi@FreeBSD.org +49 171 3101372 2 years to go ! >>=20 > _______________________________________________ > freebsd-security@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-security > To unsubscribe, send any mail to = "freebsd-security-unsubscribe@freebsd.org"