vulnérabilité phpinfo

Vous avez trouvé un bug dans l'application (dernière version stable ou bêta): Décrivez le ici afin que la correction soit intégrée a la prochaine version.
Répondre
ncandelier
Gsup LEVEL 0
Messages : 3
Enregistré le : mer. 11 févr. 2026 07:59

Hello

phpinfo est considéré comme une vulnérabilité d'exposition d'informations
je le désactive systématiquement sur mes serveurs
en le désactivant, l'accès a la section Administration > Sécurité plante : erreur 500.

pour contourner le problème, dans system.php j'ai tweaké le code, mais il serait peut etre intéressant de la prévoir nativement.

Code : Tout sélectionner

//extract php info
ob_start();
// On vérifie si la fonction phpinfo est autorisée sur le serveur
if (function_exists('phpinfo')) {
    phpinfo();
    $phpinfo = array('phpinfo' => array());
    if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
        foreach($matches as $match) {
            if(strlen($match[1])) {
                $phpinfo[$match[1]] = array();
            } elseif(isset($match[3])){
                $ak=array_keys($phpinfo);
                $phpinfo[end($ak)][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
            } else {
                $ak=array_keys($phpinfo);
                $phpinfo[end($ak)][] = $match[2];
            }
        }
    }
} else {
    // Si phpinfo est désactivé, on vide le tampon d'affichage proprement et on initialise un tableau vide
    ob_get_clean(); 
    $phpinfo = array();
}

Répondre