tomcat組態管理員-走後門,tomcat走後門
在Tomcat中,應用程式的部署很簡單,只需將你的WAR放到Tomcat的webapp目錄下,Tomcat會自動檢測到這個檔案,並將其解壓。在瀏覽器中訪問這個應用的Jsp時,通常第一次會很慢,因為Tomcat要將Jsp轉化為Servlet檔案,然後編譯。編譯以後,訪問將會很快。另外Tomcat也提供了一個應用:manager,訪問這個應用需要使用者名稱和密碼,使用者名稱和密碼儲存在一個xml檔案中。通過這個應用,輔助於Ftp,可以在遠程通過Web部署和撤銷應用,當然本地也可以,本案例就是利用這個特性來構建後門程式的。Tomcat不僅僅是一個Servlet容器,它也具有傳統的Web伺服器的功能:處理Html頁面。但是與Apache相比,它的處理靜態Html的能力就不如Apache。可以將Tomcat和Apache整合到一塊,讓Apache處理靜態Html,而Tomcat處理Jsp和Servlet.這種整合只需要修改一下Apache和Tomcat的設定檔即可。一、檢查Tomcat設定 伺服器安裝了Apache Tomcat後會預設開放8080連接埠供外部串連,一般在瀏覽器中輸入“IP:8080”或者網域名稱來訪問Apache Tomcat頁面,如所示。 二、查看Tomcat使用者設定檔 Tomcat安裝完成後有一個設定檔“tomcat-users.xml”,它位於Tomcat程式安裝目錄下的conf目錄下,直接開啟該檔案可以看到其中關於使用者名稱和密碼的明文值,檔案如下。
<?xml version='1.0' encoding='utf-8'?><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0"><!-- NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary. It is strongly recommended that you do NOT use one of the users in the commented out section below since they are intended for use with the examples web application.--><!-- NOTE: The sample user and role entries below are intended for use with the examples web application. They are wrapped in a comment and thus are ignored when reading this file. If you wish to configure these users for use with the examples web application, do not forget to remove the <!.. ..> that surrounds them. You will also need to set the passwords to something appropriate.--><!-- <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="<must-be-changed>" roles="tomcat"/> <user username="both" password="<must-be-changed>" roles="tomcat,role1"/> <user username="role1" password="<must-be-changed>" roles="role1"/>--> <!-- 配置角色 --> <role rolename="manager-gui"/> <role rolename="admin-gui"/> <!-- 組態管理員帳號,密碼及其許可權 --> <user username="你的使用者名稱" password="你的密碼" roles="admin-gui,manager-gui"/></tomcat-users>
說明:(1)有很多對tomcat不是很瞭解的管理員在安裝完Tomcat後並沒有修改預設密碼,使用者名稱是admin,密碼為空白,如果是這種情況可以直接登入。(2)如果使用者修改了該密碼,那麼其密碼一定儲存在“tomcat-users.xml”中,因此可以通過Webshell來擷取這個檔案的內容。 注釋上寫的很清楚,要進入
Manager App就需要manage-gui具有角色許可權的使用者,具有
admin-gui角色的使用者可以進入Host Manager,暫時就簡單這樣理解了,具體的這邊就不去深究了。進入到
Tomcat Web Application Manager,效果如下:三、進入Tomcat管理 Tomcat提供了線上管理,本案例也正式利用線上管理來構建後門的。在
第一個圖中單擊左上方下面的
“Tomcat Manager”連結後,會彈出一個要求輸入使用者名稱和密碼的視窗,如所示。四、查看部署情況 在中輸入從“tomcat-users.xml”檔案中擷取的具有管理員權限的使用者名稱和密碼,驗證通過後進入部署管理頁面,如所示。說明:(1)在部署管理頁面中可以“Start”(啟動)、“Stop”(停止)、“Reload”(重載)、“Undeploy”(刪除部署)已經部署的項目,單擊“Undeploy”會對檔案進行物理刪除。(2)
部署的檔案夾是以*.war檔案的名稱,例如上傳的檔案是esite.war,則在Tomcat目錄中會對應產生一個“esite”檔案夾(將war解壓出來的檔案夾) 。 五、部署JSP WebShell後門程式 在部署管理頁面的下方有一個“WAR file to deploy”,單擊瀏覽選擇一個已經設定好的後門war檔案,在本例中的後門程式為esite.war,單擊“deploy”將該檔案部署到伺服器上。說明:(1)部署是其檔案必須是war檔案。(2)將winzip軟體安裝在系統中,然後將單一或者多個jsp後門檔案壓縮成一個壓縮檔,壓縮成功後,將“*.zip”檔案更名為“*.war”即可。(3)上傳檔案後,tomcat會自動進行部署並運行。六、測試後門程式 在地址欄中輸入“
部署檔案名稱/jsp檔案”,例如在本例中其正確的訪問是“[url]http://127.0.0.1:8080/esite/test.jsp[/url]” 致謝:感謝您的耐心閱讀!