Authorization Credentials Caching Implications

I'm developing an Authorization Plug-In and have stumbled upon a concerning behavior regarding credential caching that may have security implications.

Consider this scenario: I'm working on a Mac without admin privileges, and I need to temporarily disable the Firewall for some testing. An administrator physically comes to my machine, inputs their credentials to disable the Firewall, and then leaves.

What follows is that, for a short period after this action, the administrator's credentials remain cached in Authorization Services. During this window, I can perform some additional privileged operations without any re-authentication. For example, I can open Activity Monitor and send SIGKILL signals to arbitrary privileged processes (!!).

From what I could gather, this happens because system.preferences.network shares cached credentials with other authorization rights. Even more concerning, even when I explicitly modify the authorization database to prevent credential sharing for this specific right, the behavior persists!

I suspect the issue relates to the underlying shared authentication rules (such as authenticate-admin-30, which com.apple.activitymonitor.kill uses), but I've been unable to modify these rules to test this theory.

From my understanding, the most concerning aspect is that even if all system Authorization Rights were configured to not share credentials, third-party applications could still create proprietary rights that might end up sharing credentials anyway.

From my Auth Plug-In, I've tried unsetting the kAuthorizationEnvironmentShared context value (even though the documentation in AuthorizationTags.h tells me that the value is ignored), and looking for ways to override the timeout for shared credentials, both without success.

Finally, I'm looking to answer some questions that have been raised:

  1. I understand that this credential sharing is a feature, but isn't the behavior I described actually a security vulnerability? I worry that other (potentially more dangerous) operations may be able to exploit this.
  2. Is there a recommended way to prevent privileged credentials from being reused across arbitrary authorization rights if the original process does not destroy the auth reference?
  3. Are there any options from within an Authorization Plug-In to ensure more strict authentication boundaries?
  4. What exactly is the authorization "session" mentioned in /System/Library/Security/authorization.plist? Does this concept imply that System Settings.app and Activity Monitor.app share the same session in my previous example?

This post ended up being quite long, but unfortunately, documentation on the subject seems incredibly scarce. For reference, the little information I could find came from:

Answered by DTS Engineer in 849449022

Regarding the big picture issue here, I believe that this is working as designed [1]. If you’d like to see that change, my advice is that you file a bug report explaining your concern..

Please post your bug number, just for the record.

What exactly is the authorization "session" mentioned in /System/Library/Security/authorization.plist?

This refers to the security session, which is roughly equivalent to the login session.

QA 1277

It’s hard to believe that this is the second time that truly ancient Q&A has come up in the past few weeks.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] If you look at the design of System Preferences on early versions of Mac OS X, various panels have a lock icon. That reflects the state of the admin credentials. If you’re logged in as a standard user and want to do something that requires privileges, you click the lock icon and enter your admin credentials. If you then want to walk away safely, you click the log icon again. That destroys the credentials you acquired when you unlocked.

Regarding the big picture issue here, I believe that this is working as designed [1]. If you’d like to see that change, my advice is that you file a bug report explaining your concern..

Please post your bug number, just for the record.

What exactly is the authorization "session" mentioned in /System/Library/Security/authorization.plist?

This refers to the security session, which is roughly equivalent to the login session.

QA 1277

It’s hard to believe that this is the second time that truly ancient Q&A has come up in the past few weeks.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] If you look at the design of System Preferences on early versions of Mac OS X, various panels have a lock icon. That reflects the state of the admin credentials. If you’re logged in as a standard user and want to do something that requires privileges, you click the lock icon and enter your admin credentials. If you then want to walk away safely, you click the log icon again. That destroys the credentials you acquired when you unlocked.

Thank you Quinn for the insights!

It's quite a coincidence indeed, I hadn't seen that other thread yet! I think I found that "ancient Q&A" while searching the Documentation Archive for "Authorization" information (or maybe on a comment you left in an older thread).

Before filing a bug report, I'd like to clarify whether this is actually a bug or simply a missing feature. What puzzles me specifically is the behavior of Activity Monitor.app:

Even when I use rights that are explicitly configured as non-shared (like authenticate-admin-nonshared), Activity Monitor still appears to inherit the credentials. I also tried to configure com.apple.activitymonitor.kill with a timeout of 0, but that didn't help.

The only way I've found to prevent this behavior is when the original application explicitly calls AuthorizationFree() with the .destroyRights flag. However, newer versions of System Settings don't have the lock icon you mentioned, so they appear to not be destroying these rights (even if I close the window!).

Either way, it strikes me as a weird decision to delegate the proper lifecycle management of an authorization reference exclusively to the application that acquires it. I was hoping there was something to be done at the Authorization Plug-In level to enforce more strict boundaries.

What's particularly strange to me is that if I try to access different System Settings panels, I'm always prompted for credentials again. Yet Activity Monitor continues to have access to privileged operations without re-authentication. Is there something special about Activity Monitor's authorization implementation that causes this behavior? Is it possibly using a different authentication mechanism or accessing the cached credentials in a way that bypasses the standard authorization checks?

Authorization Credentials Caching Implications
 
 
Q