From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Joey Hess <joeyh@joeyh.name>, git@vger.kernel.org
Subject: Re: [PATCH] avoid insecure use of mail in man page example
Date: Tue, 28 Sep 2021 16:46:52 -0700 [thread overview]
Message-ID: <xmqqtui4gt5f.fsf@gitster.g> (raw)
In-Reply-To: <YVNi91WYyj3Le6UF@coredump.intra.peff.net> (Jeff King's message of "Tue, 28 Sep 2021 14:46:15 -0400")
Jeff King <peff@peff.net> writes:
> On Tue, Sep 28, 2021 at 08:16:48AM -0400, Joey Hess wrote:
>
>> As recently seen in fail2ban's security hole (CVE-2021-32749),
>> piping user controlled input to mail is exploitable,
>> since a line starting with "~! foo" in the input will run command foo.
>>
>> This example on the man page pipes to mail. It may not be exploitable.
>> git rev-list --pretty indents commit messages, which prevents the escape
>> sequence working there. It's less clear if it might be possible to embed
>> the escape sequence in a signed push certificate. The user reading the
>> man page might alter the example to do something more exploitable.
>> To encourage safe use of mail, add -E 'set escape'
>
> Seems like a good goal, but is "-E" portable?
>
> On my system, where "mail" comes from the bsd-mailx package, "-E" means
> "do not send a message with an empty body" and your example command
> barfs as it tries to deliver to the recipient "set escape".
>
> At least we'd want to make a note in the documentation saying what the
> mysterious "set escape" is doing, and that not all versions of mail
> would need / want it.
It is not the primary focus for this documentation page to teach how
to send e-mails in the first place. Instead of risking confused
users rightly complain with "my 'mail' does not understand the -E
option---what does this do?", I wonder if it is better to just change it to
git rev-list --pretty ...
- fi |
- mail -s ...
+ fi >>/var/log/update.log
so that it illustrates what's available *out* *of* *us* to the
authors of the script, without having to teach them "mail" and other
things we are responsible for.
next prev parent reply other threads:[~2021-09-28 23:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 12:16 [PATCH] avoid insecure use of mail in man page example Joey Hess
2021-09-28 18:46 ` Jeff King
2021-09-28 23:46 ` Junio C Hamano [this message]
2021-09-29 0:26 ` Jeff King
2021-10-18 0:55 ` Jonathan Nieder
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=xmqqtui4gt5f.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=joeyh@joeyh.name \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.