| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hi. I've just merged #6009 instead of this. |
Sorry, something went wrong.
|
@feliperalmeida And thanks for the PR! In the future, when it comes to security-related issues, please could you check and follow the security policy of the project? If there's none available, it's good practice to ask how to disclose. The Pillow one is here: https://github.com/python-pillow/Pillow/security/policy Thanks again! |
Sorry, something went wrong.
|
@hugovk Sure, no problem. The only reason I opened the PR instead of communicating privately was because it was already made "public" in this comment. So I thought raising a PR would help to expedite the fix. Thanks. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
This is an additional fix for CVE-2022-22817 (addressed in #5923). As commented in the original PR, it's still possible to execute arbitrary code via lambda expressions - e.g.: ImageMath.eval("(lambda: exit())()").
Original Fix
The original fix checks all co_names in the compiled expression passed to ImageMath.eval() against builtins names. However, lambda expressions generates anonymous functions and they're not listed in the co_names structure.
Changes in this PR
This PR forbids Lambda expressions being passed to ImageMath.eval() by verifying all functions names in the literals section of the bytecode (co_consts).
Trade-offs
Lambda expressions will no longer be supported in ImageMath.eval(). If such support is desired, all code objects inside co_consts can be verified in the same way as the original fix does (iterating through co_names and verifying against builtins names). Please let me know in the comments I can rewrite this fix.