-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
codesign: add support for RUNTIME flag and minimum runtime version #37
Conversation
pkg/codesign/codesign.go
Outdated
@@ -434,6 +435,7 @@ type Config struct { | |||
EntitlementsDER []byte | |||
ResourceDirSlotHash []byte | |||
SlotHashes slotHashes | |||
RuntimeVersion mtypes.Version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you running gofmt? this doesn't look aligned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything else looks good
I understand that you are solving for a particular use case w/ Signal or something else, but there is an issue w/ the MachOs generated by the export.go As I mentioned I understand if you are doing this for work and don't have time, but these have been some VERY clean and well done PRs and was curious if you'd take a look. It's something I've had on the TODO list for a long time and would really appreciate some help. I know the code is pretty gross and prob needs to be re-written :( Either way, thanks for all your help w/ these PRs. Cheers |
I'm happy to take a look! I'll have a bit less time (as you infer, my earlier contributions have been for use at Signal and were fixing gaps that blocked me) but I've greatly appreciated all the time you saved me by having this here, so happy to pay that forward a bit. Do you happen to have a useful repro/test case? I don't have IDA Pro, but if you could send me some simple binary you generated with Export and the same one made the official way, I can try to understand the difference.
glad you liked them 💜
A fair amount of this could probably use a refactoring pass or two—I'm afraid I didn't improve things much in that respect with the last several contributions, I may do so with the next few. |
So the most popular use case is to extract DYLIBs from the A source of truth would be what XCode does which can be invoked by calling Incase you were unaware, the process of creating the shared_cache throws away a lot of information when combining the dylibs togethers to the process of 'extracting' them back out isn't trivial. So far the best project to do this is https://github.com/arandomdev/DyldExtractor My solution if also very close, I think only missing the ObjC runtime info fixups, but there is some error in the logic of the go-macho Export function that people have reported to me saying Ghidra/IDA complain about the MachO's header and Segment/Section boundaries?? So I guess the test rig would be using |
This change adds support for the RUNTIME code signature flag, which requires a hardened runtime and allows the binary to require a particular runtime version.