git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[gitk] bad quoting of user input for command line injection, with possible unintended side effects

From
LBLyndon Brown <jnqnfe@gmail.com>
Date
Sep 1, 2020, 20:07 UTC
Message-ID
<f3253a90491a76e755f0cd7d2b80032e6ea6ac88.camel@gmail.com>
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.
Message 1 of 1 in “[gitk] bad quoting of user input for command line injection, with possible unintended side effects”
  1. Lyndon BrownSep 1, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.