【发布时间】:2012-10-15 20:13:59
【问题描述】:
尊敬的人...
我在 openSUSE 12.2 上,我的 Apache 服务器运行良好......
我复制了 index.html,其中包含:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Program 7b</title></head>
<body>
<form method="POST" action="http://localhost/cgi-bin/7b.pl">
Please Enter the Command :
<input type="text" name="command" id="command" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
而perl文件如下:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI
$a = new CGI;
$comm = $a->param("command");
print "The Output of the entered command is:<br />";
system($comm);
cgi-bin目录下的两个文件
但我得到了错误:
脚本标题过早结束 在任何浏览器中运行 localhost/cgi-bin/index.html ....
我已经在apache配置中设置了perl文件的执行...
请帮助解决问题...
问候 -SkyKOG
【问题讨论】:
-
在系统调用中执行参数时存在非常严重的安全漏洞。如果有人输入
rm -rf /作为命令参数怎么办?此外,您应该始终使用use strict; use warnings;