
Open source security: The complete guide for 2026
Open source makes up 70-90% of a typical app, so weak maintenance, provenance, or licensing in one package spreads risk widely.
Attackers now target upstream trust: registry-native malware, hijacked maintainer accounts, and AI-accelerated exploit discovery.
Chainguard Containers, Libraries, and OS Packages give teams zero-CVE, source-built artifacts with signed SBOMs and provenance.
Almost every application now includes open-source components. That is a good thing. Developers reuse proven code for basic functions, instead of writing them from scratch. Engineering teams can focus on business-relevant product work and deliver value to users faster. The scale of this is tremendous: according to the Linux Foundation, open source software (OSS) components make up 70-90% of a typical modern application.
This scale is a double-edged sword: on the one hand, open source code can be safer because it is publicly available. Large communities, repeated reviews, and distributed bug and security scans mean more issues can be fixed faster and better. At the same time, a library that is ubiquitously used makes for a very tempting target for malicious misuse.
Log4Shell is a well-known example of a vulnerability hiding in a popular package for years. Malicious npm package updates show that risks can be deliberately planted in OSS and distributed.
What is open source security?
Open source security is a set of practices that ensure public source code issafe enough to ship in a given product. It’s how open-source packages and dependencies become free of malicious code, known vulnerabilities, and unmanaged license risks. It’s a simple-sounding definition that takes a lot of hard work to get right.
Since open-source code is ubiquitous and a good target for attackers, it’s attracting a lot of attention now. It’s common to see a supply chain attack that injects malicious code into known libraries hosted in trusted registries. Teams may download it, build with it, and ship before anyone ever catches on that the package has been subverted and is now hostile.
Open source security programs usually start with visibility. You’ll want to know which OSS software you’re using, where it came from, what its dependencies look like, and which risks they carry. You can then rely on software composition analysis to find malicious new components in your applications. Next, you’ll want to implement vulnerability tracking to map your components and their dependency trees to known Common Vulnerabilities and Exposures (CVEs) and Known Exploited Vulnerabilities (KEVs). And lastly, rely on Malware detection to find code that looks out of place or doesn’t serve an obvious purpose. As an important related benefit, your scans can also perform license checks and inform you about legal and licensing compliance risks.
That’s the traditional “shift-left” model: shift everything as close to the beginning of your software development lifecycle as possible. It’s a required first step, and makes a difference. It depends on finding the problem early enough to address it.
What are some key open source security risks?
We’ve talked about the risks from attackers paying attention to open source and publishing malware, or attempting to subvert it. The main security risks they exploit stem from the structural and passive aspects of how OSS is managed. Some of the ways in which open source communities build, maintain, and reuse software can leave open risks.
Open-source dependency vulnerabilities: useful packages are often composed into useful tools, and using one package means you inherit many others as transitive dependencies. A flaw in any of those dependencies can be inherited by your application. Log4Shell is the obvious example: many teams were exposed through basic software they adopted and forgot about.
Inadequate maintenance: many open source projects are run by volunteers. If a project is in active use and has a large community maintaining it, it can be kept in good shape. If a project is stale, underfunded, or dependent on just one maintainer with a day job, maintenance can lag. That can leave security fixes sitting in limbo, especially since it may not be obvious when a well-maintained package begins to rot.
Lack of provenance and trust verification: just because a registry is public and popular doesn’t mean it requires strong proof of where the artifacts it hosts came from or how they were built. A familiar package name can hide a weak trust model, which might be hijacked, replaced, or have malware injected into it.
License and compliance gaps: these gaps are not an exploit path, but a closely related governance issue. The same lack of inventory management and tracking that hides OSS security risks can also hide license obligations, including requirements for attribution, disclosure, and redistribution. Mature OSS security programs are expected to track both as part of a broader risk management strategy. You’ll need to know both before you can decide if software is safe to ship.
These risks exist structurally. They’re there before anyone takes advantage of them to publish a new malicious package or steal a developer’s authentication token and modify the packages they’re supposed to maintain.
How have threat actors evolved open source attacks?
Threat actors have moved their focus upstream. Not exclusively. They also still follow more traditional patterns and look for undiscovered vulnerabilities to exploit. But they are now focusing most of their efforts on highly leveraged upstream locations, including the places where open source is published, trusted, installed, and updated.
Defensive models have to change to adjust. A traditional CVE can be fixed, and the application of the fix can be tracked. However, malicious packages and code often act before they receive a CVE. A compromised maintainer account can keep hostile code from appearing as malicious for a long time. A lifecycle maintenance script can finish running before anyone notices.
Each of these attacks attempts to abuse a different trust assumption.
Registry-native malware
When malicious code is published directly to a public package repository, it can appear to belong and become registry-native. Malicious packages have appeared in all of the major ecosystem repositories developers depend on, including npm, PyPI, and RubyGems. Our trust in the quality and reputation of well known repositories is abused by these attacks.
Once a poisoned package is installed, your normal development process becomes the delivery mechanism. And the payload doesn’t show up as a bug. So it can move very quickly, and attempt to steal credentials, learn about your internal environment, exfiltrate secrets, or generally spread through CI/CD systems until something more valuable is discovered.
Exploiting identity and trust beyond the code
The people and systems around open source are also vulnerable to attack. Maintainer accounts, release tokens, GitHub Actions, package namespaces, and CI/CD workflows all implicitly trust the people and systems that operate them. This trust is a target for abuse.
Stolen tokens can make malicious releases appear legitimate. A hijacked GitHub tag can redirect build pipelines or replace good builds with malicious code. Social engineering campaigns can attempt to hijack maintainer accounts at scale. Once an official identity is hijacked (say, if someone with a high-impact account at OpenSSF were compromised), all of their work gains legitimacy and trust.
AI-enhanced exploitation and vulnerability bloat
Known weaknesses are much easier to exploit at scale when attackers use AI capabilities. AI doesn’t need to download malware; it can code an exploit from scratch, inside a compromised system. The system can call out to LLMs to perform real-time analysis and reconnaissance much faster. An LLM can make intelligent decisions and perform research on the system it’s running on without having to wait for input from a human supervisor. Pre-installed LLMs can be hijacked to create novel attacks fine-tuned to each environment. Hostile vulnerability scans can be much more automated and performed at a larger scale, with LLM analysis unlocking deeper scan automation. These attacks exploit the trust that our systems will behave in a predictable manner until a human tampers with them.
Many teams depend heavily on unsecured open-source software that’s allowed to drift and lag in its security patching schedule. Every stale dependency is much easier to detect and exploit with AI’s help. The exploitable attack surface is rapidly becoming much larger than most teams realize, and a zero-CVE posture is the first big step towards reducing it.
The hidden danger of lifecycle scripts
Dependency install or build processes often come with packaged shell and other lifecycle scripts. These are meant to perform useful and legitimate setup work. Often, though, they run without oversight and supervision, under elevated permissions. They’ve become a quiet execution path for attackers to run arbitrary code.
A malicious package can look for existing install scripts that may automatically run with elevated permissions and run them to scan, steal credentials, or otherwise corrupt the system before the malicious application is even deployed.
Minimalism matters. Production images should contain exactly and only the things needed for the application to run correctly. They should not carry installation and configuration leftovers as a junk drawer of tools for attackers to misuse.
What are some best practices in open source security?
To guarantee that your open-source dependencies are secure, standardize on a minimal, high-integrity standard. Make sure your code comes from known sources, that your dependencies are up to date, that you have useful build evidence, and that you check your policies before anything ships.
Start from clean starting points, such as automated inventory, frequently updated base images, and guardrails that block unsafe artifacts before production. And, of course, keep scanning your products once they’re in production.
1. Adopt a zero-CVE base image strategy
The easiest, most upstream change you can make is to start from clean base images before adding in any application code. Ruthlessly minimize inherited risk, and make sure any new findings are easy to understand and address.
The traditional model for creating Golden images by starting with a general-purpose image and patching it down is resource-intensive and doesn’t work well. It means your team has to deal with scanner noise before writing a single line of code, which makes it difficult to know when you’re done. A zero-CVE base-image strategy starts with the smallest, cleanest baseline you can find.
2. Automate SBOM generation and attestation
Guarantee that all your builds generate SBOMs by automating the process and checking that it runs without impacting your engineering teams’ experience. Tie them (cryptographically) to the artifact that they describe. A stale SBOM that can be faked doesn’t help much when a new vulnerability lands.
Attestations add the next layer down. They decorate the artifact with metadata that explains how it was built, by whom, with which process, and where it came from. Coupled with SBOMs, they give you evidence that backs the trust you put in the final artifact.
3. Continuous, automated dependency refreshing
Manual updates on a regular quarterly basis are no longer sufficient in a world of AI-powered bad actors. Fortunately, it’s now easier than ever to remain current and updated by default.
You’ll want to build automated dependency refresh processes and make sure they’re fully integrated into your CI pipeline. This helps keep your dependency refresh costs down, and your systems continuously secure and up to date.
4. Policy-as-code as part of key supply chain guardrails
Manually approved standards and scheduled policy reviews are slow, inefficient, and likely to fall behind. You’ll want to convert your security policies into automatically and programmatically enforced gates. Ideally, do this as close as possible to the source work for each system. Make sure you’re gating signed artifacts, library import vulnerability status, up-to-date SBOMs, and valid attestations, as soon as they can reasonably be produced.
Documented guidelines are easy to ignore and hard to retroactively scan for and enforce. Gates throughout the process guarantee you’re building on solid foundations and that those foundations are carried forward through your build without deviation.
What secure open source actually looks like at the build layer
Securing an open-source dependency at build time can be extremely distracting and daunting for your engineering team. They would have to interrupt their product-building flow to analyze provenance, evidence of quality, and so on, often multiple times for each independent bit of work. Done well, secure open source feels more like platform plumbing. You know it's working well because you’re staying secure without having to think about it.
This kind of security starts with the build layer. The highest leverage steps to securing open-source software are the simplest: use verified upstream sources. Build in predictable, validated, and controlled environments. Generate signed SBOMs as part of the build. Produce attestations at build time and double-check they’re valid as each artifact moves through your system. Feed the results through policy checks before each deployment.
This kind of work helps the folks who own your delivery system have a smooth, integrated experience. Scanners have better context to work with, there’s less need for one-off exceptions and ad hoc investigation, and there’s clearer evidence for security teams to work from. Your developers will experience fewer hard-to-reproduce late-stage blockers.
It also helps your teams have more confidence in their build results. Clean scans help prevent accidental CVEs (did anything obviously wrong make it into production?), and attestations confirm there’s been no tampering with your artifacts (has anyone intentionally subverted this artifact?). When combined, you can exponentially improve your confidence in the security of the final result.
The hidden cost of DIY: Why internal golden image programs break down
The typical engineering team’s answer to securing open source is built on the concept of “Golden Images.” These are do-it-yourself programs where you build internally approved base images of operating systems, libraries, or a combination thereof. Approved images that are pre-patched and pre-security-scanned serve as the gold standard for your engineers to use when building. They sound easy to implement, and often can be, at first.
Eventually, though, your Jira board starts to reflect a very different reality. Images can get pretty complex and require daily attention. Packages need updates, and updates flow through nested dependency chains. CVEs need fixes, the fixes may need to be applied in a specific order, and upstream dependencies may not all adopt them at the same time. Scanner results need analysis and reconciliation to remove false positives and prioritize work on actually exploitable issues. Compliance teams need written evidence for their reports. Incident response teams need to immediately identify the blast radius and business impact for ongoing incidents.
Your platform team’s small golden-image project can quickly become a full-featured product, with just one very demanding client (the rest of your engineering team). Supporting this product pulls your team away from customer and business-relevant platform improvements. It’s required work that everyone, likely including your competition, has to perform, so doing it won’t make you stand out to your customers. And since everyone has to perform it, it’s unclear who owns it or is responsible for the collective outcomes. You’ll also want to carefully plan to make sure you can sustain the required work and effort.
How Chainguard enhances open source security
Chainguard provides platform teams with a trusted source for all their open-source needs. Bundled as the Factory OS platform, Chainguard products provide you with artifacts that are built from source, continuously updated, published in trusted repositories, and shipped with all the evidence required to be verifiable as trustworthy.
You’ll be able to change your operating model:
Container images start cleaner: Chainguard Containers give teams minimal, zero-CVE container images. These include signed SBOMs, provenance, and continuous updates. Developers get a better base image without changing their build processes.
Open source dependencies are malware-free: Chainguard Libraries is a malware-free catalog of open source dependencies that allows your team to ship without inheriting someone else’s security compromise. All packages are built in a secure, SLSA L3 build system with full provenance and signed SBOMs to prove supply chain integrity.
OS packages stay current: Chainguard OS Packages give teams secure building blocks for custom images. Platform teams have full control without managing the entire supply chain themselves.
The Factory handles the grind: Chainguard Factory monitors upstream changes, rebuilds artifacts, and helps remediate CVEs at scale. It’s the same kind of robust internal maintenance loop you’d eventually build yourself, ready and present as infrastructure.
Talk to Chainguard to see how your team can reduce open-source risk by using hardened containers, libraries, and OS packages built from source, continuously updated, and shipped with provenance.
Frequently Asked Questions
Related articles