Skip to content

Commit

Permalink
(See #1221)
Browse files Browse the repository at this point in the history
udpate samba hash generation due to a possible code injection

command line parameter will be passed base64 encoded to avoid 
complex escaping sequences that may alter the initial passphrase



git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@21280 594d385d-05f5-0310-b6e9-bd551577e9d8
  • Loading branch information
bzapiec committed Oct 30, 2015
1 parent e35b990 commit a67a047
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/class_core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ DEBUG_SI = 256"),
array(
"name" => "sambaHashHook",
"type" => "command",
"default" => "perl -MCrypt::SmbHash -e \"print join(q[:], ntlmgen %password), $/;\"",
"default" => "perl -MCrypt::SmbHash -e \"use MIME::Base64; print join(q[:], ntlmgen decode_base64('%password')), $/;\"",
"description" => _("Command to create Samba NT/LM hashes. Required for password synchronization if you don't use supplementary services."),
"check" => "gosaProperty::isCommand",
"migrate" => "",
Expand Down
4 changes: 2 additions & 2 deletions include/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3101,8 +3101,8 @@ function generate_smb_nt_hash($password)
$password = addcslashes($password, '$');
$password = addcslashes($password, '$'); // <- And again once, to be able to use it as parameter for the perl script.
$tmp = $config->get_cfg_value("core",'sambaHashHook');
$tmp = preg_replace("/%userPassword/", escapeshellarg($password), $tmp);
$tmp = preg_replace("/%password/", escapeshellarg($password), $tmp);
$tmp = preg_replace("/%userPassword/", base64_encode($password), $tmp);
$tmp = preg_replace("/%password/", base64_encode($password), $tmp);
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");

exec($tmp, $ar);
Expand Down

0 comments on commit a67a047

Please sign in to comment.