-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
[3.4] bpo-32072: Fix issues with binary plists. (GH-4455) #4658
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
[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? |
@ronaldoussoren is a plistlib expert. His approved changes in 3.7 (#4455). Backports to 3.4 and 3.5 are straightforward. |
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. |
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. |
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. |
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. |
For example |
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. |
It is failed with an advanced optimizer.
43c1307
to
30a581e
Compare
(cherry picked from commit a897aee)
https://bugs.python.org/issue32072