Skip to content

Commit 9bd9fbd

Browse files
committed
[SECURITY] Avoid unintended persistence
You can disable logging function of femanager or update to the latest version. https://projekte.in2code.de/issues/72776
1 parent 261d0fc commit 9bd9fbd

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

Classes/Controller/EditController.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ public function editAction(): ResponseInterface
5757
public function updateAction(User $user, string $captcha = null)
5858
{
5959
$currentUser = UserUtility::getCurrentUser();
60-
$userValues = $this->request->hasArgument('user') ? $this->request->getArgument('user') : null;
61-
$token = $this->request->hasArgument('token') ? $this->request->getArgument('token') : null;
60+
$userValues = $this->request->getArgument('user') ?? [];
61+
$token = $this->request->getArgument('token') ?? null;
62+
$identity = (int)($userValues['__identity'] ?? 0);
63+
$isSpoof = $this->isSpoof($currentUser, $identity, $token);
64+
65+
if (!$currentUser instanceof User || $identity === 0 || $token === null || $isSpoof) {
66+
$logStatus = $isSpoof ? Log::STATUS_PROFILEUPDATEATTEMPTEDSPOOF : Log::STATUS_PROFILEUPDATEREFUSEDSECURITY;
67+
$logContext = $isSpoof ? $currentUser : $user;
68+
$this->logUtility->log($logStatus, $logContext);
6269

63-
if ($currentUser === null ||
64-
empty($userValues['__identity']) ||
65-
(int)$userValues['__identity'] === null ||
66-
$token === null ||
67-
$this->isSpoof($currentUser, (int)$userValues['__identity'], $token)
68-
) {
69-
$this->logUtility->log(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY, $user);
7070
$this->addFlashMessage(
7171
LocalizationUtility::translateByState(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY),
7272
'',

Classes/Domain/Model/Log.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Log extends AbstractEntity
2323
final public const STATUS_PROFILEUPDATEREQUEST = 204;
2424
final public const STATUS_PROFILEUPDATEREFUSEDSECURITY = 205;
2525
final public const STATUS_PROFILEUPDATEIMAGEDELETE = 206;
26+
final public const STATUS_PROFILEUPDATEATTEMPTEDSPOOF = 207;
2627
final public const STATUS_PROFILEDELETE = 301;
2728
final public const STATUS_INVITATIONPROFILECREATED = 401;
2829
final public const STATUS_INVITATIONPROFILEDELETEDUSER = 402;

Configuration/TCA/tx_femanager_domain_model_log.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@
208208
'tx_femanager_domain_model_log.state.206',
209209
Log::STATUS_PROFILEUPDATEIMAGEDELETE,
210210
],
211+
[
212+
'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:' .
213+
'tx_femanager_domain_model_log.state.207',
214+
Log::STATUS_PROFILEUPDATEATTEMPTEDSPOOF,
215+
],
211216
[
212217
'LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:' .
213218
'tx_femanager_domain_model_log.state.300',

Resources/Private/Language/locallang.xlf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@
162162
<trans-unit id="tx_femanager_domain_model_log.state.206">
163163
<source>Image deleted</source>
164164
</trans-unit>
165+
<trans-unit id="tx_femanager_domain_model_log.state.207">
166+
<source>Attempted to spoof profile</source>
167+
</trans-unit>
165168
<trans-unit id="tx_femanager_domain_model_log.state.300">
166169
<source>Delete</source>
167170
</trans-unit>

Resources/Private/Language/locallang_db.xlf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
<trans-unit id="tx_femanager_domain_model_log.state.206">
175175
<source>Image deleted</source>
176176
</trans-unit>
177+
<trans-unit id="tx_femanager_domain_model_log.state.207">
178+
<source>Attempted to spoof profile</source>
179+
</trans-unit>
177180
<trans-unit id="tx_femanager_domain_model_log.state.300">
178181
<source>Delete</source>
179182
</trans-unit>

0 commit comments

Comments
 (0)