Talos Vulnerability Report

TALOS-2024-1976

Microsoft Excel for macOS library injection vulnerability

August 19, 2024
CVE Number

CVE-2024-43106

SUMMARY

A library injection vulnerability exists in Microsoft Excel 16.83 for macOS. A specially crafted library can leverage Excel’s access privileges, leading to a permission bypass. A malicious application could inject a library and start the program to trigger this vulnerability and then make use of the vulnerable application’s permissions.

CONFIRMED VULNERABLE VERSIONS

The versions below were either tested or verified to be vulnerable by Talos or confirmed to be vulnerable by the vendor.

Microsoft Excel 16.83 for macOS

PRODUCT URLS

Excel - https://www.microsoft.com/en/microsoft-365/excel

CVSSv3 SCORE

7.1 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

CWE

CWE-347 - Improper Verification of Cryptographic Signature

DETAILS

Microsoft Excel is a robust spreadsheet program by Microsoft, featuring data analysis, extensive calculation tools, charting, large dataset management, and task automation with macros and VBA. Widely used in finance, statistics, and inventory management, Excel is a key tool in business and academics.

Microsoft Excel loads multiple libraries through relative path:

$ otool -L "/Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel"
/Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel:
    @rpath/ADAL4.framework/Versions/A/ADAL4 (compatibility version 0.0.0, current version 0.0.0)
    @rpath/Chart.framework/Versions/A/Chart (compatibility version 0.0.0, current version 0.0.0)
    @rpath/CocoaUI.framework/Versions/A/CocoaUI (compatibility version 0.0.0, current version 0.0.0)
    @rpath/COMBase.framework/Versions/A/COMBase (compatibility version 0.0.0, current version 0.0.0)
    @rpath/MicrosoftCredui.framework/Versions/A/MicrosoftCredui (compatibility version 0.0.0, current version 0.0.0)
    [...]
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
    /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 5.9.2)

In this case the location is relative to the main executable /Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel. Furthermore, Excel has a big number of entitlements that allow the program to offer its various functionalities:

$ codesign -dv --entitlements -  "/Applications/Microsoft Excel.app"
     Executable=/Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel
