Cross-Ecosystem Vulnerability Analysis for Python Applications
Python packages often bundle third-party native libraries (e.g., OpenSSL), a practice known as vendoring. Identifying vulnerabilities in these libraries is challenging because current scanners either ignore vendored libraries, causing false negatives, or ignore their origin, causing false positives by missing security fixes backported by OS distributions. We show that accurate cross-ecosystem vulnerability analysis requires the exact provenance of each vendored binary: its upstream project and version, and, when applicable, the specific OS package and version. We recover provenance deterministically using two complementary techniques. For binaries copied from OS packages, Python packaging tools rewrite metadata but leave executable code unchanged. We hash this code and match it against historical OS package artifacts. For libraries built from source, we generate per-library dynamic analysis rules that extract the version through callable interfaces exposed by the binary. Across 1,878 Python packages containing vendored native libraries, we resolve exact provenance in 73.4% of cases overall and 94.9% of practically relevant cases involving libraries with at least one CVE. Our approach substantially outperforms provenance-unaware methods in determining whether vendored libraries are affected by known vulnerabilities. We integrate it with existing Python and binary call-graph generators to perform the first cross-ecosystem reachability analysis of vulnerabilities in libraries vendored in Python packages. Analyzing the latest versions of the top 100,000 Python packages against 10 CVEs in native libraries, we identify 39 directly vulnerable packages with 47M+ monthly downloads and 312 transitively affected packages. We disclosed all findings to maintainers; 54 have been fixed to date.