介绍
我来的概念,这在观看电影中的白帽子黑客写了他所谓的1 quot虎胆龙威4.0;变异安全algorithmquot;我认为这可能是有用的,有一个系统的变化(变异)的密码,如果登录失败足够的时间,它可能会出现安全risk.nbsp;
此登录系统是不喜欢你的常规系统。经典的登录系统依靠一个定义的用户名和密码组合,以允许用户访问私人信息。很多人不经常使用足够强大的密码时,他们注册的一部分,一个社区网站,甚至当他们成立了自己的网上银行系统登录信息。
这些密码通常是生日或名字,这意味着注册一样的东西。这是其中的安全风险的用武之地。
一个可行的情况下,将一名女子签署了Facebook和设置她作为女儿的全名密码的情况。 可感觉"mischievousquot的; Facebook上的朋友,她可能已经猜到她的密码与她的女儿做的东西,并尝试在猜测她的登录详细信息。
在这种情况下,一个经典的登录系统,将允许的数量,在此期间,quot; attackerquot最终可能 猜测的权利和获得无限的猜测。
此登录系统,针对这种情况,注册用户提供了更多的安全。背景
该系统是在Visual Basic.NET编写,并使用SQL Server数据库中存储的用户信息。大多数用户数据存储为纯文本,与用户的密码使用SHA1加密的异常。
在开发过程中面临的挑战是围绕用户的密码以及跟踪登录尝试通过使用会话变量被计算每次尝试加密的小问题。这些问题是纯粹的概念和性质相对迅速地得到解决。它如何工作
新用户注册后,将发送一封电子邮件,其中会包含对他/她的帐户的详细信息。这些细节,包括他们的用户ID,用户名和密码。
要登录,用户将必须输入他们的用户ID,首先要确认他们确实有在系统上帐户。一旦用户ID进行验证,他们将被要求提供用户名和密码,他们输入的用户ID相关联。
哪里有记录不少于3登录尝试,为本届会议的登录哈希和盐的登录表单的密码字段输入值,并选择用户ID,用户名和密码值是创纪录相同的用户输入。如果选择不返回从数据库中单列,是无效的登录企图获取用户的会话计数。
如果有3计算的登录尝试,该帐户是标记为锁定的时间,因为它是由用户恢复之前,将不会被包括在未来的登录尝试的选择。
此外,36字符帐户被锁定后产生长期价值。然后将这个值散列和腌制和storednbsp;数据库作为新的帐户密码。login.aspx.vbnbsp;
这释放containsnbsp;Imports System.Data
Imports System.Data.SqlClient
Public Class Login
Inherits System.Web.UI.Page
Private connstr As String = "Data Source=.\SQLEXPRESS; Initial Catalog=test; Integrated Security=True;"
Private conn As SqlConnection = New SqlConnection(connstr)
Public NewPass As String = Nothing
Public HashedPass As String = Nothing
Public UserId As Integer = Nothing
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
pnlLoginForm.Visible = False
Session("LoginAttempt") = 0
End If
If Session("LoginAttempt") = 2 Then
' This account may be vulnerable, generate a random string for the new password and lock the account
Dim s As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Dim r As New Random
Dim sb As New StringBuilder
Dim idx As Integer = Nothing
For i As Integer = 1 To 8
idx = r.Next(0, 61)
NewPass += sb.Append(s.Substring(idx, 1)).ToString
Next
HashedPass = Crypt.Compute(NewPass, "SHA512", Nothing)
Dim sql As String = "UPDATE Users SET Password = @Pass, LockedYN = @Lock"
Dim cmd As New SqlCommand(sql, conn)
cmd.Parameters.AddWithValue("@Pass", NewPass)
cmd.Parameters.AddWithValue("@Lock", "Yes")
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
End If
End Sub
Private Sub btnVerifyID_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnVerifyID.Click
If txtUserId.Text IsNot Nothing Then
Dim UserData As New DataSet
Dim UserAdapter As New SqlDataAdapter
UserAdapter.SelectCommand = New SqlCommand("SELECT * FROM Users " & _
"WHERE UserId = @ID", conn)
UserAdapter.SelectCommand.Parameters.AddWithValue("@ID", txtUserId.Text)
UserAdapter.Fill(UserData)
If UserData.Tables(0).Rows.Count <> 1 Then
lblError.Text = "Specified User ID does not exist."
lblError.ForeColor = Drawing.Color.Red
Else
If UserData.Tables(0).Rows(0)(4).ToString = "Yes" Then
lblError.Text = "The account you tried to log into has been locked to prevent possible unauthorized access. " & _
"If this is your account, please check your email for instructions to unlock it."
lblError.ForeColor = Drawing.Color.Red
Else
UserId = txtUserId.Text
pnlLoginForm.Visible = True
End If
End If
End If
End Sub
Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
If txtUser.Text IsNot Nothing And txtPass.Text IsNot Nothing Then
If Session("LoginAttempt") <> 2 Then
Dim pass As String = Crypt.Compute(txtPass.Text, "SHA512", Encoding.UTF8.GetBytes(Crypt.SaltValue))
Dim UserData As New DataSet
Dim UserAdapter As New SqlDataAdapter
UserAdapter.SelectCommand = _
New SqlCommand("SELECT * FROM Users " & _
"WHERE Username = @User AND Password = @Pass " & _
"AND LockedYN = @Lock", conn)
UserAdapter.SelectCommand.Parameters.AddWithValue("@User", txtUser.Text)
UserAdapter.SelectCommand.Parameters.AddWithValue("@Pass", pass)
UserAdapter.SelectCommand.Parameters.AddWithValue("@Lock", "No")
UserAdapter.Fill(UserData)
If UserData.Tables(0).Rows.Count <> 1 Then
lblError.Text = "Invalid username or password."
lblError.ForeColor = Drawing.Color.Red
Session("LoginAttempt") = CInt(Session("LoginAttempt")) + 1
Else
Session("LoggedIn") = True
Response.Redirect("Home.aspx")
End If
Else
lblError.Text = "The account you tried to log into is now locked due to excessive failed login attempts. " & _
"If this is your account, please check your email for instructions to unlock it."
lblError.ForeColor = Drawing.Color.Red
End If
Else
lblError.Text = "Please enter a username and password."
lblError.ForeColor = Drawing.Color.Red
End If
End Sub
End Class
本新闻稿中包含的基本安全quot; measuresquot;由于空闲时间的挑战,我一直无法将代码添加到处理电子邮件yet.nbsp,;
目前包括:
函数来处理的SHA1加密的用户密码一般会话管理,不断跟踪登录尝试测试时使用裸机的用户界面。尚未在此version.nbsp清理;