Issue Bug Closed

#106735Upload of csv files not possible after security update

m s 05/20/25, 16:02 updated 12/02/25, 13:59

Description

After today’s security update to 12.4.31, the upload of simple CSV files no longer works because the MIMI type validation has been tightened.

Error:
Upload of file “test.csv” failed!
Mime-type “text/plain” not allowed for file extension “csv”

Explicitly allowing this MIME type with the following configuration prevents the second of the two error messages, but still does not allow the upload.

‘SYS’ => [
‘FileInfo’ => [
‘fileExtensionToMimeType’ => [
‘csv’ => [‘text/plain’],
],
],
],

The problem is that the standard MIME type of CSV files is not text/csv but text/plain.

Reviews 23

Files 2

History 3144

Show 1419 earlier messages
  1. Oliver Hader commented <span data-processor="relativetime" data-value="2025-05-20T17:44:43+00:00" > 05/20/25, 17:44 </span>

    csv should be added to the mime-type generation script for text/plain.

  2. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-21T07:32:48+00:00" > 05/21/25, 07:32 </span>

    Can you add application/vnd.openxmlformats-officedocument.presentationml.presentation for some MS PowerPoint files to that list?
    I’ve tried to upload a ppsx file (and other PowerPoint file types like potx etc.) with that MIME type, but only pptx is listed for that MIME type in /sysext/core/Classes/Resource/MimeTypeCollection.php

    The translation for the error message isn’t translated to german yet, btw.

  3. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-21T08:46:21+00:00" > 05/21/25, 08:46 </span>

    I also have a .xls file where Windows Explorer says it has a MIME type of “application/vnd.ms-excel”, and yet TYPO3 rejects it with this error message:

    Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xls".
  4. Albrecht Köhnlein commented <span data-processor="relativetime" data-value="2025-05-21T10:01:46+00:00" > 05/21/25, 10:01 </span>

    I have another one:

    *.potx is recognized as application/vnd.openxmlformats-officedocument.presentationml.presentation on my server, while TYPO3 expects application/vnd.openxmlformats-officedocument.presentationml.template

    And one more:

    image/jpeg is missing at least one file extension: *.jfif

    > However, it is still registered as “image/jpeg”

    https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format

  5. Albrecht Köhnlein commented <span data-processor="relativetime" data-value="2025-05-21T10:08:23+00:00" > 05/21/25, 10:08 </span>

    Maybe it would be a solution to allow system maintainer to define additional file extensions for the mime types. And I think SYS/FileInfo/fileExtensionToMimeType does not a good job in this case.

    If I would define

    'SYS' => [
        'FileInfo' => [
            'fileExtensionToMimeType' => [
                'jfif' => 'image/jpeg',
            ],
        ],
    ],

    this would mean, that the mime type of this-is-a-png-with-wrong-file-extension.jfif would be overwritten from correct “image/png” to incorrect “image/jpeg”

  6. Benjamin Franzke commented <span data-processor="relativetime" data-value="2025-05-21T10:14:09+00:00" > 05/21/25, 10:14 </span>

    Florian Seirer wrote in #note-5:
    > Can you add application/vnd.openxmlformats-officedocument.presentationml.presentation for some MS PowerPoint files to that list?
    > I’ve tried to upload a ppsx file (and other PowerPoint file types like potx etc.) with that MIME type, but only pptx is listed for that MIME type in /sysext/core/Classes/Resource/MimeTypeCollection.php

    Hm.. So using an example file – https://github.com/NicolasCARPi/example-files/blob/master/example.ppsx – both PHP detectors report application/vnd.openxmlformats-officedocument.presentationml.presentation, which is actually the pptx mimetype [1].

    php > echo mime_content_type('example.ppsx');
    application/vnd.openxmlformats-officedocument.presentationml.presentation
    php > echo finfo_file(new finfo(), 'example.ppsx', FILEINFO_MIME_TYPE);
    application/vnd.openxmlformats-officedocument.presentationml.presentation

    IANA (which is mime-db’s source) actually defines a separate mime-type for ppsx [2]: application/vnd.openxmlformats-officedocument.presentationml.slideshow

    Given this anomalies I fear we’ll have many more cases like these popping up in the next days :\

    [1] https://www.iana.org/assignments/media-types/application/vnd.openxmlformats-officedocument.presentationml.presentation#:https://www.iana.org/assignments/media-types/application/vnd.openxmlformats-officedocument.presentationml.slideshow#::text=File%20extension(s)%20%3A%20ppsx

  7. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-21T14:14:43+00:00" > 05/21/25, 14:14 </span>

    Another one:

    Mime-type "text/plain" not allowed for file extension "css".
  8. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-21T14:55:43+00:00" > 05/21/25, 14:55 </span>

    Not necessarily related to this bug, but to the new MIME type check in general: As the reports module now goes through every file in /fileadmin/, this could take a while for bigger sites. I barely avoided a timeout on our biggest installation (over 300k files), and got over 1000 MIME type warnings (some of them true, some false. I haven’t checked that yet). This might deserve another ticket, I just wanted to let you know.

  9. Garvin Hicking commented <span data-processor="relativetime" data-value="2025-05-21T19:54:17+00:00" > 05/21/25, 19:54 </span>

    Just to note this here too, failures for me:
    .opml
    .rss
    .ttf

  10. Benjamin Franzke commented <span data-processor="relativetime" data-value="2025-05-23T05:56:48+00:00" > 05/23/25, 05:56 </span>

    Florian Seirer wrote in #note-7:
    > I also have a .xls file where Windows Explorer says it has a MIME type of “application/vnd.ms-excel”, and yet TYPO3 rejects it with this error message:
    > Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xls".

    Can you verify if this is really an *.xls file?
    @*.xls@ upload works for me.
    The mimetype that is reported in your error message looks like you were actually uploading axlsx file.
    Maybe someone renamed xlsx to xls?

  11. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-23T06:42:26+00:00" > 05/23/25, 06:42 </span>

    You’re right. After renaming the file to *.xlsx I was able to upload it. Not sure why anyone would rename .xlsx to .xls, but I have no control over that.
    I guess you can cross that off the list.

    As for the PowerPoint files:
    I just created a PowerPoint presentation in PowerPoint 2024 and saved it in different file types:
    .ppt, .pptx and .pps were uploaded just fine, but .pptm, .potx, .ppsm, .ppsx and .potm were not.

    Mime-type "application/vnd.openxmlformats-officedocument.presentationml.presentation" not allowed for file extension "potx".
    Mime-type "application/vnd.openxmlformats-officedocument.presentationml.presentation" not allowed for file extension "potm".
    Mime-type "application/vnd.openxmlformats-officedocument.presentationml.presentation" not allowed for file extension "ppsm".
    Mime-type "application/vnd.openxmlformats-officedocument.presentationml.presentation" not allowed for file extension "ppsx".
    Mime-type "application/vnd.openxmlformats-officedocument.presentationml.presentation" not allowed for file extension "pptm".
  12. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-23T07:16:34+00:00" > 05/23/25, 07:16 </span>

    Test files created in Word 2024:

    Mime-type "application/vnd.openxmlformats-officedocument.wordprocessingml.document" not allowed for file extension "dotm".
    Mime-type "application/vnd.openxmlformats-officedocument.wordprocessingml.document" not allowed for file extension "docm".
    Mime-type "application/vnd.openxmlformats-officedocument.wordprocessingml.document" not allowed for file extension "dotx".

    Test files created in Excel 2024:

    Mime-type "text/plain" not allowed for file extension "csv".
    Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xlsb".
    Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xlsm".
    Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xltm".
    Mime-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" not allowed for file extension "xltx".
  13. Stefan Terborg commented <span data-processor="relativetime" data-value="2025-05-23T10:05:52+00:00" > 05/23/25, 10:05 </span>

    What about container files like mp4 or ogg? It should be possible to add an array of mime types for a file extension:

    'SYS' => [
        'FileInfo' => [
            'fileExtensionToMimeType' => [
                'mp4' => ['audio/mp4','video/mp4'],
                'ogg' => ['application/ogg','audio/ogg','video/ogg'],
            ],
        ],
    ],
  1. Benjamin Franzke commented <span data-processor="relativetime" data-value="2025-05-26T11:57:54+00:00" > 05/26/25, 11:57 </span>

    Stefan Terborg wrote in #note-18:
    > What about container files like mp4 or ogg? It should be possible to add an array of mime types for a file extension:

    Do you actually face any issues with these files? I could not reproduce..

  2. Stefan Terborg commented <span data-processor="relativetime" data-value="2025-05-26T12:00:55+00:00" > 05/26/25, 12:00 </span>

    Benjamin Franzke wrote in #note-22:
    > Stefan Terborg wrote in #note-18:
    > > What about container files like mp4 or ogg? It should be possible to add an array of mime types for a file extension:
    >
    > Do you actually face any issues with these files? I could not reproduce..

    Yes, when I have an audio mp4 it gets noticed in the report.

  3. Benjamin Franzke commented <span data-processor="relativetime" data-value="2025-05-27T04:47:09+00:00" > 05/27/25, 04:47 </span>

    Stefan Terborg wrote in #note-24:
    > Yes, when I have an audio mp4 it gets noticed in the report.

    In the reports module or while uploading a new mp4 file? Please share (obfuscated) screenshots. We need to know, what mimetype it was detected as.

    Also try to execute file yourfile.mp4 (on a unix/WSL shell) and post the result, to verify it’s actually a valid mp4 container.

  4. Benjamin Franzke commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-05-27T06:15:10+00:00" > 05/27/25, 06:15 </span>

    Applied in changeset commit:b4937aa23c43799041bfbec8cf259cb18d609837.

  5. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-28T09:16:09+00:00" > 05/28/25, 09:16 </span>

    After updating to 12.4.32 and running the upgrade wizard I have found 50 additional MIME type errors in the reports module (consistency status check). Reopen this ticket or create a new one?

  6. Stefan Terborg commented <span data-processor="relativetime" data-value="2025-05-28T12:21:31+00:00" > 05/28/25, 12:21 </span>

    I’m getting error messages with uppercase extensions:

    File extension "PNG" is not in the list of allowed values

    Are lowercase extensions required for files?

  7. Florian Seirer commented <span data-processor="relativetime" data-value="2025-05-28T12:27:41+00:00" > 05/28/25, 12:27 </span>

    Stefan Terborg wrote in #note-36:
    > I’m getting error messages with uppercase extensions:
    >
    > […]
    >
    > Are lowercase extensions required for files?

    This was fixed in #106738. Have you updated to 12.4.32 yet?

  8. Vivek Solanki commented <span data-processor="relativetime" data-value="2025-06-16T07:34:28+00:00" > 06/16/25, 07:34 </span>

    Hello here,

    I’m having the same problem with the CSV file

    Mime-type “text/html” not allowed for file extension “csv”.

    If anyone has a solution related to this, can you please share?

    Thanks!

  9. Albrecht Köhnlein commented <span data-processor="relativetime" data-value="2025-06-16T14:08:37+00:00" > 06/16/25, 14:08 </span>

    A “csv” file which is detected as “text/html” smells like a problem outside of TYPO3. Are you sure, it really is a CSV file and not a HTML file?

    Nevertheless, you could configure TYPO3 to handle “text/html” with file type “csv” as “text/csv”

    $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility']['text/html']['csv'] = 'text/csv';

    https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.4.x/Important-106735-FileMIMETypeCompatiblityMapping.html#important-106735-file-mime-type-compatiblity-mapping