• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Privileged write to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Privileged write to file


  • Subject: Re: Privileged write to file
  • From: Charles Srstka <email@hidden>
  • Date: Wed, 10 Mar 2004 19:20:40 -0600

I still don't understand the logic behind this.

Wouldn't it be trivial then to write a malicious app that launches your setuid root tool, pretends it's your app, and then uses the tool to copy files to all sorts of locations where they can do damage?

Charles

On Mar 10, 2004, at 3:29 AM, Nicko van Someren wrote:

On 9 Mar 2004, at 22:24, Sam McCandlish wrote:

Does anyone know of a way I can write to a file with admin privileges using the Apple security methods? I am trying to write to a configuration that you can only be written to by root.

The right way to do this is probably to write a tiny program that writes the configuration file and install it owned by root with the setuid permission bit set.

Note that the wrong way to do this is that you could write the file to a temporary location and then call AuthorizationExecuteWithPrivileges() to issue a "cp" command to copy the file to the right place. This is a bad idea because you program, which is not setuid root, could have its binary modified to change what gets passed to the authorisation call.

See http://developer.apple.com/documentation/Security/Reference/ authorization_ref/01authref_ref/function_group_5.html#//apple_ref/c/ func/AuthorizationExecuteWithPrivileges and the related pages.

Nicko
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Privileged write to file
      • From: Nicko van Someren <email@hidden>
References: 
 >Privileged write to file (From: Sam McCandlish <email@hidden>)
 >Re: Privileged write to file (From: Nicko van Someren <email@hidden>)

  • Prev by Date: Re: obj-c functions versus class methods
  • Next by Date: Re: setFrameAutosaveName question
  • Previous by thread: Re: Privileged write to file
  • Next by thread: Re: Privileged write to file
  • Index(es):
    • Date
    • Thread