오래된 클래식 ASP 사이트를 업데이트하고 있으므로 암호를 저장해야하므로 당연히 Classic ASP의 한계를 감안할 때주의해야합니다.해시되기 전에 소금에 절한 암호를 스크램블합니다. 좋은 생각?
소금과 후추를 모두 사용하고 있습니다 (고추는 데이터베이스가 아니라 서버에 저장된 상수입니다), 나는 궁금해하고 있습니다. 거기에 어떤 특징이 있습니까? 해싱하기 전에 "pepper + password + salt"문자열을 사용 하시겠습니까?
미리 정의 된 (비밀) 일련의 숫자를 기반으로하는 임의의 길이의 문자열을 스크램블 할 수있는 함수를 작성했습니다.이 시퀀스는 데이터베이스가 아닌 서버에도 저장됩니다. 따라서 함수는 항상 임의의 스크램블 된 값이 아닌 동일한 스크램블 된 값을 반환합니다 (물론 아무 쓸모가 없을 것입니다).
암호 해독에 대해 많이 읽었지만 해시되기 전에 소금에 절인 암호가 뒤섞이지 않는 사람은 없었습니다. 하지만 나에게 이는 엄청난 추가 보안 수준 인 것처럼 보인다.
다른 사람들이 생각하는 것만 궁금하십니까? 누군가가 당신의 데이터베이스에 대한 액세스 권한을 얻은 경우
Function ScrambleSalt(the_str)
'// Once you've joined the pepper + password + salt, you pass it through the "ScrambleSalt" function before
'// hashing. The "ScrambleSalt" function will scramble any string based on a pre-set sequence of numbers.
'// The sequence is imported from a txt file (kept in an offline folder, just like the pepper).
'// The sequence needs to be an incremental collection of numbers (starting from 1) but in a random order
'// and comma delimited. Here's and example with 1 to 50, although the actual sequence uses 1 - 500:
'// 22,8,21,45,49,42,3,36,11,47,19,9,15,23,40,16,29,31,43,38,44,4,41,13,35,26,17,14,10,28,6,5,34,12,39,1,
'// 30,46,32,7,27,48,33,25,18,2,50,20,24,37
'// (^ the numbers 1 to 50 in a random order)
'// How the scrambling process works (using the above example sequence) is by rearranging the characters in
'// the string so that characters 22 appears first, followed by character 8, then character 21 etc, etc...
'// the function cycles through the sequence ignoring any numbers that are larger than the length of the
'// string until the characters in the string have all been rearranged (scrambled).
'// If a string is more than 50 characters long, it will be split into individual strings, each containing
'// 50 characters (or a remainder in the case of the last string).
'// So if the length of the string is 120 characters long, it will be split into 3 string:
'// String 1 = 50 chars (chars 1 - 50)
'// String 2 = 50 chars (chars 51 - 100)
'// String 3 = 20 chars (chars 101 - 120)
'// Each string will be scrambled, then joined back together before being returned by the function.
'// Using this method means the function can scramble strings of any length and without limit.
Dim scramble_sequence, sequence_array, scramble_loop, in_loop_str, scrambled_str
scramble_sequence = file_get_contents(request.ServerVariables("APPL_PHYSICAL_PATH") & "/../keys/scramble_sequence.txt")
sequence_array = split(scramble_sequence,",")
scramble_loop = Ceil(len(the_str),uBound(sequence_array)+1) '// round up
for fx = 0 to scramble_loop-1
in_loop_str = mid(the_str,fx*(uBound(sequence_array)+1)+1,uBound(sequence_array)+1)
for fy = 0 to uBound(sequence_array)
if int(sequence_array(fy)) =< len(in_loop_str) then
scrambled_str = scrambled_str & mid(in_loop_str,int(sequence_array(fy)),1)
end if
next
next
ScrambleSalt = scrambled_str
End Function
function Ceil(dividend, divider) ' for rounding up a number
if (dividend mod divider) = 0 Then
Ceil = dividend/divider
else
Ceil = Int(dividend/divider) + 1
end if
End function
function file_get_contents(file_path)
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(file_path,1)
file_get_contents = f.ReadAll
f.Close : Set f = Nothing : Set fs = Nothing
end function
행동 위의 함수의 예
pepper value used for this example = "XC3Qpm7CNXauwAbX"
scramble sequence used for this example = "9,39,50,43,18,11,36,7,29,41,27,34,12,45,1,14,42,13,6,4,25,19,24,33,30,20,23,10,46,16,49,38,15,5,17,8,47,28,26,3,2,40,37,44,35,32,48,22,31,21"
password = "[email protected]"
salt = "G1sWNd0andiIhOYA"
concatenated pepper+password+salt:
[email protected]
scrambled using the example sequence:
[email protected]
SHA512 Hash:
9d5a7781eeb815250c55c1a1f172c569b3b6167a48951c819e4982bea9b84bd8ecad6a417ff8f110541a1039ddf1fd8daa61a52a7c401fccae71dda77c607540
소금의 목적은 레인보우 테이블을 쓸모 없게 만드는 것입니다. 왜냐하면 공격자가 해킹하려는 각 해시마다 다시 계산해야하기 때문입니다. 소금이 공격자에게 알려진 것인지 아닌지는 부적합합니다. 귀하의 접근 방식은 어떤 이점을 얻게됩니까? –
소금의 목적 (해시 된 암호 옆에 저장 됨)을 이해합니다. 데이터베이스가 손상된 경우 해커는 단일 계정을 대상으로 소금을 구현하는 무지개 표를 재구성 할 수 있습니다. 내 생각에 두 암호를 연결하는 것보다는 비밀 번호를 뒤섞어 놓는 것이 웹 사이트 소스 코드와 데이터베이스에 대한 액세스 권한이 없으면 불가능할 것입니다. 또한 과잉이라고 생각합니다. 좋은 수준의 보안과 같습니다. – Adam
무지개 테이블 재구성은 본질적으로 해시를 무차별 적으로 수행하는 것과 같습니다. 어쨌든 공격자가 할 수있는 일. –