{"id":"CVE-2026-42309","kind":"vulnerability","aliases":["CVE-2026-42309","GHSA-5xmw-vc9v-4wf2"],"related":[],"title":"Pillow has a heap buffer overflow with nested list coordinates","description":"Pillow is a Python imaging library. From version 11.2.1 to before version 12.2.0, passing nested lists as coordinates to APIs that accept coordinates such as ImagePath.Path, ImageDraw.ImageDraw.polygon and ImageDraw.ImageDraw.line could cause a heap buffer overflow, as nested lists were recursively unpacked beyond the allocated buffer. Coordinate lists are now validated to contain exactly two numeric coordinates. This issue has been patched in version 12.2.0.","summary":"Pillow, the Python imaging library, has a heap buffer overflow when nested lists are passed as coordinates to ImagePath.Path, ImageDraw polygon, or ImageDraw line. An attacker who can supply coordinate data to these calls can corrupt heap memory, which may crash the process or lead to code execution.","severity":"medium","cvss":5.5,"epss":0.001820000004954636,"exploited":false,"exploited_at":null,"products":[{"name":"pillow","fixed":["12.2.0"],"affected":">= 11.2.1, < 12.2.0","ecosystem":"pypi"},{"name":"python pillow","fixed":["12.2.0"],"affected":">= 11.2.1, < 12.2.0","ecosystem":"vendor"}],"ecosystems":["pypi","vendor"],"tags":["cwe-122","image-processing","package","pillow","python"],"not_affected_if":["no-user-controlled-coordinates","version-12.2.0-or-later","version-below-11.2.1"],"how_to_check":"Run pip show pillow and check whether the version is between 11.2.1 and 12.2.0 (exclusive of 12.2.0).\nSearch the codebase for ImagePath.Path, polygon( or line( calls that receive coordinates from user input.","fix":"Upgrade pillow to 12.2.0 or later.","status":"open","published_at":"2026-05-04T20:18:27+00:00","first_seen_at":"2026-10-23T19:11:32+00:00","triaged_at":"2026-10-23T21:48:50+00:00","updated_at":"2026-10-23T23:44:52+00:00","category":"package","confidence":0.7,"triage":{"at":"2026-10-23T21:48:50Z","model":"claude-haiku-5-5","output":{"fix":"Upgrade pillow to 12.2.0 or later.\nunknown","reach":"unknown","impact":"high","summary":"Pillow, the Python imaging library, has a heap buffer overflow when nested lists are passed as coordinates to ImagePath.Path, ImageDraw polygon, or ImageDraw line. An attacker who can supply coordinate data to these calls can corrupt heap memory, which may crash the process or lead to code execution.","category":"package","who_cares":["python","pillow","image-processing"],"confidence":0.7,"needs_auth":"unknown","worst_case":"Heap memory corruption that may crash the process or allow code execution.","analyst_note":"","how_to_check":"Run pip show pillow and check whether the version is between 11.2.1 and 12.2.0 (exclusive of 12.2.0).\nSearch the codebase for ImagePath.Path, polygon( or line( calls that receive coordinates from user input.","needs_analyst":false,"not_affected_if":["version-below-11.2.1","version-12.2.0-or-later","no-user-controlled-coordinates"],"user_interaction":"unknown","needs_special_setup":"no","severity_if_unknown":"medium"},"cost_usd":0.000499,"input_tokens":2897,"output_tokens":419,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-122':26B '-2026':12A,20A '-42309':13A,21A '11.2.1':89C '12.2.0':93C,144C '4wf2':18A '5xmw':16A 'accept':102C 'alloc':124C 'api':100C 'attack':58B 'beyond':122C 'buffer':5A,41B,114C,125C 'call':66B 'caus':111C 'code':79B 'contain':132C 'coordin':10A,49B,62B,98C,103C,126C,136C 'corrupt':68B 'could':110C 'crash':73B 'cve':11A,19A 'cwe':25B 'data':63B 'exact':133C 'execut':80B 'ghsa':15A 'ghsa-5xmw-vc9v-4wf2':14A 'heap':4A,40B,69B,113C 'imag':28B,36B,85C 'image-process':27B 'imagedraw':52B,55B 'imagedraw.imagedraw.line':109C 'imagedraw.imagedraw.polygon':107C 'imagepath.path':51B,106C 'issu':138C 'lead':77B 'librari':37B,86C 'line':56B 'list':9A,45B,96C,118C,127C 'may':72B 'memori':70B 'nest':8A,44B,95C,117C 'numer':135C 'overflow':6A,42B,115C 'packag':30B 'pass':47B,94C 'patch':141C 'pillow':1A,22A,24A,31B,33B,81C 'polygon':53B 'process':29B,75B 'python':23A,32B,35B,84C 'recurs':120C 'suppli':61B 'two':134C 'unpack':121C 'valid':130C 'vc9v':17A 'version':88C,92C,143C","nicknames":[],"mitigations":[],"who_affected":null,"tier":null,"verified":{},"analyst_revisit_at":null,"first_public_at":"2026-05-04T20:18:27+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-5xmw-vc9v-4wf2","url":"https://github.com/advisories/GHSA-5xmw-vc9v-4wf2","severity":"medium","published_at":"2026-05-04T20:18:27+00:00","modified_at":"2026-10-19T19:52:26+00:00","first_seen_at":"2026-10-23T19:11:32+00:00","fetched_at":"2026-10-23T19:11:32+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-42309","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42309","severity":null,"published_at":"2026-05-09T06:16:10+00:00","modified_at":"2026-07-24T21:10:00+00:00","first_seen_at":"2026-10-23T23:44:52+00:00","fetched_at":"2026-10-23T23:44:52+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}