Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP连SQLSERVER执行xp_cmdshell爆 驱动程序不支持所需的属性 解决办法 #239

Open
ca3tie1 opened this issue Dec 18, 2019 · 0 comments
Labels
🤝Welcome PR 欢迎对该问题提PR

Comments

@ca3tie1
Copy link
Contributor

ca3tie1 commented Dec 18, 2019

使用ASP连接SQLSERVER sa执行xp_cmdshell爆“-2147217887:ODBC 驱动程序不支持所需的属性错误”。
QQ图片20191218170841

原因是在source\core\asp\template\database\sqlserver.js中执行SQL语句代码模板中使用Recordset对象的open方法来执行SQL语句,貌似是该方法不支持请求xp_cmdshell这种过程对象,具体我也不清楚,这里参考了下菜刀的方式解决。

删除102、103行代码
Set Rs=CreateObject("Adodb.Recordset"): Rs.open ""&bd(Request("${arg2}"))&"",Conn,1,1:
更改为Connection对象的Execute方法直接执行
Set Rs=Conn.Execute(""&bd(Request("${arg2}"))&""):
为了防止执行一些返回recordset.Fields为0的命令(如开启xp_cmdshell的命令:EXEC sp_configure "show advanced options",1)后面程序进入死循环的情况,这里还需要加一个if判断:
FN=Rs.Fields.Count-1:的后面添加
If FN=-1 Then: Response.Write HD&"Execute Successfully!"&CO&RN: Else:
再在loop后面添加End If:
20191218214436631

@mozhu1024 mozhu1024 added the 🤝Welcome PR 欢迎对该问题提PR label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤝Welcome PR 欢迎对该问题提PR
Projects
None yet
Development

No branches or pull requests

2 participants