• Skip to main content

Naga Cyber Defense

Trusted Security for all of Indonesia

  • Home
  • About
  • Programs
  • Contact
  • Blog
You are here: Home / News / Hal-hal Buruk Datang dalam Paket Besar: Bypass Verifikasi Tanda Tangan .pkg di MacOS

Hal-hal Buruk Datang dalam Paket Besar: Bypass Verifikasi Tanda Tangan .pkg di MacOS

January 15, 2023 by Coffee Bean

Kerentanan (CVE-2022-42841) yang dapat digunakan untuk memodifikasi paket penginstal yang ditandatangani tanpa membatalkan tanda tangannya. Kerentanan ini dapat disalahgunakan untuk mem-bypass Gatekeeper, SIP dan dalam kondisi tertentu meningkatkan hak istimewa ke root.

Kerentanan
Untuk paket yang ditandatangani, hash TOC perlu digunakan untuk dua pemeriksaan berbeda:

  • Hash TOC yang dihitung harus sama dengan hash TOC yang disimpan di heap.
  • Tanda tangan dan sertifikat harus sesuai dengan hash TOC.

Ini diterapkan di lokasi berikut dalam kode sumber xar.

Di sini, TOC yang dihitung dibandingkan dengan nilai yang disimpan di heap.

https://github.com/apple-oss-distributions/xar/blob/f67a3a8c43fdd35021fd3d1562b62d2da32b4f4b/xar/lib/archive.c#L391-L484

Ini pertama mengambil atribut atribut checksum dari dokumen XML sebagai nilai const char *. Kemudian, strtoull mengubahnya menjadi bilangan bulat 64-bit yang tidak ditandatangani dan disimpan dalam variabel offset.

Untuk mendapatkan hash TOC untuk memvalidasi tanda tangan, sedikit kode serupa digunakan:
https://github.com/Apple-oss-distributions/xar/blob/f67a3a8c43fdd35021fd3d1562b62d2da32b4f4b/xar/lib/signature.c#L244-L276

Perhatikan di sini perbedaan kecil tapi sangat penting: sementara perbandingan pertama menyimpan offset dalam offset uint64_t (integer unsigned 64-bit), di sini ia menggunakan offset uint32_t (integer unsigned 32-bit). Perbedaan ini berarti bahwa jika offset berada di luar rentang yang dapat disimpan dalam nilai 32-bit, kedua pemeriksaan tersebut dapat menggunakan offset heap yang berbeda.

Dengan demikian, dimungkinkan untuk memodifikasi file xar tanpa membatalkan tanda tangannya sebagai berikut:

  • Ambil file xar yang ditandatangani dengan benar dan parsing TOC.
  • Ubah nilai offset checksum menjadi 4294967296 (dan buat perubahan lain yang Anda inginkan pada file yang disertakan, seperti menambahkan skrip prainstal berbahaya atau mengganti skrip pemeriksaan instalasi).
  • Tulis TOC yang dimodifikasi kembali ke file dan hitung hash TOC baru.
  • Tambahkan padding hingga heap berukuran tepat 4294967296 byte (4 GiB).
  • Tempatkan hash TOC baru di heap offset 4294967296, biarkan hash TOC asli di heap offset 0.
  • Perbaikan
    Ini diperbaiki oleh Apple dengan perbaikan 2 karakter: mengubah uint32_t menjadi uint64_t di macOS 13.1.

    selengkapnya : sector7

Tagged With: Apple, CVE, Exploit, Patch, Vulnerability

Copyright © 2025 · Naga Cyber Defense · Sitemap

Cookies Settings
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
AcceptReject AllCookie Settings
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
CookieDurationDescription
_ga2 yearsThe _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors.
_gat_gtag_UA_172707709_11 minuteSet by Google to distinguish users.
_gid1 dayInstalled by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
non-necessary
SAVE & ACCEPT
Powered by CookieYes Logo