Dependency Confusion Vulnerability in FastAPI: Malicious Code Injection Risk

fastapi Updated 26 May 2026

Summary

23/05/2026
CRITICAL
No i
Critical
Not published

MAL-2026-4750: Malicious code in fastapi (PyPI). Affects fastapi versions 0.136.3. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

FastAPI is a popular web framework for building APIs with Python 3.6+ based on standard Python type hints. It is designed to be easy to use, fast, and efficient, allowing developers to create robust applications quickly. FastAPI is widely adopted due to its performance and ease of integration with other libraries. However, the recent discovery of a malicious dependency poses a significant risk to users who install the package without awareness of its implications.

Vulnerability Detail

The vulnerability arises from the inclusion of an undocumented dependency 'fastar>=0.9.0' in FastAPI version 0.136.3. This dependency is a typosquat, meaning it is designed to exploit the similarity in naming to trick users into installing malicious code. When users follow the official installation instructions to install FastAPI with the 'standard' option, they inadvertently install 'fastar', which could lead to code execution on their systems. This poses a severe risk, especially for developers and CI environments that rely on FastAPI for their applications.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

pip uninstall fastapi

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can avoid using the 'standard' installation option and manually install only the necessary dependencies for FastAPI. For example, you can install FastAPI without the optional dependencies using:

pip install fastapi

This will prevent the installation of the 'fastar' package.

Conclusion

The discovery of the 'fastar' dependency in FastAPI highlights the importance of being vigilant about package dependencies. Users should take immediate action to update their installations and consider using tools like Vulert to monitor for vulnerabilities in their software.

See every vulnerability recorded for fastapi →

Share this vulnerability

FAQ

'fastar' is an undocumented and potentially malicious package that was added to FastAPI's dependencies, posing a risk of code execution.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If you have installed FastAPI version 0.136.3, you should immediately update to a patched version using 'pip install --upgrade fastapi'.

Using 'fastar' can lead to malicious code execution on your system, potentially compromising your application and data.

Regularly monitor your dependencies for vulnerabilities using tools like Vulert, which can alert you in real-time for open-source vulnerabilities.

Related vulnerabilities

Recent vulnerabilities recorded for fastapi.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

pip uninstall fastapi

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback