Log date · Mon
Does compiling an iOS app keep its binary secret?
Published on · Updated
No. In our before-and-after strip test, symbols decreased while a fake key, class and method name remained visible.
The short answer: compilation is not secrecy
No. An IPA’s compiled binary is not a safe place for a shared secret. In our own Objective-C sample, nm printed 18 lines before strip and 13 after strip -x, while all three strings of at least eight characters remained: a fake key, a class name and a method name.
Signing addresses identity and integrity: Apple says a signature enables detection of changes after signing. [1] That is a different question from keeping content confidential. We compare the same sample before and after stripping, then use the results to plan a release review.
| Question | Finding |
|---|---|
| Does compiled code retain readable text? | The fake key, class and method names were visible. |
| What changed after strip? | nm fell from 18 to 13 lines; all three long strings remained. |
| Were dependencies visible? | otool listed four dynamic libraries, including Foundation. |
| Does signing hide content? | Signing checks identity and integrity; hiding content is not its purpose. |
Sample and scope
We used macOS 27.2, Xcode 27.2 and Apple clang 21.0.0 to compile a command-line program. QuoteCalculator’s quoteMessage returns a deliberately invalid placeholder key. We built with -O0, copied the binary, applied strip -x to the copy, and inspected both with the same commands.
This is our own macOS Mach-O sample, not an iOS device build, a signed IPA or an App Store download. Compiler settings, language, linking and distribution artifacts affect what appears. The results demonstrate a concrete risk, not an item-by-item prediction for every IPA.
#import <Foundation/Foundation.h>
@interface QuoteCalculator : NSObject
- (NSString *)quoteMessage;
@end
@implementation QuoteCalculator
- (NSString *)quoteMessage {
return @"DEMO-KEY-not-a-real-credential-0000";
}
@end
int main(void) {
@autoreleasepool { NSLog(@"%@", [[QuoteCalculator new] quoteMessage]); }
return 0;
}The program is small, but contains a literal, Objective-C runtime names and dynamic-library dependencies. That gives each tool a distinct thing to inspect. The source has no real credential and makes no network request.
Strings and symbols answer different questions
strings looks for printable text. Here -n 8 requires at least eight characters per run; the count is output lines, not a count of every string, secret or business rule. Both files printed the same three lines. A real product can also contain resources, configuration, other encodings or split text, so an empty match does not establish that sensitive information is absent.
== selected strings ==
-- sample --
DEMO-KEY-not-a-real-credential-0000
QuoteCalculator
quoteMessage
-- sample-stripped --
DEMO-KEY-not-a-real-credential-0000
QuoteCalculator
quoteMessagenm instead lists names from the symbol table. Before stripping, the selected output includes a method implementation and class and metaclass symbols; afterward, only the class and metaclass symbols remain in that selection. The implementation symbol disappearing does not mean the method name disappeared: strings still prints quoteMessage. Apple describes selectors as representations of method names at runtime, with compiler-generated selectors mapped when a class loads. [2]
== selected symbols ==
-- sample --
0000000100000928 t -[QuoteCalculator quoteMessage]
00000001000080c0 S _OBJC_CLASS_$_QuoteCalculator
0000000100008098 S _OBJC_METACLASS_$_QuoteCalculator
0000000100000a00 s __OBJC_$_INSTANCE_METHODS_QuoteCalculator
0000000100008048 s __OBJC_CLASS_RO_$_QuoteCalculator
0000000100008000 s __OBJC_METACLASS_RO_$_QuoteCalculator
00000001000009e0 s _objc_msgSend$quoteMessage
-- sample-stripped --
00000001000080c0 S _OBJC_CLASS_$_QuoteCalculator
0000000100008098 S _OBJC_METACLASS_$_QuoteCalculatorThese counts are not a protection score for comparing different apps. Compiler, linker and tool options affect nm output, and meaningful names deserve more attention than a raw total. Preserve build settings and artifact hashes before comparing in the same environment so that a change can be traced to a build step.
What strip and dependency inspection show
We ran strip -x on a copy and kept the original for comparison. The count shows five fewer nm lines, while strings still prints three lines of at least eight characters. This is the result for these options and this sample: stripping can reduce symbol information, but it does not follow that it removes literals or all runtime metadata.
== counts (nm lines; strings lines, minimum 8 characters) ==
sample symbols=18
sample strings=3
sample-stripped symbols=13
sample-stripped strings=3otool -L lists dynamic libraries declared by the stripped file, including Foundation, CoreFoundation, libSystem and libobjc. Library names help a developer identify dependencies and review scope, but do not by themselves establish a business algorithm, an execution path or a vulnerability. Statically linked code will not appear as the same kind of dynamic-library entry.
== linked libraries ==
sample-stripped:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 5027.1.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1359.40.3)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 5027.1.8)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)Signing still matters. Apple’s iOS signing documentation says the system refuses to launch an app with a missing or invalid signature; its macOS signing guide explicitly says signing does not obscure code content. [1][4] Keep signature and integrity checks, and separately review whether the release includes authority that should not be given to a client.
Run a review on your own release
Inspect a release artifact you own or are authorized to examine. Find the main executable in your Xcode archive or build directory and substitute its path below. Extensions and embedded frameworks have executables of their own and need separate review. Inspect the original read-only; do not run strip on a signed release file.
# Replace with an executable from your own build.
BIN="path/to/YourApp.app/YourApp"
file "$BIN"
strings -n 8 "$BIN"
nm "$BIN"
otool -L "$BIN"Output can contain sensitive information. Keep it in a controlled environment and use known fake test markers for automated checks; do not place real keys in command lines or public logs. An nm error, no symbols and no match for a string are different results. Record errors and exit status, then review resources, configuration, dependencies and artifacts for other architectures.
When you find a suspect value, determine whether it actually grants access, its scope and whether older releases use it. Removing it from the next build does not revoke a credential already distributed. Restrict and rotate it, verify on the server that the old value no longer works, and plan migration for older clients.
Recommendations by asset
These are design recommendations, not effects measured by the strip experiment. First distinguish public information, device or user secrets, and credentials granting all installations shared server authority.
| Case | Recommendation |
|---|---|
| Shared privileged server credential | Keep it on a controlled server; issue scoped, revocable user tokens to clients. |
| User token or device secret | Consider Keychain and suitable access controls; test sign-out, migration and recovery. |
| Public signature-verification key | Distribute it with the client; retain the private key at the issuer. |
| Business rule that must run on the client | Assume it can be observed; limit server-side authority and test the risk. |
| Credential already released | Restrict privileges, rotate and verify revocation, then clean the new build. |
Apple recommends the Keychain for small secrets such as passwords and cryptographic keys. [3] It helps manage device or user data, but cannot turn a shared server credential already shipped with every installation into a server-only secret. Short-lived tokens need refresh, expiry and revocation handling; an offline design needs an explicit window during which revocation cannot be immediate.
Finally, make the review part of the release process: pin tool versions and build settings, retain artifact hashes and results, and review new strings and dependencies in a controlled location. Route findings to the team responsible for the associated authority, then check the new release build. This turns a one-off scan into work that can be tracked and verified.
Your checklist
- Review release executables for the app, extensions and embedded frameworks.
- Inventory sensitive strings, symbols, dependencies and resources.
- Move shared privileged credentials to a controlled server.
- Rotate released credentials and verify old values stop working.
- Retain build settings and artifact hashes, then recheck the new release.
Primary sources
- Apple: Using the latest code signature format · Checked 2026-11-11
- Apple: SEL · Checked 2026-11-11
- Apple: Storing Keys in the Keychain · Checked 2026-11-11
- Apple: About Code Signing (archived macOS guide) · Checked 2026-11-11