CVE-2023-31543
Python vulnerability analysis and mitigation

Overview

A dependency confusion vulnerability was discovered in pipreqs versions 0.3.0 to 0.4.11 (CVE-2023-31543). The vulnerability allows attackers to execute arbitrary code by uploading a crafted PyPI package to the chosen repository server. This critical vulnerability was discovered and reported in April 2023, affecting the package resolution mechanism in pipreqs (GitHub Advisory, NVD).

Technical details

The vulnerability exists in pipreqs' remote dependency resolving mechanism (pipreqs/pipreqs.py#L447-449). The attack exploits mismatches between PyPI package names and their nested Python modules. Three conditions must be met for successful exploitation: 1) The PyPI package name must differ from its exported Python module names, 2) The exported module name to PyPI package name mapping must be absent from pipreqs' hard-coded mapping file, and 3) The exported module name must be available as a package name on PyPI. The vulnerability has a CVSS v3.1 score of 9.8 (CRITICAL) with vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (GitHub Advisory).

Impact

When successfully exploited, this vulnerability allows attackers to execute arbitrary code on machines running Python code with requirements.txt files generated by vulnerable versions of pipreqs. This occurs during dependency installation when the attacker-controlled malicious package is executed (GitHub Advisory).

Mitigation and workarounds

The vulnerability was patched in pipreqs version 0.4.13, released on April 14th, 2023. The fix includes an improved local dependency resolving mechanism that accounts for possible PyPI package and Python module name mismatches. Additionally, when using the remote resolving mechanism, the application now displays a warning message to ensure developers manually review the output (GitHub PR).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-67511CRITICAL9.6
  • PythonPython
  • cai-framework
NoNoDec 11, 2025
CVE-2025-13780CRITICAL9.1
  • PythonPython
  • cpe:2.3:a:pgadmin:pgadmin
NoYesDec 11, 2025
CVE-2025-67644HIGH7.3
  • PythonPython
  • langgraph-checkpoint-sqlite
NoYesDec 11, 2025
CVE-2025-67720MEDIUM6.5
  • PythonPython
  • pyrofork
NoYesDec 11, 2025
CVE-2025-67485MEDIUM5.3
  • PythonPython
  • mad-proxy
NoNoDec 10, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management