The vulnerability is a CRLF injection weakness in the Laravel framework's mail component. The root cause is the insufficient validation of user-supplied email addresses for carriage return (CR) and line feed (LF) characters. This vulnerability exists at two levels.
First, the validateEmail function within the ValidatesAttributes concern, which backs the 'email' validation rule, did not check for these characters. This allowed a malicious string like "foo\r\nBcc: victim@example.com"@example.com to pass validation.
Second, even if the validation rule was not used, the Illuminate\Mail\Message class methods (to, from, cc, bcc, etc.) and the Illuminate\Mail\Mailables\Address class constructor would accept these un-sanitized strings and use them to construct email headers. When passed to the underlying Symfony Mailer component, the CRLF characters could be interpreted as the end of a header line, allowing an attacker to inject additional headers (like Bcc) or even modify the email body.
The patch addresses this by adding a preg_match check for \r or \n in both the validateEmail function and within the Address class constructor and related methods in the Message class. This ensures that any attempt to use an email address containing line break characters will be rejected, preventing the injection.