From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Copley Newsgroups: gmane.emacs.bugs Subject: bug#22202: 24.5; SECURITY ISSUE -- Emacs Server vulnerable to random number generator attack on Windows systems Date: Tue, 29 Dec 2015 17:44:47 +0000 Message-ID: References: <83lh8ddy45.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1451411123 28718 80.91.229.3 (29 Dec 2015 17:45:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Dec 2015 17:45:23 +0000 (UTC) Cc: 22202@debbugs.gnu.org, Demetri Obenour To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 29 18:45:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aDyKf-00022z-SB for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Dec 2015 18:45:14 +0100 Original-Received: from localhost ([::1]:49545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDyKf-0005M5-4p for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Dec 2015 12:45:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDyKX-0005Cr-Dk for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 12:45:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDyKU-0005jp-7c for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 12:45:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDyKU-0005jl-4Y for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 12:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aDyKT-0002CW-Rg for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 12:45:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Richard Copley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2015 17:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22202 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 22202-submit@debbugs.gnu.org id=B22202.14514110958435 (code B ref 22202); Tue, 29 Dec 2015 17:45:01 +0000 Original-Received: (at 22202) by debbugs.gnu.org; 29 Dec 2015 17:44:55 +0000 Original-Received: from localhost ([127.0.0.1]:48870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDyKN-0002Bz-7y for submit@debbugs.gnu.org; Tue, 29 Dec 2015 12:44:55 -0500 Original-Received: from mail-yk0-f182.google.com ([209.85.160.182]:33233) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDyKL-0002Bm-CF for 22202@debbugs.gnu.org; Tue, 29 Dec 2015 12:44:53 -0500 Original-Received: by mail-yk0-f182.google.com with SMTP id k129so112840505yke.0 for <22202@debbugs.gnu.org>; Tue, 29 Dec 2015 09:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=w4FRoQeZDHelDq/A0b+ipiVr9xt+TNPMeyoqA7bxccE=; b=cRINGNPY687NZHnlvG7LTGbWmVB1aMz55v9GYuj6SV/PtCMsQygDSjHyUEX62iN+wf 5OZqEa5UTZqTw68sSabFA9FjngwXkFaFtVbq4X4vhvJQgBoQcPtepWFN6xpKE/RKT9rE zEkqDonBExkheh5KJvHfuLx2xmOT9YmsZQh+MKjHT/bA0Fbp0LNzCsaI7UBAW4QFNoha IjR/PyewGXwmKIiqsiYO1cZT9vQfuqK5zZreYunVq6GS55lsmQBZ7oevi808eIGRqTKY BAoPVeZpYKmq4yfgcviZ29GcKeXOeGI2OjYXRSD237sSM43IaBD+92Iaeb2A+Ix1vHf7 NopQ== X-Received: by 10.129.33.65 with SMTP id h62mr44724708ywh.139.1451411087861; Tue, 29 Dec 2015 09:44:47 -0800 (PST) Original-Received: by 10.37.207.214 with HTTP; Tue, 29 Dec 2015 09:44:47 -0800 (PST) In-Reply-To: <83lh8ddy45.fsf@gnu.org> 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: 208.118.235.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:110970 Archived-At: On 29 December 2015 at 16:21, Eli Zaretskii wrote: >> Date: Tue, 29 Dec 2015 15:36:12 +0000 >> From: Richard Copley >> >> > Please provide the necessary details for reproducing this problem and >> > verifying the solution. What I'm missing: >> > >> > > 1. Be logged into the same Windows computer as someone else. >> > >> > How do you do that? I understand you are describing a situation where >> > 2 users are logged into the same Windows system simultaneously using >> > the same credentials, is that true? If so, how to create such a >> > situation? >> >> I don't think that is possible; however, two /different/ accounts can >> be logged in to a computer at the same time, via Remote Desktop or >> Fast User Switching. > > Logging in via Remote Desktop usurps the system, AFAIK. So these > possibilities are not relevant to the issue at hand. That is definitely not correct. In some configurations several users can connect via remote desktop. I do this every day. It /might/ be necessary to have a "Professional" and/or Server edition of Windows. A licensed Terminal Server supports dozens of sessions at once. Fast User Switching is a different thing. (Type CTRL-ALT-DEL and click "Switch User".) That, too, might require "Professional". >> > > 2. Have a process running that is notified whenever a process starts up >> > > 3. Have them run `emacs --daemon' or invoke `server-start'. >> > > 4. Use the knowledge of the current time and the server's PID to guess >> > > the authentication key. >> > >> > I don't think we use the current time and PID for that, but even if we >> > do, how do you get a hold of the time at the moment of the server >> > creation to nanosecond resolution? Please tell how to do that. >> >> We use function "random" (see function "server-generate-key"); its >> seed is typically set at startup using the current time and PID (see >> "init_random()" in sysdep.c), so it's the time Emacs started that you >> would want to know, not the time the server started. You can get the >> start time (to the nearest second at least) and PID of any user's >> processes using, e.g., Process Explorer. > > You need the time to nanosecond resolution to compute the seed. How > do you do that? I haven't tried, but the MSDN docs for GetProcessTimes say it returns the start time in 100 ns units. I'd guess that's what Process Explorer uses. >> I'm not sure what resolution timestamp we end up using as the seed. >> gettime() might return microsecond timestamps in certain configurations. > > On MS-Windows, gettime calls gettimeofday, which returns the system > clock in 100 nanosecond units. The actual resolution of the clock is > between 1 ms and 10 ms, but I think it's still an impossible task to > get the exact time we sample the clock during startup with such a high > accuracy. Perhaps you don't need to. Brute force. (Maybe that's ridiculous. I haven't tried to do the sums. Trying 100 to 1000 different values doesn't sound too hard.) >> I can't speak for Demetri but it seems to me he's imagining an attacker >> who is prepared to use a certain amount of brute force. Knowing or >> guessing the Emacs start time within a few seconds would reduce the >> search space. > > As I said, I don't see how such a user could even get access to a > machine without my paying attention. With respect, that's not correct (explained above). > And that if the services > required for remote access have not been turned off to begin with. Yes obviously, but many organizations do have Remote Desktop servers their staff can (or must) connect to.