<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abbas</title>
    <description>The latest articles on DEV Community by Abbas (@abbasmithaiwala).</description>
    <link>https://dev.to/abbasmithaiwala</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3602200%2Fc150135d-423c-4c95-9a1e-f5964139d389.jpg</url>
      <title>DEV Community: Abbas</title>
      <link>https://dev.to/abbasmithaiwala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abbasmithaiwala"/>
    <language>en</language>
    <item>
      <title>Sha1-Hulud Attack: What Happened &amp; How to Clean Your GitHub Safely</title>
      <dc:creator>Abbas</dc:creator>
      <pubDate>Wed, 26 Nov 2025 19:38:21 +0000</pubDate>
      <link>https://dev.to/abbasmithaiwala/sha1-hulud-attack-what-happened-how-to-clean-your-github-safely-gea</link>
      <guid>https://dev.to/abbasmithaiwala/sha1-hulud-attack-what-happened-how-to-clean-your-github-safely-gea</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0ioul2udnp5xidcwrv4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0ioul2udnp5xidcwrv4.webp" alt="Github Commit History" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your GitHub repos were suddenly hit with unknown commits, modified README files, or a weird new repo you never created, you may have been affected by &lt;strong&gt;Sha1-Hulud&lt;/strong&gt;, one of the largest &lt;strong&gt;npm supply-chain attacks&lt;/strong&gt; in recent times.&lt;/p&gt;

&lt;p&gt;This is a malware campaign that spread through &lt;strong&gt;compromised npm packages&lt;/strong&gt; and silently impacted thousands of developers.&lt;/p&gt;

&lt;p&gt;This post breaks down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Sha1-Hulud actually is&lt;/li&gt;
&lt;li&gt;What it does to your system and GitHub&lt;/li&gt;
&lt;li&gt;And the exact steps to recover safely&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Is Sha1-Hulud?
&lt;/h2&gt;

&lt;p&gt;Sha1-Hulud is malware distributed through infected npm packages.&lt;/p&gt;

&lt;p&gt;Attackers compromised legitimate package maintainers and &lt;strong&gt;injected malicious install scripts.&lt;/strong&gt; The moment a developer installed one of these packages, the malware executed automatically.&lt;/p&gt;

&lt;p&gt;Once active, it used the developer’s access to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Steal secrets (API keys, tokens, cloud creds)&lt;/li&gt;
&lt;li&gt;Spread further using trusted access&lt;/li&gt;
&lt;li&gt;Push unwanted commits to repos on GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is called a supply-chain attack, attackers don’t hack you, they &lt;strong&gt;hack the tools you trust.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Does After Infection
&lt;/h2&gt;

&lt;p&gt;Most affected devs noticed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new unknown repo suddenly appears&lt;/li&gt;
&lt;li&gt;That repo contains double-encoded Base64 data&lt;/li&gt;
&lt;li&gt;When decoded → it reveals leaked credentials&lt;/li&gt;
&lt;li&gt;README files across many repos get modified&lt;/li&gt;
&lt;li&gt;Commits appear that you never made&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of this originates from malicious packages coming through &lt;strong&gt;npm.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Is So Dangerous
&lt;/h2&gt;

&lt;p&gt;Even if the attack leaves visible clues, the real threat is silent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;APIs&lt;/strong&gt; can be abused&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud bills&lt;/strong&gt; can explode&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Databases&lt;/strong&gt; can be accessed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User data&lt;/strong&gt; can leak&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once a secret is exposed, assume it’s &lt;strong&gt;compromised forever.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The First Thing You Must Do (Do This Immediately)
&lt;/h2&gt;

