Catastrophic Backtracking Vulnerability in Python Packages: CVE-2018-1061

python2 Updated 02 Oct 2025

Summary

19/06/2018
N/A
Yes i
High
7.5

ALPINE-CVE-2018-1061: python before versions 2.7.15, 3.4.9, 3.5.6rc1, 3.6.5rc1 and 3.7.0 is vulnerable to catastrophic backtracking in the difflib.IS_LINE_JUNK method. Affects python2 versions < 2.7.15-r0. Fixed in 2.7.15-r0. 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

Python is a widely-used high-level programming language known for its readability and versatility. It supports multiple programming paradigms and is utilized in various applications, from web development to data analysis. The vulnerability identified as CVE-2018-1061 affects specific versions of Python 2 and Python 3, where a flaw in the difflib.IS_LINE_JUNK method can lead to catastrophic backtracking, making the software susceptible to denial of service attacks.

Vulnerability Detail

The vulnerability arises from a flaw in the difflib.IS_LINE_JUNK method present in Python versions prior to 2.7.15, 3.4.9, 3.5.6rc1, 3.6.5rc1, and 3.7.0. This flaw allows an attacker to exploit the method, potentially causing a denial of service by consuming excessive resources. The technical aspect of this vulnerability lies in the way the method processes input, leading to performance degradation under certain conditions.

How To Fix

Minimum fixed version

2.7.15-r0

This is the first release that contains the fix.

sudo apk add --upgrade python2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can limit the input size or sanitize the input to the difflib.IS_LINE_JUNK method to mitigate the risk of denial of service attacks until the package is updated.

Conclusion

CVE-2018-1061 represents a significant vulnerability in Python that can lead to denial of service attacks. Users are strongly encouraged to update their Python packages to the latest patched versions to mitigate this risk. Additionally, employing workarounds can provide temporary relief until updates are applied.

See every vulnerability recorded for python2 →

Share this vulnerability

FAQ

CVE-2018-1061 is a vulnerability in Python that allows for catastrophic backtracking in the difflib.IS_LINE_JUNK method, potentially leading to denial of service.

The vulnerability affects Python versions prior to 2.7.15, 3.4.9, 3.5.6rc1, 3.6.5rc1, and 3.7.0.

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

The CVSS score of CVE-2018-1061 is 7.5, indicating a high severity level.

If immediate updates are not possible, consider implementing input size limitations or sanitization as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for python2.

How To Fix

Minimum fixed version

2.7.15-r0

This is the first release that contains the fix.

sudo apk add --upgrade python2

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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