J'ai crée une application qui fait l'objet d'un probleme de hack sur securityfocus...
J'utilise une variable de session de la facon suivante :

Sur une page accueil, formulaire d'identification.
Si utilisateur présent dans la base, j'ouvre une variable de session et pointe vers la page administrateur

En haut de cette page, j'ai meme rajouté...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
 if ($_SESSION['nom']<>'Administrateur') { header("Location: ../index.php");}
Avec ce code ci-dessous et qui fonctionne parfaitement, on peut directement arriver à la page administration (en recupérant mais je n'en suis pas sur, un ancien identifiant de session sur le serveur ??)

Comment corriger le problème ?
J'ai tjrs pensé que les variables de session permettaient un accés securisé..

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function sockxp($host,$path,$prox,$wanted) 
{ 
        $hope = !empty($prox) ? $prox : $host.':80'; 
        preg_match("/^(\S*):([0-9]+){1,5}/",$hope,$hosta); 
        $hosh = $hosta[1]; 
        $hosp = $hosta[2]; 
 
        $recv = ''; 
        $meth = $_SERVER['REQUEST_METHOD']; 
        if(empty($hosh) || empty($hosp)) exit(1); 
 
 
        if(!$sock = fsockopen($hosh,$hosp)) exit(1); 
        $dat = $meth." http://".$host; 
 
        if($meth === "POST") $dat .= "/".str_replace("administration//","",$wanted); 
        else $dat .= $path.$wanted; 
 
        $dat .= " HTTP/1.1\r\n"; 
        $dat .= "Host: $host\r\n"; 
        $dat .= "Connection: Close\r\n"; 
 
        if($meth === "POST") { 
                $postdata = get_postdata(); 
                $dat .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
                $dat .= "Content-Length: ".strlen($postdata)."\r\n\r\n"; 
                $dat .= $postdata."\r\n\r\n"; 
        } else { 
                $dat .= "\r\n"; 
        } 
 
 
        fputs($sock,$dat); 
        while(!feof($sock)) $recv .= fgets($sock); 
        fclose($sock); 
 
 
        return html_replace($recv); 
} 
 
 
function html_replace($htmlc) 
{ 
        global $host,$path,$prox; 
        $iniv = $_SERVER['PHP_SELF']."?host=$host&path=$path&prox=$prox&wanted="; 
        $newc = str_replace("action=\"","action=\"$iniv",$htmlc); 
        $newc = str_replace("=\"..","=\"http://${host}${path}administration/..",$newc); 
        $newc = str_replace("a href=\"","a href=\"$iniv",$newc); 
        $newc = str_replace("MM_goToURL('parent','","MM_goToURL('parent','$iniv",$newc); 
        $newc = explode("\n",$newc); 
        for($i=0;$i<count($newc);$i++) { 
                if(preg_match("/DOCTYPE/",$newc[$i])) $v=1; 
                if($v) $nnewc .= $newc[$i]; 
        } 
        return $nnewc; 
} 
 
 
function get_postdata() 
{ 
        $postdata = ''; 
        foreach($_POST as $key => $value) { 
                $postdata .= $key."=".$value."&"; 
        } 
        return $postdata; 
} 
?>