Review 10.4 Merged

68419[SECURITY] Mitigate directly accessible file upload in form framework

Oliver Hader CR +2 V +2 Expert +2139 −53 updated 03/16/21, 09:39

Commit message

File handling implementation in `UploadedFileReferenceConverter` of
`ext:form` creates files in `/fileadmin/user_uploads/` whenever some
Extbase controller is (implicitly) dealing with `FileReference` models,
unless particular implementations assign specific type converters or
register type converters having a higher processing priority.

As a side-effect this could lead to by-passing mime-type validators,
allowing to plant cross-site scripting and other malicious binaries
to public accessible `/fileadmin/` storage. PHP files and similar are
blocked since `fileDenyPattern` rule is active in any case.

This change makes the usage of `UploadedFileReferenceConverter` more
specific in the scope of processing contact forms with `ext:form`

* use random folder names for files, `.../form_abcde12345/image.png`
* removes `UploadedFileReferenceConverter` from being used implicitly
  by other Extbase implementations dealing with `FileReference` models

`PseudoFileReference` has been introduced to limit properties being
serialized to `uid` (in case it's a real file reference) or `uidLocal`
(in case it's a transient reference, pointing to a file).

Direct URLs to uploaded files are substituted by `fileDump` eID script
now, enforcing corresponding FAL mime-type and denying the web server
from guessing/interpreting a different mime-type based on file suffix.

A unique form `__session` value has been introduce, serving as seed
to derive for instance mentioned folder names for uploaded files. In
addition to that, form `__state` is only parsed when having been
submitted via expected `FormFrontendController::performAction`.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2

Issues 1

Files 24

Show 4 more files

Review log 34

  1. Oliver Hader uploaded patch set 1 03/16/21, 08:59

  2. Oliver Hader commented on patch set 1 V +2 CR +2 03/16/21, 08:59

    Auto-approved
  3. Oliver Hader merged patch set 2 03/16/21, 08:59

  4. core-ci voted on patch set 1 V +1 03/16/21, 09:39 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1575