<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tal Folkman on Medium]]></title>
        <description><![CDATA[Stories by Tal Folkman on Medium]]></description>
        <link>https://medium.com/@tal.folkman?source=rss-49a438ea7b77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3FnGPWROpfh578uwNDY-Hw.jpeg</url>
            <title>Stories by Tal Folkman on Medium</title>
            <link>https://medium.com/@tal.folkman?source=rss-49a438ea7b77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:43:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tal.folkman/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Over 170K Users Affected by Attack Using Fake Python Infrastructure]]></title>
            <link>https://zero.checkmarx.com/over-170k-users-affected-by-attack-using-fake-python-infrastructure-05a04b7e058a?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/05a04b7e058a</guid>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[pypi]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 12:22:08 GMT</pubDate>
            <atom:updated>2024-03-25T18:46:01.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCyu-4d9zxtdO8qxP-pWGw.png" /></figure><p>The Checkmarx Research team recently discovered an attack campaign targeting the software supply chain, with evidence of successful exploitation of multiple victims. These include the Top.gg GitHub organization (a community of over 170k users) and several individual developers. The threat actors used multiple TTPs in this attack, including account takeover via stolen browser cookies, contributing malicious code with verified commits, setting up a custom Python mirror, and publishing malicious packages to the PyPi registry. This report will cover the attack and the techniques used by the attackers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xb9uGjjO-jyIqyGD8X3U2A.png" /></figure><h3>Key Points</h3><ul><li>An attacker distributed a malicious dependency hosted on a fake Python infrastructure by linking it to popular projects on GitHub and legitimate Python packages.</li><li>The malicious dependency, masquerading as the popular “colorama” package, contained hidden malware designed to steal sensitive data from infected systems.</li><li>The attacker hijacked GitHub accounts, including one belonging to a <a href="http://top.gg/">top.gg</a> contributor, using it to make malicious commits and spread the malware to a community of over 170K members.</li><li>Employing a multi-stage execution process, the malware fetches and executes obfuscated code from multiple external sources, using techniques like encryption, encoding, compression, and misleading characters to evade detection.</li><li>Targeting a wide array of applications, such as web browsers, social media platforms, email services, and messaging apps, the malware harvests sensitive information, including login credentials, session tokens, and personal data.</li><li>Stolen data is exfiltrated to the attacker’s server, and persistence is established through Windows registry modifications.</li></ul><h3>Weird Message, Got Hacked</h3><blockquote>“I was using my laptop today, just the regular messing around with python and other stuff on my command line, until I seen a weird message on my command line saying that there’s something wrong with colorama on python, I didn’t care much cause I’m used to this stuff so I just skipped it, Few minutes later I got the same error message but in a different script I’m using. <strong>The moment I seen this I knew what’s going on, I got hacked</strong>.”</blockquote><p>This chilling account comes from a recent <a href="https://medium.com/@demonia/discovering-malwares-in-public-github-repositories-3e080f030ecc">blog post by Mohammed Dief</a>, a security researcher who fell victim to a sophisticated malware attack while cloning the repository “maleduque/Valorant-Checker”.</p><p>Mohammed’s story is just one example of the far-reaching impact of this malware campaign. The attacker behind the campaign employed a devious strategy to spread the malware through malicious GitHub repositories.</p><h3>Fake Python Mirror</h3><p>The attack infrastructure included a website that appeared to be a Python package mirror and was registered under the domain <strong>“files[.]pypihosted[.]org”.</strong></p><p>This domain selection is a clever <strong>typosquat</strong> of the official Python mirror “files.pythonhosted.org,” as the latter is where the official artifact files of PyPi packages are typically stored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCdxNznS5_sS01Q-kRubCw.png" /></figure><p>In the attacker’s footprints, we saw they utilized a feature in pip (package manager for Python) where you can specify a URL to grab your package dependency and use their fake Python mirror to download packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yrTuEaS01IBfYs9MMv4nLQ.png" /><figcaption><em>Requirement.txt file, Fake mirror URL vs legitimate URL</em></figcaption></figure><h3><strong>Hosting a poisoned “colorama”</strong></h3><p>The threat actors took <a href="https://pypi.org/project/colorama/">Colorama</a> (a highly popular tool with 150+ million monthly downloads), copied it, and inserted malicious code. They then concealed the harmful payload within Colorama using space-padding and hosted this modified version on their typosquatted-domain fake-mirror. This strategy makes it considerably more challenging to identify the package’s harmful nature with the naked eye, as it initially appears to be a legitimate dependency.</p><h3><strong>GitHub Account Takeover</strong></h3><p>The attacker’s reach extended beyond creating malicious repositories through their own accounts. They managed to hijack GitHub accounts with high reputations and use the resources under those accounts to contribute malicious commits.</p><p>One of the victims is the GitHub account <a href="https://github.com/editor-syntax">editor-syntax</a> who is also a maintainer of <a href="https://github.com/top-gg">Top.gg</a> GitHub organization and has write permissions to Top.gg’s git repositories.</p><p>With control over this trusted account, the attacker made a <a href="https://github.com/top-gg/python-sdk/commit/ecb87731286d72c8b8172db9671f74bd42c6c534">malicious commit</a> to the <a href="https://github.com/top-gg/python-sdk">top-gg/python-sdk</a> repository using the stolen GitHub identity of <a href="https://github.com/editor-syntax">editor-syntax</a>. They added to the requirements.txt instructions to download the poisoned version of colorama from their fake Python mirror.</p><p>They also used that account to star multiple malicious GitHub repositories to increase their visibility and credibility.</p><h3><strong>Account Takeover via Stolen Cookies</strong></h3><p>The GitHub account of “editor-syntax” was likely hijacked through stolen cookies. The attacker gained access to the account’s session cookies, allowing them to bypass authentication and perform malicious activities using the GitHub UI. This method of account takeover is particularly concerning, as it does not require the attacker to know the account’s password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ukj6symuZAi5O1hgMuFGLg.png" /></figure><p><strong>“Bro What”</strong></p><p>The Top.gg community (which boasts over 170K members) was also a victim of this attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0qzvOUw0Bvk_yqCzD2T0A.png" /></figure><p>On March 3rd, 2024, users alerted<strong> “editor-syntax”</strong> on the community’s Discord chat about the malicious activities originating from his account. <strong>“editor-syntax”</strong> was quite shocked, to say the least, as he realized what had occurred through his GitHub account. It became evident that the malware had compromised multiple individuals, highlighting the scale and impact of the attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36yCBTzJKmluN1tsqz0eFA.png" /></figure><p>Interestingly, the attacker’s Typosquatting technique was so convincing that even a user on GitHub fell victim to it without realizing they were under attack. When the malicious domain, “piphosted[.]org”, went down, the user opened an issue on one of the malicious repositories, complaining about it, not realizing it had been a host for malicious payloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F89bEz6URypHs5NxHOzQiQ.png" /></figure><p><strong>A Needle in a Haystack</strong></p><p>To further conceal their malicious intent, the attacker employed a strategic approach when committing changes to many of the malicious repositories. They would simultaneously commit multiple files, including the requirements file containing the malicious link, along with other legitimate files. This calculated move aimed to minimize the chances of detection, as the malicious link would blend in with the legitimate dependencies, reducing the likelihood of users spotting the anomaly during a cursory review of the committed changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItjgGMDO_OBZVjEYPprFmw.png" /><figcaption><em>Example of the attacker hiding Fake mirror URL within a commit of multiple files.</em></figcaption></figure><p><strong>Deep Dive into the Malicious Package</strong></p><p>In addition to spreading the malware through malicious GitHub repositories, the attacker also utilized a malicious Python package called “yocolor” to further distribute the “colorama” package containing the malware. They employed the same typosquatting technique, hosting the malicious package on the domain “<strong>files[.]pypihosted[.]org</strong>” and using an identical name to the legitimate “colorama” package.</p><p>By manipulating the package installation process and exploiting the trust users place in the Python package ecosystem, the attacker ensured that the malicious “colorama” package would be installed whenever the malicious dependency was specified in the project’s requirements. This tactic allowed the attacker to bypass suspicions and infiltrate the systems of unsuspecting developers who relied on the integrity of the Python packaging system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_wDoU6_vn1lewKd_Qn-ow.png" /></figure><h4><strong>Stage 1</strong></h4><p>The first stage is where the unsuspected user downloads the malicious repo or package which contains the malicious dependency — “colorama” from the typosquatted domain, <strong>“files[.]pypihosted.org”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*edOuF7S7ZW6B8jNEaz4SAQ.png" /><figcaption><em>Example of how the malicious code looks like within the ycolor package</em></figcaption></figure><h4><strong>Stage 2</strong></h4><p>The malicious “colorama” package contains code that is identical to the legitimate package, with the exception of a short snippet of additional malicious code. Initially, this code was located within the file <strong>“colorama/tests/__init__.py”,</strong> but the attacker later moved it to <strong>“colorama/init.py”,</strong> likely to ensure that the malicious code is executed more reliably. This code sets the stage for the subsequent phases of the attack.</p><p>The attacker employed a clever technique to hide the malicious payload within the code. They used a significant amount of whitespace to push the malicious code off-screen, requiring someone inspecting the package to scroll horizontally for an extended period before discovering the hidden malicious content. This technique aimed to make the malicious code less noticeable during a quick review of the package’s source files.</p><p>This code fetches and executes another piece of Python code from “hxxps[:]//pypihosted[.]org/version,” which installs necessary libraries and decrypts hard-coded data using the “fernet” library. The decrypted code then searches for a valid Python interpreter and executes yet another obfuscated code snippet saved in a temporary file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FD0SdWfZWwPg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DD0SdWfZWwPg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FD0SdWfZWwPg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0a0c94a5dddbea4c6520845a9870451/href">https://medium.com/media/d0a0c94a5dddbea4c6520845a9870451/href</a></iframe><h4><strong>Stage 3</strong></h4><p>The malware progresses further, fetching additional obfuscated Python code from another external link: hxxp[:]//162[.]248[.]100[.]217/inj, and executes it using “exec”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Pc_48MI_y-MayMIQtBt5g.png" /></figure><h4><strong>Stage 4</strong></h4><p>Upon analysis, it’s clear that the attacker has put thought into obfuscating their code. Techniques such as the use of Chinese and Japanese character strings, zlib compression, and misleading variable names are just a few of the techniques employed to complicate the code’s analysis and comprehension.</p><p>The simplified code checks the compromised host’s operating system and selects a random folder and file name to host the final malicious Python code, which is retrieved from “hxxp[:]//162[.]248[.]100.217[:]80/grb.”</p><p>A persistence mechanism is also employed by the malware by modifying the Windows registry to create a new run key, which ensures that the malicious Python code is executed every time the system is rebooted. This allows the malware to maintain its presence on the compromised system even after a restart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jOiP2NW-IsY6Umx2rf4w6Q.png" /></figure><h4><strong>Stage 5 — No One is Left Behind</strong></h4><p>The final stage of the malware, retrieved from the remote server, reveals the true extent of its data-stealing capabilities. It targets a wide range of popular software applications and steals sensitive information, some of which include:</p><p><strong>Browser Data</strong>: The malware targets a wide range of web browsers, including Opera, Chrome, Brave, Vivaldi, Yandex, and Edge. It searches for specific directories associated with each browser and attempts to steal sensitive data such as cookies, autofill information, browsing history, bookmarks, credit cards, and login credentials.</p><p><strong>Discord Data</strong>: The code specifically targets Discord by searching for Discord-related directories and files. It attempts to locate and decrypt Discord tokens, which can be used to gain unauthorized access to the victim’s Discord account.</p><p><strong>Cryptocurrency Wallets</strong>: The malware includes a list of cryptocurrency wallets that it aims to steal from the victim’s system. It searches for specific directories associated with each wallet and attempts to steal wallet-related files. The stolen wallet data is then compressed into ZIP files and uploaded to the attacker’s server.</p><p><strong>Telegram Sessions</strong>: The malware also attempts to steal Telegram session data. It searches for Telegram-related directories and files, aiming to capture the victim’s session information. With access to Telegram sessions, the attacker could potentially gain unauthorized access to the victim’s Telegram account and communications.</p><p><strong>Computer Files</strong>: The malware includes a file stealer component that searches for files with specific keywords in their names or extensions. It targets directories such as Desktop, Downloads, Documents, and Recent Files.</p><p><strong>Instagram data</strong>: The malware attempts to steal sensitive information from the victim’s Instagram profile by leveraging the Instagram session token. The malware sends requests to the Instagram API using the stolen session token to retrieve various account details.</p><p>Further analysis of the final payload reveals that the malware also includes a keylogging component. It captures the victim’s keystrokes and saves them to a file, which is then uploaded to the attacker’s server. This capability allows the attacker to monitor and record the victim’s typed input, potentially exposing sensitive information such as passwords, personal messages, and financial details.</p><p>The stolen data is exfiltrated to the attacker’s server using various techniques. The code includes functions to upload files to anonymous file-sharing services like GoFile and Anonfiles. It also sends the stolen information to the attacker’s server using HTTP requests, along with unique identifiers like hardware ID or IP address to track the victim.</p><h3><strong>Conclusion</strong></h3><p>This campaign is a prime example of the sophisticated tactics employed by malicious actors to distribute malware through trusted platforms like PyPI and GitHub.</p><p>This incident highlights the importance of vigilance when installing packages and repositories even from trusted sources. It is crucial to thoroughly vet dependencies, monitor for suspicious network activity, and maintain robust security practices to mitigate the risk of falling victim to such attacks.</p><p>As the cybersecurity community continues to uncover and analyze these threats, collaboration and information sharing remain essential in the ongoing battle against malicious actors in the software supply chain.</p><p>We reported the abused domains to Cloudflare, and they have since been taken down.</p><p>As part of the Checkmarx Supply Chain Security solution, our research team continuously monitors suspicious activities in the open-source software ecosystem. We track and flag “signals” that may indicate foul play and promptly alert our customers to help protect them.</p><p>Working together to keep the open source ecosystem safe.</p><h3><strong>Timeline</strong></h3><ul><li><strong>Nov 2022:</strong> Pypi User “felpes” added three packages to the Python Package Index (PyPI) that contained various forms of malicious code.</li><li><strong>Feb 01, 2024:</strong> The domain pypihosted[.]org was registered by the attacker.</li><li><strong>Mar 04, 2024:</strong> The GitHub account of a top.gg contributor was compromised, and the attacker used it to commit malicious code to the organization’s repository.</li><li><strong>Mar 13, 2024:</strong> The attacker registered the domain pythanhosted.org, further expanding their typosquatting infrastructure.</li><li><strong>Mar 05, 2024: </strong>“felpes” published the malicious package “yocolor” on PyPI, acting as a delivery mechanism for the malware.</li></ul><h3><strong>Packages</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10ece5d8e0f9c7399abf2a40b7b03a0f/href">https://medium.com/media/10ece5d8e0f9c7399abf2a40b7b03a0f/href</a></iframe><h3><strong>IOC</strong></h3><ul><li>hxxps[:]//files[.]pythanhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.5.tar.gz</li><li>hxxps[:]//files[.]pypihosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz</li><li>hxxps://files[.]pypihosted[.]org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.3.tar.gz</li><li>162[.]248.101.215</li><li>pypihosted.org/version</li><li>162[.]248.100.217</li><li>162.248.100.117</li><li>0C1873196DBD88280F4D5CF409B7B53674B3ED85F8A1A28ECE9CAF2F98A71207</li><li>35AC61C83B85F6DDCF8EC8747F44400399CE3A9986D355834B68630270E669FB</li><li>C53B93BE72E700F7E0C8D5333ACD68F9DC5505FB5B71773CA9A8668B98A17BA8</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05a04b7e058a" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/over-170k-users-affected-by-attack-using-fake-python-infrastructure-05a04b7e058a">Over 170K Users Affected by Attack Using Fake Python Infrastructure</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Uncovered An Army of Fake User Accounts]]></title>
            <link>https://zero.checkmarx.com/how-i-uncovered-an-army-of-fake-user-accounts-aec8cb1dfd4c?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/aec8cb1dfd4c</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 10:28:03 GMT</pubDate>
            <atom:updated>2023-02-20T10:37:11.633Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ETkQuTK4r3GIVOpDMK0riQ.png" /></figure><p>Mitigating software supply chain attacks is a never-ending game of cat and mouse. We, as defenders, are always trying to find ways to close the gap between the time the attack has started and the moment we are able to stop it or at least defend potential victims.</p><p>One way of doing that is to anticipate the attacker&#39;s moves and be there when they make them. This is possible when defenders can identify patterns in the attacker’s actions based on their movements and “hunt” for them. Sometimes we are able to do it using data we already possess. In other cases, this data must be acquired first, like in our recent incident.</p><h3>Intro</h3><p>Last weekend, we <a href="https://medium.com/checkmarx-security/17-malicious-python-packages-targeting-selenium-users-to-steal-crypto-8d24628ec656">reported</a> on a large-scale attack on the Python ecosystem. Over 400 malicious packages were published by 22+ separate user accounts aimed at stealing crypto wallets from Python users.</p><p>As the week progressed, the number of malicious packages published by the attacker continued to climb, surpassing 900 packages from dozens of user accounts. We were all witnessing an ongoing attack with no clue when it would end.</p><p>We needed to develop a proactive strategy to stay ahead of the attacker and prevent them from compromising any more victims. While we were already monitoring user accounts that had published malicious packages, we were also concerned about unknown user accounts that were related to the attacker but had not yet released any malicious packages.</p><p>To address this issue, I investigated further and found that all user accounts related to the ongoing attack were created on the same day, November 4th. I then created a map of all suspicious user accounts created on the PyPI platform on November 4th and had yet to release any packages (there were many of those!). By monitoring these accounts for any activity, I could catch malicious packages the moment they were released, effectively thwarting the attacker’s efforts.</p><p>In this blog, I will share my strategy for identifying and monitoring suspicious user accounts to prevent future attacks.</p><h4>Get All PyPi User Accounts</h4><p>My first go-to was PyPi’s APIs, as they show the total number of user accounts on the main page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HAIGSy-NiZ-OudF8EKU4gw.png" /></figure><p>PyPi does provide various REST APIs for accessing information about packages hosted on its platform. A couple of examples of such are:</p><pre>https://pypi.org/pypi/{package_name}/json</pre><p>Which returns detailed information about a specified package, including the package’s versions and metadata.</p><p>There is also <a href="https://warehouse.pypa.io/api-reference/xml-rpc.html">PyPi’s XML-RPC</a> API which provides a range of methods for interacting with its platform, such as searching for packages and retrieving package metadata.</p><p><strong>Sadly</strong>, none of PyPi’s APIs support getting a list of all user accounts published in a specific timeframe, nor a complete list of all users in general.</p><h4>sitemap.xml To The Rescue</h4><p>In SEO, an XML sitemap is used to list a website’s essential pages, making sure search engines like Google can find and crawl them all.</p><p>As I suspected, PyPi’s <a href="https://pypi.org/sitemap.xml">sitemap.xml</a> file lists pages related to all user accounts, packages, and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L_Fn7GOquBGja2Ptv2OvVw.png" /></figure><p>To extract the list of user accounts from this source, I built a simple scraper in Python with the help of a library called <strong>beautifulsoup. </strong>It goes over each sub-page of the sitemap file and extracts all user account URLs on the PyPi website, effectively providing us with a list of all users on this registry.</p><pre>def get_all_pypi_usernames(session):<br>    url = &quot;https://pypi.org/sitemap.xml&quot;<br>    r = session.get(url)<br>    r.raise_for_status()<br>    soup = BeautifulSoup(r.text, &#39;xml&#39;)<br>    sitemaps = soup.findAll(&#39;sitemap&#39;)<br>    sitemap_urls = map(lambda x: x.find(&#39;loc&#39;).text, sitemaps)<br>    with ThreadPoolExecutor(max_workers=10) as executor:<br>        futures = [executor.submit(session.get, sitemap_url) for sitemap_url in sitemap_urls]<br>        for future in concurrent.futures.as_completed(futures):<br>            r = future.result()<br>            r.raise_for_status()<br>            soup = BeautifulSoup(r.text, &#39;xml&#39;)<br>            url_elements = soup.findAll(&#39;url&#39;)<br>            pypi_urls = map(lambda x: x.find(&#39;loc&#39;).text, url_elements)<br>            pypi_urls = filter(lambda x: x.startswith(&#39;https://pypi.org/user/&#39;), pypi_urls)<br>            pypi_urls = map(lambda x: x.replace(&#39;https://pypi.org/user/&#39;, &#39;&#39;).strip(&#39;/&#39;), pypi_urls)<br>            pypi_urls = map(lambda x: x.lower(), pypi_urls)<br>            yield from pypi_urls</pre><h4>Getting More User Data</h4><p>After acquiring the complete list of over 620k user accounts, I wanted to get more data on each user.</p><p>I expanded my scraper to load each user’s page on PyPi using the URL pattern https://pypi.org/user/&lt;username&gt; and extracted interesting data such as:</p><ul><li>Display Name</li><li>Registration Date</li><li>Number of Packages</li><li>Profile image URL (more on that in a moment)</li></ul><p>Although PyPi displays the day the user account was created, I was able to retrieve the timestamp after inspecting the page’s source code and extracting the timestamp from a datetime attribute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*piHpvRI2CFfjfKawR_aCKg.png" /></figure><p>It is noteworthy that <strong>not </strong>all user’s profile pages provided a registration date. My hypothesis is that PyPi started to audit this field for users created after 2013, and this is missing for user accounts registered before September 17, 2013.</p><pre>def get_pypi_user_info(username, session):<br>    url = f&#39;https://pypi.org/user/{username}/&#39;<br>    r = session.get(url)<br>    r.raise_for_status()<br>    soup = BeautifulSoup(r.content, &#39;html.parser&#39;)<br>    profile_info_element = soup.find(class_=&#39;author-profile__info&#39;)<br>    registration_date = &#39;&#39;<br>    author_profile = soup.find(class_=&#39;author-profile&#39;)<br>    profile_image_url = author_profile.find(&#39;img&#39;)[&#39;src&#39;]<br><br>    r = session.get(profile_image_url)<br>    r.raise_for_status()<br><br>    image = Image.open(BytesIO(r.content))<br>    is_gravatar_default_image = list(image.getdata()) == list(DEFAULT_GRAVATAR_IMAGE.getdata())<br><br>    if profile_image_url and profile_image_url.startswith(&#39;https://warehouse-camo.ingress.cmh1.psfhosted.org&#39;):<br>        hex_encoded_url = profile_image_url.split(&#39;/&#39;)[-1]<br>        profile_image_url = bytes.fromhex(hex_encoded_url).decode()<br><br>    registration_date_element = profile_info_element.find(&#39;time&#39;)<br>    if registration_date_element:<br>        registration_date = registration_date_element.attrs.get(&#39;datetime&#39;, &#39;&#39;)<br><br>    display_name = &#39;&#39;<br>    profile_name_element = soup.find(class_=&#39;author-profile__name&#39;)<br>    if profile_name_element:<br>        display_name = profile_name_element.text<br><br>    published_packages = soup.findAll(class_=&#39;package-snippet&#39;)<br>    published_packages_count = len(published_packages)<br><br>    return display_name, registration_date, published_packages_count, profile_image_url, is_gravatar_default_image</pre><h4>Checking if a user has a default image</h4><p>To check if the user account changed the profile image (via Gravatar), I wrote the following code to compare the user’s image with the default gravatar Image. This worked surprisingly well.</p><pre>// download this image from:<br>// https://secure.gravatar.com/avatar/default?size=225<br>DEFAULT_GRAVATAR_IMAGE = Image.open(&#39;gravatar_template_image.jpg&#39;)<br><br>.<br>.<br>.<br>.<br><br>r = session.get(profile_image_url)<br>r.raise_for_status()<br><br>image = Image.open(BytesIO(r.content))<br>is_gravatar_default_image = list(image.getdata()) == list(DEFAULT_GRAVATAR_IMAGE.getdata())</pre><h4>Result</h4><p>The full script I created is available <a href="https://gist.github.com/jossef/4b45d96a9f7c16a97127ba5eb7d11e30">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50b46694c0053f9f55328da7b5c147fc/href">https://medium.com/media/50b46694c0053f9f55328da7b5c147fc/href</a></iframe><h3>Finding Anomalies</h3><p>After extracting this information regarding user accounts in PyPi, I began searching for anomalies, and more specifically — user accounts <a href="https://medium.com/checkmarx-security/17-malicious-python-packages-targeting-selenium-users-to-steal-crypto-8d24628ec656">related to the incident from last week, where someone published 900 malicious typosquatting packages</a> using over 30 different user accounts. <strong>All were created in advance </strong>a couple of months earlier, <strong>on Nov 4, 2022.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UapIEbNA-tliAv_y7bGvaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nz5uHaq4vmXX61KHwHdgeg.png" /></figure><p>I produced a list of suspicious PyPi user accounts, which I believe that might be related to the typosquatting attack from last week. Sharing the list below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42fb511e1ffa8479b21666872937b172/href">https://medium.com/media/42fb511e1ffa8479b21666872937b172/href</a></iframe><h3>Summary</h3><p>My efforts resulted in a list of ~280 PyPi user accounts suspected of being part of the attacker’s infrastructure created on November 4, 2022, for future usage.</p><p>I call on <strong>other defenders </strong>to monitor this list of suspicious user accounts just in case they are activated and start publishing new malicious packages.</p><p>Realizing that this is not a malicious package problem but an attacker problem, shifts the way we think and might help us prevent attacks much closer to their creation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aec8cb1dfd4c" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/how-i-uncovered-an-army-of-fake-user-accounts-aec8cb1dfd4c">How I Uncovered An Army of Fake User Accounts</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolution of a Software Supply Chain Attacker]]></title>
            <link>https://zero.checkmarx.com/evolution-of-a-software-supply-chain-attacker-740cd33d1f29?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/740cd33d1f29</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[pypi]]></category>
            <category><![CDATA[attacker]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Tue, 31 Jan 2023 14:03:52 GMT</pubDate>
            <atom:updated>2023-01-31T14:03:52.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*kkTGG8wxjA6_t8PWJ0N3Lg.png" /></figure><p>Just like Hollywood has its own celebrities and well-known actors, the world of malicious open-source packages also has its own notorious players. And just like Hollywood stars, these threat actors don’t always stay in the spotlight. They can take breaks and reemerge with new tactics, techniques, and tools. Keeping a close eye on these threat actors is a big part of our job at Checkmarx’ Supply Chain Security team, as we track their activities to keep users safe.</p><p>In this blog post, we will delve into the tactics of one attacker who has been distributing their packages for at least four months and shows no signs of stopping; we<strong> track this threat actor as PYTA27</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFRrU4o7Y0Hc&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFRrU4o7Y0Hc&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7b55704927f5fd276fc15733f7e9066/href">https://medium.com/media/b7b55704927f5fd276fc15733f7e9066/href</a></iframe><p>Studying how attackers adapt and improve their methods over time is a valuable tool for security professionals. The fact that this particular attacker has been active for a significant amount of time and has demonstrated a willingness to change tactics suggests that the risk for users is ongoing and that the effort required for the attacker is minimal. This provides a unique opportunity for security professionals to learn from this attacker’s tactics and improve their own defenses.</p><h3>Background</h3><p>As we observe the evolution of attackers, it is clear that they are constantly improving their methods. Among these actors, we can find individuals like the PyPi username “claysmith,” who have been uploading multiple packages over the past few months. Others are more sophisticated, using various tactics such as changing their usernames. One notable example is the attack group that uses ten different usernames to upload 35 packages, all related to stealing from the popular communication platform, Discord. These are just a few examples of the diverse and ever-evolving landscape of malicious actors in the open-source ecosystem.</p><h3>Threat Actor PYTA27</h3><p>A few weeks ago, the original <a href="https://github.com/lotus04/W4sp-Stealer">GitHub repository</a> of W4SP Stealer was removed by GitHub staff. For those of you who are not familiar, W4SP Stealer is an open-source malware that aims to steal all the victim’s Discord accounts, passwords, crypto wallets, credit cards, and other valuable files on their PC and sends them to the attacker via a pre-set Discord webhook address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*sSDA6C9O65v_Rwwx50O95g.png" /><figcaption>Screenshot from LoTus04, W4sp creator</figcaption></figure><p>Since then, <strong>countless copycats</strong> of the same concept have emerged, calling themselves by different names such as ANGEL Stealer, Celestial Stealer, Leaf $tealer, Zay injection, and more.</p><p>We dubbed one of those threat actors <strong>PYTA27</strong> and this is the story of their evolution over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*lEatGX5_K4179fYR85kGgQ.png" /><figcaption>PYTA27 user accounts and connections</figcaption></figure><h3>Plain Text</h3><p>We first observed PYTA27 activity on September 11, 2022, with the appearance of four packages published at the same hour by the user account “diazz” all with the description “Discord Code.” Three of the packages were empty, but one of them contained clear text code for a copycat of the “wasp” malware called “zay injection.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOvdONxVa4icOo5uUYr08A.png" /><figcaption>From the “colorcolorfull” package</figcaption></figure><p>Since then, in each batch of packages, PYTA27 has attempted to use different techniques to conceal the malicious code and make it more difficult to identify the payload.</p><h3>Using Obfuscation</h3><p>On September 12, 2022, PYTA27 uploaded the package “color-vividpy,” which used the <a href="https://pyobfuscate.com/">Pyobfuscate obfuscator</a>. (Code obfuscation with this tool can easily be deobfuscated following the steps in this <a href="https://blog.phylum.io/malicious-open-source-package-authors-are-bad-and-should-feel-bad">blog</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*74eIrg57CAg-_cVXPsp3ww.png" /><figcaption>From the “color-vividpy” package</figcaption></figure><p>The next four packages that they uploaded targeted Discord. In two of them, the attacker used the <a href="https://github.com/billythegoat356/Hyperion">Hyperion obfuscator</a> (originally used in the W4SP Stealer). On another package, the <a href="https://development-tools.net/python-obfuscator/">Python obfuscation tool by development-tools.net</a> is used. (This brought up old memories with the usage of an obfuscator incorporating words such as “love,” “magic,” “joy”, etc.) This kind of obfuscation was common in obfuscated code over a year ago, but in recent months, we have seen fewer attackers using it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*4n7opJTGo4gvvbPAwKP2aQ.png" /><figcaption><em>From the ”pyselfdiscord” package</em></figcaption></figure><h3>Hiding Malicious Code at the Bottom</h3><p>Another technique is adding legitimate code before the malicious part, making it difficult to identify at first. They continued to use double obfuscation and added more data to further conceal the malware (as was done in the “discord-py-v13” package). In all their recent packages, they targeted Discord users by using package names and descriptions such as “Used in Discord tools to have great natural functionality without errors and interruptions!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Emtc8fyONVEC7BK9A95jXg.png" /><figcaption>From the “discord-py-v13”</figcaption></figure><h3>Using a Second Stage</h3><p>After that, PYTA27 took a break for about a month and a half and resumed their attack on November 1, 2022, by uploading new packages under a different username (laurenjackson) but with the same description as before.</p><p>In another change of their techniques, they added a snippet that downloads a second stage code from a remote location (hxxps://www.klgrth[.]io/paste/j2yvv/raw), saves it to a random path with a random name and runs it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*zP9NXzZzu4JX49Bz7Eb2Cg.png" /><figcaption><em>From the “joinerutil” package</em></figcaption></figure><p>The downloaded obfuscated code was the stealer. In some of the packages, the attacker incorporated a persistence mechanism by adding a “SecurityHealthSystray.exe” key in the “run” directory in the registry to trigger the payload on startup. This, along with the fact that the code uses Windows local path and the Python libraries “winreg” and “wmi”, suggests that the code only runs on Windows machines.</p><p>At this point, the attacker opened the “ch4zzin” user account and uploaded additional malicious packages, this time, changing the final payload and using two new types of stealers: “Leaf $tealer” and “Celestial Stealer.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*67Hsc_Sl7SEEMzcw1vzlkg.png" /><figcaption><em>Adding registry key</em></figcaption></figure><h3>The Leaf $tealer</h3><p>The “Leaf $tealer” can be found on a <a href="https://github.com/diniz-LG/Leaf-Stealer">GitHub repository</a> and describe itself as follow:</p><p>“<em>A thief of discord accounts and Bitcoin wallets (Captures other logins from sites including steam, PayPal, sellix and several other sites) after running once it is injected into the victim’s computer receiving always new information after a reboot (Undetectable antivirus)</em>”</p><p>The creator, “diniz,” has only created one repository that they continuously update. Inside the “injection.py” file, you can find a simple Python script that steals credentials from the victim’s machine and installs several dependencies. What’s notable is that “diniz” keeps changing the last dependency, so if the package gets deleted or removed, their replacement package will be a dependency for the project, so it will automatically download it. In the example shown, the malicious packages are “realtek” and “coincounter”, but earlier that day, it was changed to a new malicious package, “movers”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*b81AN6WRvCEWTf99UpYfMg.png" /><figcaption><em>Changing packages names</em></figcaption></figure><p>If you look at the second file in that repository, “module.bat”, you can see that it also contains the same malicious packages (including one that was removed a long time ago — wniutil).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*srYh42PVB_q-Hwy2hpZKSg.png" /><figcaption><em>Keeping the removed package — wniutil</em></figcaption></figure><p>They also maintain an active Discord channel that they update whenever they make changes to the repository. The discord channel was created in December 2022, and was deleted on 18.1.23 by discord due to a TOS violation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*IdtrRhpVwmWq6n-EUln6GQ.png" /><figcaption>Stock’s diniz discord server</figcaption></figure><h3>Still Evolving</h3><p>After another break, the attacker appeared again in December 2022, and since then has continued to publish malicious packages with minor adjustments. After returning to their old username, “laurenjackson”, the attacker uploaded packages with a new C2 server and a piece of code ensuring the program would exit in case the host operating system is not Windows.</p><p>The reason for this addition is that the package is designed to run on Windows only; attempting to install it on different operating systems, such as Linux, will result in errors.</p><p>These days, the C2 server they use is a simple GitHub page (<a href="https://raw.githubusercontent.com/IvanDevGames/index.js/main/1337.py">https://raw.githubusercontent.com/IvanDevGames/index.js/main/1337.py</a>) that keeps on changing whenever a new package is uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*L9zMr3rjw8bkze46Bu6-sw.png" /><figcaption>checking for windows machine</figcaption></figure><h3>TTP Evolution</h3><p>PYTA27 has been evolving their tactics, techniques, and procedures (TTPs) over time, starting with plain text code, then using obfuscation tools such as Pyobfuscate and Hyperion, and finally hiding the malicious code at the bottom of legitimate code.</p><p>Another significant aspect to note about PYTA27 is their persistence. This attacker has been active for at least four months and has not shown any signs of stopping, which highlights the ongoing risk for users. Additionally, PYTA27’s willingness to change tactics and use different techniques, such as different obfuscation tools, shows that they are actively trying to evade detection. This is why it is essential for security professionals to stay informed about the latest TTPs used by threat actors like PYTA27. They should also continuously update their defenses accordingly. This includes not only technical measures, but also educating users to be more cautious about downloading and using open-source packages from untrusted sources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*Bmf3Fe5YoionY8kTTqTaIw.png" /><figcaption>Evolution over time</figcaption></figure><h3>Conclusion</h3><p>In conclusion, this blog post highlights the ongoing threat of malware distribution and the need for constant vigilance and adaptation in order to protect against it. The attacker discussed in this blog post has shown a willingness to adapt and improve their methods over time, making detecting and removing malware more difficult. This serves as a reminder that security professionals must stay informed and aware of new techniques and methods in order to protect against these types of attacks effectively. It also shows the importance of open source threat intelligence and information sharing among security professionals to help stay ahead of attackers. The use of code obfuscation, multiple usernames, and different packages is a common technique used by attackers, and security professionals should always be cautious when downloading packages from untrusted sources.</p><p>Persistent threat actors operating in the open-source code ecosystem are experimenting and launching attacks on version control systems, mainly GitHub and package registries such as PyPi and NPM. The Checkmarx Labs supply chain security research team is continuously tracking these actors to be able to keep users safe and mitigate attacks quickly after they appear.</p><p>The low risk and ease of commencing such attacks ensure that existing attackers will continue their activities while more newcomers will start experimenting similarly and attacking well.</p><h3>Packages</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb2903e48087d1c8af0cc4c13576d016/href">https://medium.com/media/fb2903e48087d1c8af0cc4c13576d016/href</a></iframe><h3>IOCs</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/771993ec839ecc3e19a589c3770f1fb5/href">https://medium.com/media/771993ec839ecc3e19a589c3770f1fb5/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=740cd33d1f29" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/evolution-of-a-software-supply-chain-attacker-740cd33d1f29">Evolution of a Software Supply Chain Attacker</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hunting for Malicious Code: The Dangers of WASP Stealer]]></title>
            <link>https://zero.checkmarx.com/hunting-for-malicious-code-the-dangers-of-wasp-stealer-e0d073913623?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0d073913623</guid>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[wasp-stealer]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 13:35:11 GMT</pubDate>
            <atom:updated>2022-12-13T13:35:11.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wldaMgwFkySofa2tCZ8BcA.png" /></figure><p>WASP Stealer, for those of you who aren’t familiar, is an open-source malware created by <a href="https://github.com/loTus04">loTus04</a> that is designed to steal sensitive information from a victim’s computer. It has several features that make it particularly effective at this task. For example, it can steal saved passwords, browser cookies, and PC information. Additionally, it can steal Discord tokens from browsers and the Discord app, and it can get all the information associated with these tokens, such as the user’s email, nitro/badge, and rare friends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5NETk9jeidQU37yJSf_tzQ.png" /></figure><h4>Fake GitHub Profiles</h4><p>A new trending concern is attackers create fake profiles to host malware disguised as legitimate projects and silently include malicious dependencies and harmful code. We see many attackers take advantage of the unvetted ecosystem where anyone with a working email address can create a new profile and claim false facts about himself.</p><p>This attack technique sounds simple but it is quite effective as many victims land on those fake GitHub profiles and their repositories origin from general search engines and execute the code on their computers.</p><p>To build such fake credibility, attackers make their projects appear “pro” by using stats and descriptions stolen from popular users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPvYk-s0w4vvV6ekaie6CQ.png" /></figure><h3>Hunting for Malicious Code</h3><p>As many attackers also copy WASP Stealer open source malware’s code and embed it into fake open source tools at scale, I decided to hunt and report such attackers.</p><p>To do so, I used <a href="https://github.com/search?o=desc&amp;p=8&amp;q=%22__import__%28%27builtins%27%29.exec%28%22&amp;s=indexed&amp;type=Code">this GitHub search query</a>, and surprisingly, I found dozens of repositories containing the WASP Stealer malicious code.</p><pre>&quot;__import__(&#39;builtins&#39;).exec(&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_I6KTiSP51RElrXvnSMDSA.png" /></figure><p>By simply searching for this query “__import__(‘builtins’).exec” in GitHub, I have found over 100 repos that use this specific malicious code.</p><p>Going through all of those results reveals the majority of those attackers use the techniques to hide their malicious payloads from the naked eye by padding it with many spaces so it won’t appear unless scrolled horizontally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6E077_SsJYvsRmN-5sSCkA.png" /></figure><h4>Social Engineering</h4><p>Most of the malicious repos’ names target victims who search for tools to automate Discord, TikTok, Snapchat and other apps by having project names like — “TikTok-Follow-Views-BotV2” or “discord-boost-bot” and more.</p><p>This social engineering scheme had proven to work as <a href="https://medium.com/checkmarx-security/wasp-attack-on-python-polymorphic-malware-shipping-wasp-stealer-infecting-hundreds-of-victims-10e92439d192">seen last month</a> when a victim of a similar campaign tried to use code he found on GitHub, however, it didn’t work as expected and a couple of hours later he noticed that he was under attack.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcW2PHJOuplI&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcW2PHJOuplI&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FcW2PHJOuplI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eed267f96699b74e6a474ea097efbd32/href">https://medium.com/media/eed267f96699b74e6a474ea097efbd32/href</a></iframe><h4>Attack Hard to Stop</h4><p>The number of such malicious repos is growing rapidly. Even when the malicious user is being detected, reported, and removed, they can simply create a new identity and relaunch its campaign in a few seconds.</p><p>For example, the malicious user “Femelles”, has opened at least 3 different users. “FemellesV11”, “Femelles”, “Femelles01” previously created 6 repositories targeting Discord and TikTok victims, disguised as legit projects; however, all share the same malicious code and receive orders from the same C2 server.</p><h4>The Hassle of Reporting to GitHub</h4><p>Once I gathered the information, I wanted to report the findings to GitHub. To report a malicious user, you need to go to the user’s profile, click on the “Block or report” manually fill abuse report, and explain why it is malicious. When wanting to report only one repo it’s not too much effort to do but when having dozens of projects, it’s a little bit harder and not practical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BTgdjXx-79STi_S-8gQ0JQ.png" /></figure><h3>Conclusion</h3><p>The original WASP Stealer repository created by <a href="https://github.com/loTus04">loTus04</a> was taken down by GitHub two weeks ago. Still, this problem is compounded by the difficulty of stopping these attackers, as they can simply create new identities and continue their campaigns with copies of the WASP Stealer malware. Additionally, reporting these malicious users to GitHub is a tedious and time-consuming process.</p><p>It is important for users searching for code online to be cautious when downloading and executing code from the internet, and to avoid using tools and software from untrustworthy sources.</p><h4>List of GitHub projects</h4><p>Sharing a list of projects containing the WASP Stealer payload</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0169ec7676193f7b1ed2c694fe10f153/href">https://medium.com/media/0169ec7676193f7b1ed2c694fe10f153/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0d073913623" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/hunting-for-malicious-code-the-dangers-of-wasp-stealer-e0d073913623">Hunting for Malicious Code: The Dangers of WASP Stealer</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unverified Commits: Are You Unknowingly Trusting Attackers’ Code?]]></title>
            <link>https://zero.checkmarx.com/unverified-commits-are-you-unknowingly-trusting-attackers-code-c22c56ab308d?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/c22c56ab308d</guid>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[open-source-security]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Sun, 17 Jul 2022 07:08:14 GMT</pubDate>
            <atom:updated>2022-07-17T07:24:19.248Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DZ3cMzaB-JaZaxHx1Rqo7Q.png" /></figure><p><strong><em>An alarming software supply chain attack technique allows threat actors to trick developers into using potentially malicious code.</em></strong></p><p>By leveraging the ability to spoof and forge commits’ metadata on GitHub, an attacker can deceive users and lure them into using poisoned repositories.</p><p>Now might be a good time to check whether you are unknowingly listed as a contributor in a suspicious repository or if you are using code from a user that is not as trustworthy as you think.</p><h3>INTRO</h3><p>Developers looking for an open source project are more likely to choose one that is active and maintained, and more likely to trust long-time developers with a track record of activity in the past few years. GitHub makes it easy to assess this by providing much of this metadata. Unfortunately, some of these data points can be easily forged.</p><h3>DETAILS</h3><p>One of the building blocks of the Git version control system are the commits. <a href="https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits">GitHub’s documentation describes commits</a> as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OjmkU0aSsDRN4lkS_5-KsQ.png" /></figure><p>As this points out, in addition to the data itself, which is the changes to the code, commits also includes metadata. This metadata comes in the form of timestamp and the identity of the creator. The issue is that both can be forged.</p><h3>FALSIFIED COMMIT DATE</h3><p>As mentioned, each commit on GitHub is attached with its own timestamp indicating when it was committed. However, this timestamp can be easily manipulated, meaning we can make commits look as if they were done in a different time other than the moment they were actually committed. To achieve that, all we have to do is alter two environment variables on the local machine with the command “git set”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Bg-3U7y4x8UzcsP6Ric2rg.png" /></figure><p>Committing some changes with these environment variables and pushing them to GitHub will result in the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*AtsPHbkUdSmv2At4GHT2YA.png" /></figure><p>In this example, it’s worth mentioning that the fake timestamp predates the creation of both the user committing it, and the repository it was committed to.</p><h3>WHAT CAN WE DO WITH THIS?</h3><p>Due to this lack of verification for timestamps, a malicious user can appear credible by making it look like they have been extremely active for a very long time.</p><p>A prominent measure of user activity on GitHub is the “activity graph” presented on the user’s profile page. This graph is essentially a heatmap showing the user’s activity through time. Hence, if we are able to fabricate commits with any timestamp we want, we can fill this graph with falsified activities.</p><p>If we go on with our previous example, fake commit in April 2010, we can see that the activity graph is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*ZWgkDs95qMy6Q5rz.png" /></figure><p>At this point, there is nothing preventing us from automatically generating fake commits and fill our graph of 2010 to look however we want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*UiHrHi2MgKoXMhBXz2ECJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*b_LgLRhMkQnZcwtJ7kbCEQ.png" /></figure><p>Since the activity graph displays activity on both public and private repositories, it is impossible to discredit these fake commits, and therefore, this deception technique can be hard to detect as well.</p><h3>ADDING SPOOFED CONTRIBUTORS</h3><p>In a similar manner, it is also possible to spoof the identity of the committer and attribute a commit to a real existing user account on GitHub. For example, we could use the reputation of one of the top contributors on GitHub and push a commit on their behalf.</p><p>Spoofing commits to make it look like they were done by any user we choose is relatively simple:</p><p><strong>1 </strong>— <strong>Find out the user’s email address</strong></p><p>Although GitHub offers ways to prevent a user’s email from being exposed, they require the developer to opt into these features and are mostly not used. In order to find out the user’s email, we can manually follow the below steps or even automate them.</p><ul><li>Looking for an authentic commit of the user following this URL pattern: href=”https://github.com/&lt;username&gt;/&lt;repo_name&gt;/commit/https://github.com/&lt;username&gt;/&lt;repo_name&gt;/commit/&lt;commit_hash&gt;\</li><li>Add the string “.patch” at the end of the URL, like so: href=”https://github.com/&lt;username&gt;/&lt;repo_name&gt;/commit/https://github.com/&lt;username&gt;/&lt;repo_name&gt;/commit/&lt;commit_hash&gt;.patch</li><li>browsing to this address will yield a result similar to the one below which will include the user’s email address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ko4xOZj1QYIlwQWEMOzFBA.png" /></figure><p><strong>2 </strong>— <strong>Set the username and email on git CLI</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*gmP6Tqy5k8r0EygrQNCB5w.png" /></figure><p><strong>3 — Commit changes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*cA0eZMY0OYW84P3thWVQrA.png" /></figure><h3>WHAT CAN WE DO WITH THIS?</h3><p>As shown a few weeks ago by <a href="https://blog.aquasec.com/npm-package-planting">Aqua</a>, the NPM package manager allowed package owners to add to their package any contributor they would like, and enhancing their project reputation and credibility by doing so.</p><p>By spoofing the identity of the committer, this can be done for GitHub repositories as well. To make their project look reliable, attackers can use this technique once or multiple times and populate their repository’s contributors section with known reliable contributors, which in turn, makes the project look trustworthy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*An9PmShjsD3E0G4TSL6geA.png" /></figure><p>What makes this commit spoofing even more alarming is the fact that the user being spoofed isn’t notified and won’t know that their name is being used.</p><h3>VERIFIED COMMITS</h3><p>To mitigate the risk of spoofed contributors described above, GitHub introduced “<a href="https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification">Commit Signature Verification</a>”. This feature allows users to cryptographically sign their commits so their contribution can be checked and verified as their own’s and not of an imposter. However, this feature only verifies the signatures themselves and not their existence. If a commit isn’t signed it won’t be flagged in any way.</p><p>To increase the effectiveness of this feature in alerting of unverified commits, it is possible to enable “<a href="https://docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits">vigilant mode</a>” which will display the verification status of all of your commits, including the ones that were not signed at all. This way, it is easier to spot attempts of this impersonation.</p><h3>CONCLUSION</h3><p>In this blog, Checkmarx SCS team detailed two ways in which threat actors can leverage GitHub’s features to trick developers into using repositories with potentially malicious code.</p><p>The metadata on GitHub helps developers make decisions regarding the usage of certain repositories.</p><p>Hence, fake metadata can mislead developers to use code they would knowingly not have used, and can potentially encompass malicious code.</p><p>The lack of validation of the committer identity and the commit’s timestamp is an issue by itself, but it also enables ill-wished actors to leverage it to gain credibility to their users and repositories.</p><p>GitHub offers a solution for verifying committers’ identity, but it requires active involvement from developers and can be expended to include more protective measures.</p><p>We encourage developers to sign their commits and enable vigilant mode on their user, steps that will help make the ecosystem safe.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c22c56ab308d" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/unverified-commits-are-you-unknowingly-trusting-attackers-code-c22c56ab308d">Unverified Commits: Are You Unknowingly Trusting Attackers’ Code?</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New Technique Used by Attackers in NPM to Avoid Detection]]></title>
            <link>https://zero.checkmarx.com/new-technique-used-by-attackers-in-npm-to-avoid-detection-b246b1041faa?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/b246b1041faa</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[checkmarx]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[open-source-security]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 08:11:41 GMT</pubDate>
            <atom:updated>2022-06-09T08:11:41.092Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*92CBQJGe02GbHcObnxpvEQ.png" /></figure><p>Checkmarx SCS team recently detected several malicious NPM packages using a new evasion technique, enhancing dependency confusion attacks to help malicious packages avoid detection.</p><p>This novel technique tries to avoid being detected by security scanners or AppSec platforms, which sometimes only look at the latest version of a package. It does so by publishing a benign latest version after a burst of malicious versions with high version number.</p><p><strong>Intro</strong></p><p>In the past few weeks, the Checkmarx SCS team has detected 14 malicious packages exhibiting a new behavior. They all have a benign latest version along with multiple malicious versions trying to exfiltrate the machine’s environment variables.</p><p>At first glance, it seems that this kind of technique will defeat the purpose of the attack, as the malicious functionality won’t be installed by end-users using the “npm install” command, which automatically serves the package’s latest version. However, these end-users are not the attackers’ targets.</p><p>It seems the attackers’ intent is to target automatic updates of “patch” and “minor” versions as part of dependency confusion attacks.</p><p><strong>How NPM Versioning Works</strong></p><p>To better understand this nuance, some background on NPM and semantic versioning (semver) is required. Great resource about semver is <a href="https://semver.org/">https://semver.org/</a> and is highly recommended to checkout.</p><p>In a nutshell, a valid semver version is constructed from 3 parts: “major”, “minor”, and “patch”</p><ul><li>Major — Promoted when making significant version changes, usually known breaking changes</li><li>Minor — Promoted when adding new features</li><li>Patch — Promoted when fixing issues, either functionality or security</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*TR1swHhuYMRV2Pl9bf7Ycw.png" /></figure><p>As previously mentioned, using the “npm install” command will install the latest version of the package even if the version number is not the highest among the versions that were released; however, most package installations are performed as a dependency of other packages. These dependencies are specified in the package.json file of the package:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14b753145e1a4017b566f81d6929c193/href">https://medium.com/media/14b753145e1a4017b566f81d6929c193/href</a></iframe><p>The example above shows 4 options for consuming dependencies:</p><p>1. The “dep” package will install precisely the “3.3.3” version of the package and no other (commonly known as version pinning).</p><p>2. The “latest_dep” will install the package’s latest version available.</p><p>3. The “my_dep” includes the Caret sign (^) prior to the version number, in which case NPM will pull “patch” and “minor” updates to the specified version. For instance, version 1.1.0 or 1.0.1 but not 2.0.0.</p><p>4. The “another_dep” includes the Tilda sign (~) prior to the version number, in which case NPM will only pull “patch” updates to the specified version. For instance, version 2.2.1 but not 2.3.0 or 3.0.0.</p><h3>The Technique</h3><p>With this understanding of NPM versioning mechanism and the <a href="https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610">original dependency confusion</a> technique, it is easier to understand the attackers’ intent.</p><p>The attacker releases a burst of versions for each package, almost all of them with low “major” version number and high “minor” and “patch” version numbers. The low “major” component of the version is intended to match the one used by the victim and the high “minor” and “patch” components are made to ensure automatic update in case the dependency version is not pinned to a specific one.</p><p>Finally, the attacker releases one last version with low version number to function as the latest version of the package. This version contains legitimate code that in many cases is even related to the package’s name and seems to be borrowed from a related package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*Mw6VOFi496pQ46wfMC9r2Q.png" /></figure><p>Releasing a package in this manner, as seen in the image above for example, will result in the following outcomes:</p><ul><li>The dependency confusion attack will work — a package dependent on the malicious package without version pinning, such as ‘&lt;malicous_package_name&gt;: “³.1.0”’, will download and install the malicious version “3.758.11”</li><li>A security scanner that scans only the latest version of a package will deem it legitimate.</li></ul><h3>The Attack</h3><p>Aside from using this novel technique, this cluster of 14 malicious packages discover in the last few weeks has several other characteristics in its package:</p><ol><li>The objective of these attacks is to exfiltrate all the victim machine’s environment variables to the attacker via a webhook of the legitimate service “pipedream”:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*GabPu5HnqC0wy-0p-wed4Q.png" /></figure><p>2. Sandbox detection</p><p>Another evasion technique the attacker employed is trying to avoid running on environments suspected as sandboxes. This attempt was implemented by filtering out specific values of environment variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb081892351a358b646056a265cf1a35/href">https://medium.com/media/bb081892351a358b646056a265cf1a35/href</a></iframe><p>Should one of these values appears in the environment variable the code breaks from its malicious functionality and won’t exfiltrate this sensitive information.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ec07af8dedb3970b86364c1c741965f/href">https://medium.com/media/9ec07af8dedb3970b86364c1c741965f/href</a></iframe><p>During the past few weeks, we observed that the “filter” variable grows bigger to include more environment variables, identifying more scanners that the attackers want to avoid, which indicates that they are learning and improving their capabilities.</p><p>3. obfuscation</p><p>Some of the packages in these attacks were also using obfuscation and double obfuscation to hinder researchers from studying the packages’ code.</p><h3>IOC’s</h3><ul><li>bd43527e019ae8efb47eb39bb9313ac5.m.pipedream[.]net</li><li>eol8qq3niztjn4p.m.pipedream[.]net</li><li>eolock03iutvcf7.m.pipedream[.]net</li><li>c2e7a0cfd4f45f811ede4b077ae48dfa.m.pipedream[.]net</li><li>eoxb1lay4m45mms.m.pipedream[.]net</li><li>eof0n35fe1w7o9j.m.pipedream[.]net</li><li>eobn5xcv41edv52.m.pipedream[.]net</li><li>1268384ff816fb002f65302287b639ce.m.pipedream[.]net</li><li>dbky7khu4dz2.m.pipedream[.]net</li><li>eorthox7nn7e4fg.m.pipedream[.]net</li><li>eovsmsusn4979sc.m.pipedream[.]net</li><li>eo9jtk2svcyyaus.m.pipedream[.]net</li><li>eojea1m1h2bi4nw.m.pipedream[.]net</li></ul><h3>Conclusion</h3><p>Dependency confusion attacks continue to flood NPM ecosystem and introduce new techniques to make it harder for defenders to detect and block them. The technique described above demonstrates the advantages of “version pinning” while writing a new package. This approach has its own shortcomings, such as a potentially longer timeframe in which your package could be exploitable by new vulnerabilities, but these should be considered against the alternative of leaving your package susceptible to these kinds of attacks.</p><h3>Packages</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e98614e83552e3cce6011b0a36602b5f/href">https://medium.com/media/e98614e83552e3cce6011b0a36602b5f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b246b1041faa" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/new-technique-used-by-attackers-in-npm-to-avoid-detection-b246b1041faa">New Technique Used by Attackers in NPM to Avoid Detection</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attacker adds evasive technique to their ongoing attacks on NPM]]></title>
            <link>https://zero.checkmarx.com/attacker-adds-evasive-technique-to-their-ongoing-attacks-on-npm-112efde77cd1?source=rss-49a438ea7b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/112efde77cd1</guid>
            <category><![CDATA[red-lili]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <dc:creator><![CDATA[Tal Folkman]]></dc:creator>
            <pubDate>Tue, 26 Apr 2022 13:20:39 GMT</pubDate>
            <atom:updated>2022-04-27T08:00:38.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NafEgRjOgLOJgicHseeQmA.png" /></figure><h3>Intro</h3><p>A few weeks ago, we wrote about a new threat actor we called RED-LILI and described their capabilities, including an in-depth walkthrough of the automated system for publishing malicious NPM packages from automatically created user accounts.</p><p>After our publication, we have seen this same attacker changing their techniques and adding new exfiltration targets, enhancing evasive abilities in an attempt to slow down researchers, and even trying to communicate with the researchers using package names (such as “fuckyouscanner”).</p><h3>RED-LILI Tracker</h3><p>To keep track of RED-LILI as they deliver more <a href="https://www.linkedin.com/signup/cold-join?session_redirect=https%3A%2F%2Fwww%2Elinkedin%2Ecom%2Ffeed%2Fhashtag%2Fmalicious&amp;trk=public_post_share-update_update-text">malicious</a> packages, our research team has launched RED-LILI Tracker (<a href="https://red-lili.info/"><strong>https://red-lili.info</strong></a>) — an <a href="https://www.linkedin.com/signup/cold-join?session_redirect=https%3A%2F%2Fwww%2Elinkedin%2Ecom%2Ffeed%2Fhashtag%2Fopensource&amp;trk=public_post_share-update_update-text">open source</a> mini-project tracking the attacker’s packages over time, while sharing analysis findings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*V4DyZ8-8z4__KJs8Px-Xfg.png" /><figcaption><a href="https://red-lili.info/">https://red-lili.info</a> website</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*vX-yWEUiguE4ANgcA5tuXg.png" /><figcaption><a href="https://red-lili.info/">https://red-lili.info</a> package details</figcaption></figure><p>RED-LILI has continued to publish packages similar to the ones we described in our <a href="https://checkmarx.com/blog/a-beautiful-factory-for-malicious-packages/">previous blog</a>. Since then, they published more than 60 malicious packages from over 50 unique accounts. This automated behavior has subsided recently and cleared the way for several changes. In this blog, we describe our new observations regarding this attacker’s TTPs.</p><h3>Message in a bottle</h3><p>Shortly after our publication, and probably in light of the community’s joint efforts in taking down RED-LILI’s malicious packages, we started seeing that some of the package’s names diverging from the normal pattern and seem to try and relay messages such as:</p><ul><li>dontbelikethat</li><li>notsobrilliant</li><li>dontgothereever</li><li>dontblowthisoff</li><li>heisnotwhatyousee</li><li>helloboy634</li><li>nosoawesome232</li><li>fuckyouscanner</li></ul><h3>Hidden Malicious Code in Text Files</h3><p>Most of these “message in a bottle” packages such as the package “dontgothereever” introduced a new tactic. Instead of the normal preinstall script:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bb1ca6de8ad239e18963e922eebc338/href">https://medium.com/media/4bb1ca6de8ad239e18963e922eebc338/href</a></iframe><p>They move the malicious code to “lib/README.md” or “README.md”, obfuscated it, and run it from the preinstall script as before:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc3534cef4a00efa98a225d1bba55ae9/href">https://medium.com/media/cc3534cef4a00efa98a225d1bba55ae9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*uH5DRdSGoNzXOV6xNFcYIA.png" /><figcaption>obfuscated README.md</figcaption></figure><h3>Stolen Package Description</h3><p>Another experiment with the package description files in RED-LILI’s recent attacks, which we saw in the “wf_storage” package for example, is the attacker stealing another project’s description (<a href="https://github.com/raincatcher-beta/raincatcher-file#supported-storage-engines">https://github.com/raincatcher-beta/raincatcher-file#supported-storage-engines</a>). In an attempt to make the package look more credible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*mMRNf0x0zFxImIfQMpJSug.png" /><figcaption>Stolen project description appears in the malicious package, taken from a random GitHub page</figcaption></figure><h3>eval() &amp; hexilify() a match made in hell</h3><p>Another new obfuscation technique we observed, in “turbine_helper” for example, is a combined usage of the nefarious built-in function “eval()” and the “hexilify()” function written by the package’s developer.</p><p>We saw two different usages of this combination:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b305b0bcef458c56fe6c4837f25667ad/href">https://medium.com/media/b305b0bcef458c56fe6c4837f25667ad/href</a></iframe><p>or:<br><a href="https://gist.github.com/TalFo/a88ccadccd4639d3a991b804dacefd8f">https://gist.github.com/TalFo/a88ccadccd4639d3a991b804dacefd8f</a></p><p>the “hexilify()” function’s main purpose is to decode hexadecimal string into the original code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/117cb8bb6d149b822db84cd01014d2a6/href">https://medium.com/media/117cb8bb6d149b822db84cd01014d2a6/href</a></iframe><p>The hex encoded input to this function varies slightly between the different packages using it, but it looks roughly as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/072cfc5471b63e5ed96b4675e70ce514/href">https://medium.com/media/072cfc5471b63e5ed96b4675e70ce514/href</a></iframe><p>the “hexilify()” is also used in other parts of the code to hinder defenders using static analysis by obfuscating strings that may use to identify this attacker’s activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8d1b44edc38d5e2ae5410421376477d/href">https://medium.com/media/e8d1b44edc38d5e2ae5410421376477d/href</a></iframe><h3>isValid() adjustments</h3><p>In the field of security scanners’ detection, we saw a minor change in the “isValid()” function, which is meant to detect hostnames and usernames belonging to scanners or other machines the attacker want to avoid from running on.</p><p>In the package “bfs-hello-world” for example, we saw a new regex which was made to detect “uuid”s (Universal Unique Identifier) and keep the code from running in these environments. This is possibly because the attacker noticed security scanners with “uuid”s as hostnames and tried to avoid it as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff959c8b147e52906e2a2258da1c1632/href">https://medium.com/media/ff959c8b147e52906e2a2258da1c1632/href</a></iframe><h3>Using ‘child_process’</h3><p>In the package “bfx-hf-func-data”, we saw for the first time the usage of “child_process” from this attacker. Here, the preinstall script still runs the index.js file upon package installation, but this file itself contains different code with include the following snippets:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bfa55d3724585d0de52820d84644bb9/href">https://medium.com/media/0bfa55d3724585d0de52820d84644bb9/href</a></iframe><p>These lines of code spawn a child process that runs the bgService.js file which contains the same hex encoded malicious code we saw before.</p><h3>The Next Attack Wave is Coming</h3><p>Since the previous wave we wrote about in our first blogpost about the attacker, RED-LILI have slowed down and paused the burst automation attacks. They dumped their old domain names and registered a new domain (22timer[.]ga). We believe the next wave is yet to come and that RED-LILI is now exploring and publishing cherry-picked packages, each with different evasion technique.</p><p>However, the attacker’s thumbprint still remains as they re-use similar characteristics (code similarity, same identifying strings, etc.). In recent packages they are doing it while exfiltrating the data they collect to previously unknown addresses on different services, from what we have seen before such as free webhook services, for example, pipedream and requestbin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*cSjKBB8ytean7ILqwyp8VA.png" /><figcaption>old domains</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*JQ4nF3CppTp86MWw1gFhcA.png" /><figcaption>new 22timer.ga domain</figcaption></figure><p>Some of the latest packages published have also showed slight changes in regard to the user accounts publishing them. Up until now we were used to randomly generated usernames publishing a single package per account. However, the recent packages RED-LILI have published were from the usernames “john.moralis” and “leftwing_tenore” with the latter publishing 5 different packages.</p><h3>Conclusion</h3><p>In the past weeks, Checkmarx supply chain security team is tracking the threat actor RED-LILI which is constantly developing its capabilities. In this blog we reported about RED-LILI’s recent changes in code and TTP’s.</p><p>Furthermore, our research team has launched <a href="https://red-lili.info/"><strong>red-lili.info</strong></a> — an <a href="https://www.linkedin.com/signup/cold-join?session_redirect=https%3A%2F%2Fwww%2Elinkedin%2Ecom%2Ffeed%2Fhashtag%2Fopensource&amp;trk=public_post_share-update_update-text">open source</a> mini-project tracking the attacker’s packages over time, while sharing analysis findings.</p><h3>IOC’s</h3><ul><li>eome8ew0yti04in.m.pipedream[.]net</li><li>eo74s7cfv23fror.m.pipedream[.]net</li><li>33mail[.]ga</li><li>636o3.fuzzdb[.]cf</li><li>3faa13bc25347fa55cff.d.requestbin[.]net</li><li>425a2.33mail[.]ga</li><li>22timer[.]ga</li></ul><h3>Packages</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23fb2c8c578d7f431faa69ec9d5a09fd/href">https://medium.com/media/23fb2c8c578d7f431faa69ec9d5a09fd/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=112efde77cd1" width="1" height="1" alt=""><hr><p><a href="https://zero.checkmarx.com/attacker-adds-evasive-technique-to-their-ongoing-attacks-on-npm-112efde77cd1">Attacker adds evasive technique to their ongoing attacks on NPM</a> was originally published in <a href="https://zero.checkmarx.com/">Checkmarx Zero</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>