Skip to content

Conversation

@hugbubby
Copy link

No description provided.

@zeropath-ai-staging
Copy link

🟡 Security issue(s) detected below the blocking threshold. Reviewed everything up to a605adb.

View Issue 1

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► admin/include/add_core_tabs.inc.php
    Add Security Center tab
► admin/include/functions.php
    Add security_center to active menu cases
► admin/security_center.php
    Add Security Center page
► admin/themes/default/template/security_center.tpl
    Add Security Center template
► include/constants.php
    Define LOGIN_ATTEMPTS_TABLE
► include/functions_user.inc.php
    Implement login attempt recording
► language/en_UK/admin.lang.php
    Add Security Center translations
► install/db/182-database.php
    Create login_attempts table
► install/piwigo_structure-mysql.sql
    Add login_attempts table structure
Configuration changes ► admin/include/functions_upgrade.php
    Define LOGIN_ATTEMPTS_TABLE
Enhancement ► install.php
    Log user after install
► register.php
    Log user after registration
► ws.php
    Log user after web service authentication

@zeropath-ai-dev
Copy link

Possible security or compliance issues detected. Reviewed everything up to a605adb.

The following issues were found:

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► admin/include/add_core_tabs.inc.php
    Add Security Center tab
► admin/include/functions.php
    Add Security Center to active menu
► admin/security_center.php
    Implement Security Center page
► admin/themes/default/template/security_center.tpl
    Add Security Center template
► include/constants.php
    Define LOGIN_ATTEMPTS_TABLE
► include/functions_user.inc.php
    Implement login attempt recording
► language/en_UK/admin.lang.php
    Add Security Center translations
► register.php
    Record login attempt on registration
► ws.php
    No description available
Configuration changes ► admin/include/functions_upgrade.php
    Define LOGIN_ATTEMPTS_TABLE
► install/db/182-database.php
    Create login_attempts table
► install/piwigo_structure-mysql.sql
    Add login_attempts table structure
Other ► include/functions_user.inc.php
    Add function to get login username
► include/functions_user.inc.php
    Modify log_user to record login attempts
► include/functions_user.inc.php
    Modify auto_login to record origin
► include/functions_user.inc.php
    Modify pwg_login to record login attempts
► include/functions_user.inc.php
    Modify auth_key_login to record login attempts
► install.php
    Modify install to record origin

Comment on lines +1 to +50
<?php
// +-----------------------------------------------------------------------+
// | This file is part of Piwigo. |
// | |
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+

if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}

include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');

if (!isset($_GET['debug_nocheck']) || $_GET['debug_nocheck'] !== '1')
{
check_status(ACCESS_ADMINISTRATOR);
}
$page['debug_nocheck'] = isset($_GET['debug_nocheck']) && $_GET['debug_nocheck'] === '1';

$page['tab'] = 'security_center';
include(PHPWG_ROOT_PATH.'admin/include/user_tabs.inc.php');

$table_exists = false;
$table_check = pwg_query('SHOW TABLES LIKE \''.pwg_db_real_escape_string(LOGIN_ATTEMPTS_TABLE).'\'');
if ($table_check)
{
$table_exists = pwg_db_num_rows($table_check) > 0;
}

$filters = array(
'outcome' => isset($_GET['outcome']) ? $_GET['outcome'] : 'all',
'user_id' => isset($_GET['user_id']) ? $_GET['user_id'] : '',
'username' => isset($_GET['username']) ? trim($_GET['username']) : '',
'ip' => isset($_GET['ip']) ? trim($_GET['ip']) : '',
'date_start' => isset($_GET['date_start']) ? $_GET['date_start'] : '',
'date_end' => isset($_GET['date_end']) ? $_GET['date_end'] : '',
);

check_input_parameter('attempt_page', $_GET, false, PATTERN_ID);
check_input_parameter('user_id', $_GET, false, PATTERN_ID);
check_input_parameter('outcome', $_GET, false, '/^(success|failure|all)$/');
check_input_parameter('date_start', $_GET, false, '/^\d{4}-\d{2}-\d{2}$/');
check_input_parameter('date_end', $_GET, false, '/^\d{4}-\d{2}-\d{2}$/');
check_input_parameter('ip', $_GET, false, '/^[0-9a-fA-F:\\.]{0,50}$/');

$retention_days = isset($_POST['retention_days']) ? max(1, intval($_POST['retention_days'])) : 180;

if ($table_exists && isset($_POST['purge_attempts']))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQL Injection Vulnerability in admin/security_center.php (Severity: LOW)

A SQL injection vulnerability exists in admin/security_center.php, potentially allowing an attacker to execute arbitrary SQL queries and compromise the database. The vulnerability occurs because the application constructs a dynamic WHERE clause using the unsanitized extra_where parameter. This could allow a malicious user to inject SQL code into the query, leading to unauthorized data access or modification.
View details in ZeroPath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants