天天看點

TextpatternCMS背景未過濾直接上傳php導緻getshell

該漏洞CNVD-ID: CNVD-2019-12539

漏洞送出CNVD後,待CNVD公示才發出本文。

測試環境:windows7 + firefox + Burpsuite + apache2 +php5.6.27 + mysql5.5.53

産品官網:https://textpattern.com/

github: https://github.com/textpattern/textpattern

系統安裝環境要求:https://textpattern.com/about/119/system-requirements

一、漏洞分析

上傳檔案是由/textpattern/include/txp_file.php檔案中的function file_insert()函數處理。

整個函數中,沒有對檔案擴充名進行驗證。

上傳後沒有更改檔案名,使用預設的檔案路徑。

TextpatternCMS背景未過濾直接上傳php導緻getshell
TextpatternCMS背景未過濾直接上傳php導緻getshell

檔案目錄沒有做有效的通路控制,如用 .htaccess控制不能直接通路。導緻可以通過路徑直接通路上傳的php檔案。

TextpatternCMS背景未過濾直接上傳php導緻getshell

二、漏洞測試

POC:

登陸背景後,來到檔案頁面/textpattern/index.php?event=file

能成功上傳php檔案。

Php檔案中的内容:

<?php phpinfo(); ?>

TextpatternCMS背景未過濾直接上傳php導緻getshell

然後打開上傳檔案路徑/files/test.php

TextpatternCMS背景未過濾直接上傳php導緻getshell

繼續閱讀