Identifier=com.microsoft.Excel
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=473855 flags=0x10000(runtime) hashes=14797+7 location=embedded
Signature size=9011
Timestamp=12 Mar 2024 at 03:46:16
Info.plist entries=54
TeamIdentifier=UBF8T346G9
Runtime Version=14.2.0
Sealed Resources version=2 rules=13 files=18277
Internal requirements count=1 size=180
[Dict]
    [Key] com.apple.application-identifier
    [Value]
        [String] UBF8T346G9.com.microsoft.Excel
    [Key] com.apple.developer.aps-environment
    [Value]
        [String] production
    [Key] com.apple.developer.team-identifier
    [Value]
        [String] UBF8T346G9
    [Key] com.apple.security.app-sandbox
    [Value]
        [Bool] true
    [Key] com.apple.security.application-groups
    [Value]
        [Array]
            [String] UBF8T346G9.Office
            [String] UBF8T346G9.ms
            [String] UBF8T346G9.com.microsoft.oneauth
            [String] UBF8T346G9.OfficeOsfWebHost
            [String] UBF8T346G9.OfficeOneDriveSyncIntegration
    [Key] com.apple.security.assets.movies.read-only
    [Value]
        [Bool] true
    [Key] com.apple.security.assets.music.read-only
    [Value]
        [Bool] true
    [Key] com.apple.security.assets.pictures.read-write
    [Value]
        [Bool] true
    [Key] com.apple.security.automation.apple-events
    [Value]
        [Bool] true
    [Key] com.apple.security.cs.allow-unsigned-executable-memory
    [Value]
        [Bool] true
    [Key] com.apple.security.cs.disable-library-validation
    [Value]
        [Bool] true
    [Key] com.apple.security.files.bookmarks.app-scope
    [Value]
        [Bool] true
    [Key] com.apple.security.files.bookmarks.document-scope
    [Value]
        [Bool] true
    [Key] com.apple.security.files.user-selected.read-write
    [Value]
        [Bool] true
    [Key] com.apple.security.network.client
    [Value]
        [Bool] true
    [Key] com.apple.security.personal-information.addressbook
    [Value]
        [Bool] true
    [Key] com.apple.security.personal-information.photos-library
    [Value]
        [Bool] true
    [Key] com.apple.security.print
    [Value]
        [Bool] true
    [Key] com.apple.security.scripting-targets
    [Value]
        [Dict]
            [Key] com.apple.mail
            [Value]
                [Array]
                    [String] com.apple.mail.compose
    [Key] com.apple.security.temporary-exception.apple-events
    [Value]
        [Array]
            [String] com.microsoft.outlook
            [String] com.microsoft.solver
            [String] com.filemaker.client.pro12
            [String] com.microsoft.query
    [Key] com.apple.security.temporary-exception.files.absolute-path.read-only
    [Value]
        [Array]
            [String] /Library/Preferences/com.microsoft.office.licensingV2.plist
            [String] /Library/Application Support/Microsoft/
    [Key] com.apple.security.temporary-exception.files.home-relative-path.read-only
    [Value]
        [Array]
            [String] /Library/Application Support/Microsoft/
    [Key] com.apple.security.temporary-exception.mach-lookup.global-name
    [Value]
        [Array]
            [String] com.microsoft.office.licensingV2.helper.port
    [Key] com.apple.security.temporary-exception.sbpl
    [Value]
        [Array]
            [String] (allow file-read* file-write* (require-all (vnode-type REGULAR-FILE) (regex #"(^|/)~\$[^/]+$")) )
            [String] (deny file-write* (subpath (string-append (param "_HOME") "/Library/Application Scripts")) (subpath (string-append (param "_HOME") "/Library/LaunchAgents")) )
    [Key] com.apple.security.temporary-exception.shared-preference.read-write
    [Value]
        [Array]
            [String] com.microsoft.autoupdate2
            [String] com.microsoft.office
            [String] com.microsoft.shared
    [Key] keychain-access-groups
    [Value]
        [Array]
            [String] UBF8T346G9.com.microsoft.identity.universalstorage

The program is compiled using the Hardened Runtime, a security feature which aims, among other things, to prevent dynamically linked library hijacking.
However, the program includes this specific entitlement:

[Key] com.apple.security.cs.disable-library-validation
[Value]
    [Bool] true

With this entitlement enabled, the program’s defense against library hijacking is effectively nullified, as it allows the loading of unsigned dynamic libraries. This is an issue because a malicious application could leverage Excel’s permissions without proper authorization.

Indeed, an attacker could copy the application into a controllable location and perform a library injection to use the entitlements of the application. So, an attacker could potentially send emails through Microsoft Outlook, access the Pictures folder, exfiltrate data, and more.
In scenarios where the attacker leverages permissions already granted to Excel, or when Apple Events are sent to the other Microsoft apps under the scope of the com.apple.security.temporary-exception.apple-events entitlement, the system will not display a pop-up permission prompt, executing actions straightaway.
However, in cases where the required permission hasn’t yet been granted, the Microsoft Excel app will initiate the request. This could lead users to potentially grant the permission based on their trust in the Microsoft app.

Because of the use of the com.apple.security.cs.disable-library-validation entitlement set to true, a malicious application could perform a library injection in Microsoft Excel without any special permission.

TIMELINE

2024-04-16 - Vendor Disclosure
2024-05-13 - Vendor reply
2024-07-29 - Feedback to vendor
2024-08-01 - Vendor reply and request for additional information
2024-08-06 - Vendor informed of CVE assignments
2024-08-14 - Vendor acknowledgement
2024-08-19 - Public Release

Credit

Discovered by Francesco Benvenuto of Cisco Talos.