Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8571911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:53:13+00:00 2026-06-11T18:53:13+00:00

I have an OSX Application that I am working on. It is not sandboxed

  • 0

I have an OSX Application that I am working on. It is not sandboxed (it is an internal application that does things which prevent sandboxing).

At some point my application kicks off an auxiliary application, really just a command line application. I would like to be able to strip this application of being able to do anything except write files into the TMPDIR. I am trying to follow the principle of least privilege.

The current code I am using is:

NSTask* task = [NSTask new];
NSBundle* thisBundle = [NSBundle mainBundle];
[task setArguments:@[a, b, c]];
[task setLaunchPath:[thisBundle pathForAuxiliaryExecutable:@"MyProgram"]];
[task launch];

Is this possible with NSTask? If not, what mechanisms can I use to start MyProgram with very low privileges?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:53:14+00:00Added an answer on June 11, 2026 at 6:53 pm

    The best tool for this is called XPC. It was kind of weak in 10.7, but in 10.8 it’s incredibly powerful. Its entire purpose is to let you segment your program this way, while making the IPC very easy. Some docs:

    • “Creating XPC Services” in Daemons and Services Programming Guide
    • NSXPCConnection
    • Cocoa Interprocess Communication With XPC (WWDC 2012 session)
    • Introducing XPC (WWDC 2011 session)
    • ObjectToXPC – 3rdparty library. I haven’t played with it but it promises to do object marshaling in 10.7 (see below why object marshaling can be dangerous, though). You could also just use your own JSON protocol or the like.

    One of the great changes for XPC in 10.8 is that they added NSSecureCoding. They modified the compiler to inject class information into protocol definitions so that object marshaling can be done more safely. This means that when you say that a ObjC protocol passes an NSString, they can actually check that the object is an NSString. (Before 10.8, there was no class information in the Protocol object. You could only check whether an argument should be “an object.”)

    Who cares? Well, say I hijack your low-privilege task and trick it into returning an NSSomethingElse rather than an NSString (maybe I just overwrite the isa pointer to modify its class). And let’s say that NSSomethingElse has a length method that does something useful to me as the attacker. Now, when your high-privilege task calls [returnedValue length], it’s going to run the wrong method. Alternately, maybe NSSomethingElse has no length method, so I can force the high-privelege task to throw a “does not implement selector” exception, which could be useful to me as well. With NSSecureCoding, this kind of attack is much harder. It can introspect the returned object, note that it isn’t an NSString, and refuse to return it to the calling code.

    Even without the niceties of NSXPCConnection, I recommend XPC for this kind of work if you’re targeting 10.7+.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a relatively simple application which I need to make native Mac OSX
I have a VS2010 project which is a windows application that acquires data from
I have an application that uses HTTPS for some of its routes in conjunction
I am working on an Android application which does http request and download contents
GAE 1.5.5 looks to have some excellent, long-waited for features. However, they're not working
i have a swing application that i would like to run on os x
I have a Cocoa, Document-based Mac OS X application. One feature that I have
I have an application for Mac OS X that supports plugins that are intended
I have an objective-c application for OS X that compares two sqlite DB's and
I have seen a few OSX apps that have a Special Characters menu item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.