CVE-2022-31143 (PHP, published 2022-09-14T18:15Z)
Description: value: GLPI stands for Gestionnaire Libre de Parc Informatique and is a Free Asset and IT Management Software package, that provides ITIL Service Desk features, licenses tracking and software auditing. It was found that in affected versions there is an exposure of private information defined in setup of GLPI (like smtp or cas hosts). Note that passwords are not exposed. Users are advised to upgrade to version 10.0.3. There are no known workarounds for this issue.
Severity: nan (CVSS v3 base score: 5.3)
Weakness: CWE-200 \u2014 Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
Repository: https://github.com/glpi-project/glpi
Files changed:
front/login.php
src/Html.php
templates/pages/login_error.html.twig
Commit message: Do not expose CFG_GLPI on anonymous page


Vulnerable code:
   // we have done at least a good login? No, we exit.
    Html::nullHeader("Login", $CFG_GLPI["root_doc"] . '/index.php');
    echo '<div class="center b">' . $auth->getErr() . '<br><br>';
   // Logout whit noAUto to manage auto_login with errors
    echo '<a href="' . $CFG_GLPI["root_doc"] . '/front/logout.php?noAUTO=1' .
         str_replace("?", "&", $REDIRECT) . '">' . __('Log in again') . '</a></div>';
    Html::nullFooter();
         'url_base': '" . (isset($CFG_GLPI['url_base']) ? $CFG_GLPI["url_base"] : '') . "',
         'root_doc': '" . $CFG_GLPI["root_doc"] . "',
      };";
         $cfg_glpi
         $plugins_path
      ");

Fixed code:
use Glpi\Application\View\TemplateRenderer;
    TemplateRenderer::getInstance()->display('pages/login_error.html.twig', [
        'error'     => $auth->getErr(),
        'login_url' => $CFG_GLPI["root_doc"] . '/front/logout.php?noAUTO=1' . str_replace("?", "&", $REDIRECT),
    ]);
        // prevent leak of data for non logged sessions
        $full = $full && (Session::getLoginUserID(true) !== false);

            'url_base': '" . (isset($CFG_GLPI['url_base']) ? $CFG_GLPI["url_base"] : '') . "',
            'root_doc': '" . $CFG_GLPI["root_doc"] . "',
        };";
            $cfg_glpi
            $plugins_path
        ");
{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2022 Teclib' and contributors.
 # @copyright 2003-2014 by the INDEPNET Development Team.
 # @licence   https://www.gnu.org/licenses/gpl-3.0.html
 #
 # ---------------------------------------------------------------------
 #
 # LICENSE
 #
 # This file is part of GLPI.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{% extends 'layout/page_card_notlogged.html.twig' %}

{% block content_block %}
<div class="alert alert-warning">
    <div class="d-flex align-items-center">
        <div class="me-4">
            <i class="ti ti-alert-triangle fa-2x"></i>
        </div>
        <div>
            <h4 class="alert-title">
                {{ __("Error") }}
            </h4>
            <div>
                {{ error }}
            </div>

            <a href="{{ login_url }}" class="btn btn-primary mt-3">
                <i class="ti ti-login"></i>
                <span>{{ __('Log in again') }}</span>
            </a>
        </div>
    </div>
</div>
{% endblock %}