Skip to content

Commit e1952a6

Browse files
committed
Security fix: prevent password exposure in SQL logs
- Hash password in PHP before SQL query to avoid cleartext password in logs - Only md5(password) is sent to SQL, never the cleartext password - Maintains OpenSimulator password verification compatibility - Follows defense-in-depth: password and salt never coexist in PHP memory
1 parent 487dfdd commit e1952a6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

v1/gridauth.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ function w4os_gridauth( $user, $username, $password ) {
3131
return $user;
3232
}
3333

34+
// Hash password in PHP to avoid exposing it in SQL logs
35+
$password_md5 = md5( $password );
36+
3437
$avatar_query = "SELECT *
3538
FROM UserAccounts LEFT JOIN auth ON PrincipalID = UUID
3639
WHERE active = 1 AND Email != ''
3740
AND $match
38-
AND passwordHash = md5(concat(md5('$password'),':', passwordSalt))
41+
AND passwordHash = md5(concat('$password_md5',':', passwordSalt))
3942
;";
4043
$avatar_row = $w4osdb->get_row( $avatar_query );
4144
if ( is_wp_error( $avatar_row ) ) {

0 commit comments

Comments
 (0)