-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative to auditToken #1
Comments
IMO it's a bad idea to use the PID because an attacker can fork a lot of times, enqueue a lot of XPC messages and then replace the image to the right one. (The attacker doesn't have to wrap PIDs) Let's take a look at the following example:
Even if the I talked with a guy from Apple Security about the non-public audit_token APIs. We have to wait for them. 😊 But until Apple releases public APIs, I'd recommend using the private ones... |
As I expressed in that thread, I'm completely puzzled in what "reliance on the n-the message being from the original connection" has to do with a race for the PID at all. Do you see how "validity" of an XPC connection can help mitigate the attack? |
Probably the Apple's employee assumed that the attacker will not be able to enqueue more than 1 message in the same connection. So the assumption was that in the 2nd message you will make another validation that will prove that the client's process is signed with another certificate (so you will invalidate the whole connection). |
Is it something that was proved to be wrong? Assuming the OS enqueues exactly 1 messages for user's handler and validates the XPC connection by checking whether the peer is still alive, it should be sufficient. I realize that in the example above you implied that no such validation happens, but is it just a theory? |
AFAIK if you make a lot of XPC connections the OS will enqueue more than 1 message in 1 connection (if you of course send more messages)
The peer will be still alive always in that attack. I'm considering the case where the peer uses the You can read more about this attack in my post |
I'm not aware of the internals, but I assume there are at least 2 queues involved:
Wouldn't it invalidate connection preventing the OS from delivering the 2nd message? I guess the only way to find out is to conduct a test to see whether it's possible to deliver 2 message with originating peer dying somewhere before the 1st message is received by user's XPC event handler. |
I found this issue accidentally in a Google search (I have an XPC-based privileged helper, ergo have similar concerns), ad am happy to share two recent-ish developments:
Hopefully this proves useful here. |
That's great! I was looking for some sample code for these functions and found a discussion on Apple's Developer Forums |
Earlier this month an Apple employee posted an update to ADC where he suggested an alternative to using the audit token:
The idea being only the 1st message over the connection is vulnerable.
What's your opinion on that?
The text was updated successfully, but these errors were encountered: