Talos Vulnerability Report

TALOS-2024-1977

Microsoft Word for macOS library injection vulnerability

August 19, 2024
CVE Number

CVE-2024-41165

SUMMARY

A library injection vulnerability exists in Microsoft Word 16.83 for macOS. A specially crafted library can leverage Word’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 Word 16.83 for macOS

PRODUCT URLS

Word - https://www.microsoft.com/en/microsoft-365/word

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 Word is a leading word processing program developed by Microsoft, offering robust tools for document creation, editing, and formatting, widely used across personal, educational, and professional domains for diverse writing tasks.

Microsoft Word loads multiple libraries through relative path:

$ otool -L "/Applications/Microsoft Word.app/Contents/MacOS/Microsoft Word"
/Applications/Microsoft Word.app/Contents/MacOS/Microsoft Word:
    @rpath/Forms.framework/Versions/A/Forms (compatibility version 0.0.0, current version 0.0.0)
    @rpath/MicrosoftFontLibrary.framework/Versions/A/MicrosoftFontLibrary (compatibility version 0.0.0, current version 0.0.0)
    @rpath/MSXML.framework/Versions/A/MSXML (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2487.30.104)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 64.0.0)
    /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0)
    [...]
    @rpath/osf.framework/Versions/A/osf (compatibility version 0.0.0, current version 0.0.0)
    @rpath/osfstorage2.framework/Versions/A/osfstorage2 (compatibility version 0.0.0, current version 0.0.0)
    @rpath/ProofingUI.framework/Versions/A/ProofingUI (compatibility version 0.0.0, current version 0.0.0)
    @rpath/MicrosoftPTLS7.framework/Versions/A/MicrosoftPTLS7 (compatibility version 0.0.0, current version 0.0.0)
    @rpath/MicrosoftRichEdit.framework/Versions/A/MicrosoftRichEdit (compatibility version 0.0.0, current version 0.0.0)
    @rpath/Uniscribe.framework/Versions/A/Uniscribe (compatibility version 0.0.0, current version 0.0.0)
    @rpath/WinCrypto.framework/Versions/A/WinCrypto (compatibility version 0.0.0, current version 0.0.0)
    @rpath/XPG.framework/Versions/A/XPG (compatibility version 0.0.0, current version 0.0.0)
    @rpath/OLEAutomation.framework/Versions/A/OLEAutomation (compatibility version 0.0.0, current version 0.0.0)
    @rpath/rpcrt4.framework/Versions/A/rpcrt4 (compatibility version 0.0.0, current version 0.0.0)
    @rpath/WLMGraphicsDevice.framework/Versions/A/WLMGraphicsDevice (compatibility version 0.0.0, current version 0.0.0)
    @rpath/WLMKernel.framework/Versions/A/WLMKernel (compatibility version 0.0.0, current version 0.0.0)
    @rpath/Xmllite.framework/Versions/A/Xmllite (compatibility version 0.0.0, current version 0.0.0)
    @rpath/WordSDKShim.framework/Versions/A/WordSDKShim (compatibility version 0.0.0, current version 0.0.0)

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

$ codesign -dv --entitlements -  "/Applications/Microsoft Word.app"
Executable=/Applications/Microsoft Word.app/Contents/MacOS/Microsoft Word
Identifier=com.microsoft.Word
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=375422 flags=0x10000(runtime) hashes=11721+7 location=embedded
Signature size=9011
Timestamp=12 Mar 2024 at 03:37:31
Info.plist entries=54
TeamIdentifier=UBF8T346G9
Runtime Version=14.2.0
Sealed Resources version=2 rules=13 files=29300
Internal requirements count=1 size=180
[Dict]
    [Key] com.apple.application-identifier
    [Value]
        [String] UBF8T346G9.com.microsoft.Word
    [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-only
    [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.device.audio-input
    [Value]
        [Bool] true
    [Key] com.apple.security.files.bookmarks.app-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.lync
            [String] com.microsoft.skypeforbusiness
            [String] com.filemaker.client.pro12
            [String] com.thomsonresearchsoft.endnote
            [String] com.dessci.mathtype
    [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-only
    [Value]
        [Array]
            [String] com.ThomsonResearchSoft.EndNote
    [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 Word’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 record audio, send emails through Microsoft Outlook, access the Pictures folder, exfiltrate data, and more.
In scenarios where the attacker leverages permissions already granted to Word, 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 Word 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 Word 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.