# macOS Standaard Sandbox Foutopsporing {{#include ../../../../banners/hacktricks-training.md}} Op hierdie bladsy kan jy vind hoe om 'n toepassing te skep om arbitrêre opdragte vanuit die standaard macOS sandbox te begin: 1. Compileer die toepassing: ```objectivec:main.m #include int main(int argc, const char * argv[]) { @autoreleasepool { while (true) { char input[512]; printf("Enter command to run (or 'exit' to quit): "); if (fgets(input, sizeof(input), stdin) == NULL) { break; } // Remove newline character size_t len = strlen(input); if (len > 0 && input[len - 1] == '\n') { input[len - 1] = '\0'; } if (strcmp(input, "exit") == 0) { break; } system(input); } } return 0; } ``` Kompileer dit deur te loop: `clang -framework Foundation -o SandboxedShellApp main.m` 2. Bou die `.app` bundel ```bash mkdir -p SandboxedShellApp.app/Contents/MacOS mv SandboxedShellApp SandboxedShellApp.app/Contents/MacOS/ cat << EOF > SandboxedShellApp.app/Contents/Info.plist CFBundleIdentifier com.example.SandboxedShellApp CFBundleName SandboxedShellApp CFBundleVersion 1.0 CFBundleExecutable SandboxedShellApp EOF ``` 3. Definieer die regte {{#tabs}} {{#tab name="sandbox"}} ```bash cat << EOF > entitlements.plist com.apple.security.app-sandbox EOF ``` {{#endtab}} {{#tab name="sandbox + downloads"}} ```bash cat << EOF > entitlements.plist com.apple.security.app-sandbox com.apple.security.files.downloads.read-write EOF ``` {{#endtab}} {{#endtabs}} 4. Teken die app (jy moet 'n sertifikaat in die sleutelkettie skep) ```bash codesign --entitlements entitlements.plist -s "YourIdentity" SandboxedShellApp.app ./SandboxedShellApp.app/Contents/MacOS/SandboxedShellApp # An d in case you need this in the future codesign --remove-signature SandboxedShellApp.app ``` {{#include ../../../../banners/hacktricks-training.md}}