Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efflux: Disable logging of plaintext passwords in debugging mode (CVE-2024-43444) #588

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Kernel/System/Auth/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sub Auth {
my $RemoteAddr = $ENV{REMOTE_ADDR} || 'Got no REMOTE_ADDR env!';
my $UserID = '';
my $GetPw = '';
my $Method;
my $Method = '';

# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
Expand Down Expand Up @@ -177,8 +177,8 @@ sub Auth {
{
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message =>
"User: '$User' tried to authenticate with bcrypt but 'Crypt::Eksblowfish::Bcrypt' is not installed!",
Message =>
"User: $User tried to authenticate with bcrypt but 'Crypt::Eksblowfish::Bcrypt' is not installed!",
);
return;
}
Expand Down Expand Up @@ -245,10 +245,19 @@ sub Auth {

# just in case for debug!
if ( $Self->{Debug} > 0 ) {
my $EnteredPw = $CryptedPw;
my $ExpectedPw = $GetPw;

# Don't log plaintext passwords.
if ( $Method eq 'plain' ) {
$EnteredPw = 'xxx';
$ExpectedPw = 'xxx';
}

$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
"User: '$User' tried to authenticate with Pw: '$Pw' ($UserID/$Method/$CryptedPw/$GetPw/$Salt/$RemoteAddr)",
Message =>
"User: $User tried to authenticate (User ID: $UserID, method: $Method, entered password: $EnteredPw, expected password: $ExpectedPw, salt: $Salt, remote address: $RemoteAddr)",
);
}

Expand All @@ -275,7 +284,7 @@ sub Auth {
elsif ( ($UserID) && ($GetPw) ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
Message =>
"User: $User authentication with wrong Pw!!! (Method: $Method, REMOTE_ADDR: $RemoteAddr)"
);
return;
Expand Down
5 changes: 2 additions & 3 deletions Kernel/System/Auth/LDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: ($Param{User}) added $Self->{UserSuffix} to username!",
Message => "User: $Param{User} added $Self->{UserSuffix} to username!",
);
}
}
Expand All @@ -160,8 +160,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: '$Param{User}' tried to authenticate with Pw: '$Param{Pw}' "
. "(REMOTE_ADDR: $RemoteAddr)",
Message => "User: $Param{User} tried to authenticate (REMOTE_ADDR: $RemoteAddr)",
);
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/Auth/Radius.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: '$User' tried to authenticate with Pw: '$Pw' ($RemoteAddr)",
Message => "User: $User tried to authenticate (REMOTE_ADDR: $RemoteAddr)",
);
}

Expand Down
31 changes: 25 additions & 6 deletions Kernel/System/CustomerAuth/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ sub Auth {
my $RemoteAddr = $ENV{REMOTE_ADDR} || 'Got no REMOTE_ADDR env!';
my $UserID = '';
my $GetPw = '';
my $Method = '';

# sql query
$Self->{DBObject}->Prepare(
Expand Down Expand Up @@ -143,6 +144,7 @@ sub Auth {

if ( $Self->{CryptType} eq 'plain' ) {
$CryptedPw = $Pw;
$Method = 'plain';
}

# md5 or sha pw
Expand All @@ -161,9 +163,11 @@ sub Auth {

if ( $Magic eq '$apr1$' ) {
$CryptedPw = apache_md5_crypt( $Pw, $Salt );
$Method = 'apache_md5_crypt';
}
else {
$CryptedPw = unix_md5_crypt( $Pw, $Salt );
$Method = 'unix_md5_crypt';
}
$EncodeObject->EncodeInput( \$CryptedPw );
}
Expand All @@ -176,6 +180,7 @@ sub Auth {
$SHAObject->add($Pw);
$CryptedPw = $SHAObject->hexdigest();
$EncodeObject->EncodeInput( \$CryptedPw );
$Method = 'sha256';
}

# sha512 pw
Expand All @@ -186,6 +191,7 @@ sub Auth {
$SHAObject->add($Pw);
$CryptedPw = $SHAObject->hexdigest();
$EncodeObject->EncodeInput( \$CryptedPw );
$Method = 'sha512';
}

elsif ( $GetPw =~ m{^BCRYPT:} ) {
Expand All @@ -196,7 +202,7 @@ sub Auth {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message =>
"User: '$User' tried to authenticate with bcrypt but 'Crypt::Eksblowfish::Bcrypt' is not installed!",
"CustomerUser: $User tried to authenticate with bcrypt but 'Crypt::Eksblowfish::Bcrypt' is not installed!",
);
return;
}
Expand All @@ -218,6 +224,7 @@ sub Auth {
);

$CryptedPw = "BCRYPT:$Cost:$Salt:" . Crypt::Eksblowfish::Bcrypt::en_base64($Octets);
$Method = 'bcrypt';
}

# sha1 pw
Expand All @@ -231,6 +238,7 @@ sub Auth {
$SHAObject->add($Pw);
$CryptedPw = $SHAObject->hexdigest();
$EncodeObject->EncodeInput( \$CryptedPw );
$Method = 'sha1';
}

# No-13-chars-long crypt pw (e.g. in Fedora28).
Expand All @@ -242,6 +250,7 @@ sub Auth {
# Encode output, needed by crypt() only non utf8 signs.
$CryptedPw = crypt( $Pw, $SaltUser );
$EncodeObject->EncodeInput( \$CryptedPw );
$Method = 'crypt';
}
}

Expand All @@ -259,22 +268,32 @@ sub Auth {
# encode output, needed by crypt() only non utf8 signs
$CryptedPw = crypt( $Pw, $Salt );
$EncodeObject->EncodeInput( \$CryptedPw );
$Method = 'crypt';
}

# just in case!
if ( $Self->{Debug} > 0 ) {
my $EnteredPw = $CryptedPw;
my $ExpectedPw = $GetPw;

# Don't log plaintext passwords.
if ( $Self->{CryptType} eq 'plain' ) {
$EnteredPw = 'xxx';
$ExpectedPw = 'xxx';
}

$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "CustomerUser: '$User' tried to authenticate with Pw: '$Pw' "
. "($UserID/$CryptedPw/$GetPw/$Salt/$RemoteAddr)",
Message =>
"CustomerUser: $User tried to authenticate (User ID: $UserID, method: $Method, entered password: $EnteredPw, expected password: $ExpectedPw, salt: $Salt, remote address: $RemoteAddr)",
);
}

