Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges?



On Aug 29, 2007, at 3:16 PM, Mark Wagner wrote:

On 8/28/07, email@hidden <email@hidden> wrote:
As a general security consideration, privileged commands
should do as little as possible and do highly specific
things.  This minimizes the chance a mistake or exploit
can cause more damage than it should.

In this case, you probably should resolve the glob ("*")
first while unprivileged, and then call a sequence of
highly specific "rm" commands with the results.

The standard C library in <glob.h> (among other approaches)
handles "*".  Run "man 3 glob" in a terminal for more
information on the glob() function.

e.g. glob("test*.txt") might yield test1.txt and test2.txt.
With those results, you could generate commands like:
     "rm test1.txt"
     "rm test2.txt"
(or simply "rm test1.txt test2.txt").

And a malicious user could create a file named "-rf .." in the target directory. Using your suggestion, that would turn into a privileged execution of the command "rm -rf .." -- not as bad as the dreaded "rm -rf /", but still quite destructive.

To be fair, one would hope that these "highly specific 'rm' commands" handled escaping of filenames.
Then again, given that the OP doesn't really seem to consider problems like this relevant, maybe not.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: judiexu <email@hidden>)
 >Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: email@hidden)
 >Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: "Mark Wagner" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.