From patchwork Mon Aug 1 20:13:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 1026622 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p71KDmCI008092 for ; Mon, 1 Aug 2011 20:13:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753163Ab1HAUNs (ORCPT ); Mon, 1 Aug 2011 16:13:48 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:38699 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752821Ab1HAUNr (ORCPT ); Mon, 1 Aug 2011 16:13:47 -0400 Received: by gxk21 with SMTP id 21so3676799gxk.19 for ; Mon, 01 Aug 2011 13:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=v5kyzIkHtyz7ssVtw9rd214/NH8B1eVi1d78VtXD+jQ=; b=KgWC52L35FMp0Nj/NTfurm5VppzlLpVkwIP6aGDzIWutpglOLvz+qJ9nn6eZGizihV 5gv7lh/3MdpeWOL4RgbHUylqD4iD4gJ2ZT/P0R8HfsoFQD+VR3aYExqP8YwM3XzhIDmT nb7b+Ybkodfs5nblY9yluNzpEXvEmvUsn4sW0= Received: by 10.42.74.197 with SMTP id x5mr3212801icj.421.1312229626571; Mon, 01 Aug 2011 13:13:46 -0700 (PDT) Received: from seurat.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net [99.26.161.222]) by mx.google.com with ESMTPS id d5sm3552007ibi.45.2011.08.01.13.13.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Aug 2011 13:13:45 -0700 (PDT) From: Chuck Lever Subject: [PATCH] rpc.statd: Bind downcall socket to loopback address To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Date: Mon, 01 Aug 2011 16:13:43 -0400 Message-ID: <20110801201129.3503.99913.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 01 Aug 2011 20:13:49 +0000 (UTC) In the past, rpc.statd posted SM_NOTIFY requests using the same socket it used for sending downcalls to the kernel. To receive replies from remote hosts, the socket was bound to INADDR_ANY. With commit f113db52 "Remove notify functionality from statd in favour of sm-notify" (Mar 20, 2007), the downcall socket is no longer used for sending requests to remote hosts. However, the downcall socket is still bound to INADDR_ANY. Thus a remote host can inject data on this socket since it is an unconnected UDP socket listening for RPC replies. Thanks to f113db52, the port number of this socket is no longer controlled by a command line option, making it difficult to firewall. We have demonstrated that data injection on this socket can result in a DoS by causing rpc.statd to consume CPU and log bandwidth, but so far we have not found a breach. To prevent unwanted data injection, bind this socket to the loopback address. BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=177 Signed-off-by: Chuck Lever --- Confirmed that reboot recovery still works, and that data injection is no longer possible. This is an updated and final version of this patch. utils/statd/rmtcall.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c index 0e52fe2..4ecb03c 100644 --- a/utils/statd/rmtcall.c +++ b/utils/statd/rmtcall.c @@ -85,7 +85,7 @@ statd_get_socket(void) memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); if (bindresvport(sockfd, &sin) < 0) { xlog(D_GENERAL, "%s: can't bind to reserved port",