MASTG-TEST-0228: Position Independent Code (PIC) not Enabled
Overview¶
PIE (Position Independent Executables) are designed to enhance security by allowing executables to be loaded at random memory addresses, mitigating certain types of attacks.
In the context Mach-O file format of iOS applications:
- PIE is applicable to executables with the
MH_EXECUTEfile type, which essentially means the main app binary (e.g.YourApp.app/YourApp). - Shared libraries with the
MH_DYLIBfile type (dylibs and frameworks) are inherently position-independent and do not utilize theMH_PIEflag.
This test case checks if the main executable is compiled with PIE.
Steps¶
- Extract the application and identify the main binary ( Obtaining and Extracting Apps).
- Run Obtaining Compiler-Provided Security Features on the main binary and grep for "pic" or the corresponding keyword used by the selected tool.
Observation¶
The output should list if PIC is enabled or disabled.
Evaluation¶
The test case fails if PIC is disabled.