From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp1 ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id 8OxJAT4Kr2BxbwAAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 27 May 2021 04:55:58 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp1 with LMTPS
	id GNOVOD0Kr2DYZwAAbx9fmQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 27 May 2021 02:55:57 +0000
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 05B0F15875
	for <larch@yhetil.org>; Thu, 27 May 2021 04:55:57 +0200 (CEST)
Received: from localhost ([::1]:53860 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1lm6Bf-00076K-Rh
	for larch@yhetil.org; Wed, 26 May 2021 22:55:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33172)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1lm6Ao-0006Oc-Vn; Wed, 26 May 2021 22:55:02 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:38834)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1lm6Ao-0004Jd-JH; Wed, 26 May 2021 22:55:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1lm6Ao-00021j-GJ; Wed, 26 May 2021 22:55:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: bug#48676: Arbitrary code execution in Org export macros
References: <2nk0nl7asb.fsf@fencepost.gnu.org>
Resent-From: Greg Minshall <minshall@umich.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org
Resent-Date: Thu, 27 May 2021 02:55:02 +0000
Resent-Message-ID: <handler.48676.B48676.16220840597723@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 48676
X-GNU-PR-Package: emacs,org-mode
X-GNU-PR-Keywords: security
To: Glenn Morris <rgm@gnu.org>
Received: via spool by 48676-submit@debbugs.gnu.org id=B48676.16220840597723
 (code B ref 48676); Thu, 27 May 2021 02:55:02 +0000
