The vulnerability is a Server-Side Request Forgery (SSRF) in the Lemmy server's image fetching functionality. It stems from the file_type query parameter in the /api/v4/image/{filename} endpoint not being properly sanitized before being used to construct a URL for an internal request to the pict-rs image service.
The core of the issue was in the lemmy_routes::images::file_type function, which originally passed the user-provided string without validation. This allowed an attacker to inject arbitrary URL parameters, such as ?proxy=http://internal-service, into the request sent to pict-rs.
The main entry point for this attack is the lemmy_routes::images::get_image function. This function takes the user input and uses helper methods, specifically PictrsGetParams::process_url, to build the final URL. The patch addresses the vulnerability by modifying the PictrsFileType enum to be parsed strictly from a string and adding a default value. The call sites in PictrsGetParams::process_url and ImageProxyParams::process_url were updated to use this new safe parsing, ensuring that any malicious input in the file_type parameter would cause the parsing to fail and fall back to a safe default ('jpg'), effectively neutralizing the SSRF vector.