{"id":33223,"date":"2024-05-08T06:34:29","date_gmt":"2024-05-08T10:34:29","guid":{"rendered":"https:\/\/www.kaspersky.co.za\/blog\/?p=33223"},"modified":"2024-05-12T14:11:31","modified_gmt":"2024-05-12T12:11:31","slug":"beware-github-malicious-links","status":"publish","type":"post","link":"https:\/\/www.kaspersky.co.za\/blog\/beware-github-malicious-links\/33223\/","title":{"rendered":"Malware lurking in &#8220;official&#8221; GitHub and GitLab links"},"content":{"rendered":"<p>One of the oldest security tips is: \u201cOnly download software from official sources\u201d. \u201cOfficial sources\u201d are usually the main app stores on each platform, but for millions of useful and free open-source apps, the most \u201cofficial\u201d source is the developer\u2019s repository on a dedicated site such as GitHub or GitLab. There, you can find the project\u2019s source code, fixes and additions to the code, and often a ready-to-use build of the app. These sites are familiar to anyone with even the slightest interest in computers, software, and programming. That\u2019s why it was an unpleasant discovery for many (including IT security specialists and the developers themselves) that a file accessible at a link like <em>github{.}com\/{User_Name}\/{Repo_Name}\/files\/{file_Id}\/{file_name}<\/em> could be published by someone other than the developer and contain\u2026 anything.<\/p>\n<p>Of course, cybercriminals immediately took advantage of this.\n<\/p>\n<h2>Breaking down the problem<\/h2>\n<p>\nGitHub and its close relative GitLab are built around collaboration on software development projects. A developer can upload their code, and others can offer additions, fixes, or even create forks \u2013 alternative versions of the app or library. If a user finds a bug in an app, they can report it to the developer by creating an issue report. Other users can confirm the issue in the comments. You can also comment on new versions of the app. If necessary, you can attach files to the comments, such as screenshots showing the error or documents that crash the application. These files are stored on GitHub servers using links of the type described above.<\/p>\n<p>However, GitHub has one peculiarity: if a user prepares a comment and uploads accompanying files, but doesn\u2019t click \u201cPublish\u201d, the information remains \u201cstuck\u201d in the draft \u2013 and it\u2019s invisible to both the application owner and other GitHub users. Nevertheless, a direct link to the file uploaded in the comment is created and fully operational, and anyone who follows it will receive the file from GitHub\u2019s CDN.<\/p>\n<div id=\"attachment_51206\" style=\"width: 1219px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/103\/2024\/05\/08123654\/beware-github-malicious-links-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51206\" class=\"size-full wp-image-51206\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/103\/2024\/05\/08123654\/beware-github-malicious-links-01.jpg\" alt=\"A download link for a malicious file is generated after the file is added to an unpublished comment on GitHub\" width=\"1209\" height=\"787\"><\/a><p id=\"caption-attachment-51206\" class=\"wp-caption-text\">A download link for a malicious file is generated after the file is added to an unpublished comment on GitHub<\/p><\/div>\n<p>Meanwhile, the owners of the repository where this file is posted in the comments cannot delete or block it. They don\u2019t even know about it! There are also no settings to restrict the upload of such files for the repository as a whole. The only solution is to disable comments completely (on GitHub, you can do this for up to six months), but that would deprive developers of feedback.<\/p>\n<p>GitLab\u2019s commenting mechanism is similar, allowing files to be published via draft comments. The files are accessible via a link like <em>gitlab.com\/{User_Name}\/{Repo_Name}\/uploads\/{file_Id}\/{file_name}.<\/em><\/p>\n<p>However, the problem in this case is mitigated somewhat by the fact that only registered, logged-in GitLab users can upload files.\n<\/p>\n<h2>A gift for phishing campaigns<\/h2>\n<p>\nThanks to the ability to publish arbitrary files at links starting with GitHub\/GitLab and containing the names of respected developers and popular projects (because an unpublished comment with a file can be left in almost any repository), cybercriminals are presented with the opportunity to carry out very convincing phishing attacks. <a href=\"https:\/\/www.bleepingcomputer.com\/news\/security\/github-comments-abused-to-push-malware-via-microsoft-repo-urls\/\" target=\"_blank\" rel=\"nofollow noopener\">Malicious campaigns<\/a> have already been discovered where \u201ccomments\u201d, supposedly containing cheating apps for games, are left in Microsoft repositories.<\/p>\n<p>A vigilant user might wonder why a gaming cheat would be in the Microsoft repository: <em>https:\/\/github{.}com\/microsoft\/vcpkg\/files\/\u2026..\/Cheat.Lab.zip<\/em>. But it\u2019s much more likely that the keywords \u201cGitHub\u201d and \u201cMicrosoft\u201d will reassure the victim, who won\u2019t scrutinize the link any further. Smarter criminals might disguise their malware even more carefully, for example, by presenting it as a new version of an app distributed through GitHub or GitLab and posting links via \u201ccomments\u201d on that app.\n<\/p>\n<h2>How to protect yourself from malicious content on GitHub and GitLab<\/h2>\n<p>\nWhile this design flaw remains unfixed and anyone can freely upload arbitrary files to the CDN of GitHub and GitLab, users of these platforms need to be extremely careful.\n<\/p>\n<ul>\n<li>Do not download files from direct GitHub\/GitLab links that you find in external sources \u2013 other websites, emails, or chats. Instead, open the project page (<em>github{.}com\/{User_Name}\/{Repo_Name}<\/em> or <em>gitlab{.}com\/{User_Name}\/{Repo_Name})<\/em> and make sure that you can actually download the file from there. Official files from developers should be published and visible in the repository.<\/li>\n<li>Make sure you\u2019re on the right developer page \u2013 in GitHub, GitLab, and other open-source repositories, <a href=\"https:\/\/www.kaspersky.com\/blog\/lookalike-domains-in-bec\/48686\/\" target=\"_blank\" rel=\"noopener nofollow\">typosquatting<\/a> is common: creating fake projects with names that differ from the original by one or two letters (for example, Chaddev instead of Chatdev).<\/li>\n<li>Avoid downloading applications that have few stars (likes) and have been created recently.<\/li>\n<li>Use protection against malware and phishing on all your computers and smartphones. <a href=\"https:\/\/www.kaspersky.co.za\/premium?icid=en-za_bb2022-kdplacehd_acq_ona_smm__onl_b2c_kdaily_lnk_sm-team___kprem___\" target=\"_blank\" rel=\"noopener\">Kaspersky Premium<\/a>\u00a0provides comprehensive protection for gamers and computer enthusiasts.<\/li>\n<\/ul>\n<input type=\"hidden\" class=\"category_for_banner\" value=\"premium-geek\">\n","protected":false},"excerpt":{"rendered":"<p>Can you catch malware by downloading files from Microsoft&#8217;s repositories on GitHub? Turns out, you can. Stay alert!<\/p>\n","protected":false},"author":2722,"featured_media":33226,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2670],"tags":[647,1057,3728,3057,76,422,131],"class_list":{"0":"post-33223","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-threats","8":"tag-gamers","9":"tag-github","10":"tag-gitlab","11":"tag-open-source","12":"tag-phishing","13":"tag-threats","14":"tag-tips"},"hreflang":[{"hreflang":"en-za","url":"https:\/\/www.kaspersky.co.za\/blog\/beware-github-malicious-links\/33223\/"},{"hreflang":"en-in","url":"https:\/\/www.kaspersky.co.in\/blog\/beware-github-malicious-links\/27407\/"},{"hreflang":"en-ae","url":"https:\/\/me-en.kaspersky.com\/blog\/beware-github-malicious-links\/22731\/"},{"hreflang":"ar","url":"https:\/\/me.kaspersky.com\/blog\/beware-github-malicious-links\/11672\/"},{"hreflang":"en-us","url":"https:\/\/usa.kaspersky.com\/blog\/beware-github-malicious-links\/30092\/"},{"hreflang":"en-gb","url":"https:\/\/www.kaspersky.co.uk\/blog\/beware-github-malicious-links\/27562\/"},{"hreflang":"es-mx","url":"https:\/\/latam.kaspersky.com\/blog\/beware-github-malicious-links\/27369\/"},{"hreflang":"es","url":"https:\/\/www.kaspersky.es\/blog\/beware-github-malicious-links\/30022\/"},{"hreflang":"it","url":"https:\/\/www.kaspersky.it\/blog\/beware-github-malicious-links\/28826\/"},{"hreflang":"ru","url":"https:\/\/www.kaspersky.ru\/blog\/beware-github-malicious-links\/37388\/"},{"hreflang":"tr","url":"https:\/\/www.kaspersky.com.tr\/blog\/beware-github-malicious-links\/12343\/"},{"hreflang":"x-default","url":"https:\/\/www.kaspersky.com\/blog\/beware-github-malicious-links\/51203\/"},{"hreflang":"fr","url":"https:\/\/www.kaspersky.fr\/blog\/beware-github-malicious-links\/21872\/"},{"hreflang":"pt-br","url":"https:\/\/www.kaspersky.com.br\/blog\/beware-github-malicious-links\/22606\/"},{"hreflang":"de","url":"https:\/\/www.kaspersky.de\/blog\/beware-github-malicious-links\/31264\/"},{"hreflang":"ja","url":"https:\/\/blog.kaspersky.co.jp\/beware-github-malicious-links\/36366\/"},{"hreflang":"ru-kz","url":"https:\/\/blog.kaspersky.kz\/beware-github-malicious-links\/27711\/"},{"hreflang":"en-au","url":"https:\/\/www.kaspersky.com.au\/blog\/beware-github-malicious-links\/33561\/"}],"acf":[],"banners":"","maintag":{"url":"https:\/\/www.kaspersky.co.za\/blog\/tag\/phishing\/","name":"phishing"},"_links":{"self":[{"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/posts\/33223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/users\/2722"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/comments?post=33223"}],"version-history":[{"count":4,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/posts\/33223\/revisions"}],"predecessor-version":[{"id":33230,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/posts\/33223\/revisions\/33230"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/media\/33226"}],"wp:attachment":[{"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/media?parent=33223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/categories?post=33223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaspersky.co.za\/blog\/wp-json\/wp\/v2\/tags?post=33223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}