From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Max Nikulin Newsgroups: gmane.emacs.bugs Subject: bug#66390: `man' allows to inject arbitrary shell code Date: Mon, 9 Oct 2023 22:12:34 +0700 Message-ID: References: <83wmvyzir2.fsf@gnu.org> <585dcaf0-358e-4a9d-84d1-6fd9c2c8aec5@gmail.com> <83v8bizf9r.fsf@gnu.org> <1865abb8-16cd-4570-9a8a-87cf9430583d@gmail.com> <875y3iigua.fsf@gmx.de> <83o7hazap7.fsf@gnu.org> <87mswugyoq.fsf@gmx.de> <83jzryz6op.fsf@gnu.org> <87a5sugwcx.fsf@gmx.de> <83h6n2z3tr.fsf@gnu.org> <831qe5znrz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26688"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 66390@debbugs.gnu.org, michael.albinus@gmx.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 09 17:14:06 2023 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 1qprxN-0006ho-IK for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Oct 2023 17:14:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qprx1-0001eA-M5; Mon, 09 Oct 2023 11:13:43 -0400 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 1qprwz-0001du-Qn for bug-gnu-emacs@gnu.org; Mon, 09 Oct 2023 11:13:41 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qprwz-0000vv-Im for bug-gnu-emacs@gnu.org; Mon, 09 Oct 2023 11:13:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qprxJ-0000Zu-NW for bug-gnu-emacs@gnu.org; Mon, 09 Oct 2023 11:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Max Nikulin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Oct 2023 15:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66390 X-GNU-PR-Package: emacs Original-Received: via spool by 66390-submit@debbugs.gnu.org id=B66390.16968643912138 (code B ref 66390); Mon, 09 Oct 2023 15:14:01 +0000 Original-Received: (at 66390) by debbugs.gnu.org; 9 Oct 2023 15:13:11 +0000 Original-Received: from localhost ([127.0.0.1]:60702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qprwR-0000YM-5O for submit@debbugs.gnu.org; Mon, 09 Oct 2023 11:13:11 -0400 Original-Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:60689) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qprwN-0000Xo-3J for 66390@debbugs.gnu.org; Mon, 09 Oct 2023 11:13:05 -0400 Original-Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2bfed7c4e6dso52118301fa.1 for <66390@debbugs.gnu.org>; Mon, 09 Oct 2023 08:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696864356; x=1697469156; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=/A6Fnp0ZDnH0YxljJu73DI0ix4EfIPhk2muLvghBgts=; b=MteaK7rPNskOeNh9X8nkvNiQzmGcD87ks0FV/pkqISbEcu27/AYDm+ERKcyPvlgerr uS5Iw80IfLH/sv+/r4xw7peE/esBQA1SS0X2wh5eQBA4lv2vpOWwf4rFivcgs4yXtdvR FXbsjis9VFizjk5ql3Ffqyxl6A63d7ZIxuPozRL1GXyvD1FJSl14NcHMFeRRVc7Ya2Gn tTJ1Gqw6O6/CRYI+Bo7HMOMx523p2Vxu/kMBiW8WOq+7g3X7qmKw/0KwcDcry+vVHDuu 009IwRqOlO+oDTUK3+EAPf8Fdii0/d2xqIqZ4BXiVoyZKPt/WYrLcjVQc9f9AilZNJjg Zkrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696864356; x=1697469156; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/A6Fnp0ZDnH0YxljJu73DI0ix4EfIPhk2muLvghBgts=; b=mwK6IJX7uLnqwF4tI8OhWvegIVE491qM6GyOADdaUNnsOxaFBEuMeULjOfoMqIVvu1 9C6/II0WZIzKa+iVYevPuSkk2CmsSG6JQVAnh/bknkRTT4Y7oGqYcV6HzJ6uPVAf9Sns 4hmZxv4VW7A/tpYbdoowJgTeWUyOPDpI0v2R+zRSjAQkfdcdobkXfUfn5C5Swgvy1osD 7FUAEKl7hy9WbKqgSmV7k1rCpky81zsOlPzlkr8CJdoY5Ebs4recpTvnrHTH7HrIllZQ DTEl85D+csR1U3uz3Z6sHa1BZZn+cdFs9NFrBj1s8uLaU3QNbz6XeNHv798bXYf+MeYR REbA== X-Gm-Message-State: AOJu0YzGmjtU6+++ks8u2GAWy01oD/30gCxvAE4urN8nV+s94/1laHj8 RXNFEodVcA9oYtRISHazSHk= X-Google-Smtp-Source: AGHT+IEaATbEm/1n3pGgiUavsUbLCpzM4ZZIfi+Tbt93EDGDBh4PJSi3VPhxGlK0D3Q6Vbn8fSyIMQ== X-Received: by 2002:a2e:9b51:0:b0:2b9:412a:111d with SMTP id o17-20020a2e9b51000000b002b9412a111dmr15609822ljj.42.1696864356199; Mon, 09 Oct 2023 08:12:36 -0700 (PDT) Original-Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id e9-20020a2e8189000000b002c12630e4d3sm2099487ljg.127.2023.10.09.08.12.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Oct 2023 08:12:35 -0700 (PDT) Content-Language: en-US, ru-RU In-Reply-To: <831qe5znrz.fsf@gnu.org> 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:272150 Archived-At: On 08/10/2023 12:28, Eli Zaretskii wrote: >> Date: Sun, 8 Oct 2023 10:37:33 +0700 From: Max Nikulin > >> I had in mind using at least `shell-quote-argument'. > That doesn't work with 'man', which has its own ideas about quoting, > besides shell-related quoting. I see usage of `shell-quote-argument' for completion where shell is not involved. During formatting there is parsing of references with some regular expressions to get (X) section suffix, but I have not noticed quoting. Certainly the code relies on spaces passed literally and substituted into shell command directly. If there were page names with spaces it would be a problem. I mean passing through `shell-quote-argument' each word returned by `Man-translate-references' P.S. (defun Man-translate-cleanup (string) "Strip leading, trailing and middle spaces." ^^^^^^^^^^^^^ (Man-translate-cleanup " w") " w" ?