CVE-2009-5042: Insecure Usage of Temporary Files in python-docutils

docutils Updated 02 Oct 2025

Summary

13/03/2020
Yes i
Critical
9.1

CVE-2009-5042: python-docutils allows insecure usage of temporary files. Affects docutils versions >= 0.5, < 0.6. Fixed in 0.6. How to fix ↓

Also tracked for

The same CVE-2009-5042 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

python-docutils is a Python package that provides tools for parsing and processing plaintext documentation. It is commonly used in various projects to generate documentation in different formats, such as HTML, LaTeX, and XML. This vulnerability in python-docutils allows for insecure usage of temporary files, which can lead to unauthorized access, information disclosure, or remote code execution.

Vulnerability Detail

The vulnerability arises from the insecure handling of temporary files by python-docutils. When processing documentation, the package creates temporary files without proper security measures, such as setting appropriate file permissions or using secure file naming conventions. This can allow an attacker to manipulate or replace these temporary files, potentially leading to the execution of arbitrary code or the exposure of sensitive information.

How To Fix

Minimum fixed version

0.6

This is the first release that contains the fix.

pip install --upgrade "docutils==0.6"

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

Workaround

As a temporary workaround, users can manually modify the code to ensure secure handling of temporary files. This can be achieved by setting appropriate file permissions and using secure file naming conventions. Here is an example of how to securely create a temporary file in Python:

import tempfile

with tempfile.NamedTemporaryFile(delete=False, mode='w', prefix='secure_', dir='/tmp') as temp_file: # Perform operations on the temporary file temp_file.write('Secure temporary file')

This code snippet creates a temporary file with secure permissions and a secure file name prefix.

Conclusion

In summary, python-docutils is vulnerable to insecure usage of temporary files, which can lead to unauthorized access, information disclosure, or remote code execution. It is crucial to update the package to version 0.6 or later to mitigate this vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for docutils →

Share this vulnerability

FAQ

This vulnerability can allow an attacker to manipulate or replace temporary files created by python-docutils. This can lead to unauthorized access, information disclosure, or remote code execution.

At the time of this advisory, there are no known public exploits targeting this specific vulnerability. However, it is important to promptly apply the recommended fixes to mitigate the risk.

No, only versions prior to 0.6 are affected by this vulnerability. It is recommended to update to version 0.6 or later to address the issue.

Yes, this vulnerability can be exploited remotely if an attacker can manipulate or replace the temporary files created by python-docutils. This can be done through various attack vectors, such as tricking a user into opening a specially crafted document.

Yes, the CVSS score for this vulnerability is 9.1, indicating a critical severity level.

How To Fix

Minimum fixed version

0.6

This is the first release that contains the fix.

pip install --upgrade "docutils==0.6"

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