From: Dave Marotti <landshark666@gmail.com>
To: git@vger.kernel.org
Subject: Starting subshells via tags
Date: Wed, 12 Sep 2018 12:34:52 -0500 [thread overview]
Message-ID: <CA+5phNzsn8wS39aSLZJDNahxYoBuK3QZX81KWpaSKavssVLREw@mail.gmail.com> (raw)
Hello -
This is not a git bug or issue. It's just something I stumbled across
and didn't see any google results for. I thought others would benefit
from being aware of it.
I saw a makefile which included of "git describe --tags --dirty" to
define version information for a binary's --version command line
parameter. The commit/tag information was passed to g++ in a Makefile
via:
CXXFLAGS += -DBUILD_COMMIT="\"$(shell git describe --tags --dirty)\""
For fun (on Linux) I made simple c++ program and Makefile with the
above CXXFLAGS, and a tag (backticks work too): git tag
'$(echo>/tmp/test.txt)'
Then built. Make executes the git command via a shell and the shell
executes the subshell. /tmp/test.txt was created.
The tags themselves don't allow spaces so the complexity of the
command is limited, though I didn't explore what I could do with
chaining shells or escape characters. It's easy enough to add a script
to the repository where the tag is located and execute that script
from the tag's subshell with a tag, such as $(./test.sh).
Again, this is not at all a git issue, git is just used as the
transport. As with every other shell attack, it comes down to "always
sanitize what you pass through to a shell". Or don't pass it to the
shell at all, use another mechanism.
reply other threads:[~2018-09-12 17:34 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=CA+5phNzsn8wS39aSLZJDNahxYoBuK3QZX81KWpaSKavssVLREw@mail.gmail.com \
--to=landshark666@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).