Oh, I Found a Security Issue
Published October 26, 2026
This video features Mateusz Bełczowski at DjangoCon Europe 2026 in Athens, Greece.
TALK: What's in your dependencies? Supply chain attacks on Python projects by Mateusz Bełczowski
Your Django project doesn't just depend on Django - it depends on dozens, sometimes hundreds, of packages. Each one is code that runs with your privileges. What happens when one of them gets compromised? This isn't theoretical. Attackers have phished maintainers to publish malicious versions of trusted packages. They've exploited CI/CD pipelines to inject crypto miners into popular libraries. They've registered typosquatted package names and waited for developers to mistype. This talk examines how these attacks work and what you can do about them. We'll look at real incidents to understand the attack patterns - how attackers get in, what payloads they deploy, and how compromises get detected.
More information: https://2026.djangocon.eu/speakers/FLBRLU/
Follow DjangoCon Europe on social media:
*X - https://x.com/DjangoConEurope/
*LinkedIn - https://www.linkedin.com/company/djangocon-europe/
*Mastodon - https://fosstodon.org/@djangoconeurope
#django #djangocon #djangoconeurope #djangoconeurope2026
Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1: So we're going towards the end of the conference, but not the end of the fun, because we have uh the talk from Mateus Belkowski. uh who's uh for many years a python developer. Uh he's also training uh people on python and in other interesting things and he's going to talk about our dependencies. So what's in your dependencies? Let's see. Thanks a lot, Ponteus, and welcome
Speaker 2: Okay, so welcome everyone. Today we are going to talk about supply chain attacks. This topic is not specific to Django or Python ecosystem, but definitely relevant to all of us, no matter if we are just Python uh Django users or uh package maintainers. Uh quick intro, I am Mateusz Bałczowski from Poland. I am a developer who's really passionate about cybersecurity I work at a company named Tofil Software. It's a software house in Poland and I am currently involved in building vulnerability management platform for the Swedish client. This is my second Django con Europe, but first time as a speaker. Okay, so we'll uh today we'll cover uh how supply chain attacks work, uh what attackers typically do with
Speaker 2: an access, uh we'll analyze a few case studies and we'll try to learn from them. And the most important part we will discuss how can we defend from these types of attacks. One thing that we need to realize is that nowadays it's almost impossible to build any real life project without using third-party packages even that Django itself comes with a lot of batteries included, we still need to pull additional dependencies. Perhaps over the last two days We had about many great packages that we need to install to get excess functionalities And whenever we decide to introduce a package to our project,
Speaker 2: we signal that we trust maintainer and the community that this package is safe to use. But we also need to keep in mind that every package that we install can bring the whole chain of transitive dependencies. So even this really simple example that I have on the slide We explicitly requested three packages, so Django request and salary, but as a result total uh ten total dependencies were installed and we need to somehow trust all of them. And attackers know that and they try to inject malicious code into any package in that tree and that's what we called a supply chain attack Quick note, uh on Wednesday uh there
Speaker 2: was a talk about uh reporting vulnerabilities in Django and uh Those are usually CVs are usually accidental mistakes made in the third-party code that carries security implications. Supply chain attacks are about intentional malicious code injection. Okay, so let's put uh ourselves into the shoes of the attacker for a moment and uh let's assume that we try to inject malicious code into dependency tree of the project. On the high level it consists of two steps. We must put malicious code out there, probably on the PIPI, and somehow make people install it. Obviously attackers don't gain anything if the back
Speaker 2: bat package is sitting out there but nobody installs it. So there must be this installation step And we have like a two main ways. One is creating new malicious package. That's much easier because anyone can submit a package to PyPI registry. And the tricky part is how to make people install it. Attackers need to somehow promote it or make it easy to install by accident and popular techniques involve typosquatting or the newer technique slop squatting, also called LRM hallucination. The other way that is a little bit harder to pull off but allows attackers to gain more
Speaker 2: is about compromising existing packages. So if they target some kind of popular package, they automatically achieve the effect of scale because most popular packages can be installed hundreds of thousands or even millions times a day and that's what we will see in the case studies of these real world attacks Okay, but let's quickly understand what attackers can actually do and what can what they what they are actually trying to accomplish Malicious code can run the moment you PP install or the moment you import a package. When it runs, it runs with your permission. So it has access to everything your process does. It can be environment variables, cloud credentials, SSH keys,
Speaker 2: your developer credentials thought in the dot files, just everything. Basically, the most common concept is to steal this and send back somehow to the attacker. But sometimes attackers also decide to to play the long game and for example put some kind of persistent into the system by placing some kind of backdoors. Most uh the other important part is the threat component. So uh nowadays we see that these attacks state to propagate further. So uh if attackers detect that uh the exfiltrated environment has access to PyPI, GitHub or some other service, they they would use that to publish more
Speaker 2: malware so the attack quickly compounds. So let's start by typoscottic examples because it's the easiest one. We as a human make uh Easy mistakes when typing. So for example we've got an example here. We've got the first line is about installing the package called TermColor. But since M and N are close to each other on the keyboard, it's easy to make a typo and install telon color. The first one is a legit package, the second one is actually a malware. that it's no longer available but if we are unfortunate to type this to mistype this uh when it was available uh our machine could be infected
Speaker 2: Another trick that we observed recently is that attackers try to use um The fact that some packages, some tools goes viral really quickly. So for example, there is this DeepSeek LLM that went viral last year in January. So quickly we quickly observed multiple package names that tried to spoof the actual lipsig official package. and uh most likely these malicious packages were written by an LLM. Okay, so let's move to the case studies because I be I believe that's the interesting part. So let's start in December 2024.
Speaker 2: and it's about ultra lytics package. This is quite popular computer vision library. And attackers used clever GitHub Action Exploit to publish uh multiple malicious versions that contained cryptocurrency miner. The attack was active for about 12 hours and came in two waves. I won't go into much details, but the pipeline was basically vulnerable to the uh shell injection. Uh attackers created pull requests with a branch name that allowed them to uh to execute specific payload in the pipeline and that pipeline had access to GitHub secret and allowed to exfiltrate uh PyPI tokens
Speaker 2: So a few lessons for maintainers is that we need to revoke credentials immediately after any breach. So I mentioned that this attack came in two waves and basically the second wave was caused by the fact that exfiltrated PyPI credentials were not rotated. We need to audit our CICD workflow permissions so there was some misconfiguration that allowed external PRs to access the secrets. And uh there is a PyPI feature called trusted publishing that allows to use fmrl tokens instead of persistent ones. So even if uh Attackers uh streak uh token, it's no it's valid only for short time
Speaker 2: Another case study covers num2ad package, obviously as name suggests it's about converting number to words This time it's a little bit more recent because from July last year. And the techn technical it was not technical exploit but fishing that led to the theft of maintainer credentials. The method itself was pretty clever because basically someone sent to the maintainer the uh fake uh PyPI uh email and the domain used was PyPj instead of PyPI But under the hood there was like a real -time transparent proxy that defeated the second factor authentication.
Speaker 2: So basically even though the account was uh had uh 2FA configured it was bypassed using this uh transparent proxy and as a result multiple accounts were compromised but uh and malicious versions were published to the PyPI But since attackers gained access to the only to the PyPI , there were no associated GitHub commits. that looked a little bit suspicio suspicious when someone started analyzing why that was a release in PyPI and nothing in GitHub. This time the demol were targeted Windows and obviously once again there was it was designed to steal credentials. From the outside package appeared to work normally
Speaker 2: and there was even this accept pass uh pattern so even in in case ever anything goes wrong uh the editor was silenced. Many people could potentially install it and even not notice Once again attackers try to propagate the attack through the compromised PyPI credentials. So we observe the same pattern that um attackers uh attacks nowadays try to uh propagate further. Um perhaps the hardware security keys would be a little bit better because uh they they are bound to the specific domain so uh a UbiKey enrolled on pypi. org wouldn't wouldn't work on the fee
Speaker 2: on this uh phishing domain. Uh but also we observe something that worries uh that is worry some a little bit because um uh dependabot started to create uh uh pull requests uh allowing users to upgrade to the malicious version. So The tool that was supposed to help us keep up to date was used against us to create PRs with malicious version. So even though it was detected within two hours still some people were affected. How many people had about light alm attack that happened last month?
Speaker 2: Okay, so not enough. Okay, so this is the most recent case study coming from la last month There's a package called LiteLM. I haven't personally used it, but it appears that it has 3 million downloads per day, so pretty much. And the fun fact is that light LM maintainers were using another tool that is called Trivi. Does anyone know Trivi? It's like a security scanner and this security scanner was compromised the irony and uh as a result uh the It was running in the pipeline
Speaker 2: and attackers were able to fully take over the GitHub account of the maintainer. As a result multiple versions were published and we got a little bit lucky because there was a bug in the malware that caused some noticeable system issues. Users installed it and noticed that there is something uh wrong going on locally and started to investigate that But the the actual exploit was pretty clever. To be honest, I I haven't heard before about. pth uh extension. But apparently there's like like the file that you can put uh in the site packages that gets executed automatically on every Python process startup.
Speaker 2: So it doesn't matter if you import the package or not. you you could install the light LLM and never import it and you will still be affected because of this uh functionality So this is official timeline published by PyPI team. So we see that like it uh it was uh put down but uh uh after about three hours but uh package was still downloaded around uh one one hundred uh one twenty hundred thousand uh times so pretty uh many downloads downloads Once again, it collected everything that uh it was able to. So private SSH keys, cloud credentials, uh
Speaker 2: crypto wallets, files, even shell history, things like that. There was additional logic to that side to achieve persistence for related usage, for example in the inside the Kubernetes clusters. And also the encrypted files were shared were sent to the domain that looked like the it belongs to light LLM. So maybe if we observe the logs it looks like a legit traffic. that also made the detection a little bit harder harder. Okay, so most important most important from this is uh Security tools are also dependencies. So we usually remember about pinning specific uh project dependencies, but for example if we use some kind of
Speaker 2: 3v security scanner inside the pipeline and we don't pin exact version, we can become a victim of attack like this. Credential rotation is uh uh speed is critical because uh there was like a few days gap between the TV 's compromise and uh actual LHLM uh uh incident and obviously the unpinned uh dependencies in CICD are high risk Okay, so let's uh before we talk about uh ways to defend ourselves we can go through some common misconceptions that uh don't always tell the full story. So I'm always hitting that log file protects us.
Speaker 2: So yes, they protect us If we are sure that the dependencies that we locked in are safe, but obviously you need to still install new packages, install update the existing dependencies. If we are unlucky and uh run install or update commands during the time when the package is malicious log files uh wouldn't protect us. Obviously we also have some kind of many packages that are like Dev dependencies that we don't care about that much and they also be targeted in this type of attack A few years ago I was just hitting the advice, it's easy, just don't install suspicious packages and you are fine.
Speaker 2: But now Uh it seems like the attacks are more and more sophisticated, so I don't know AI generated readmes and uh the package the package looks legit so it's not easy to to tell if something is like malicious or not. just looking at the package itself. We run everything in Docker so we are safe. Yeah so it limits the uh the blast radius, limits the damage but uh Obviously credentials can still be exfilcated from the Docker, so it doesn't prevent that. And unfortunately the sad truth is that we can't fully prevent supply chain attacks It's enough to have one weak link in the chain of dependencies to be affected.
Speaker 2: So even if we make sure that like 99 of our dependencies are safe, it's enough to have like one bad dependency to be affected. Yeah, so basically we can either never update any package and get hit by critical CV or update fast and get hit by a supply chain attack. That's the choice that's the choice that we are faced facing, but on the series note uh there must be something in between Yeah, so um most important thing that we can do is to use concept of dependency cooldown. So we don't ever want to be the first to install the fresh version Most of the poly malicious packages are detected within uh
Speaker 2: minutes, hours or days. And this this is like one asterisk here because obviously it's it's about popular packages, but if there is like less popular package The time to detect malicious action can take even longer, so that's something that we need to keep in mind. Unfortunately both uh UV and Peep uh offer dedicated flags uh to filter the package. version by upload time so we can specify that we don't want to the versions that were released like six hours ago, uh two days ago or whatever period of time we select It's important to pin versions and verify hashes, so
Speaker 2: uh having just three requirements takes day is not enough. It's not it's not a proper log file, it doesn't have a checksum, so we need to think about that this. And we need to be extra careful when uh adding or updating the dependencies to new versions we need to scan with tools. I will discuss them in a moment. We need to check project health and review the Pendabot PRs and don't blindly accept them Okay, so I don't want to try to sell you any specific tools as we have seen. Triv was supposed to uh help and uh in the light LM attack it
Speaker 2: it was the cause. So I would like to to you to present the overview of what's available out there and what approaches are taken by different tools so you can decide yourself. which approach is relevant for your use case. Basically there is a concept of pattern scanning so there are tools like GarDoc from Datadoc Company that analyzes the package source code for suspicious patterns like uh base 64 execution network calls in the setup pie uh and it does it before you install There's also install time firewall, so it's uh there is like a database of known malicious uh packages and tools like socket firewall or
Speaker 2: supply chain firewall from Datadoc are checking the package that is about to be installed against these versions. There's a new concept of LLM-based diff analysis, so there are tools that monitor registers for new releases and uh diff against previous versions and use LLM to classify if the uh changes are correct or malicious. Before introducing dependency to our project, we can review the project health. So there's a like an open SSF scorecard that allows us to check if uh project is following security practices uh
Speaker 2: so we can assess that before adopting and there's also this concept of hard and built environments so uh coin container images with extra security tool tools like uh this socket file uh that I mentioned in the second row. Um obviously Pype I is getting uh better so uh they they have introduced a few uh things that are worth mentioning so those short-lived tokens uh there's an option to quarantine the suspicious package there's a concept of att station so approved that a package came from a specific CIA workflow There's also this concept of typosquatting detection, so they try to automatically check when you register a package if it's uh It's trying to
Speaker 2: post as a different package, but yeah. Like every presentation now needs to mention AI so I don't want to be worse, so AI here is like a double double-edged sort. We can treat AI as an as an attack vector. Like I mentioned, slop squatting, so it's a technique where LLMs sometimes hallucinate package names that do not exist. And attackers use that fact and try to register these packages, relying on the fact that if another user prompts their LLM for similar use case, they will be recommended the same package. Fortunately or unfortunately
Speaker 2: more and more projects use AI to automatically trash issues or PRs. So this is like a real-life example of the appearance injection for the uh GitHub issue. That is uh we are using LLMs so there are like uh plug-in cell skills for the LLMs and they can also contain malicious code. Um The sad fact is that some often the AI agents don't just suggest that we need to install some package, they install it automatically. So that's why sometimes we can be affected very quickly. But there are also upsides, so I mentioned the LM
Speaker 2: -based package monitoring. Someone from Elastic built a tool called Supply Chain Monitor. Basically they they've read about light LLM incident and uh decided that maybe that that's approach that it's worth following so they build it in in like a MVP MVP version in a single afternoon And fun fact is that there was a supply chain attack on the Axios, so it's like a popular NPM package That happened like a week after Light LM and it was called Live using this tool. It was tested on the real example and worked, so maybe there's potential there. And obviously we can use
Speaker 2: uh scale advantage so LLMs can analyze more packages per day than human reviewers so maybe that's an approach that it's worth exploring Okay, so at the end of this presentation I wanted to present you with like a few tips when it comes to managing dependencies. Minimize your dependency service so it's easy to add new packets, we often forget to remove them. So let's remember about that. If you need only one specific piece of code from a library, we could consider copying it directly instead of uh bringing the whole dependency. I found the proverb in the Golang community that a little copying is better than a little dependency.
Speaker 2: So maybe that's something worth thinking about And if we need to use the package but it's it seems like unmaintained or maybe we don't fully trust it but there's no alternative uh we could consider forking it so uh at least we have a full control over it Yeah, when it comes to protecting environment, as we have seen, like all of the attacks had this component of credentials exploitation. So like a highest impact single thing would be restricting outbound network traffic for some kind of firewall.
Speaker 2: We need to reduce the blast radius, so uh we don't we don't uh let's don't keep what you what we don't actually need so uh we should use containers as VMs to isolate things. If there are credentials that we are no longer needed needing, we can consider removing them. As a fun exercise, you can just dump your n variables and look for the SSH keys and cloud credentials and all the other tokens and like assess if you really need all these things to be available on your machine And uh we need to investigate anything suspicious, so uh there was this uh unexpected network traffic, high CP usage.
Speaker 2: potentially symptoms of something going wrong so uh we we can't ignore it we need to investigate as soon as possible And last tips are uh I hope that it doesn't happen to any of you, but when you are compromised uh we need to assume the full compromise. It's not enough to just uninstall the package. We need to rotate all credentials accessible, even the cached wheels, because they can re-infect the machine uh we need to check if we were part of the chain so if we had access to any publishing credentials like uh PyPI and PM tokens uh We need to check that and potentially rotate.
Speaker 2: And if possible builds don't patch. So if we have some kind of backups Whether it's like our local environment or the production, we need to uh restore the known good version Okay, so that's all I wanted to show you today. I hope this presentation has increased the awareness about supply chain attacks. And we need to remember that dependencies in our projects can be considered an attack surface, so that's why we need to defend them. Thanks.
Speaker 1: Thank you very much for the great presentation. So we have time for questions. Anybody having questions?
Speaker 3: Hi. So you mentioned these attacks which are broad. How would you defend against a specific attack against one person or one organization? Uh especially from a powerful adversary. Like if I was an insider on PyPI or if I hacked PyPI, I could just I don't know select your IP range and then only give the malicious package to you And you probably wouldn't know it, right? Even with all these uh tools, maybe except for the LLM diff. How would you defend against that?
Speaker 2: Yeah, so uh I mean if someone has big budgets you can't defend defend against that. That's the sad truth. So we need to put trust somewhere. I mean we can be really it depends on the our risk risk level but we can be really paranoid about it maybe uh like uh isolate the machines uh uh run firewalls locally but there's always some kind of because here we talked only about the uh packages themselves but uh if we consider all the other toolings so like system uh packages uh like uh IDs , plugins for the IDs, coding agents,
Speaker 2: plugins for the coding agents. So the surface is really uh huge. So it's Uh we can talk about PyPI and how to make it better, but uh it wouldn't uh be enough even if we make PyPI perfect so no one slips in to the PyPI. There are a lot of other potential vectors that could uh uh cause some damage.
Speaker 3: Okay thanks.
Speaker 1: I think we have time for one more question. Yeah.
Speaker 4: Hello, thank you for this talk. Uh are are there ways that we can limit the effect of of uh uh specific Python packages, for example to prevent certain operations from being executed by setup PY even if the package once installed needs to do them later.
Speaker 2: Uh to be honest, uh yeah so by default it installs as the user that you are currently logged in. So it has the same permissions. I know that in the npm there is like a flag that allows you to disable pre and post install hooks, but I don't know anything in Python for the setup. py So I'm afraid that one thing that you could try is to uh install the package inside the isolated environment like a Docker container. and there there are ways in Docker to like um cut out the network so only you can only like allow this package to be uh installed but any external call would be caught
Speaker 2: by uh the uh Docker firewall so that's an option but uh I don't I'm not aware of any ways to limit that in setup Pi
Speaker 1: Thank you very much for this uh great presentation. Um round of applause please.
April 15 - 17, 2026
Athens, Greece
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026