Skip to content

Commit df48637

Browse files
bnfohader
authored andcommitted
[SECURITY] Do not disclose encryptionKey via InstallTool
The encryptionKey is a secret that must never be sent within any request, therefore it is now dropped from the editing interface in "Configure Installation-Wide Options". Resolves: #103046 Releases: main, 13.0, 12.4, 11.5 Change-Id: I260a8a2e9af29908543dfe48ac3658d8c45cc440 Security-Bulletin: TYPO3-CORE-SA-2024-004 Security-References: CVE-2024-25119 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82948 Reviewed-by: Oliver Hader <[email protected]> Tested-by: Oliver Hader <[email protected]>
1 parent cafc5af commit df48637

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

typo3/sysext/core/Classes/Configuration/ConfigurationManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ConfigurationManager
6666
'EXTCONF',
6767
'DB',
6868
'SYS/caching/cacheConfigurations',
69+
'SYS/encryptionKey',
6970
'SYS/session',
7071
'EXTENSIONS',
7172
];

typo3/sysext/core/Classes/Log/Writer/FileWriter.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public function __construct(array $options = [])
6666
{
6767
// the parent constructor reads $options and sets them
6868
parent::__construct($options);
69-
if (empty($options['logFile'])) {
69+
if (empty($options['logFile']) &&
70+
// omit logging if TYPO3 has not been configured (avoid creating a guessable filename)
71+
($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] ?? '') !== ''
72+
) {
7073
$this->setLogFile($this->getDefaultLogFileName());
7174
}
7275
}
@@ -76,6 +79,9 @@ public function __construct(array $options = [])
7679
*/
7780
public function __destruct()
7881
{
82+
if ($this->logFile === '') {
83+
return;
84+
}
7985
self::$logFileHandlesCount[$this->logFile]--;
8086
if (self::$logFileHandlesCount[$this->logFile] <= 0) {
8187
$this->closeLogFile();
@@ -130,6 +136,10 @@ public function getLogFile(): string
130136
*/
131137
public function writeLog(LogRecord $record)
132138
{
139+
if ($this->logFile === '') {
140+
return $this;
141+
}
142+
133143
$data = '';
134144
$context = $record->getData();
135145
$message = $record->getMessage();

typo3/sysext/core/Configuration/DefaultConfiguration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
],
8282
'createGroup' => '',
8383
'sitename' => 'TYPO3',
84-
'encryptionKey' => '',
8584
'cookieDomain' => '',
8685
'trustedHostsPattern' => 'SERVER_NAME',
8786
'devIPmask' => '127.0.0.1,::1',

typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ SYS:
7676
sitename:
7777
type: text
7878
description: 'Name of the base-site.'
79-
encryptionKey:
80-
type: text
81-
description: 'This is a "salt" used for various kinds of encryption, CRC checksums and validations. You can enter any rubbish string here but try to keep it secret. You should notice that a change to this value might invalidate temporary information, URLs etc. At least, clear all cache if you change this so any such information can be rebuilt with the new key.'
8279
cookieDomain:
8380
type: text
8481
description: 'Restricts the domain name for FE and BE session cookies. When setting the value to ".domain.com" (replace domain.com with your domain!), login sessions will be shared across subdomains. Alternatively, if you have more than one domain with sub-domains, you can set the value to a regular expression to match against the domain of the HTTP request. The result of the match is used as the domain for the cookie. eg. <code>/\.(example1|example2)\.com$/</code> or <code>/\.(example1\.com)|(example2\.net)$/</code>. Separate domains for FE and BE can be set using <a href="#FE-cookieDomain">$TYPO3_CONF_VARS[''FE''][''cookieDomain'']</a> and <a href="#BE-cookieDomain">$TYPO3_CONF_VARS[''BE''][''cookieDomain'']</a> respectively.'

typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ public static function importFilesDataProvider(): array
667667
*/
668668
public function importFiles(string $typoScript, string $expected): void
669669
{
670+
$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'secret-encryption-key-test';
670671
$resolvedIncludeLines = TypoScriptParser::checkIncludeLines($typoScript);
672+
unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
671673
self::assertEquals($expected, $resolvedIncludeLines);
672674
}
673675

typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Routing/UriBuilderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,20 @@ protected function setUp(): void
3737
{
3838
parent::setUp();
3939
$this->mockExtensionService = $this->createMock(ExtensionService::class);
40+
$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'secret-encryption-key-test';
4041
$this->subject = $this->getAccessibleMock(UriBuilder::class, ['build']);
4142
$this->subject->setRequest($this->createMock(Request::class));
4243
$this->subject->injectConfigurationManager($this->createMock(ConfigurationManagerInterface::class));
4344
$this->subject->injectExtensionService($this->mockExtensionService);
4445
$this->subject->_set('contentObject', $this->createMock(ContentObjectRenderer::class));
4546
}
4647

48+
protected function tearDown(): void
49+
{
50+
unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
51+
parent::tearDown();
52+
}
53+
4754
/**
4855
* @test
4956
*/

0 commit comments

Comments
 (0)