Skip to content
Info disclosure Disclosed report Intermediate CVE-2022-44268

[CVE-2022-44268] Arbitrary Remote Leak via ImageMagick

An outdated ImageMagick version on hackerone.com allowed a crafted PNG to make the image resizing process embed the contents of a local file into the resized output. An attacker could upload such an image and then download the resized version to read local files such as the system password file.

mikkocarreon Follow

Originally disclosed on HackerOne

Critical 9.9 View original
  • Triaged in 5 hours
  • Fixed in 7 hours
  • Paid in 19 days
  • Disclosed after 42 days

Summary by the program

Last month, HackerOne was notified through the HackerOne Bug Bounty Program by a HackerOne community member (“hacker”) that they had been able to exploit a Local File Inclusion vulnerability on hackerone.com.

This vulnerability was present in an outdated version of ImageMagick. Our patch management procedure did not pick up the update, which addresses this vulnerability, due to a missing CVE reference and thereby we pushed the ImageMagic update to the regular update cycle rather than scheduling an immediate update.

After receiving the report, the HackerOne Incident Response team immediately mitigated the vulnerability, which was deployed to production within hours.

The Local File Inclusion vulnerability in ImageMagick can be exploited when uploaded images are being resized. By uploading a malicious PNG image, the resizing process will include the local file as content of the resized image in a hexadecimal representation. MetabaseQ has written a great blog post with more in depth information on the exploit.

Understanding whether this exploit was used outside of this report was a challenge since every image uploaded to our platform could be infected with this malicious payload. These malicious PNGs can be identified by searching for the string “tEXtprofile” in the image’s metadata.

However, on Amazon S3 we store many hundreds of gigabytes of PNG images that could contain this payload. To ensure this vulnerability wasn’t exploited beyond the vulnerability report; we wrote an AWS Lambda function that scanned through all the objects in these S3 buckets and identified any malicious payloads.

The technical investigation concluded that there were no malicious images stored in any of the S3 buckets apart from the image provided by the hacker on the report and images created by the Incident Response team to validate the vulnerability and confirm the patch was successfully rolled out.

In parallel to identifying any malicious use of the vulnerability, we performed a full rotation of application secrets that could theoretically have been accessed by this exploit, to err on the side of caution.

We continue to work on efforts to reduce the blast radius of exploits in ImageMagick.

We know that no organization is immune to software vulnerabilities. HackerOne runs its own bug bounty program to identify and fix any issues like this one, highlighted by @mikkocarreon. We believe in transparency and the vital role it plays in building trust, so any valid vulnerabilities discovered on our program are publicly disclosed once confirmed and resolved. We’d like to thank @mikkocarreon for sending in their report, allowing us to make our platform even more secure.

The report

Summary: HackerOne's image upload is using ImageMagick to convert/resize images and is likely updated. Thus, it's vulnerable to CVE-2022-44268.

Description:

Steps To Reproduce

  1. Navigate to your profile
  2. Edit and upload the attached image (im-lfi.png) as your profile picture
  3. Save changes and download the resized picture
  4. Issue the following command to view the downloaded image's profile data;
Bash
identify -verbose image.png

Then, copy the Raw profile type: and decode it using any tool or using Python like;

Bash
python -c "print(bytes.fromhex('2c2c2c3a2f72756e2f73797374656d643a2f7573722f7362696e2f6e6f6c6f67696e0a').decode())"

I've attached the resized image too which contains the content of /etc/passwd i.e. 86bca9490b71a481329efc85de3a82a98f6c29475f4926fd2b5fc844b96899c0.png

Impact

Arbitrary Remote Leak

The original report as published on HackerOne, by mikkocarreon. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely an outdated ImageMagick release affected by CVE-2022-44268, where a crafted image profile causes a local file to be read and embedded during resizing.

Impact

An attacker could read local files on the server, potentially including application secrets, though the text does not confirm any secrets were actually exposed.

What the attacker needed

A HackerOne account; ability to upload a profile picture

The fix

The vulnerability was mitigated in production within hours and the ImageMagick update was applied, with application secrets rotated as a precaution.

How it was found

  1. Go to your profile page.
  2. Upload the crafted image as your profile picture and save.
  3. Download the resized profile picture.
  4. Inspect the downloaded image's profile data with the identify tool.
  5. Decode the raw profile hex to read the leaked file contents.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you upload a picture, the site often shrinks it using a tool called ImageMagick. A bug in an old version of that tool let a specially crafted image ask the tool to read a file on the server and copy its contents into the new picture, so the uploader could download it and see secrets.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by mikkocarreon

View all

2 more disclosed reports, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.