Received: (at 48676) by debbugs.gnu.org; 27 May 2021 02:54:19 +0000
Received: from localhost ([127.0.0.1]:50376 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1lm6A6-00020V-SP
 for submit@debbugs.gnu.org; Wed, 26 May 2021 22:54:19 -0400
Received: from relay-egress-host.us-east-2.a.mail.umich.edu
 ([18.219.209.13]:48318 helo=joyful-pryderi.relay-egress.a.mail.umich.edu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <minshall@umich.edu>) id 1lm6A4-00020I-Fs
 for 48676@debbugs.gnu.org; Wed, 26 May 2021 22:54:16 -0400
Received: from shaggy-alux.authn-relay.a.mail.umich.edu
 (ip-10-0-74-243.us-east-2.compute.internal [10.0.74.243])
 by joyful-pryderi.relay-egress.a.mail.umich.edu with ESMTPS
 id 60AF09D2.B252B.7065D8E5.1224308; Wed, 26 May 2021 22:54:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu;
 s=relay-2018-08-29; t=1622084050;
 bh=jeJ3Nq/QViL185aDFTFzng7gdFvbeZlA4oMvc2Z0hf0=;
 h=From:To:cc:Subject:In-reply-to:Date;
 b=Cf1/YxGU/rDGwNOwfd0GMptAJllg+JJkwhy0+pt5Ryios+hDaV1MefAE98BbMHKnq
 YCbD9DIVV8KTOfJNDNFH77QoqAyeK4zPCGaFc2hbUHpihLhwNs2qpBFKksGJgi/obe
 A9Iei4M7VwEIDZAq7calka5EM8ZKYuYroQpizbofeihG9/+CSBby5YRkVUpknfcGg7
 O/7SfZqJ0Fz4XsdWytvae+2eJpyMfvP9S2fxFs951zroevee6MBPBbwq55qf9WTACg
 AZRBxEx3zeEBijmooNA5YWv8p9DdOixgTtcLzfPnyhhp8qPP+LB92cMl2dENnlFHGX
 yBnzwvOuGweGA==
Received: from localhost (Mismatch [88.236.240.114])
 by shaggy-alux.authn-relay.a.mail.umich.edu with ESMTPSA
 id 60AF09CF.F13A9.DE8AB7C.1769026; Wed, 26 May 2021 22:54:08 -0400
From: Greg Minshall <minshall@umich.edu>
In-reply-to: Your message of "Wed, 26 May 2021 11:52:04 -0400."
 <2nk0nl7asb.fsf@fencepost.gnu.org>
X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.2
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <4005253.1622084044.1@apollo2.minshall.org>
Date: Thu, 27 May 2021 05:54:04 +0300
Message-ID: <4005254.1622084044@apollo2.minshall.org>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: emacs-orgmode@gnu.org
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Cc: 48676@debbugs.gnu.org
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1622084157;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:resent-cc:resent-from:resent-sender:
	 resent-message-id:in-reply-to:in-reply-to:references:references:
	 list-id:list-help:list-unsubscribe:list-subscribe:list-post:
	 dkim-signature; bh=jeJ3Nq/QViL185aDFTFzng7gdFvbeZlA4oMvc2Z0hf0=;
	b=bp5S3JyKHWmWFmfdc+gYkLlEQVRwJ1Pi9ZC6U0hL4cV9DgCHYw1aMktjtiwmy85TT60PWQ
	dVE5irGAqrnLNOAdVGkWpKo3GMUQA9bEeONylYxWDe+fLzLr/m9WIjo5gvQ0j4XRN2X7wa
	yF/783Bmqlz0A1NPfnlGSWQx27/33QG0qTd4w0KlvOjIvSuooCayACzvsGi926s0kud6XY
	79E/Q6Qnrq2QEI552xsS/JSX7Iy1JDrJp3PFkuu8WBRgDFqpyp2XoWHLyVnoZE0ciJNs4R
	1YwZ69025fPazfVEZVeS4OBhBhOc4qlB6+tjRTxOrFmD3YjqcjHQJN1XAfmEJQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622084157; a=rsa-sha256; cv=none;
	b=UimQxveUXI9ODh1FPH6hoPDVE774h7SDXoF2Y+4YOvxj2e655kRH9CZv6FFouGbMGEiqRa
	G1OvggUHpUrKeKs8vak74s06jp+S733nHfA0auUCKl6vFbis2wHLtfvJXu0UZhY3jDJj4F
	JaYmEZP4dGeIeackdMyIjZiwZ7WzMaZPPOJxhusu+xzM2vR16ugrhd73a0s9AGRGiKRjEV
	bEgO9QAr0FYmgh188ty45tfGHkVsjOm/yEw6oCNtFlYT43PQsqJBeACpMdm3UnDeB5g71H
	jM5MEh0NFvc8Jbpo10ErL8ROLQh3UO5Ym08gU7MaEiK960dLjEegeMz4742V/Q==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=umich.edu header.s=relay-2018-08-29 header.b="Cf1/YxGU";
	dmarc=fail reason="SPF not aligned (relaxed)" header.from=umich.edu (policy=none);
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Spam-Score: -1.33
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=umich.edu header.s=relay-2018-08-29 header.b="Cf1/YxGU";
	dmarc=fail reason="SPF not aligned (relaxed)" header.from=umich.edu (policy=none);
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Queue-Id: 05B0F15875
X-Spam-Score: -1.33
X-Migadu-Scanner: scn0.migadu.com
X-TUID: Q/1Z6gGCZEyH

Glenn,

thanks for the report.

i guess my take is that macro-evaluation, and that of other forms,
should be subject to the same restrictions as that of source block
evaluation.  i.e., prompting for permission to execute, subject to
=org-confirm-babel-evaluate= (or, more specific variables).

cheers, Greg

> Package: emacs,org-mode
> Version: 28.0.50
> Severity: important
> Tags: security
> 
> emacs -Q hello.org, where hello.org contains:
> 
> #+macro: hello (eval (shell-command-to-string "touch /tmp/HELLO"))
> Hello. {{{hello}}}
> 
> Then:
> M-x org-export-dispatch
> t A
> 
> -> now /tmp/HELLO exist, with no prompting.
> 
> This seems contrary to normal Emacs practice for risky local variables,
> and to the section "Code Evaluation and Security Issues" in the Org manual
> (which does not mention macros).