From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59817: [PATCH] Fix etags local command injection vulnerability Date: Sun, 04 Dec 2022 19:04:15 +0200 Message-ID: <83lenn9k34.fsf@gnu.org> References: <83r0xf9qsx.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7995"; mail-complaints-to="usenet@ciao.gmane.io" Cc: lx@shellcodes.org, 59817@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 04 18:05:17 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1sQX-0001rU-MU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Dec 2022 18:05:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1sQJ-0002VT-Mb; Sun, 04 Dec 2022 12:05:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1sQI-0002VK-JD for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 12:05:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1sQI-0008Rp-An for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 12:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1sQI-0004Ij-5x for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 12:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Dec 2022 17:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59817 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59817-submit@debbugs.gnu.org id=B59817.167017348416521 (code B ref 59817); Sun, 04 Dec 2022 17:05:02 +0000 Original-Received: (at 59817) by debbugs.gnu.org; 4 Dec 2022 17:04:44 +0000 Original-Received: from localhost ([127.0.0.1]:58720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1sQ0-0004IP-4k for submit@debbugs.gnu.org; Sun, 04 Dec 2022 12:04:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1sPx-0004IJ-HS for 59817@debbugs.gnu.org; Sun, 04 Dec 2022 12:04:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1sPr-0008PP-5Z; Sun, 04 Dec 2022 12:04:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VNnqGzNoLWM8/MmrdTBPocfjibw//vgGDOT5FedDJO8=; b=EcCaHMLNzjTR yLF11QCB7q/c9NbBnLuSBjgc/vBgwu7lZmJT1vzaj3CBHUq5v1Sp3hR/9mqgZdh+9muS2tassxuEF 7O75+guKZcDcMkyZVxKRNqcnyCGYxLmcfgKqeXS5HH/ThnJYZYzJKgesFth5n9n9SSXrtkWUA/aWG xKabEDwJEAhBdPz7ZQFgZmvmUml43A0FqWdnC40P6h3e0JQMKutDPRA4gGD9/deNYhB+c86enwg29 pEt+uWfoQv520FUuCpCPPYaYHq5/uMVDFPNPmNukXENu8nHeC90l6RRlQaCU4ualePVLtCwfhBeF9 Xqd9wDgEiFbkPH2GiLJUzw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1sPq-0005e4-Et; Sun, 04 Dec 2022 12:04:34 -0500 In-Reply-To: (message from Stefan Kangas on Sun, 4 Dec 2022 08:27:14 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249954 Archived-At: > From: Stefan Kangas > Date: Sun, 4 Dec 2022 08:27:14 -0800 > Cc: 59817@debbugs.gnu.org > > Eli Zaretskii writes: > > > Thanks, but no, thanks. This cure is worse than the disease. Let's please > > find simpler, more robust solutions. It TMPDIR is a problem, let's use a > > file whose name is hard-coded in the etags.c source, or quote the name when > > we pass it to the shell. If we suspect someone could disguise shell > > commands as file names, let's quote the file names we pass to the shell with > > '...' to prevent that. Etc. etc. -- let's use simple solutions that don't > > drastically change the code. > > With single quotes, every single quote character also needs to be quoted > so you can't just use a file named "';rm -rf $HOME;'". Yes. But still, doing so is hardly rocket science, and it leaves the general design of etags.c intact. > The safest option is to just not call system, of course. I'd rather not go there unless it was really necessary.