From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#8427: [SECURITY] sql.el -- comint process passwords are leaked to ps(1) listing Date: Sun, 6 Oct 2019 05:28:00 +0200 Message-ID: References: <87fwpxdjlk.fsf@blue.sea.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="226133"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 8427@debbugs.gnu.org, Stefan Monnier To: Andrew Hyatt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 06 05:29:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iGxEN-000wjD-4Q for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Oct 2019 05:29:11 +0200 Original-Received: from localhost ([::1]:59968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGxEL-0004CX-Bn for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 23:29:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48094) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGxEF-0004CF-25 for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 23:29:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGxEE-0006Mr-1C for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 23:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGxED-0006Mn-Ub for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 23:29:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iGxED-00087P-Pf for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 23:29:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87fwpxdjlk.fsf@blue.sea.net> Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Oct 2019 03:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8427 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 8427-submit@debbugs.gnu.org id=B8427.157033250031153 (code B ref 8427); Sun, 06 Oct 2019 03:29:01 +0000 Original-Received: (at 8427) by debbugs.gnu.org; 6 Oct 2019 03:28:20 +0000 Original-Received: from localhost ([127.0.0.1]:45425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGxDX-00086P-Nu for submit@debbugs.gnu.org; Sat, 05 Oct 2019 23:28:19 -0400 Original-Received: from mail-pf1-f195.google.com ([209.85.210.195]:40060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGxDV-000869-SS for 8427@debbugs.gnu.org; Sat, 05 Oct 2019 23:28:18 -0400 Original-Received: by mail-pf1-f195.google.com with SMTP id x127so6309069pfb.7 for <8427@debbugs.gnu.org>; Sat, 05 Oct 2019 20:28:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=svBcBcxNIZr4JBCN9CRz8DunOb4BN1y00G3GyhlPHsM=; b=IdOKfmZgcTQxRR7n9v7e32iNEzw6Ogi6MseO/bea/yO7/b9l/fxCHH4rmSRJ+HCfcY JqwgMMmME6mc5fcZMuQvJz/dGAyRTF3AaSVhjLmYmvgVxCAHSRbpXuxdQQVa4ahLUQ2h wZ99NhaayWt2dB1iHaXLuTGJpfGARaxDnRqkDG6QtmpB0wm7s/aWrK7I1f0KMLuXDUjS jQMmx/grDpHOCLEKUCuAhmBv89ToS2GCtAXbsW4zUVvMeHUlMZoGEunmT7U85k5H+dF7 ReV8EHruMuXUHCnQrgKfz5NbdMrKslMwKxjuRZM3P60LZGSsjN7iqvCMlUpVi+xxzes9 o5/Q== X-Gm-Message-State: APjAAAWuVg7pcPdqBSC873dWaBM/RsbDAuLsbePxx37OseeG3FIWMe44 ietL3OuER8UshvTwsttSVhJdOtUUhgo/MkhA/nA= X-Google-Smtp-Source: APXvYqyjPITvUiLsLEOKE2qMd06wA31pem+wFNodAr2/0M0G9wbpvH4tdL2OPTal90BZxyWPo/7KIyd9f0keF8nEQyE= X-Received: by 2002:a63:720f:: with SMTP id n15mr22881674pgc.198.1570332491892; Sat, 05 Oct 2019 20:28:11 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:168412 Archived-At: Hi Andrew, Andrew Hyatt writes: > This is fairly easy to fix - mysql can check to see if the user entered > a blank for the password prompt, and instead of not sending a password, > send just the "--password" argument so the user can enter it into the > process instead of the command line. I have a fix ready to check in > that works for mysql (I'm not sure which other products support that). I think using an empty "--pasword" parameter sounds like the right fix. That makes mysql prompt for the password, and we could supply it there instead. I guess that's what you meant? Could you perhaps send your patch here for review? > Alternatively, we can just have a variable that controls whether > passwords are asked for on the command line at all (if sql-password is > unset), which could default to nil, making the security better by > default. I'm not sure what this means, but I guess the above fix should be enough. Perhaps I'm missing something. > BTW, I guess the attack here is that another user process can use > something like strace to snoop on emacs's child processeses and obtain > the mysql password? Well, according to the threads linked earlier this can still be a problem on Solaris, where the password is visible to all users if they just run "ps". Perhaps it's been fixed since whenever these comments were written though... > Stefan Monnier writes: > >>> Apparently, no they cannot, since mysql replaces the password characters >>> with x's: >> >> Of course, that still leaves the chars exposed during a short time window. And as Stefan explains here the password is still exposed during a short time window even on GNU/Linux. AFAIU, it's a possible race attack which it would be nice to avoid. Best regards, Stefan Kangas