科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道SQL Server和MySQL的安全性分析

SQL Server和MySQL的安全性分析

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

大型网站一般使用Oracle或DB2,而中小型网站大多数使用更加灵活小巧的SQL Server数据库或者MySQL数据库。

作者:ecitnet 来源:IT专家网 2007年11月20日

关键字: SQL Server

  • 评论
  • 分享微博
  • 分享邮件

在本页阅读全文(共3页)

二.外部网络安全性分析

  1.数据库服务的探测

  为了安全,可以让mysql服务运行在内网,但是如果你的机器有外网的接口,mysql也会自动被绑定在外网上面,暴露在internet中,而且系统会在TCP的3306端口监听,非常容易被端口扫描工具发现,不能保证数据安全。如果默认,mssql则会打开TCP的1433端口监听。虽然mssql可以人为的改变监听端口,但是通过微软未公开的1434端口的UDP探测可以很容易知道SQL Server使用的什么TCP/IP端口了。往UDP1434端口

  发送一个1个字节的内容为02的数据包,被探测的系统则会返回安装的mssql服务信息,这些信息包括:主机名称、实例名称、版本、管道名称以及使用的端口等。这个端口是微软自己使用,而且不象默认的1433端口那样可以改变,1434是不能改变的。一个典型的返回的信息如下:

  ServerName;Sky;InstanceName;sky;IsClustered;No;Version;8.00.194;tcp;3341;np;\\sky\pipe\MSSQL$XHT310\sql\query; 可以发现mssql的tcp端口改成了3341,为攻击者打开了方便之门!只要会一点socket编程知识,很容易就可以写出扫描mssql服务的程序,而且,由于利用了udp端口,一般的过滤是很难防范的。 补天的awen写了个探测程序,用的是c#语言,代码如下: 

 using System;
  using System.Net.Sockets;
  using System.Net;
  using System.Text;
  using System.Threading;
  namespace ConsoleApplication3
  {
  class Class1
  {
  //创建一个UDPCLIENT实例
  private static UdpClient m_Client;
  //LISTEN用来获取返回的信息
  public static string Listen(string hostip)
  {
  string HostIP = hostip;
  IPAddress thisIP = IPAddress.Parse(HostIP);
  IPEndPoint host = new IPEndPoint(thisIP,1434);
  byte [] data = m_Client.Receive(ref host);
  Encoding ASCII = Encoding.ASCII;
  String strData = ASCII.GetString(data);
  return strData;
  }
  //SEND
  public static void Send(string hostip)
  {
  string HostIP = hostip;
  byte [] buffer = {02};
  //02为要发送的数据,只有02、03、04有回应
  int ecode = m_Client.Send(buffer,1,HostIP,1434);
  //ecode用来返回是否成功发送
  if(ecode <= 0)
  {
  Console.WriteLine("发送时出错:" + ecode);
  }
  }
  //对返回的信息的简单的处理
  public static void OutputInfo(string strdata)
  {
  string str = strdata;
  //str.le
  char [] that = {‘;‘,‘;‘};
  string [] strofthis =str.Split(that);
  //int i= 0
  for(int i=0;i{
  Console.Write(strofthis);
  Console.Write(‘
  ‘);
  }
  }
  //输入IP
  public static string InputHostIP()
  {
  Console.Write("enter the ip you want to scan:
  ");
  string hostip =Console.ReadLine();
  Console.Write(‘
  ‘);
  return hostip;
  }
  //EXIT
  public static void Exit()
  {
  Console.WriteLine("if you want to exit ,just input 1
  ");
  int a = Console.Read();
  if(a!= 1)
  {
  Console.WriteLine("if you want to exit ,just input 1
  ");
  Console.Read();
  }
  else
  {
  }
  }
  [STAThread]
  static void Main(string[] args)
  {
  string HostIP;
  HostIP = InputHostIP();
  Console.WriteLine("Begin to send udp to the host");
  m_Client = new UdpClient();
  Send(HostIP);
  string strData=Listen(HostIP);
  OutputInfo(strData);
  Exit();
  }
  }
  }

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章