1

请看下面的代码:

public ActionResult URLInjection(string id)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["SQLInjection"].ToString();
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                try
                {
                    connection.Open()
                    SqlCommand command = new SqlCommand("select * from SQLInjection.Person WHERE ID = @id", connection);
                    command.Parameters.Add(new SqlParameter("@id", id));
                    command.CommandTimeout = 5;
                    command.ExecuteNonQuery();
                    using (System.IO.StreamWriter w = System.IO.File.AppendText("C:\\Development\\C#\\SQLInjection\\Log.log"))
                    {
                        w.WriteLine("Executed query");
                    }
                    Response.Redirect("~/Home/Index");
                }
                catch (Exception e)
                {
                    //Log the error
                }
            }

我已将其部署到本地 PC 上的 IIS。请参阅下面的 SQLMap 命令:

C:\SQLMap\sqlmap.py -u http://localhost/SQLInjection/SQLInjection/URLInjection/1 --dbs --tamper between.py

如果我执行这个命令,那么 SQLMap 会返回我本地服务器上所有数据库的名称。

如果我将 IIS 端口绑定从 80 更改为 81,那么它不会,即如果我运行下面的命令(将端口从 80 更改为 81 之后),那么它说没有问题(我已经确认它可以在端口 81):

C:\SQLMap\sqlmap.py -u http://localhost:81/SQLInjection/SQLInjection/URLInjection/1 --dbs --tamper between.py

这似乎表明我的本地开发 PC 上的端口 80 存在安全问题。

问题可能是什么?

4

0 回答 0