Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit b7ed457

Browse files
committed
Merge pull request #308 from joomlatools/feature/297-security
Port security fixes from Joomla v3.4.6 - v3.4.8
2 parents e70b1a8 + c0089a1 commit b7ed457

File tree

7 files changed

+267
-689
lines changed

7 files changed

+267
-689
lines changed

app/administrator/components/com_menus/models/item.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,9 +1256,13 @@ public function save($data)
12561256
{
12571257
// Adding self to the association
12581258
$associations = $data['associations'];
1259+
1260+
// Unset any invalid associations
1261+
$associations = Joomla\Utilities\ArrayHelper::toInteger($associations);
1262+
12591263
foreach ($associations as $tag => $id)
12601264
{
1261-
if (empty($id))
1265+
if (!$id)
12621266
{
12631267
unset($associations[$tag]);
12641268
}
@@ -1299,9 +1303,10 @@ public function save($data)
12991303
$key = md5(json_encode($associations));
13001304
$query->clear()
13011305
->insert('#__languages_associations');
1306+
13021307
foreach ($associations as $id)
13031308
{
1304-
$query->values($id . ',' . $db->quote('com_menus.item') . ',' . $db->quote($key));
1309+
$query->values((int) $id . ',' . $db->quote('com_menus.item') . ',' . $db->quote($key));
13051310
}
13061311
$db->setQuery($query);
13071312

app/site/components/com_users/models/reset.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,20 +275,14 @@ public function processResetConfirm($data)
275275
return false;
276276
}
277277

278-
$parts = explode(':', $user->activation);
279-
$crypt = $parts[0];
280-
281-
if (!isset($parts[1]))
278+
if (!$user->activation)
282279
{
283280
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
284281
return false;
285282
}
286283

287-
$salt = $parts[1];
288-
$testcrypt = JUserHelper::getCryptedPassword($data['token'], $salt, 'md5-hex');
289-
290284
// Verify the token
291-
if (!($crypt == $testcrypt))
285+
if (!(JUserHelper::verifyPassword($data['token'], $user->activation)))
292286
{
293287
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
294288

@@ -305,7 +299,7 @@ public function processResetConfirm($data)
305299

306300
// Push the user data into the session.
307301
$app = JFactory::getApplication();
308-
$app->setUserState('com_users.reset.token', $crypt . ':' . $salt);
302+
$app->setUserState('com_users.reset.token', $user->activation);
309303
$app->setUserState('com_users.reset.user', $user->id);
310304

311305
return true;
@@ -412,8 +406,7 @@ public function processResetRequest($data)
412406

413407
// Set the confirmation token.
414408
$token = JApplicationHelper::getHash(JUserHelper::genRandomPassword());
415-
$salt = JUserHelper::getSalt('crypt-md5');
416-
$hashedToken = md5($token . $salt) . ':' . $salt;
409+
$hashedToken = JUserHelper::hashPassword($token);
417410
$user->activation = $hashedToken;
418411

419412
// Save the user to the database.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"joomla/application": "~1.2",
2424
"joomla/registry": "~1.2",
2525
"joomla/string": "~1.0",
26+
"joomla/uri": "~1.0",
2627
"phpmailer/phpmailer": "5.2.9",
2728
"vlucas/phpdotenv": "^2.1.0",
2829
"joomlatools/console": "^1.4.0"

composer.lock

Lines changed: 94 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/libraries/joomla/database/driver/mysqli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function connect()
200200
public function disconnect()
201201
{
202202
// Close the connection.
203-
if ($this->connection)
203+
if ($this->connection instanceof mysqli && $this->connection->stat() !== false)
204204
{
205205
foreach ($this->disconnectHandlers as $h)
206206
{

0 commit comments

Comments
 (0)