# just a note
if ( !$Pw ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
Message =>
"CustomerUser: $User authentication without password (REMOTE_ADDR: $RemoteAddr)",
);
return;
Expand All @@ -293,7 +312,7 @@ sub Auth {
elsif ( $UserID && $GetPw ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
Message =>
"CustomerUser: $User Authentication with wrong password (REMOTE_ADDR: $RemoteAddr)"
);
return;
Expand All @@ -303,7 +322,7 @@ sub Auth {
else {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
Message =>
"CustomerUser: $User doesn't exist, is invalid or has no password set (REMOTE_ADDR: $RemoteAddr)"
);
return;
Expand Down
9 changes: 4 additions & 5 deletions Kernel/System/CustomerAuth/LDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "CustomerUser: ($Param{User}) added $Self->{UserSuffix} to username!",
Message => "CustomerUser: $Param{User} added $Self->{UserSuffix} to username!",
);
}
}
Expand All @@ -161,8 +161,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "CustomerUser: '$Param{User}' tried to authenticate with Pw: '$Param{Pw}' "
. "(REMOTE_ADDR: $RemoteAddr)",
Message => "CustomerUser: $Param{User} tried to authenticate (REMOTE_ADDR: $RemoteAddr)",
);
}

Expand Down Expand Up @@ -248,7 +247,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => 'check for groupdn!',
Message => 'Checking for GroupDN.',
);
}

Expand Down Expand Up @@ -288,7 +287,7 @@ sub Auth {
# failed login note
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message =>
Message =>
"CustomerUser: $Param{User} authentication failed, no LDAP group entry found"
. "GroupDN='$Self->{GroupDN}', Filter='$Filter2'! (REMOTE_ADDR: $RemoteAddr).",
);
Expand Down
6 changes: 3 additions & 3 deletions Kernel/System/CustomerAuth/Radius.pm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sub Auth {
if ( $Self->{Debug} > 0 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: '$User' tried to authenticate with Pw: '$Pw' ($RemoteAddr)",
Message => "CustomerUser: $User tried to authenticate (REMOTE_ADDR: $RemoteAddr)",
);
}

Expand Down Expand Up @@ -133,7 +133,7 @@ sub Auth {
if ( defined($AuthResult) && $AuthResult == 1 ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: $User Authentication ok (REMOTE_ADDR: $RemoteAddr).",
Message => "CustomerUser: $User Authentication ok (REMOTE_ADDR: $RemoteAddr).",
);
return $User;
}
Expand All @@ -142,7 +142,7 @@ sub Auth {
else {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'notice',
Message => "User: $User Authentication with wrong Pw!!! (REMOTE_ADDR: $RemoteAddr)"
Message => "CustomerUser: $User Authentication with wrong Pw!!! (REMOTE_ADDR: $RemoteAddr)"
);
return;
}
Expand Down
Loading