Commit 88757c3
committed
[SECURITY] Enforce file extension and MIME-type consistency
The File Abstraction Layer (FAL) methods `addFile`, `renameFile`,
`replaceFile`, and `addUploadedFile` in `ResourceStorage` have
been enhanced to enforce consistency and security of file data.
Two validations are now applied:
* Only explicitly allowed file extensions are accepted.
These must be configured in the TYPO3 global config under
`$GLOBALS['TYPO3_CONF_VARS']['SYS']`:
- `textfile_ext`
- `mediafile_ext`
- `miscfile_ext`
* A file's MIME-type must match the expected type for its
extension. For example, uploading a PNG image as `image.exe`
is disallowed.
The new configuration property `miscfile_ext` enables defining
extensions that don't logically fit into text or media groups
(e.g. `zip`, `xz`). Any extensions not configured are disallowed
by default.
New feature flags:
* `security.system.enforceAllowedFileExtensions`
- Enforces the file extension allowlist.
- Disabled by default in existing installations.
- Enabled by default in new installations.
* `security.system.enforceFileExtensionMimeTypeConsistency`
- Enforces consistency between file extension and MIME type.
For internal use cases, such as file imports via trusted
low-level system components, one-time exemptions can be declared
using a dedicated trait method.
Resolves: #106240
Releases: main, 13.4, 12.4
Change-Id: Ibfc5b97f65c817d1e2f281f619869a52bfbfef8d
Security-Bulletin: TYPO3-CORE-SA-2025-014
Security-References: CVE-2025-47939
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/89468
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>1 parent 316f5ce commit 88757c3
File tree
20 files changed
+810
-6
lines changed- typo3/sysext
- core
- Classes
- Localization
- Resource
- OnlineMedia/Helpers
- Service
- Utility/File
- Validation
- Configuration
- Documentation/Changelog/12.4.x
- Resources/Private/Language
- Tests/Functional/Resource/Service
- extbase/Classes/Service
- form/Classes/Mvc/Property/TypeConverter
- impexp/Classes
- reports/Classes/Report/Status
20 files changed
+810
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
1070 | 1072 | | |
1071 | 1073 | | |
1072 | 1074 | | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1073 | 1083 | | |
1074 | 1084 | | |
1075 | 1085 | | |
| |||
1182 | 1192 | | |
1183 | 1193 | | |
1184 | 1194 | | |
| 1195 | + | |
1185 | 1196 | | |
1186 | 1197 | | |
1187 | 1198 | | |
| |||
1912 | 1923 | | |
1913 | 1924 | | |
1914 | 1925 | | |
| 1926 | + | |
| 1927 | + | |
1915 | 1928 | | |
1916 | 1929 | | |
1917 | 1930 | | |
| |||
1954 | 1967 | | |
1955 | 1968 | | |
1956 | 1969 | | |
| 1970 | + | |
| 1971 | + | |
1957 | 1972 | | |
1958 | 1973 | | |
1959 | 1974 | | |
| |||
1989 | 2004 | | |
1990 | 2005 | | |
1991 | 2006 | | |
| 2007 | + | |
| 2008 | + | |
1992 | 2009 | | |
1993 | 2010 | | |
1994 | 2011 | | |
| |||
0 commit comments