Skip to content

ev_spawn: escape field codes in the arguments (incomplete fix of CVE-2026-46529) - #738

Open
gpoo wants to merge 1 commit into
linuxmint:masterfrom
gpoo:wip/gpoo/spawn-field-codes
Open

gpoo wants to merge 1 commit into
linuxmint:masterfrom
gpoo:wip/gpoo/spawn-field-codes

Conversation

@gpoo

@gpoo gpoo commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

The fix for CVE-2026-46529 (50052ea here) quotes the page label, named
destination and search string passed to ev_spawn() with g_shell_quote().
However, g_app_info_create_from_commandline() expands desktop entry
field codes like %f before splitting the arguments, even inside quotes.
A named destination or page label "%f" in a document becomes the
document's path, unquoted, which can split it into several arguments
of the new process; and "50% off" arrives as "50off".

This escapes "%" as "%%" after quoting, as Evince does since
cf6dfa30d (Evince 48.5):
https://gitlab.gnome.org/GNOME/evince/-/commit/cf6dfa30d54b90af03a8fa52481efe792ea0bfd1

GLib documents that the Exec key rules apply, so "%" must be doubled:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5187

Used Evince's test for checking this (test-ev-spawn), built against this
helper, passes; with g_shell_quote() alone it fails.

Commit 50052ea quotes the page label, named destination and search string.
However, g_app_info_create_from_commandline() expands field codes like
%f before splitting the arguments, even inside quotes. Hence "50% off"
arrives as "50off", and a named destination "%f" becomes the document
path, unquoted, which can split it into several arguments.

Page labels and named destinations come from the document, so this is
still the argument injection of CVE-2026-46529. Escape "%" as "%%"
after quoting.

Based on Evince commit cf6dfa30d54b90af03a8fa52481efe792ea0bfd1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant