[3.4] bpo-32072: Fix issues with binary plists. (GH-4455)#4658
Conversation
* Fixed saving bytearrays. * Identical objects will be saved only once. * Equal references will be load as identical objects. * Added support for saving and loading recursive data structures.. (cherry picked from commit a897aee)
|
I'm not qualified to review this change. Can you find another core dev who is? |
Sorry, something went wrong.
|
@ronaldoussoren is a plistlib expert. His approved changes in 3.7 (#4455). Backports to 3.4 and 3.5 are straightforward. |
Sorry, something went wrong.
|
This appears to be a backport to python 3.4. AFAIK that version is in security-fix-only mode, and this is not a security fix. Other than that I'm fine with backporting. |
Sorry, something went wrong.
|
I think this is a security issue. The bug allows to organize a DDOS attack if the Python application reads Plist files from untrusted sources. For example LLVM Performance Tracking Software can be vulnerable. |
Sorry, something went wrong.
|
I didn't expect that anyone would use plist files like this, they are a crummy interchange format. Sigh... I'm not entirely convinced about the DDOS potential, the recursion should be stopped before the interpreter crashes and anyone reading nested data structures should already deal with unwanted recursion: I could just as easily send a plist file that contains a deeply nested list. An uncompressed XML plist file containing a array nested 1200 deep is still only about 18K bytes long, and should easily nest deep enough to hit the recursion limit. |
Sorry, something went wrong.
|
The problem is not only with the deep recursion, but with consuming a large amount of memory. For XML plist file and for other uncompressed data formats the consumed memory is linear from the size of the file. For binary plist file it can be exponential (O(2^N)). A 200-byte long plist file is enough for producing multiple gigabytes or terrabytes structures in memory. This is different from other common data formats. |
Sorry, something went wrong.
|
For example |
Sorry, something went wrong.
|
That is a good reason to see this as a security issue, memory attacks are much harder to defend against. I'm OK with applying this patch to 3.4. |
Sorry, something went wrong.
It is failed with an advanced optimizer.
Sorry, something went wrong.
43c1307 to
30a581e
Compare
December 26, 2017 11:09
(cherry picked from commit a897aee)
https://bugs.python.org/issue32072