From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#59544: [PATCH] Fixed lib-src/etags.c command execute vulnerability Date: Thu, 24 Nov 2022 10:12:31 -0800 Message-ID: References: <837czkw7sl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59544@debbugs.gnu.org To: Eli Zaretskii , lux Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 24 19:13:22 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 1oyGiw-0001LB-1f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Nov 2022 19:13:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyGie-0002tV-Px; Thu, 24 Nov 2022 13:13:04 -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 1oyGic-0002rX-Op for bug-gnu-emacs@gnu.org; Thu, 24 Nov 2022 13:13: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 1oyGic-0006Dc-CT for bug-gnu-emacs@gnu.org; Thu, 24 Nov 2022 13:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oyGib-0006QC-Si for bug-gnu-emacs@gnu.org; Thu, 24 Nov 2022 13:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Nov 2022 18:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59544 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59544-submit@debbugs.gnu.org id=B59544.166931356024653 (code B ref 59544); Thu, 24 Nov 2022 18:13:01 +0000 Original-Received: (at 59544) by debbugs.gnu.org; 24 Nov 2022 18:12:40 +0000 Original-Received: from localhost ([127.0.0.1]:59982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyGiF-0006PZ-TU for submit@debbugs.gnu.org; Thu, 24 Nov 2022 13:12:40 -0500 Original-Received: from mail-oi1-f171.google.com ([209.85.167.171]:47017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyGiE-0006PM-Cb for 59544@debbugs.gnu.org; Thu, 24 Nov 2022 13:12:38 -0500 Original-Received: by mail-oi1-f171.google.com with SMTP id r76so2239746oie.13 for <59544@debbugs.gnu.org>; Thu, 24 Nov 2022 10:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=UglYn8Op/mNLAnKg98ngC2F9GSt4E/SaZehWwi4licc=; b=Qf5ypC9NQLUSMgGWMY6/PCnYd5ZJf6XTaRZrsyQssWKFWLLY1CyhGElcgeN0IzrVK7 sU0JwJWaLU3pjLwC8IxxLLtwVqPD42dMcR9fytVW2/WFktUuolU7C71O74WbdtB3EclZ mVEReMDJHcFjuk8fTbe6ZrSBM6Y2RVFwBm8ysYtCoNTKgv8LChls1mu1Gq5x4KvAXJbg nFOx6YUHwxXUzGY3vNGrd/VKA4GLWSctuRBU7kWCQ9HowrUN8+j+KUnb6N3kcBneJvTQ bEAgPcTOX7vTeRjoTmu0smrvCQyj/AXaoRd3XaXAUknF7NjWKmoc7d0q1Lx/ceMshNkU yUUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UglYn8Op/mNLAnKg98ngC2F9GSt4E/SaZehWwi4licc=; b=PkfQph71+aBD57Nb8H7jddaIYV/RE2PTSakP5Kac9X1CI0FU4SA5/gTIlocW6JhHFQ nQmbGcjFGDTQf7247LIQVHY3wE+U9fA2+F7ZqGWwTNfLBqTHDjOkrfDCYowGGO6/5SFw 4Hkqtk3UUOELUFURRQpPvVdXVHzQCqwTaoF6Wxjb92x8IHnqL0/Xk22RvaiEVj69/aUF r7o2R+VCzqv0qOPUu/RqnJOQhokWjky5h9oibvldo0cK0is+7txXeSTento3DNE3FS5D MK5C7y5y2IS8LwuCmW/S1GAC4wn780rHcNySgD7807HaUye6mUJEWZmbpIAjkRpHoAjr 4WYA== X-Gm-Message-State: ANoB5pk2XfwQA8rSC6b1icm/iW/HDhe6NRegri2O7DlmC5QPELVN+50s BIYCDlUPWIurJHhKRT5/sszAJhieMMaq1ulDcYw= X-Google-Smtp-Source: AA0mqf6Oy/5i565Wkf0bUc36S/NbWshVPEG1NWJYF03N5YW/Q7FOt4uND+sLXJK61KVnJ/Y2prGIrb0gkoIBwHZ6JNw= X-Received: by 2002:a05:6808:2229:b0:35b:2b17:af81 with SMTP id bd41-20020a056808222900b0035b2b17af81mr7429585oib.199.1669313552565; Thu, 24 Nov 2022 10:12:32 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 24 Nov 2022 10:12:31 -0800 In-Reply-To: <837czkw7sl.fsf@gnu.org> X-Hashcash: 1:20:221124:59544@debbugs.gnu.org::cDZlnbUGXCAsl3mL:0FCK 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:248886 Archived-At: Eli Zaretskii writes: > Thanks, but the solution you propose for this is too drastic: it in effect > rejects legitimate file names just because they have characters which look > "suspicious". I think we need a more accurate test, which will not produce > false positives so easily. Or maybe we need to ask the user for > confirmation instead of skipping the files with suspicious names. I think we could escape the file name using single quotes, but AFAIU we then need to escape single quote characters too, so that: ' becomes '\'' See here for why: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Single-Quotes But would it not be better to rewrite etags.c to not use system(1) at all?