struts2-045 Remote Code Execution Vulnerability (CVE-2017-5638)

 

Table of contents

S2-045 Remote Code Execution Vulnerability (CVE-2017-5638)

Open the vulnerability environment


 

S2-045 Remote Code Execution Vulnerability (CVE-2017-5638)

Open the vulnerability environment

 进入Ubuntu系统下的对应漏洞环境,开启环境

443c8b97fcc37ce64e8b1069023097a7.png

 Open up the vulnerable environment

d3a0e5616b3128e6f6ecdf5bfcb88371.png

Check whether the startup is successful

2cec38063d847f84754bcd68b87f2c7c.png

 

 After the startup is successful, go to the browser to visit:
通过浏览器去访问该漏洞环境
 http://ip:8080

335074169bbf20760e2c19d8915e5dce.png

 Next, we try to upload the file (upload casually), then grab the data packet, modify the data packet, and then observe the change of the response data

upload any file

46bb7cf065b95e050a53ab97cf375e20.png

Capture packets:

抓取数据包,修改数据包,查看修改后,收到的响应数据
 ​
 直接发送以下数据包
 POST / HTTP/1.1
 Host: localhost:8080
 Upgrade-Insecure-Requests: 1
 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
 Accept-Language: en-US,en;q=0.8,es;q=0.6
 Connection: close
 Content-Length: 0
 Content-Type: %{#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('lc',123+123)}.multipart/form-data
 ​
 发现123+123已经被执行,显示出结果

grab bag

fa412675daa1d6e4ae9c16592007eb26.png

After sending to the repeater:

 Modify the packet information and view the response

7fdda7874260d55712e615656257d861.png

 

 Observation found that the 123+123 we entered has been executed

 

 解析了以后,我们借助第三方工具,来进行生成木马文件,然后进行随意上传文件,进行漏洞检测,然后上传木马文件,获取服务器的shell
 工具:哥斯拉、struts2漏洞检测工具

Open Godzilla and generate a Trojan:

ab53582cab5a79b49373da384a7a1bb3.png

 View Trojan files

2803267960a1f99cac7624e956148b75.png

 Try to upload random files and watch the url change

f5ea321e07127f9fca51bb59e9df21ba.png

 After uploading, observe this url

432de02917b92dd29090f6f14a337e41.png

 
复制此url,借助第三方工具进行扫描
 工具:struts2漏洞扫描工具

27e8ee4b8b54263b9dd87dc8c7c25ce7.png

 

 View the inspection results, there are loopholes

eb8619af20892b5178d646073d3f06c1.png

 

 Validation Vulnerabilities

fda3214a244a6d0d29c8515ca5020a4a.png

 

 remote command execution

c957674c6f0df27049072a396190eb68.png

 

 View the contents of the root directory

6acf5d16f4d1df8964af1cf5bca0fc61.png

 

 Click the file upload module and try to upload the Trojan file

a0875707e81f29f95c783124283611e0.png

 

 Check whether the upload is successful, and observe that the upload has been successful

ea682d3fac9af91666d566f73535a968.png

 

 Observe the upload access path, make a copy, connect using a third-party tool (Godzilla)

3e4a89c124e3524e31d9155f800da547.png

 Connect via Godzilla

fee7fc88f5a52f45e784cff3719f9e18.png

 

 The connection is successful, add, enter, and successfully get the server shell

c93cd155b5952423d89c08b4da52000b.png

 successfully added

 

6edb7db638e8da158d04fbab88e36ff1.png

 Click to enter, successfully get the shell

94231fc5228390f31e80febe3448fb61.png

Any operation can be performed on the file:

67c5ce8ef9ca360fbdcaf169f5e5fa67.png

 

If the article is inappropriate, criticism and correction are welcome! 

 

Guess you like

Origin blog.csdn.net/rumil/article/details/131002631