usd-2019-0068 | Chocolatey Python 3 package / 3.8.1

Advisory ID: usd-2019-0068
CVE Number: Not requested
Affected Product: Python 3 package for chocolatey
Affected Version: 3.8.1
Vulnerability Type: Weak File Permissions
Security Risk: High
Vendor URL: https://chocolatey.org/packages/python3/
Vendor Status: Fixed

Introduction

The Chocolatey package manager installs the Python3 package with „modify“ permissions for all users.

Proof of Concept (PoC)

Run following commands as administrator:

Now switch to a low privileged cmd.exe process and check the permissions on the global Python folder:

As one can see, all authenticated Users have the modify (M) permission on the Python folder. This can be exploited
in several ways. Chocolatey adds the python folder also to the default Path for all user accounts. Therefore, dll hijacking
of privileged processes could be possible. The easiest attack is of course to replace the python executable (python.exe) with
another malicious file:

If another user account now runs python a reverse shell spawns at the attackers terminal:

Victim:

Attacker:

Fix

The global Python folder should not be writable by low privileged user accounts.

Timeline

  • 2019-10-22 The vulnerability was found during a pentest on one of our customers
  • 2019-12-17 Report is sent to the maintainer of the package
  • 2020-01-10 Version 3.8.1.20200110 is released that fixes the issue
  • 2020-04-29 Security advisory released

Credits

This security vulnerability was found by Tobias Neitzel of usd AG.

ABOUT usd SECURITY ADVISORIES

In order to protect businesses against hackers and criminals, we always have to keep our skills and knowledge up to date. Thus, security research is just as important for our work as is building up a security community to promote the exchange of knowledge. After all, more security can only be achieved if many individuals take on the task.

Our CST Academy and our usd HeroLab are essential parts of our security mission. We share the knowledge we gain in our practical work and our research through training courses and publications. In this context, the usd HeroLab publishes a series of papers on new vulnerabilities and current security issues.

Always for the sake of our mission: „more security.“

to usd AG


In accordance with usd AG’s Responsible Disclosure Policy, all vendors have been notified of the existence of these vulnerabilities.

Disclaimer

The information provided in this security advisory is provided „as is“ and without warranty of any kind. Details of this security advisory may be updated in order to provide as accurate information as possible.