-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
heap overflow in zipimporter module #70359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
in zipimport.c If compress != 0, then bytes_size = data_size + 1 |
New changeset 01ddd608b85c by Benjamin Peterson in branch '3.4': New changeset 985fc64c60d6 by Benjamin Peterson in branch '2.7': New changeset 10dad6da1b28 by Benjamin Peterson in branch '3.5': New changeset 2df462852464 by Benjamin Peterson in branch 'default': |
in zipimport.c If compress != 0, then bytes_size = data_size + 1 |
I believe this should be applied to Python 3.3 as well, since the same problem (unchecked data_size before adding +1 for bytes_size) exists there too, and is thus a security issue. |
reopening for 3.3.7 evaluation. Georg? |
Here's the patch that I made for FreeBSD's Python 3.3 port. With this patch, on FreeBSD, Python 3.3 built fine and passed the zipimport related unit tests. It's basically the same code from 3.4, 3.5 and 2.7, just placed at appropriate place in the source. |
Any updates on this? We've committed the patch for Python 3.3 as well in FreeBSD. https://svnweb.freebsd.org/ports?view=revision&revision=417019 |
New changeset 5ae8756a1ae0 by Berker Peksag in branch '3.3': New changeset fa006d671f41 by Berker Peksag in branch '3.4': New changeset 2fb148cd95a2 by Berker Peksag in branch '3.5': New changeset aa0c49b8edae by Berker Peksag in branch '3.6': New changeset f3df6b16af7d by Berker Peksag in branch 'default': |
Thanks! |
I think patches put up in http://bugs.python.org/msg258736 is at least not sufficient enough for Python 2.7. Traceback (most recent call last):
File "crash.py", line 25, in <module>
print(importer.get_data(FILE))
IOError: zipimport: can't read data
Segmentation fault (core dumped) but I couldn't reproduce the same with latest 2.7.12:- jchang@qasus-ubun12x64-001:~/Downloads/Python-2.7.12$ python2.7 -V
Python 2.7.12
jchang@qasus-ubun12x64-001:~/Downloads/Python-2.7.12$ python2.7 crash.py
Traceback (most recent call last):
File "crash.py", line 25, in <module>
print(importer.get_data(FILE))
zipimport.ZipImportError: negative data size As we can see issue does happen in 2.7.12 because of following extra check :- if (data_size < 0) {
PyErr_Format(ZipImportError, "negative data size");
return NULL;
} which was merged in https://hg.python.org/cpython/rev/2edbdb79cd6d. I was thinking of backporting the same to Python 2.7.8 as well to completely address this issue. Could you guys confirm if my understanding is correct on this ? Thanks |
Parvesh, we only maintain the latest micro release of a release cycle; for 2.7, that is currently 2.7.12. In other words, once 2.7.9 was released, 2.7.8 was no longer supported by us (although, of course, downstream distributors of Cpython can choose to backport fixes to older releases on their own). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: