arandomdev / DyldExtractor

Extract Binaries from Apple's Dyld Shared Cache
MIT License
404 stars 40 forks source link

iOS 17: objc_fixer.py: TypeError #60

Open pwnee opened 11 months ago

pwnee commented 11 months ago

Describe the bug

Trying to extract any dylib from iOS 17 dsc results in error in objc_fixer.py.

21C62__iPhone16,2> dyldex -e JavaScriptCore dyld_shared_cache_arm64e
Extracting /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
21:26:33:609 [ WARNING ] objc_fixer.py:503 : Unknown objc opt version: 4, but continuing on.
ObjC Fixer >> Processing Classes :: [-]                                                                                       21:26:33:610 [  ERROR  ] objc_fixer.py:1223 : Small method list at 0x186c4e8c1, has an entsize that doesn't match the size of objc_method_small_t
Traceback (most recent call last):
  File "/opt/homebrew/bin/dyldex", line 277, in <module>
    main()
  File "/opt/homebrew/bin/dyldex", line 272, in main
    _extractImage(args.dyld_path, dyldCtx, imageMap[targetPaths[0]], outputPath)
  File "/opt/homebrew/bin/dyldex", line 138, in _extractImage
    objc_fixer.fixObjC(extractionCtx)
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 1519, in fixObjC
    _ObjCFixer(extractionCtx).run()
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 447, in run
    self._processSections()
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 634, in _processSections
    if self._processClass(classAddr)[1]:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 850, in _processClass
    classDef.isa, needsFutureIsa = self._processClass(classDef.isa)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 850, in _processClass
    classDef.isa, needsFutureIsa = self._processClass(classDef.isa)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 855, in _processClass
    classDef.superclass, needsFutureSuper = self._processClass(
                                            ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 867, in _processClass
    classDef.data = self._processClassData(
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 929, in _processClassData
    classDataDef.baseProtocols = self._processProtocolList(
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 1034, in _processProtocolList
    newProtoAddr = self._processProtocol(protoAddr)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/objc_fixer.py", line 1058, in _processProtocol
    protoDef = self._slider.slideStruct(protoAddr, objc_protocol_t)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/converter/slide_info.py", line 412, in slideStruct
    structOff, context = self._dyldCtx.convertAddr(address)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/DyldExtractor/cache_context.py", line 34, in convertAddr
    if vmaddr >= lowBound and vmaddr < highBound:
       ^^^^^^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'NoneType' and 'int'

To Reproduce

  1. iOS version 17.2
  2. DYLD target device and identifier: iPhone 15 Pro Max 16,2
  3. Terminal command to reproduce. dyldex -e JavaScriptCore dyld_shared_cache_arm64e

Additional context