This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
forked from pypa/pip
-
Notifications
You must be signed in to change notification settings - Fork 2
Endless data attacks for pip without TUF
Trishank Karthik Kuppusamy edited this page Sep 21, 2013
·
4 revisions
In an endless data attack, we serve endless data to pip. This will allow an attacker to fill up the victim's hard drive.
First, we set up the virtual environment (for cleanroom testing) and install pip-without-TUF:
$ cd /tmp
$ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
$ tar xvfz virtualenv-1.10.1.tar.gz
$ python virtualenv-1.10.1/virtualenv.py --no-site-packages endless-data-without-tuf
$ source endless-data-without-tuf/bin/activate
Suppose that FooBar 0.1 is actually ~8MB and the web server sends instead FooBar-0.1 twice in a row:
$ pip install FooBar --index-url http://mirror1.poly.edu/test-pip/endless-data/targets/simple/
Downloading/unpacking FooBar
Downloading FooBar-0.1.tar.gz (16.8MB): 16.8MB downloaded
Hash of the package http://mirror1.poly.edu/test-pip/endless-data/targets/packages/source/F/FooBar/FooBar-0.1.tar.gz#md5=f5c4c1fb93ce61f95f48bb2977ebbe42 (from http://mirror1.poly.edu/test-pip/endless-data/targets/simple/FooBar/) (b3acaab80bd85e30305a79fe285b735a) doesn't match the expected hash f5c4c1fb93ce61f95f48bb2977ebbe42!
Cleaning up...
Bad md5 hash for package http://mirror1.poly.edu/test-pip/endless-data/targets/packages/source/F/FooBar/FooBar-0.1.tar.gz#md5=f5c4c1fb93ce61f95f48bb2977ebbe42 (from http://mirror1.poly.edu/test-pip/endless-data/targets/simple/FooBar/)
Storing complete log in /home/trishank/.pip/pip.log
In this small-scale test, pip-without-TUF caught the endless data attack in the form of a bad hash (because the original hash is meant for the 8MB file). However, a true endless data attack would have filled up the victim's hard drive and prevented pip-without-TUF from checking for a bad hash. This situation could have been avoided with the endless data attack protection offered by PyPI-with-TUF.