Skip to content
RCE Write-up Intermediate

CVE-2025–50817: Python-Future Module Arbitrary Code Execution v

The python-future module imports a file named test.py from the current directory or sys.path when its standard_library package is loaded. An attacker who can write a file named test.py into that location can have arbitrary code executed automatically when the module is imported.

flowireai Follow

Published on medium.com

A critical vulnerability has been discovered in the Python-Future module that allows for arbitrary code execution through the unintended import of a file named test.py. This vulnerability affects python-future version 1.0.0, a widely-used module that helps maintain compatibility of legacy code with the latest Python…

flowireai, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The package contains a bare import of a generic module name, test, which resolves to a file in the current directory or sys.path rather than a package-internal module.

Impact

An attacker who can write a file named test.py into a directory on the import path could achieve arbitrary code execution and possibly persistence, though the text only describes scenarios rather than a demonstrated real-world exploit.

What the attacker needed

Python-future 1.0.0 installed; ability to write test.py to cwd or sys.path

The fix

The project is end-of-support and will not be patched, so users should migrate away from python-future and restrict file-write permissions in directories on sys.path.

How it was found

  1. Install the future module with pip.
  2. Create a script that imports a submodule which loads future/standard_library/__init__.py.
  3. Place a file named test.py in the same directory or somewhere on sys.path.
  4. Run the script; the test.py file is executed automatically.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Python looks for modules in certain folders, including the current one. This library asks for a module called test, so if someone can place a file with that name nearby, Python runs it without warning. That means a file write can turn into code execution.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.