Mac: Library Validation permits substitution of any code signed with the same Team ID, regardless of certificate type |
||
Issue description(This is an Apple bug, and is being reported to product-security@apple.com contemporaneously with being filed here for our own records.) This bug is subject to a 90 day disclosure deadline. If 90 days elapse without a broadly available patch, then the bug report will automatically become visible to the public. The library validation feature is documented thusly: The code will only be able to link against system libraries and frameworks, or libraries, frameworks, and plug-in bundles with the same team identifier embedded in the code directory. Team identifiers are automatically recorded in signatures when signing with suitable Apple-issued signing certificates. Team identifiers are overly broad for this purpose. Apple-issued signing certificates share the same Team ID even when issued for different purposes. For example, code signed with a Developer ID Application certificate has the same team ID as code signed with a Mac Development certificate, provided that a team agent or team admin has added the developer to their team. See https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31-SW41 and https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/ManagingYourTeam/ManagingYourTeam.html#//apple_ref/doc/uid/TP40012582-CH16-SW10. This shifts the security model provided by library validation in a subtle but important way. The model was previously understood to be “as long as you protect the key you use to sign for distribution, library validation prevents you from loading unwanted code.” In reality, the model adds that “all developers on your team must protect their code signing keys as well; furthermore, you must trust all developers on your team for purposes of releasing code on behalf of your organization.” This is a gigantic shift. An organization may treat the private key for its Developer ID Application code signing certificate as a closely-guarded secret, available to a small number of employees only on well-secured and not-easily-accessible systems, further protected by a strong passphrase. By contrast, individual developers are not likely to secure the private keys for their development certificates as diligently. Development certificates are likely to be installed on development systems with only ordinary security precautions, and will normally be well-connected to the Internet. Because these certificates are assumed to be for the purposes of development and not production, the risks associated with incompletely securing them are assumed to be low, or at least lower than the risks of incompletely securing Developer ID certificates. Furthermore, an organization would not reasonably assume that by granting an employee membership in its “Team” that the developer certificates such an employee would be able to obtain from Apple would enable that employee to release code on behalf of the organization. That privilege is normally reserved for those who hold the Developer ID certificate, whose creation is rightfully restricted to the highest access level within a team, the team agent. By ignoring the certificate type used to sign a code object, the library validation feature allows any developer on a team, or anyone who can obtain any developer on the team’s private key, to release code that the code signature system will validate as having been released by the organization as a whole. As a more concrete example, application A.app links against a library in B.framework and specifies library validation. Both A.app and B.framework are signed by the organization’s Developer ID Application certificate for release. A malicious employee is able to release a compromised version of B.framework signed with his or her own development certificate. A.app will load this compromised version of B.framework without complaint, despite having requested library validation. Furthermore, an outside attacker may be able to obtain the private key corresponding to even a conscientious employee’s development certificate more easily than they would be able to obtain the private key corresponding to the organization’s Developer ID certificate. In possession of any of the private keys corresponding to any of the organization’s certificates (as determined by the team ID), any outside attacker would be able to release a compromised version of B.framework that A.app will load without complaint. The attached test case exhibits this problem. You can build it by running “build” after setting three variables to the common name (CN) values of three certificates: developer_id_cert should be a Developer ID certificate, mac_developer_cert should be a Mac Development certificate from the same team as developer_id_cert, and other_developer_id_cert should be a Developer ID certificate from an entirely different team. This will produce an executable signed with the first Developer ID certificate and requesting library validation, and three shared libraries, each signed by one of the three certificates above. It will also produce an unsigned shared library. The “test” script attempts to run the executable with each of these four shared libraries. It is expected that the executable signed with the Developer ID certificate and requesting library validation will only be able to load the library signed by the same Developer ID certificate. In reality, the test executable will not only run in this configuration, but will also load the library signed by the Mac Development certificate that has the same Team ID.
,
Aug 30 2016
2016-08-30 19:02:50 UTC from Apple: Hello, Thank you for forwarding this issue to us. We take any report of a potential security issue seriously. You should have already received our automated response message. This message is being sent to you by a security analyst who has reviewed your note. The issue is being investigated, and we appreciate the time you have taken to report it to us. If we need additional information, you will hear from us very soon. Because of the potentially sensitive nature of security issues, we ask that this information remain between you and Apple while we investigate it further. You’ll notice a number at the top of this email. Including that number in any further emails you send to us on this issue will help us rapidly associate it with your original report. We do not automatically provide status updates on issues as we work on them, but please feel free to request one if needed by replying to this message. Best regards, Scotty Apple Product Security
,
Sep 15 2016
2016-09-14 17:10 UTC from Apple: Hello Mark, In order to help us reproduce and investigate this issue, we will need some additional details. Do you have the binaries as signed by Google, with the mentioned combination of certificates? Best regards, Scotty Apple Product Security
,
Sep 15 2016
2016-09-15 15:18 UTC to Apple: I’m not comfortable providing exploit proof-of-concept binaries signed by Google. What I can do is provide these binaries signed by me individually. I hope that this suffices for your purposes. Please let me know if it doesn’t. In the attached archive, the lv_team_id_test executable and libfunc_developer_id.dylib library are signed by my Developer ID certificate (2U6V92CJ3Q). libfunc_mac_developer.dylib is signed by my Mac Developer certificate (P4FY735MER), which is associated with team 2U6V92CJ3Q. This is the same certificate configuration that we see with Google’s certificates, where the Developer ID certificate (EQHXZ8M8AV) shares that team ID with all Mac Developer certificates issued to team members.
,
Sep 21 2016
2016-09-21 21:07 UTC from Apple: Hello Mark, Thank you for the additional information. The information you’ve provided will be valuable in our efforts to determine the cause of the issue you reported. We appreciate your assistance in improving the security of our products. Best regards, Scotty Apple Product Security
,
Nov 14 2016
2016-11-14 17:19 UTC to Apple: As indicated when this issue was initially reported, it will be publicly disclosed 90 days from the date it was reported. Because the 90-day period ends on November 24, a holiday in the United States, disclosure is scheduled for the following business day, Monday, November 28. Please let us know when this problem will be resolved, and provide the CVE vulnerability ID that you have assigned to it for tracking purposes.
,
Nov 17 2016
2016-11-17 01:16 UTC from Apple: Hello Mark, Thank you for letting us know the updated disclosure dates. This issue has been addressed in macOS Sierra 10.12.1. We would appreciate your assessment of whether this fully addresses the issue you reported. We have issued CVE-2016-7584 for this issue and will be updating our advisory. When we address an issue in a Security Update, we like to give credit to the person who reported the issue to us. The information is typically in the following format: Credit to [Person] of [Company or School or Agency] for reporting this issue. Would you please let us know if you would like to be credited, and the information you would like us to use? Thank you again for taking the time to report this issue to us. Best regards, Scotty Apple Product Security
,
Nov 17 2016
2016-11-18 18:22 UTC to Apple: This does in fact appear fixed in 10.12.1 16B2657. Because a widely-available fix has already been released, I’m going to disclose details now. Please credit: Mark Mentovai and Boris Vidolov of Google Inc.
,
Nov 17 2016
10.12.1 was released on 2016-10-24. It contains a fix for this vulnerability, which was assigned CVE ID CVE-2016-7584. “About the security content of macOS Sierra 10.12.1…”, https://support.apple.com/en-us/HT207275, has not yet been updated to reflect this fix. De-restricting because a fix has been made broadly available.
,
Dec 15 2016
2016-12-14 11:31 UTC from Apple: Hello Mark, We have updated our macOS Sierra 10.12.1, iOS 10.1, tvOS 10.0.1, and watchOS 3.1 advisories to include your credit information. They are available at: https://support.apple.com/HT207275 , https://support.apple.com/HT207270 , https://support.apple.com/HT207269 , and https://support.apple.com/HT207271. AppleMobileFileIntegrity Impact: A signed executable may substitute code with the same team ID Description: A validation issue existed in the handling of code signatures. This issue was addressed through additional validation. CVE-2016-7584: Mark Mentovai and Boris Vidolov of Google Inc. Best regards, Scotty Apple Product Security
,
Dec 15 2016
https://support.apple.com/en-us/HT207275 now says AppleMobileFileIntegrity Available for: macOS Sierra 10.12 Impact: A signed executable may substitute code with the same team ID Description: A validation issue existed in the handling of code signatures. This issue was addressed through additional validation. CVE-2016-7584: Mark Mentovai and Boris Vidolov of Google Inc. Entry added November 27, 2016 |
||
►
Sign in to add a comment |
||
Comment 1 by mark@chromium.org
, Aug 26 2016