summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-10-19 19:37:12 +0200
committerAnuj Mittal <anuj.mittal@intel.com>2025-10-30 14:44:50 +0800
commit4e64442c585762c979fc8ed3e810cd07bb40453f (patch)
tree53bc2f9a55a17fce0466ef5353dea01342b01061 /meta-oe
parentbfff201fff61c301a101ff751af7941a68a6e7b5 (diff)
downloadmeta-openembedded-4e64442c585762c979fc8ed3e810cd07bb40453f.tar.gz
emacs: patch CVE-2024-39331
Details: https://nvd.nist.gov/vuln/detail/CVE-2024-39331 Pick the patch that's mentioned in thee details. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-support/emacs/emacs_29.1.bb1
-rw-r--r--meta-oe/recipes-support/emacs/files/0001-org-link-expand-abbrev-Do-not-evaluate-arbitrary-uns.patch71
2 files changed, 72 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/emacs/emacs_29.1.bb b/meta-oe/recipes-support/emacs/emacs_29.1.bb
index abc99d3e08..23388f309b 100644
--- a/meta-oe/recipes-support/emacs/emacs_29.1.bb
+++ b/meta-oe/recipes-support/emacs/emacs_29.1.bb
@@ -9,6 +9,7 @@ SRC_URI = "https://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.xz \
9 file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \ 9 file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \
10 file://0001-org-latex-preview-Add-protection-when-untrusted-cont.patch \ 10 file://0001-org-latex-preview-Add-protection-when-untrusted-cont.patch \
11 file://0001-org-file-contents-Consider-all-remote-files-unsafe.patch \ 11 file://0001-org-file-contents-Consider-all-remote-files-unsafe.patch \
12 file://0001-org-link-expand-abbrev-Do-not-evaluate-arbitrary-uns.patch \
12 " 13 "
13SRC_URI:append:class-target = " \ 14SRC_URI:append:class-target = " \
14 file://use-emacs-native-tools-for-cross-compiling.patch \ 15 file://use-emacs-native-tools-for-cross-compiling.patch \
diff --git a/meta-oe/recipes-support/emacs/files/0001-org-link-expand-abbrev-Do-not-evaluate-arbitrary-uns.patch b/meta-oe/recipes-support/emacs/files/0001-org-link-expand-abbrev-Do-not-evaluate-arbitrary-uns.patch
new file mode 100644
index 0000000000..88fdaaf22d
--- /dev/null
+++ b/meta-oe/recipes-support/emacs/files/0001-org-link-expand-abbrev-Do-not-evaluate-arbitrary-uns.patch
@@ -0,0 +1,71 @@
1From 8b8866eb94c7b7140ba94eb2b4e6ead14c0d986d Mon Sep 17 00:00:00 2001
2From: Ihor Radchenko <yantar92@posteo.net>
3Date: Fri, 21 Jun 2024 15:45:25 +0200
4Subject: [PATCH] org-link-expand-abbrev: Do not evaluate arbitrary unsafe
5 Elisp code
6
7* lisp/org/ol.el (org-link-expand-abbrev): Refuse expanding %(...)
8link abbrevs that specify unsafe function. Instead, display a
9warning, and do not expand the abbrev. Clear all the text properties
10from the returned link, to avoid any potential vulnerabilities caused
11by properties that may contain arbitrary Elisp.
12
13CVE: CVE-2024-39331
14Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?id=c645e1d8205f0f0663ec4a2d27575b238c646c7c]
15
16Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
17---
18 lisp/org/ol.el | 40 +++++++++++++++++++++++++++++-----------
19 1 file changed, 29 insertions(+), 11 deletions(-)
20
21diff --git a/lisp/org/ol.el b/lisp/org/ol.el
22index 9ad191c..c15128f 100644
23--- a/lisp/org/ol.el
24+++ b/lisp/org/ol.el
25@@ -1063,17 +1063,35 @@ Abbreviations are defined in `org-link-abbrev-alist'."
26 (if (not as)
27 link
28 (setq rpl (cdr as))
29- (cond
30- ((symbolp rpl) (funcall rpl tag))
31- ((string-match "%(\\([^)]+\\))" rpl)
32- (replace-match
33- (save-match-data
34- (funcall (intern-soft (match-string 1 rpl)) tag))
35- t t rpl))
36- ((string-match "%s" rpl) (replace-match (or tag "") t t rpl))
37- ((string-match "%h" rpl)
38- (replace-match (url-hexify-string (or tag "")) t t rpl))
39- (t (concat rpl tag)))))))
40+ ;; Drop any potentially dangerous text properties like
41+ ;; `modification-hooks' that may be used as an attack vector.
42+ (substring-no-properties
43+ (cond
44+ ((symbolp rpl) (funcall rpl tag))
45+ ((string-match "%(\\([^)]+\\))" rpl)
46+ (let ((rpl-fun-symbol (intern-soft (match-string 1 rpl))))
47+ ;; Using `unsafep-function' is not quite enough because
48+ ;; Emacs considers functions like `genenv' safe, while
49+ ;; they can potentially be used to expose private system
50+ ;; data to attacker if abbreviated link is clicked.
51+ (if (or (eq t (get rpl-fun-symbol 'org-link-abbrev-safe))
52+ (eq t (get rpl-fun-symbol 'pure)))
53+ (replace-match
54+ (save-match-data
55+ (funcall (intern-soft (match-string 1 rpl)) tag))
56+ t t rpl)
57+ (org-display-warning
58+ (format "Disabling unsafe link abbrev: %s
59+You may mark function safe via (put '%s 'org-link-abbrev-safe t)"
60+ rpl (match-string 1 rpl)))
61+ (setq org-link-abbrev-alist-local (delete as org-link-abbrev-alist-local)
62+ org-link-abbrev-alist (delete as org-link-abbrev-alist))
63+ link
64+ )))
65+ ((string-match "%s" rpl) (replace-match (or tag "") t t rpl))
66+ ((string-match "%h" rpl)
67+ (replace-match (url-hexify-string (or tag "")) t t rpl))
68+ (t (concat rpl tag))))))))
69
70 (defun org-link-open (link &optional arg)
71 "Open a link object LINK.