报告编号:B6-2019-081901
报告来源:360-CERT
报告作者:360-CERT
更新日期:2019-08-19
在2019年7月26日的时候 @luizfschrickte 就在 webmin 官方github 仓库 #947 反馈了这个问题。
@DEFCON AppSec Village link 也在 2019 年08月10日的时候提到该问题
因为问题出现在 password_change.cgi
cgi 文件基本就是可以理解为是一个可以用于网络请求的 sh/bash/或任意本地可执行程序解释的脚本文件
此处的是 #!/usr/local/bin/perl
# Is this a Webmin user?
if (&foreign_check("acl")) {
&foreign_require("acl", "acl-lib.pl");
($wuser) = grep { $_->{'name'} eq $in{'user'} } &acl::list_users();
if ($wuser->{'pass'} eq 'x') {
# A Webmin user, but using Unix authentication
$wuser = undef;
}
elsif ($wuser->{'pass'} eq '*LK*' ||
$wuser->{'pass'} =~ /^\!/) {
&pass_error("Webmin users with locked accounts cannot change ".
"their passwords!");
}
}
此处逻辑为获得传入的用户名是否存在,虽然可以看到赋值 $wuser = undef
,但实际是 {}
即可通过下面判断。
if ($wuser) {
# Update Webmin user's password
$enc = &acl::encrypt_password($in{'old'}, $wuser->{'pass'});
$enc eq $wuser->{'pass'} || &pass_error($text{'password_eold'});
$perr = &acl::check_password_restrictions($in{'user'}, $in{'new1'});
$perr && &pass_error(&text('password_enewpass', $perr));
$wuser->{'pass'} = &acl::encrypt_password($in{'new1'});
$wuser->{'temppass'} = 0;
&acl::modify_user($wuser->{'name'}, $wuser);
&reload_miniserv();
}
这个漏洞最离奇的地方来了,上面这个文件在 2014 年以前均是这样的。而 在 deb 包中其中关键的一行
$enc eq $wuser->{'pass'} || &pass_error($text{'password_eold'},qx/$in{'old'}/);
$in{'old'}
被直接带入了 pass_error
sub pass_error
{
&header(undef, undef, undef, undef, 1, 1);
print &ui_hr();
print "<center><h3>",$text{'password_err'}," : ",@_,"</h3></center>\n";
print &ui_hr();
&footer();
exit;
}
这就直接导致了命令执行
升级到 1.930 版本能够缓解该漏洞所带来的影响。或者选择从 github 上直接安装也是早就没有此漏洞影响的。
2019-08-19 360CERT监测到业内安全公司发布预警
2019-08-19 360CERT发布分析报告
2、DEFCON-Webmin-1920
[https://www.pentest.com.tr/exploits/DEFCON-Webmin-1920-Unauthenticated-Remote-Command-Execution.html]
推荐阅读:
2、微软补丁日:Word/DHCP/LNK远程代码执行漏洞预警
长按下方二维码关注360CERT!谢谢你的关注!
注:360CERT官方网站提供《CVE-2019-15107: webmin 远程命令执行漏洞预警》完整预警详情,点击阅读原文