Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a vulnerability where a standard user could disable any user #4367

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/config/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

define('TP_VERSION', '3.1.2');
define("UPGRADE_MIN_DATE", "1727110744");
define('TP_VERSION_MINOR', '115');
define('TP_VERSION_MINOR', '116');
define('TP_TOOL_NAME', 'Teampass');
define('TP_ONE_DAY_SECONDS', 86400);
define('TP_ONE_WEEK_SECONDS', 604800);
Expand Down
10 changes: 5 additions & 5 deletions includes/tables_integrity.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
{
"table_name": "background_tasks_logs",
"structure_hash": "0f61780d6c72a4d7511f84f80ed7f2d85b422716da572609f329252cd730b285"
"structure_hash": "3fe2df7f32ad36a9c9534c4f03079547eda7fcf5bdf02358943f8ead6b55ef27"
},
{
"table_name": "cache",
Expand Down Expand Up @@ -101,7 +101,7 @@
},
{
"table_name": "log_system",
"structure_hash": "a69db25d9f3baa4c2cc7d9daafbb5eca717cddaf636b421b63036f79a1ae6e6e"
"structure_hash": "6332e45543704b860cfaf663e3aa766d250380f8b4102139e09d67f1010ad0b0"
},
{
"table_name": "misc",
Expand Down Expand Up @@ -161,15 +161,15 @@
},
{
"table_name": "sharekeys_fields",
"structure_hash": "b5caa08ad0132073e509b6bbfc1bbf7692a8acf06c239df1f00cd89efd2bb857"
"structure_hash": "7d6abf91104490eb1e5f78e5f8136c5e03ba48a774c0133e704c470453174f60"
},
{
"table_name": "sharekeys_files",
"structure_hash": "bcae5ea668519654581f065b57a1f0991f4f1abd34ad19cf8d7405785eeeb594"
"structure_hash": "c4f4692b26fd4564e981ccf6e95f939557c030851fcd1c3ca3049d1fc1a445f0"
},
{
"table_name": "sharekeys_items",
"structure_hash": "11a176592b7c1756c3488c0bd0fcf5812e2db5b16d12f3683b8be99196aa4504"
"structure_hash": "eacd859ad9395ac91e019834597b0135c64b9dbb8874ff3689e4abdd83e405d6"
},
{
"table_name": "sharekeys_logs",
Expand Down
1 change: 0 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
<link rel="stylesheet" href="plugins/adminlte/css/adminlte.min.css?v=<?php echo TP_VERSION; ?>">
<link rel="stylesheet" href="plugins/pace-progress/themes/corner-indicator.css?v=<?php echo TP_VERSION; ?>" type="text/css" />
<link rel="stylesheet" href="plugins/select2/css/select2.min.css?v=<?php echo TP_VERSION; ?>" type="text/css" />
<!--<link rel="stylesheet" href="plugins/select2/css/select2-bootstrap.min.css?v=<?php echo TP_VERSION; ?>" type="text/css" />-->
<link rel="stylesheet" href="plugins/select2/theme/select2-bootstrap4.min.css?v=<?php echo TP_VERSION; ?>" type="text/css" />
<!-- Theme style -->
<link rel="stylesheet" href="includes/css/teampass.css?v=<?php echo TP_VERSION; ?>">
Expand Down
3 changes: 2 additions & 1 deletion sources/main.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,8 @@ function getStatisticsData(array $SETTINGS): array
);
$counter_items_perso = DB::count();
DB::query(
'SELECT id FROM ' . prefixTable('users') . ''
'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
'OTV', 'TP', 'API'
);
$counter_users = DB::count();
DB::query(
Expand Down
15 changes: 15 additions & 0 deletions sources/users.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,21 @@
break;
}

// Is this user allowed to do this?
if (
(int) $session->get('user-admin') !== 1
&& (int) $session->get('user-can_manage_all_users') !== 1
) {
echo prepareExchangedData(
array(
'error' => true,
'message' => $lang->get('error_not_allowed_to'),
),
'encode'
);
break;
}

// decrypt and retrieve data in JSON format
$dataReceived = prepareExchangedData(
$post_data,
Expand Down