老早就想写这篇文章了,为什么呢?因为至从在灰色轨迹看到COOLCAT的那篇《肉机保护术一》后,天天晚上就睡不着,感觉是不错,但总觉得好象有破绽,苦思苦想后,终于明白了,还是有很多破解方法和保护方法的,哈,但是最近很忙,所以不能写太多,自己好好理解吧,嗯,如果你有SQL基础的话,下面的东西,你会觉得很简单的.......
灰色上的那篇文章上的SQL语句是这样的: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[xp_cmdshell]') and OBJECTPROPERTY(id, N'IsExtendedProc') = 1) exec sp_dropextendedproc N'[dbo].[xp_cmdshell]' GO
破解 先sp_helpextendedproc xp_cmdshell 看看是哪个DLL文件 再EXEC sp_addextendedproc xp_cmdshell ,@dllname ='DLL文件名' 一般SQL2000是通过下面语句恢复 EXEC sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll' 而SQL97是通过下面语句恢复 EXEC sp_addextendedproc xp_cmdshell ,@dllname ='xpsql70.dll' 就这么简单,哈
嗯,所以说,那个灰色上的那篇文章做的保护还是不周到。
再加保护: DROP PROCEDURE sp_addextendedproc if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[xp_cmdshell]') and OBJECTPROPERTY(id, N'IsExtendedProc') = 1) exec sp_dropextendedproc N'[dbo].[xp_cmdshell]' GO
这下只sp_addextendedproc和xp_cmdshell都不能用了,哈,怎么样上面这段可是我自己写的哦,呵呵,比灰色那个安全吧
再破解 sp_addextendedproc只是个存储过程,不能再添加吗,事实上是可以的 下面是添加的语句 create procedure sp_addextendedproc --- 1996/08/30 20:13 @functname nvarchar(517),/* (owner.)name of function to call */ @dllname varchar(255)/* name of DLL containing function */ as /* ** If we're in a transaction, disallow the addition of the ** extended stored procedure. */ set implicit_transactions off if @@trancount > 0 begin raiserror(15002,-1,-1,'sp_addextendedproc') return (1) end /* ** Create the extended procedure mapping. */ dbcc addextendedproc( @functname, @dllname) return (0) -- sp_addextendedproc GO
再加保护
现在的保护已经很难了,想来想去只有去除SA对master的存储过程的控制,也就是说让SA和Guest不能对master的存储过程的控制,做到这点已经是很不容易了,其它方法我想也就没有了,如果再去除create procedure,那我不是教大家去坐牢吗.......?另外我觉得如果不能在MASTER中创建,那能不能在其它的数据库中创建呢?在其它数据库中调用呢?....... 所以想要再加保护很难了...... 再说吧,一个存储过程并不能算什么的,因为一个存储过程只是几个语句的集合,不要这个存储过程我也能用几个语句去实现这个功能啊,因此我想如果想再加保护,只能对这段存储过程中几个一般SQL程序员不常用到的语句做限制了....... create procedure sp_addextendedproc --- 1996/08/30 20:13 @functname nvarchar(517),/* (owner.)name of function to call */ @dllname varchar(255)/* name of DLL containing function */ as /* ** If we're in a transaction, disallow the addition of the ** extended stored procedure. */ set implicit_transactions off if @@trancount > 0 begin raiserror(15002,-1,-1,'sp_addextendedproc') return (1) end /* ** Create the extended procedure mapping. */ dbcc addextendedproc( @functname, @dllname) return (0) -- sp_addextendedproc GO 再看看这段程序,再想了想,限制哪段呢?,嗯,55555.....,我可不是SQL的研发者啊......算了,这条路不通,走其它的.......
想了半个小时,终于想出了SQL最佳的保护术,哈哈
SQL最佳的保护术诞生......
嗯,对了,不是要调用那个*.dll嘛,删了不就得了,嗯,很简单,而且又没有破绽...... 哈哈,只能这样做了,上3389先NET stop mssqlserver,然后把xplog70.dll(SQL97下用xpsql70.dll)删了,哦,对了,还要NET start mssqlserver,要不小心被抓,因为如果连续几个小时SQL停止工作,会对一个大型企业造成很严重的影响,所以要记得打开...... 嗯,这个下去,谁还能破解呢?
|