From: "Francesco Potortì" <pot@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: lux <lx@shellcodes.org>, 59817@debbugs.gnu.org, stefankangas@gmail.com
Subject: bug#59817: [PATCH] Fix etags local command injection vulnerability
Date: Tue, 06 Dec 2022 16:19:32 +0100 [thread overview]
Message-ID: <87pmcwtv97.fsf@tucano.isti.cnr.it> (raw)
In-Reply-To: <83bkog7fev.fsf@gnu.org> (eliz@gnu.org)
>I don't understand why you need an extra pair of quotes in the expanded
>string.
>
> $ echo \''hello; world'
> 'hello; world
>
>As you see, the semi-colon was successfully hidden from the shell.
>
>What am I missing?
That only works at the beginning or end of a string. In general, inside a single-quoted string, single quotes are not allowed. So, to include a single quote inside a single-quoted string, you have to:
- close the quoted string using '
- put a literal single quote usign \'
- reopen the quoted string using '
If you want to avoid checking for the special cases of a stray single string at beginning or end of the original string, you just quote everything qith a single quote at beginning and end, and then substitute each ' with '\''.
next prev parent reply other threads:[~2022-12-06 15:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 13:51 bug#59817: [PATCH] Fix etags local command injection vulnerability lux
2022-12-04 14:39 ` Eli Zaretskii
2022-12-04 16:27 ` Stefan Kangas
2022-12-04 17:04 ` Eli Zaretskii
[not found] ` <tencent_2F6B5EEED2E485C363837738F5661E6AB009@qq.com>
2022-12-05 12:34 ` Eli Zaretskii
2022-12-06 7:48 ` lux
2022-12-06 12:55 ` Eli Zaretskii
2022-12-06 13:11 ` lux
2022-12-06 14:52 ` Eli Zaretskii
2022-12-06 15:05 ` Francesco Potortì
2022-12-06 15:19 ` Francesco Potortì [this message]
2022-12-06 15:49 ` lux
2022-12-06 16:14 ` Eli Zaretskii
2022-12-06 13:05 ` Andreas Schwab
2022-12-06 14:33 ` Eli Zaretskii
2022-12-05 0:58 ` lux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmcwtv97.fsf@tucano.isti.cnr.it \
--to=pot@gnu.org \
--cc=59817@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=lx@shellcodes.org \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).