&lt;p&gt;This is the most critical step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the &lt;strong&gt;new repo&lt;/strong&gt; created by the attack&lt;/li&gt;
&lt;li&gt;Make that repository &lt;strong&gt;PRIVATE&lt;/strong&gt; immediately&lt;/li&gt;
&lt;li&gt;That repo contains all your leaked credentials, only protected by &lt;strong&gt;double Base64 encoding&lt;/strong&gt; (which is NOT real security).&lt;/li&gt;
&lt;li&gt;If it stays public, anyone on the internet can decode your secrets.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Fully Clean the Damage Safely
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Rotate All Exposed Credentials&lt;/strong&gt;&lt;br&gt;
Immediately regenerate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API keys&lt;/li&gt;
&lt;li&gt;Access tokens&lt;/li&gt;
&lt;li&gt;DB passwords&lt;/li&gt;
&lt;li&gt;Cloud provider secrets&lt;/li&gt;
&lt;li&gt;CI/CD tokens
Never reuse old credentials.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Find All Repositories Modified by Sha1-Hulud&lt;/strong&gt;&lt;br&gt;
I created a script that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scans all your repos&lt;/li&gt;
&lt;li&gt;Detects the ones touched by Sha1-Hulud&lt;/li&gt;
&lt;li&gt;Lists all malicious commits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Run it here:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/abbasmithaiwala/repo-manager" rel="noopener noreferrer"&gt;https://github.com/abbasmithaiwala/repo-manager&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Revert the Malicious Commits (With Extreme Caution)&lt;/strong&gt;&lt;br&gt;
From the same repo, use the undo-commit script, which reverts the commits and force pushes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚠️ Important Warning Before Force Push&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Make sure no legit commits were made after the malicious one&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;--force&lt;/code&gt; is destructive&lt;/li&gt;
&lt;li&gt;Always review commit history&lt;/li&gt;
&lt;li&gt;If unsure → create a backup branch first&lt;/li&gt;
&lt;li&gt;One careless force push can permanently delete valid work.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How This Attack Actually Happened
&lt;/h2&gt;

&lt;p&gt;This was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Not&lt;/strong&gt; a GitHub bug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not&lt;/strong&gt; a hash vulnerability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not&lt;/strong&gt; a direct account hack&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It happened because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A trusted npm package was &lt;strong&gt;compromised&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Devs or CI pipelines &lt;strong&gt;installed&lt;/strong&gt; it&lt;/li&gt;
&lt;li&gt;The malicious install script ran &lt;strong&gt;automatically&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Secrets were &lt;strong&gt;harvested and misused&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;This is the modern reality of &lt;strong&gt;open-source supply chain attacks.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Protect Yourself Going Forward
&lt;/h2&gt;

&lt;p&gt;Basic but &lt;strong&gt;powerful habits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never commit:&lt;/li&gt;
&lt;li&gt;.env files&lt;/li&gt;
&lt;li&gt;Private keys&lt;/li&gt;
&lt;li&gt;API tokens&lt;/li&gt;
&lt;li&gt;Use .gitignore properly&lt;/li&gt;
&lt;li&gt;Store secrets only in environment variables&lt;/li&gt;
&lt;li&gt;Enable GitHub secret scanning&lt;/li&gt;
&lt;li&gt;Lock dependency versions&lt;/li&gt;
&lt;li&gt;Avoid blindly running install scripts in CI&lt;/li&gt;
&lt;li&gt;Be cautious with rarely-maintained npm packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security is no longer “advanced stuff”, it’s basic dev hygiene.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Sha1-Hulud showed how one compromised dependency can silently touch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Thousands of machines&lt;/li&gt;
&lt;li&gt;Thousands of repos&lt;/li&gt;
&lt;li&gt;And millions of users downstream&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you were affected:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make the leaked repo private&lt;/li&gt;
&lt;li&gt;Rotate all secrets immediately&lt;/li&gt;
&lt;li&gt;Revert commits safely&lt;/li&gt;
&lt;li&gt;Lock down your workflow&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You didn’t fail, you just gained real-world &lt;strong&gt;security experience.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>github</category>
    </item>
  </channel>
</rss>
