git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lyndon Brown <jnqnfe@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: [gitk] bad quoting of user input for command line injection, with possible unintended side effects
Date: Tue, 01 Sep 2020 21:07:29 +0100	[thread overview]
Message-ID: <f3253a90491a76e755f0cd7d2b80032e6ea6ac88.camel@gmail.com> (raw)

Hi,

So I pasted the following line (without quotes) into the 'find' textbox
of gitk, whilst in 'touching paths' mode, intending to switch to
add/remove afterwards.

"*pp_es = (i_es > 0) ? calloc( i_es, sizeof(**pp_es) ) : NULL;"

This results in an error dialog stating the following:

----
can't read output from command: standard output was redirected
can't read output from command: standard output was redirected
    while executing
"open $cmd r+"
    (procedure "do_file_hl" line 28)
    invoked from within
"do_file_hl 46"
    ("after" script)
----

What prompted me to report this at this time (I've encountered and
ignored this previously) is that subsequently I switched back to git-
gui and refreshed, and was surprised to find that a new empty file had
been created called "0)".

Clearly the text has made it into some commandline execution without
proper quoting, thus the "> 0)" portion of the text has resulted in
creation of the file.

I'm using version 1:2.28.0-1 on Debian.


                 reply	other threads:[~2020-09-01 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3253a90491a76e755f0cd7d2b80032e6ea6ac88.camel@gmail.com \
    --to=jnqnfe@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).