Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753387Ab0FXX4e (ORCPT ); Thu, 24 Jun 2010 19:56:34 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:42421 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751266Ab0FXX4c (ORCPT ); Thu, 24 Jun 2010 19:56:32 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 From: KOSAKI Motohiro To: Kees Cook Subject: Re: [PATCH v2] sanitize task->comm to avoid leaking escape codes Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Andrew Morton , Tejun Heo , Veaceslav Falico , Alexander Viro , Oleg Nesterov , Neil Horman , Roland McGrath , Ingo Molnar , Peter Zijlstra , Hidetoshi Seto , Stefani Seibold , Thomas Gleixner , Eric Paris , James Morris , "Andrew G. Morgan" , Dhaval Giani , "Serge E. Hallyn" , Steve Grubb , Christoph Hellwig , linux-fsdevel@vger.kernel.org In-Reply-To: <20100624190527.GD5917@outflux.net> References: <20100624190527.GD5917@outflux.net> Message-Id: <20100625082722.8031.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.50.07 [ja] Date: Fri, 25 Jun 2010 08:56:28 +0900 (JST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1585 Lines: 35 > Through get_task_comm() and many direct uses of task->comm in the kernel, > it is possible for escape codes and other non-printables to leak into > dmesg, syslog, etc. In the worst case, these strings could be used to > attack administrators using vulnerable terminal emulators, and at least > cause confusion through the injection of \r characters. > > This patch sanitizes task->comm to only contain printable characters > when it is set. Additionally, it redefines get_task_comm so that it is > more obvious when misused by callers (presently nothing was incorrectly > calling get_task_comm's unsafe use of strncpy). > > Signed-off-by: Kees Cook I've reviewed this patch briefly, Here is my personal concern... On Linux, non-printable leaking is fundamental, only fixing task->comm doesn't solve syslog exploit issue. Probably all /proc/kmsg user should have escaping non-pritables code. However, task->comm is one of most easy injection data of kernel, because we have prctl(PR_SET_NAME), attacker don't need root privilege. So, conservative assumption seems guard from crappy fault. Plus, this patch is very small and our small TASK_COMM_LEN lead that we don't need big performance concern. So, I don't find demerit in this proposal. but I'm not security specialist, it's only personal thinking. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/