unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: Re: Emacs master, security concernes, ms-windows
Date: Thu, 14 Sep 2017 15:33:40 +0200	[thread overview]
Message-ID: <87k211xv4b.fsf@qcore> (raw)
In-Reply-To: CAFgFV9PEF0BA_VQx9EYXmx5=e3v5arr8oBBHfdp7OaqCF0Ny8Q@mail.gmail.com

Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> Since there seems to be a lot of concerns wrt to security,
> I am submitting the attached patch.
>
> The reason for this patch is to limit the search for dlls loaded at
> runtime to the win32 system directory and/or the emacs application
> directory.
> In the current state, dlls can be picked up in any directory in the path.
> Some one could fake one of these dlls (xpm, png, etc.) and use it for
> mean reasons.
> It is not bullet proof, but it levels up security and
> many other projects have applied such a restriction.
>
> Best regards,
>
> Fabrice
> diff --git a/src/unexw32.c b/src/unexw32.c
> index 5259b2a52b..10f720f734 100644
> --- a/src/unexw32.c
> +++ b/src/unexw32.c
> @@ -772,7 +820,7 @@ unexec (const char *new_name, const char *old_name)
>    {
>      PIMAGE_DOS_HEADER dos_header;
>      PIMAGE_NT_HEADERS nt_header;
> -    HANDLE hImagehelp = LoadLibrary ("imagehlp.dll");
> +    HANDLE hImagehelp = LoadLibraryEx ("imagehlp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);

According do MSDN, LoadLibraryEx does not support
LOAD_LIBRARY_SEARCH_SYSTEM32 nor LOAD_LIBRARY_SEARCH_APPLICATION_DIR on
Windows XP, and on Windows 7 and some other version it requires certain
security system patch to be installed.

Apart from that, the security provided by this approach is questionable.
If the attacker has enough control to install a DLL and modify the PATH,
it is game over.

Finally, this patch can be a hindrance for those who build Emacs. After
the build is over, you need to copy the required extra dlls (for image
support, etc) to the build binary directory to test or use Emacs. Not a
huge inconvenience, but it isn't irrelevant either.




  reply	other threads:[~2017-09-14 13:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  7:58 Emacs master, security concernes, ms-windows Fabrice Popineau
2017-09-14 13:33 ` Óscar Fuentes [this message]
2017-09-14 13:46   ` Fabrice Popineau
2017-09-14 15:20     ` Óscar Fuentes
2017-09-14 15:56       ` Fabrice Popineau
2017-09-14 17:27         ` Eli Zaretskii
2017-09-14 17:24       ` Eli Zaretskii
2017-09-14 17:18   ` Eli Zaretskii
2017-09-14 14:13 ` Andy Moreton
2017-09-14 17:08 ` Eli Zaretskii

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=87k211xv4b.fsf@qcore \
    --to=ofv@wanadoo.es \
    --cc=emacs-devel@gnu.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.
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).