exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Launcher Execution Mitigation Patch

Launcher Execution Mitigation Patch
Posted Jan 10, 2020
Authored by Enrico Weigelt

This patch mitigates allowing launcher the ability to execute arbitrary programs.

tags | arbitrary, patch
systems | unix
SHA-256 | 05bbc4faa849e25fbad6d25534f4c781fc3cc329c48f156bf5eb3fdb0bb6fa54

Launcher Execution Mitigation Patch

Change Mirror Download
What might be convenience functionality, poses a real-life security threat:

A user can be tricked be tricked to download malicious code, unpack it with
+x permissions (eg. via tar) and execute it by just clicking on the icton.
In combination with other techniques (eg. homoglyphs), even more experienced
users can be tricked "open" some supposedly harmless file type, while Thunar
in fact executes a binary - with full user's privileges. (the same approach
is one of the primary infection vectors used by thousands of malwares in
Windows world, which already caused gigantic damages).

Therefore introduce a new setting and only execute programs if explicitly
enabled.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
thunar/thunar-file.c | 55 +++++++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index c7aae58a..72e1c1cd 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2865,8 +2865,8 @@ gboolean
thunar_file_is_executable (const ThunarFile *file)
{
ThunarPreferences *preferences;
- gboolean can_execute = FALSE;
gboolean exec_shell_scripts = FALSE;
+ gboolean exec_programs = FALSE;
const gchar *content_type;

_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
@@ -2874,31 +2874,38 @@ thunar_file_is_executable (const ThunarFile *file)
if (file->info == NULL)
return FALSE;

- if (g_file_info_get_attribute_boolean (file->info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))
- {
- /* get the content type of the file */
- content_type = thunar_file_get_content_type (THUNAR_FILE (file));
- if (G_LIKELY (content_type != NULL))
- {
- can_execute = g_content_type_can_be_executable (content_type);
+ if (thunar_file_is_desktop_file (file, NULL))
+ return TRUE;

- if (can_execute)
- {
- /* check if the shell scripts should be executed or opened by default */
- preferences = thunar_preferences_get ();
- g_object_get (preferences, "misc-exec-shell-scripts-by-default", &exec_shell_scripts, NULL);
- g_object_unref (preferences);
-
- /* do never execute plain text files which are not shell scripts but marked executable */
- if (g_strcmp0 (content_type, "text/plain") == 0)
- can_execute = FALSE;
- else if (g_content_type_is_a (content_type, "text/plain") && ! exec_shell_scripts)
- can_execute = FALSE;
- }
- }
- }
+ if (!g_file_info_get_attribute_boolean (file->info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))
+ return FALSE;
+
+ /* get the content type of the file */
+ content_type = thunar_file_get_content_type (THUNAR_FILE (file));
+ if (G_UNLIKELY (content_type == NULL))
+ return FALSE;
+
+ if (!g_content_type_can_be_executable (content_type))
+ return FALSE;
+
+ /* check if the shell scripts should be executed or opened by default */
+ preferences = thunar_preferences_get ();
+ g_object_get (preferences, "misc-exec-shell-scripts-by-default", &exec_shell_scripts, NULL);
+ g_object_get (preferences, "misc-exec-programs-by-default", &exec_programs, NULL);
+ g_object_unref (preferences);
+
+ /* security: do never open exec programs (scripts or binaries), unless explicitly enabled */
+ if (!exec_programs)
+ return FALSE;

- return can_execute || thunar_file_is_desktop_file (file, NULL);
+ /* do never execute plain text files which are not shell scripts but marked executable */
+ if (g_strcmp0 (content_type, "text/plain") == 0)
+ return FALSE;
+
+ if (g_content_type_is_a (content_type, "text/plain") && ! exec_shell_scripts)
+ return FALSE;
+
+ return TRUE;
}


--
2.11.0



Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close