The vulnerability is a code injection in the HTML encoder of ImageMagick. The analysis of the source code of the HTML encoder (coders/html.c) revealed that the WriteHTMLImage function is responsible for generating the HTML output. Within this function, the href attributes of the <area> tags are constructed using the WriteHtmlEncodedString function to sanitize user-provided filenames. This function performs HTML entity encoding, which is not the correct sanitization method for URL attributes. An attacker can craft a filename that, when HTML-encoded, breaks out of the href attribute and injects malicious JavaScript code. The correct fix would be to use URL encoding for the href attribute values. Although the exact commit for the fix was not identified due to confusing information in the security advisories and release notes, the analysis of the source code strongly points to WriteHTMLImage as the vulnerable function.