Bug 83093 - [patch] pkexec parameter parsing memory leak
Summary: [patch] pkexec parameter parsing memory leak
Status: RESOLVED FIXED
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-26 09:52 UTC by Hanno Böck
Modified: 2014-08-27 19:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
0001-Refuse-duplicate-user-arguments-to-pkexec.patch (1.30 KB, patch)
2014-08-26 16:07 UTC, Miloslav Trmac
Details | Splinter Review

Description Hanno Böck 2014-08-26 09:52:58 UTC
Google's Project Zero has developed an exploit for a glibc vulnerability:
http://googleprojectzero.blogspot.de/2014/08/the-poisoned-nul-byte-2014-edition.html

Part of that exploit is abusing a memory leak in pkexec's parameter handling. While not in itself a security vulnerability, this memory leak makes exploiting other bugs easier.

This is the code in question in pkexec.c (starting line 543):
      else if (strcmp (argv[n], "--user") == 0 || strcmp (argv[n], "-u") == 0)
        {
          n++;
          if (n >= (guint) argc)
            {
              usage (argc, argv);
              goto out;
            }

          opt_user = g_strdup (argv[n]);
        }

If multiple -u arguments are set opt_user gets set multiple times, overwriting (and thus leaking) pointers of previous results.
Comment 1 Miloslav Trmac 2014-08-26 16:07:20 UTC
Created attachment 105295 [details] [review]
0001-Refuse-duplicate-user-arguments-to-pkexec.patch

Thanks for your report.
Comment 2 Colin Walters 2014-08-26 18:19:07 UTC
Comment on attachment 105295 [details] [review]
0001-Refuse-duplicate-user-arguments-to-pkexec.patch

Review of attachment 105295 [details] [review]:
-----------------------------------------------------------------

Yep, looks good to me.
Comment 3 David Zeuthen (not reading bugmail) 2014-08-27 17:10:32 UTC
Sure.
Comment 4 Miloslav Trmac 2014-08-27 19:03:37 UTC
Thanks, commited as https://bugs.freedesktop.org/show_bug.cgi?id=83093 .
Comment 5 Miloslav Trmac 2014-08-27 19:03:55 UTC
… as 6c992bc8aefa195a41eaa41c07f46f17de18e25c .


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.