Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing unknown load command on dataOffsetForAddress #39

Open
btereso-sa opened this issue Oct 12, 2022 · 13 comments
Open

Throwing unknown load command on dataOffsetForAddress #39

btereso-sa opened this issue Oct 12, 2022 · 13 comments

Comments

@btereso-sa
Copy link

btereso-sa commented Oct 12, 2022

Recently ppios stopped working and it's throwing dozens of unknown errors on dataOffsetForAddress.
My project didn't change at all, this happened over night, after I updated to MacOS 12.6 and Xcode 14.0.1

All missing commands are related to 0x80000034 and 0x80000033

This should not be Swift related because I don't use any Swift code.

Any ideas? Thanks in advance

snippet:
...
2022-10-11 21:51:39.307 ppios-rename[15534:139893] Unknown load command: 0x80000033
2022-10-11 21:51:39.307 ppios-rename[15534:139893] Unknown load command: 0x80000034
...
2022-10-11 21:51:39.419 ppios-rename[15534:139893] Error: Cannot find offset for address 0x801000000000000d in dataOffsetForAddress:

Side note: the same project/file works fine when I switch to a MacOS 12.3 / XCode 13.1 Macbbok

@rohitashPrajapati
Copy link

Hi, facing similar issue... any workaround.

@btereso-sa
Copy link
Author

No luck here, still waiting for a reply.
I solved it by using an old Macbook to do the obfuscation, a Macbook with an old OS works just fine.

@BillBai
Copy link

BillBai commented May 8, 2023

This is because the iOS SDK's frameworks binaries from newer version of Xcode are using chained fixups and export trie Mach-O load commands to encode bind/rebase and symbol info. Not the dyld info in the older version. And the ppios-rename does not support these load commands yet.

A quick fix is just download the older version of Xcode (https://xcodereleases.com) ,and use the older version sdk by passing the "--sdk-root" argument.

The sdk from Xcode 11 works for me.

ppios-rename --analyze <binary path>  --sdk-root /<downloaded older version of>/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk

@mfarhand-sa
Copy link

mfarhand-sa commented May 11, 2023

@BillBai Thanks for replying on this thread,
We've tried your solution but it doesn't work, but the result has been changed:

`
./ppios-rename --analyze XXXX.app --sdk-root /Applications/Xcode11.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk

2023-05-09 11:16:09.886 ppios-rename[50889:3975433] Unknown load command: 0x80000034
2023-05-09 11:16:09.886 ppios-rename[50889:3975433] Unknown load command: 0x80000033
2023-05-09 11:16:09.887 ppios-rename[50889:3975433] Unknown load command: 0x80000034
2023-05-09 11:16:09.887 ppios-rename[50889:3975433] Unknown load command: 0x80000033
2023-05-09 11:16:09.887 ppios-rename[50889:3975433] Unknown load command: 0x80000034
2023-05-09 11:16:09.887 ppios-rename[50889:3975433] Unknown load command: 0x80000033
`

We get 4-6 times "Unknown load command: 0x80000034" and then it starts analyzing the binary and generating the symbols.map file and then we run the ppios-rename --obfuscate-sources it will generate symbols.h file.
Those 6 errors seem to be enough for the project not to run, we can't just ignore it. It seems to be failing at injecting the headers path at some libraries too. Hard to understand what is failing and where.

mfarhand-sa added a commit to mfarhand-sa/PPiOS-Rename that referenced this issue May 17, 2023
@mfarhand-sa
Copy link

I've fixed the issue, and It's working with our project. 🚀🥳
The fix still needs the @BillBai workaround, which I've already explained in the PR. 🦧🦍
I've already requested a PR. ✌🏻

Special shoutout to @BillBai for his first response. 🎉🎉🎉

@mobikats
Copy link

Thanks for sharing that fix that's extremely helpful!
I've built your update and tried it, and I get far fewer "Unknown load command" problems :)
I uncommented the log showing the path, and I see a lot of these:
Warning: Unable to read file: ../Xcode_11.7.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot

(Xcode 11.7 is the older Xcode I am using that used to work).

You mention I can add in the older dylibs, but do you know which specific older version I should copy them from please? And am I copying from Xcode? Presumably not Xcode 11.7 as that seems to be missing them :-(

@mobikats
Copy link

No luck here, still waiting for a reply. I solved it by using an old Macbook to do the obfuscation, a Macbook with an old OS works just fine.

Which OS please? I'm thinking of creating a virtual machine just for this task

@mfarhand-sa
Copy link

mfarhand-sa commented Nov 26, 2023

I've used a virtual machine for this task as well. ( to extract old dylibs )
Are you using Xcode 11.7 and still getting errors?
Are you using my PR / Repo?
I'm wondering why are you getting simruntime error, this process doesn't have anything with the simulator!

@mobikats
Copy link

I've used a virtual machine for this task as well. ( to extract old dylibs ) Are you using Xcode 11.7 and still getting errors? Are you using my PR / Repo? I'm wondering why are you getting simruntime error, this process doesn't have anything with the simulator!

I tried on a VM running macOS 10.14, but then hit other build issues, so I need to setup a VM - which MacOS and Xcode combination are you using pls?

My usual attempt is running on an M1 MacBookPro referencing SDK from 11.7, and using your PR yes (which reduced the load errors from maybe 7 lines down to now currently two).

The sim runtime is bizarre it should be building for deployment devices only, maybe something else has broken too! :/

@btereso-sa
Copy link
Author

Hi,
Sorry for the delay.

I'm able to run it on a Macbook Pro (2017) with MacOS Monterey 12.3
Using XCode 13.1 build 13A1030d.

@mobikats
Copy link

Hi, Sorry for the delay.

I'm able to run it on a Macbook Pro (2017) with MacOS Monterey 12.3 Using XCode 13.1 build 13A1030d.

Ah thanks Bruno - v appreciate that - will try it asap!

@mobikats
Copy link

Finally got around to trying this :)
ppios-rename can run in the VM.
But using the older Xcode is providing lots of problems!

I'm now trying a manual combination with build steps on the host, then manually pass args to script in VM, then back.

@mobikats
Copy link

Got it operating on my project but then ran into this:

2024-03-27 20:44:55.837 ppios-rename[1477:27966] Error: Cannot find offset for address 0x1000000027b170 in dataOffsetForAddress:

:/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants