{"id":31685,"date":"2023-03-15T04:26:53","date_gmt":"2023-03-15T08:26:53","guid":{"rendered":"https:\/\/www.kaspersky.com.au\/blog\/ios-macos-nspredicate-class-of-bugs\/31685\/"},"modified":"2023-03-17T01:58:19","modified_gmt":"2023-03-16T14:58:19","slug":"ios-macos-nspredicate-class-of-bugs","status":"publish","type":"post","link":"https:\/\/www.kaspersky.com.au\/blog\/ios-macos-nspredicate-class-of-bugs\/31685\/","title":{"rendered":"Why you need to update iOS and macOS ASAP"},"content":{"rendered":"<p>The latest versions of iOS and iPadOS (16.3) and macOS (Ventura 13.2) have fixed the vulnerabilities tracked as CVE-2023-23530 and CVE-2023-23531. We explain the nature of these bugs, why they deserve your attention, what <a href=\"https:\/\/www.kaspersky.com\/blog\/pegasus-spyware\/14604\/\" target=\"_blank\" rel=\"noopener nofollow\">Pegasus<\/a> spyware has to do with it, and why you should take these and future iOS, iPad and macOS security updates seriously.<\/p>\n<h2>NSPredicate, FORCEDENTRY, Pegasus, and all the rest<\/h2>\n<p>To explain why these latest updates are important, we need a little background. The software foundation of apps made for Apple operating systems is called \u2014 though you may not believe it \u2014 the Foundation framework! Here\u2019s Apple\u2019s <a href=\"https:\/\/developer.apple.com\/documentation\/foundation\" target=\"_blank\" rel=\"nofollow noopener\">description<\/a> of it:<\/p>\n<div style=\"background-color: #E5F0EC; padding: 10px 25px; margin-bottom: 10px;\"> \u201cThe Foundation framework provides a base layer of functionality for apps and frameworks, including data storage and persistence, text processing, date and time calculations, <strong>sorting and filtering<\/strong>, and networking. The classes, protocols, and data types defined by Foundation are used throughout the macOS, iOS, watchOS, and tvOS SDKs.\u201d<\/div>\n<p>A little over two years ago, in January 2021, an iOS security researcher known as <a href=\"https:\/\/twitter.com\/CodeColorist\" target=\"_blank\" rel=\"nofollow noopener\">CodeColorist<\/a> published a <a href=\"https:\/\/codecolor.ist\/2021\/01\/16\/see-no-eval-runtime-code-execution-objc\/\" target=\"_blank\" rel=\"nofollow noopener\">report<\/a> that showed how implementation of the NSPredicate and NSExpression classes (which both make up part of the Foundation framework) can be exploited to execute arbitrary code. As it happens, these classes are responsible for <strong>sorting and filtering data<\/strong>. What\u2019s key here in the context of what we\u2019re telling you in this blogpost is that these tools allow to execute scripts on a device without verifying the digital signature of the code.<\/p>\n<p>CodeColorist\u2019s main finding was that such scripts can help bypass Apple security mechanisms \u2014 including app isolation. This makes it possible to write a malicious app that steals data (such as user\u2019s correspondence or random photos from the gallery) from other apps.<\/p>\n<p>March 2022 saw the release of a paper on the <a href=\"https:\/\/googleprojectzero.blogspot.com\/2021\/12\/a-deep-dive-into-nso-zero-click.html\" target=\"_blank\" rel=\"nofollow noopener\">practical implementation<\/a> of such an app \u2014 the FORCEDENTRY zero-click exploit \u2014 which was used to spread the infamous Pegasus malware. The vulnerabilities within NSPredicate and NSExpression allowed this malware to perform a <a href=\"https:\/\/encyclopedia.kaspersky.com\/glossary\/sandbox-escape\/\" target=\"_blank\" rel=\"noopener\">sandbox escape<\/a> and gain access to data and functions outside the strictly defined boundaries within which all iOS apps work.<\/p>\n<p>In the wake of both CodeColorist\u2019s theoretical work and the hands-on study of the FORCEDENTRY exploit, Apple implemented a number of security measures and restrictions. However, a new <a href=\"https:\/\/www.wired.com\/story\/trellix-ios-macos-bug-nspredicate\/\" target=\"_blank\" rel=\"nofollow noopener\">study<\/a> shows that these are still easy to bypass.<\/p>\n<h2>Why CVE-2023-23530 and CVE-2023-23531 are dangerous<\/h2>\n<p>The CVE-2023-23530 and CVE-2023-23531 vulnerabilities have become new ways to bypass these restrictions. The first, CVE-2023-23530, stems from how exactly Apple addressed the problem. Specifically, they drew up extensive denylists of classes and methods that pose an obvious security risk within NSPredicate. The catch is that, by using methods not <em>included<\/em> in the denylists, it\u2019s possible to wipe these lists clean and then use the full set of methods and classes.<\/p>\n<p>The second vulnerability, CVE-2023-23531, relates to how processes within iOS and macOS interact with each other, and how the data-receiving process filters incoming information. Simply put, the process of sending data can add to it a \u201ccontents verified\u201d tag, then feed the receiving process a malicious script that uses the NSPredicate, which in some cases will be executed without verification.<\/p>\n<p>According to the researchers, these two techniques for bypassing security checks allow exploitation of a number of other specific vulnerabilities. Attackers could use these vulnerabilities to gain access to user data and dangerous operating system features, and even install applications (including system ones). In other words, CVE-2023-23530 and CVE-2023-23531 can be used to create FORCEDENTRY-type exploits.<\/p>\n<p>To demonstrate the capabilities of CVE-2023-23530 and CVE-2023-23531, the researchers shot a video showing how a malicious app can be made to execute code inside <a href=\"https:\/\/en.wikipedia.org\/wiki\/SpringBoard\" target=\"_blank\" rel=\"nofollow noopener\">SpringBoard <\/a>(the standard application that manages the home screen on iOS) on an iPad. For its part, SpringBoard has elevated privileges and multiple access rights \u2014 including to the camera, microphone, call history, photos and geolocation data. What\u2019s more \u2014 it can completely wipe the device.<\/p>\n<h2>What this means for iOS and macOS security<\/h2>\n<p>We should stress that the dangers posed by CVE-2023-23530 and CVE-2023-23531 are purely theoretical: there\u2019ve been no recorded cases of in-the-wild exploitation. Also, the iOS 16.3 and macOS Ventura 13.2 updates have patched them, so if you install them on time, you are, supposedly, safe.<\/p>\n<p>That said, we don\u2019t know how well Apple has patched the vulnerabilities <em>this<\/em> time. Perhaps workarounds will be found for these patches too. At any rate, in conversation with Wired, the researchers themselves were pretty sure that new vulnerabilities of this class will <a href=\"https:\/\/www.wired.com\/story\/trellix-ios-macos-bug-nspredicate\/\" target=\"_blank\" rel=\"nofollow noopener\">continue to appear<\/a>.<\/p>\n<p>Keep in mind that, just being able to run scripts in iOS using NSPredicate is not enough for a successful hack. An attacker still needs to somehow get into the victim\u2019s device to be able to do anything with it. In the case of FORCEDENTRY, this involved the use of <a href=\"https:\/\/googleprojectzero.blogspot.com\/2021\/12\/a-deep-dive-into-nso-zero-click.html\" target=\"_blank\" rel=\"nofollow noopener\">other vulnerabilities<\/a>: an infected PDF disguised as an innocent GIF file was slipped onto the target device through iMessage.<\/p>\n<p>The likelihood of such vulnerabilities being used in <a href=\"https:\/\/www.kaspersky.com\/resource-center\/threats\/advanced-persistent-threat\" target=\"_blank\" rel=\"noopener nofollow\">APT attacks<\/a> is high, so it bears repeating the countermeasures you can take. We have a separate post about this where Costin Raiu, the Director of our Global Research &amp; Analysis Team (GReAT), explains in detail how to <a href=\"https:\/\/www.kaspersky.com\/blog\/how-to-protect-from-pegasus-spyware\/43453\/\" target=\"_blank\" rel=\"noopener nofollow\">protect yourself against Pegasus-class malware<\/a> and why these measures work. Here\u2019s a brief summary of his advice:<\/p>\n<ul>\n<li>Restart your iPhone and iPad more often \u2014 it\u2019s hard for attackers to gain a permanent foothold in iOS, and a restart often kills malware.<\/li>\n<li>Disable iMessage and FaceTime if it\u2019s possible \u2014 these apps provide a convenient entry point for attacking iOS devices.<\/li>\n<li>Instead of Safari, use an alternative browser like, say, Firefox Focus.<\/li>\n<li>Don\u2019t follow links in messages.<\/li>\n<li>Install <a href=\"https:\/\/www.kaspersky.com.au\/premium?icid=au_bb2022-kdplacehd_acq_ona_smm__onl_b2c_kdaily_lnk_sm-team___kprem___\" target=\"_blank\" rel=\"noopener\">reliable protection<\/a> on all your devices.<\/li>\n<li>And finally (as we keep insisting ad infinitum), keep your operating systems up to date (and from now on, perhaps keep more watchful eye out for iOS, iPadOS and macOS updates as and when they are released).<\/li>\n<\/ul>\n<input type=\"hidden\" class=\"category_for_banner\" value=\"premium-generic\">\n","protected":false},"excerpt":{"rendered":"<p>You shouldn\u2019t put off updating to iOS 16.3 and macOS Ventura 13.2 and future updates, and here\u2019s why.<\/p>\n","protected":false},"author":2726,"featured_media":31686,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2646],"tags":[14,1250,1946,1991,121,268],"class_list":{"0":"post-31685","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-threats","8":"tag-apple","9":"tag-ios","10":"tag-macos","11":"tag-pegasus","12":"tag-updates","13":"tag-vulnerabilities"},"hreflang":[{"hreflang":"en-au","url":"https:\/\/www.kaspersky.com.au\/blog\/ios-macos-nspredicate-class-of-bugs\/31685\/"},{"hreflang":"en-in","url":"https:\/\/www.kaspersky.co.in\/blog\/ios-macos-nspredicate-class-of-bugs\/25376\/"},{"hreflang":"en-ae","url":"https:\/\/me-en.kaspersky.com\/blog\/ios-macos-nspredicate-class-of-bugs\/20815\/"},{"hreflang":"en-us","url":"https:\/\/usa.kaspersky.com\/blog\/ios-macos-nspredicate-class-of-bugs\/27982\/"},{"hreflang":"en-gb","url":"https:\/\/www.kaspersky.co.uk\/blog\/ios-macos-nspredicate-class-of-bugs\/25665\/"},{"hreflang":"es-mx","url":"https:\/\/latam.kaspersky.com\/blog\/ios-macos-nspredicate-class-of-bugs\/26105\/"},{"hreflang":"es","url":"https:\/\/www.kaspersky.es\/blog\/ios-macos-nspredicate-class-of-bugs\/28552\/"},{"hreflang":"ru","url":"https:\/\/www.kaspersky.ru\/blog\/ios-macos-nspredicate-class-of-bugs\/34858\/"},{"hreflang":"x-default","url":"https:\/\/www.kaspersky.com\/blog\/ios-macos-nspredicate-class-of-bugs\/47513\/"},{"hreflang":"fr","url":"https:\/\/www.kaspersky.fr\/blog\/ios-macos-nspredicate-class-of-bugs\/20326\/"},{"hreflang":"pt-br","url":"https:\/\/www.kaspersky.com.br\/blog\/ios-macos-nspredicate-class-of-bugs\/20957\/"},{"hreflang":"de","url":"https:\/\/www.kaspersky.de\/blog\/ios-macos-nspredicate-class-of-bugs\/29920\/"},{"hreflang":"ja","url":"https:\/\/blog.kaspersky.co.jp\/ios-macos-nspredicate-class-of-bugs\/33475\/"},{"hreflang":"ru-kz","url":"https:\/\/blog.kaspersky.kz\/ios-macos-nspredicate-class-of-bugs\/25971\/"},{"hreflang":"en-za","url":"https:\/\/www.kaspersky.co.za\/blog\/ios-macos-nspredicate-class-of-bugs\/31390\/"}],"acf":[],"banners":"","maintag":{"url":"https:\/\/www.kaspersky.com.au\/blog\/tag\/ios\/","name":"iOS"},"_links":{"self":[{"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/posts\/31685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/users\/2726"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/comments?post=31685"}],"version-history":[{"count":2,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/posts\/31685\/revisions"}],"predecessor-version":[{"id":31695,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/posts\/31685\/revisions\/31695"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/media\/31686"}],"wp:attachment":[{"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/media?parent=31685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/categories?post=31685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaspersky.com.au\/blog\/wp-json\/wp\/v2\/tags?post=31685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}