{"id":39256,"date":"2021-04-08T14:52:28","date_gmt":"2021-04-08T18:52:28","guid":{"rendered":"https:\/\/www.kaspersky.com\/blog\/?p=39256"},"modified":"2021-04-08T14:52:28","modified_gmt":"2021-04-08T18:52:28","slug":"is-txt-file-safe","status":"publish","type":"post","link":"https:\/\/www.kaspersky.com\/blog\/is-txt-file-safe\/39256\/","title":{"rendered":"Are text files safe?"},"content":{"rendered":"<p>Employees who receive external e-mails typically receive information about which files are potentially dangerous. For example, EXE files are considered unsafe by default, as are DOCX and XLSX files, which can contain malicious macros. Text files, on the other hand, are generally considered harmless by design, because they cannot contain anything other than plain text. But that isn\u2019t always the case.<\/p>\n<p>Researchers found a way to exploit a vulnerability (now patched) in the format, and they could find more. The file format isn\u2019t actually the problem; it\u2019s the way programs handle TXTs.<\/p>\n<h2>macOS\u2019s CVE-2019-8761 vulnerability<\/h2>\n<p>Researcher Paulos Yibelo <a href=\"https:\/\/www.paulosyibelo.com\/2021\/04\/this-man-thought-opening-txt-file-is.html\" target=\"_blank\" rel=\"nofollow noopener\">highlighted<\/a> a curious way of attacking macOS computers through text files. Like many other protective solutions, macOS\u2019s built-in security system, Gatekeeper, views text files as completely trustworthy. Users can download and open them using the built-in editor TextEdit without additional checks.<\/p>\n<p>However, TextEdit is somewhat more sophisticated than Microsoft Windows\u2019 Notepad. It can do more stuff, such as display text in bold, let users change the font color, and more. Because the TXT format is not designed to store style information, TextEdit takes on the additional technical information so it can handle the task. For example, if a file starts with the line &lt;!DOCTYPE HTML&gt;&lt;html&gt;&lt;head&gt;&lt;\/head&gt;&lt;body&gt;, TextEdit begins to handle HTML tags, even in a file with a .txt extension.<\/p>\n<p>Essentially, writing HTML code into a text file that starts with that line forces TextEdit to process the code, or at least some elements of it.<\/p>\n<h2>Attacks possible through text files<\/h2>\n<p>After carefully examining all possibilities available to a potential attacker using this method, Yibelo found that the vulnerability enables:<\/p>\n<ul>\n<li>DoS attacks. Gatekeeper does not prevent the opening of local files from an object with the TXT extension. Therefore, opening a malicious text file can overload a computer, for example, using the HTML code to access the <a href=\"https:\/\/en.wikipedia.org\/wiki\/dev\/zero\" target=\"_blank\" rel=\"nofollow noopener\">\/dev\/zero<\/a> file, an endless source of null characters.<\/li>\n<li>Identifying a user\u2019s real IP address. Code in the text file can call AutoFS, a standard program for mounting file systems, which can provide access to an external drive. Although that action is harmless on its own, because the automatic mounting process forces the system kernel to send a TCP request, even if the user is behind a proxy server, the creator of the malicious text file can find out the exact time it was opened and register the real IP address.<\/li>\n<li>File theft. Entire files can be inserted into a text document containing the &lt;iframedoc&gt; Therefore, the malicious text file can gain access to any file on the victim\u2019s computer and then transfer its contents using a dangling markup attack. The user just has to open the file.<\/li>\n<\/ul>\n<p>The vulnerability was reported to Apple back in December\u00a02019, and it was assigned the number <a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2019-8761\" target=\"_blank\" rel=\"nofollow noopener\">CVE-2019-8761<\/a>. <a href=\"https:\/\/www.paulosyibelo.com\/2021\/04\/this-man-thought-opening-txt-file-is.html\" target=\"_blank\" rel=\"nofollow noopener\">Paulos Yibelo\u2019s post<\/a> provides more information about exploiting the vulnerability.<\/p>\n<h2>How to stay safe<\/h2>\n<p>A 2020 update patched the <a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2019-8761\" target=\"_blank\" rel=\"nofollow noopener\">CVE-2019-8761<\/a> vulnerability, but that\u2019s no guarantee no TXT-related bugs lurk in the software. There could be others that no one has worked out how to exploit\u00a0\u2014 yet. So, the correct answer to the question \u201cIs this text file safe?\u201d is something like: \u201cYes, for now. But stay vigilant.\u201d<\/p>\n<p>Therefore, we recommend <a href=\"https:\/\/k-asap.com\/en\/?icid=gl_kdailyplacehold_acq_ona_smm__onl_b2b_kasperskydaily_wpplaceholder____kasap___\" target=\"_blank\" rel=\"noopener\">training all employees<\/a> to treat any file as a potential threat, even if it looks like a harmless text file.<\/p>\n<p>Regardless, handing control of all the company\u2019s outgoing information flows to an internal or <a href=\"https:\/\/www.kaspersky.com\/enterprise-security\/managed-detection-and-response?icid=gl_kdailyplacehold_acq_ona_smm__onl_b2b_kasperskydaily_wpplaceholder____\" target=\"_blank\" rel=\"noopener nofollow\">external SOC<\/a> makes sense.<\/p>\n<input type=\"hidden\" class=\"category_for_banner\" value=\"kasap\">\n","protected":false},"excerpt":{"rendered":"<p>Files with the TXT extension are typically considered safe. Are they, though? <\/p>\n","protected":false},"author":2581,"featured_media":39257,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1999,3051,3052],"tags":[268],"class_list":{"0":"post-39256","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-business","8":"category-enterprise","9":"category-smb","10":"tag-vulnerabilities"},"hreflang":[{"hreflang":"x-default","url":"https:\/\/www.kaspersky.com\/blog\/is-txt-file-safe\/39256\/"},{"hreflang":"en-in","url":"https:\/\/www.kaspersky.co.in\/blog\/is-txt-file-safe\/22708\/"},{"hreflang":"en-ae","url":"https:\/\/me-en.kaspersky.com\/blog\/is-txt-file-safe\/18189\/"},{"hreflang":"en-us","url":"https:\/\/usa.kaspersky.com\/blog\/is-txt-file-safe\/24519\/"},{"hreflang":"en-gb","url":"https:\/\/www.kaspersky.co.uk\/blog\/is-txt-file-safe\/22557\/"},{"hreflang":"es-mx","url":"https:\/\/latam.kaspersky.com\/blog\/is-txt-file-safe\/21597\/"},{"hreflang":"es","url":"https:\/\/www.kaspersky.es\/blog\/is-txt-file-safe\/25049\/"},{"hreflang":"it","url":"https:\/\/www.kaspersky.it\/blog\/is-txt-file-safe\/24330\/"},{"hreflang":"ru","url":"https:\/\/www.kaspersky.ru\/blog\/is-txt-file-safe\/30455\/"},{"hreflang":"tr","url":"https:\/\/www.kaspersky.com.tr\/blog\/is-txt-file-safe\/9512\/"},{"hreflang":"fr","url":"https:\/\/www.kaspersky.fr\/blog\/is-txt-file-safe\/16727\/"},{"hreflang":"pt-br","url":"https:\/\/www.kaspersky.com.br\/blog\/is-txt-file-safe\/17296\/"},{"hreflang":"pl","url":"https:\/\/plblog.kaspersky.com\/is-txt-file-safe\/14662\/"},{"hreflang":"de","url":"https:\/\/www.kaspersky.de\/blog\/is-txt-file-safe\/26504\/"},{"hreflang":"nl","url":"https:\/\/www.kaspersky.nl\/blog\/is-txt-file-safe\/26893\/"},{"hreflang":"ru-kz","url":"https:\/\/blog.kaspersky.kz\/is-txt-file-safe\/23735\/"},{"hreflang":"en-au","url":"https:\/\/www.kaspersky.com.au\/blog\/is-txt-file-safe\/29081\/"},{"hreflang":"en-za","url":"https:\/\/www.kaspersky.co.za\/blog\/is-txt-file-safe\/28879\/"}],"acf":[],"banners":"","maintag":{"url":"https:\/\/www.kaspersky.com\/blog\/tag\/vulnerabilities\/","name":"vulnerabilities"},"_links":{"self":[{"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/posts\/39256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/users\/2581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/comments?post=39256"}],"version-history":[{"count":2,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/posts\/39256\/revisions"}],"predecessor-version":[{"id":39259,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/posts\/39256\/revisions\/39259"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/media\/39257"}],"wp:attachment":[{"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/media?parent=39256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/categories?post=39256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaspersky.com\/blog\/wp-json\/wp\/v2\/tags?post=39256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}