Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow @@ and @@u usage in desktop files #4148

Closed
wants to merge 1 commit into from

Conversation

refi64
Copy link
Collaborator

@refi64 refi64 commented Mar 2, 2021

Fixes #4146.

@rh-atomic-bot
Copy link

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

Copy link
Collaborator

@smcv smcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainers: please could someone look at this as a matter of some urgency? I think this should be handled as a security issue and fixed in stable branches and distro packages.

@refi64's proposed change looks good to me, with or without the changes I suggest. I'm going to apply it in Debian now.

It's unfortunate that this was reported as a public issue. It would be great if Flatpak had a documented path for reporting security issues, similar to bubblewrap's.

@@ -7139,6 +7139,8 @@ export_desktop_file (const char *app,
g_string_append_printf (new_exec, " @@ %s @@", arg);
else if (strcasecmp (arg, "%u") == 0)
g_string_append_printf (new_exec, " @@u %s @@", arg);
else if (strcmp (arg, "@@") == 0 || strcmp (arg, "@@u") == 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we already have two special tokens, @@ and @@u, I'd be tempted to assume we will eventually need to invent a third, and assume that it will be @@x or something:

Suggested change
else if (strcmp (arg, "@@") == 0 || strcmp (arg, "@@u") == 0)
else if (g_str_has_prefix (arg, "@@"))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, seems best to just reserve the entire @@ prefix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4156 incorporates this suggestion.

@@ -7139,6 +7139,8 @@ export_desktop_file (const char *app,
g_string_append_printf (new_exec, " @@ %s @@", arg);
else if (strcasecmp (arg, "%u") == 0)
g_string_append_printf (new_exec, " @@u %s @@", arg);
else if (strcmp (arg, "@@") == 0 || strcmp (arg, "@@u") == 0)
g_print (_("Skipping invalid Exec argument %s\n"), arg);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is either an attempted attack or something that will break %u and %f processing, I'd be tempted to make it fail hard:

Suggested change
g_print (_("Skipping invalid Exec argument %s\n"), arg);
{
flatpak_fail_error (error, FLATPAK_ERROR_EXPORT_FAILED,
_("Invalid Exec argument %s"), arg);
goto out;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, agreed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4156 incorporates this suggestion.

@smcv
Copy link
Collaborator

smcv commented Mar 5, 2021

I've opened #4155 to try to document the security policy as I understand it, but it's missing a private contact route that reporters of security vulnerabilities can use.

@alexlarsson
Copy link
Member

closed in favour of #4156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CVE-2021-21381: Arbitrary file read/write without permissions via special token in .desktop file
5 participants