CVE-2021-43806 (published 2021-12-15T20:15Z)

Tuleap is a Libre and Open Source tool for end to end traceability of application and system developments. In affected versions Tuleap does not sanitize properly user settings when constructing the SQL query to browse and search commits in the CVS repositories. A authenticated malicious user with read access to a CVS repository could execute arbitrary SQL queries. Tuleap instances without an active CVS repositories are not impacted. The following versions contain the fix: Tuleap Community Edition 13.2.99.155, Tuleap Enterprise Edition 13.1-7, and Tuleap Enterprise Edition 13.2-6.

Severity: MEDIUM
CVSS v2 base score: 6.5 (AV:N/AC:L/Au:S/C:P/I:P/A:P)
CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/Enalean/tuleap
commit_details: repo_url: https://github.com/Enalean/tuleap
author: Thomas Gerbet
author_date: 2021-12-07 16:05:44+01:00
msg: request #24202: SQL injection via the user settings of the CVS commits browser

Change-Id: I9dff1d45d703de5c9a55182d673a70c21ea53d89
repository: repo_url: https://github.com/Enalean/tuleap
repo_name: Enalean/tuleap
description: Tuleap is an Open Source Suite to improve management of software developments and collaboration. With a single web-based solution, project managers, developers & quality managers can easily build, deploy software projects.
repo_language: PHP
owner: Enalean
file_changes: filename: commit_utils.php
change_type: ModificationType.MODIFY
diff: @@ -713,12 +713,12 @@ function cvs_get_revisions($project, $offset, $chunksz, $_tag = 100, $_branch =
     $query          = "SELECT id from cvs_repositories where cvs_repositories.repository='$cvs_repository' ";
     $rs             = db_query($query);
     $repo_id        = db_result($rs, 0, 0);
-    $repo_id        = $repo_id ? $repo_id : -1;
+    $repo_id        = db_ei($repo_id ? $repo_id : -1);
 
     $select = 'SELECT distinct cvs_checkins.commitid as id, cvs_checkins.commitid as revision, cvs_descs.id as did, cvs_descs.description, cvs_commits.comm_when as c_when, cvs_commits.comm_when as date, cvs_commits.comm_when as f_when, user.user_name as who ';
     $from   = "FROM cvs_descs, cvs_checkins, user, cvs_commits ";
     $where  = "WHERE cvs_checkins.descid=cvs_descs.id " .
-    "AND " . (check_cvs_access(user_getname(), $project->getUnixName(false), '') ? 1 : 0) . " " .
+    "AND " . db_ei(check_cvs_access(user_getname(), $project->getUnixName(false), '') ? 1 : 0) . " " .
         "AND cvs_checkins.commitid=cvs_commits.id " .
         "AND user.user_id=cvs_checkins.whoid " .
             "AND cvs_checkins.repositoryid=" . $repo_id . " " .
@@ -729,7 +729,7 @@ function cvs_get_revisions($project, $offset, $chunksz, $_tag = 100, $_branch =
 
     $limit = '';
     if (! $pv) {
-        $limit = " LIMIT $offset,$chunksz";
+        $limit = " LIMIT " . db_ei($offset) . ',' . db_ei($chunksz);
     }
 
     if (empty($order_by)) {

programming_language: PHP