Skip to content
Permalink
Browse files Browse the repository at this point in the history
daemon, dbus: allow only root to create CCpp, Koops, vmcore and xorg
Florian Weimer <fweimer@redhat.com>:
    This prevents users from feeding things that are not actually
    coredumps and excerpts from /proc to these analyzers.

    For example, it should not be possible to trigger a rule with
    “EVENT=post-create analyzer=CCpp” using NewProblem

Related: #1212861

Signed-off-by: Jakub Filak <jfilak@redhat.com>
  • Loading branch information
Jakub Filak committed May 7, 2015
1 parent 3287aa1 commit 7417505
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/daemon/abrt-server.c
Expand Up @@ -487,7 +487,7 @@ static gboolean key_value_ok(gchar *key, gchar *value)
}
}

return TRUE;
return allowed_new_user_problem_entry(client_uid, key, value);
}

/* Handles a message received from client over socket. */
Expand Down
10 changes: 9 additions & 1 deletion src/dbus/abrt-dbus.c
Expand Up @@ -168,13 +168,20 @@ bool allowed_problem_dir(const char *dir_name)

static char *handle_new_problem(GVariant *problem_info, uid_t caller_uid, char **error)
{
char *problem_id = NULL;
problem_data_t *pd = problem_data_new();

GVariantIter *iter;
g_variant_get(problem_info, "a{ss}", &iter);
gchar *key, *value;
while (g_variant_iter_loop(iter, "{ss}", &key, &value))
{
if (allowed_new_user_problem_entry(caller_uid, key, value) == false)
{
*error = xasprintf("You are not allowed to create element '%s' containing '%s'", key, value);
goto finito;
}

problem_data_add_text_editable(pd, key, value);
}

Expand All @@ -189,12 +196,13 @@ static char *handle_new_problem(GVariant *problem_info, uid_t caller_uid, char *
/* At least it should generate local problem identifier UUID */
problem_data_add_basics(pd);

char *problem_id = problem_data_save(pd);
problem_id = problem_data_save(pd);
if (problem_id)
notify_new_path(problem_id);
else if (error)
*error = xasprintf("Cannot create a new problem");

finito:
problem_data_free(pd);
return problem_id;
}
Expand Down
2 changes: 2 additions & 0 deletions src/include/libabrt.h
Expand Up @@ -51,6 +51,8 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
bool dir_is_in_dump_location(const char *dir_name);
#define dir_has_correct_permissions abrt_dir_has_correct_permissions
bool dir_has_correct_permissions(const char *dir_name);
#define allowed_new_user_problem_entry abrt_allowed_new_user_problem_entry
bool allowed_new_user_problem_entry(uid_t uid, const char *name, const char *value);

#define g_settings_nMaxCrashReportsSize abrt_g_settings_nMaxCrashReportsSize
extern unsigned int g_settings_nMaxCrashReportsSize;
Expand Down
24 changes: 24 additions & 0 deletions src/lib/hooklib.c
Expand Up @@ -483,3 +483,27 @@ bool dir_has_correct_permissions(const char *dir_name)
}
return true;
}

bool allowed_new_user_problem_entry(uid_t uid, const char *name, const char *value)
{
/* Allow root to create everything */
if (uid == 0)
return true;

/* Permit non-root users to create everything except: analyzer and type */
if (strcmp(name, FILENAME_ANALYZER) != 0
&& strcmp(name, FILENAME_TYPE) != 0
/* compatibility value used in abrt-server */
&& strcmp(name, "basename") != 0)
return true;

/* Permit non-root users to create all types except: C/C++, Koops, vmcore and xorg */
if (strcmp(value, "CCpp") != 0
&& strcmp(value, "Kerneloops") != 0
&& strcmp(value, "vmcore") != 0
&& strcmp(value, "xorg") != 0)
return true;

error_msg("Only root is permitted to create element '%s' containing '%s'", name, value);
return false;
}

0 comments on commit 7417505

Please sign in to comment.