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的配置文件便可。
1、檢查Tomcat設置
  服務器安裝了Apache Tomcat後會默認開放8080端口供外部鏈接,通常在瀏覽器中輸入「IP:8080」或者域名來訪問Apache Tomcat頁面,以下圖所示。
 
2、查看 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,效果以下:
3、進入Tomcat管理
  Tomcat提供了在線管理,本案例也正式利用在線管理來構建後門的。在第一個圖中單擊左上角下面的Tomcat Manager」連接後,會彈出一個要求輸入用戶名和密碼的窗口,以下圖所示。
4、查看部署狀況
  在上圖中輸入從「tomcat-users.xml」文件中獲取的具備管理員權限的用戶名和密碼,驗證經過後進入部署管理頁面,以下圖所示。
說明:
(1)在部署管理頁面中能夠「Start」(啓動)、「Stop」(中止)、「Reload」(重載)、「Undeploy」(刪除部署)已經部署的項目,單擊「Undeploy」會對文件進行物理刪除。
(2) 部署的文件夾是以*.war文件的名稱,例如上傳的文件是esite.war,則在Tomcat目錄中會對應生成一個「esite」文件夾(將war解壓出來的文件夾) 。
 
5、部署JSP WebShell後門程序
  在部署管理頁面的下方有一個「WAR file to deploy」,單擊瀏覽選擇一個已經設置好的後門war文件,在本例中的後門程序爲esite.war,單擊「deploy」將該文件部署到服務器上。
說明:
(1)部署是其文件必須是war文件。
(2)將winzip軟件安裝在系統中,而後將單一或者多個jsp後門文件壓縮成一個壓縮文件,壓縮成功後,將「*.zip」文件改名爲「*.war」便可。
(3)上傳文件後,tomcat會自動進行部署並運行。
6、測試後門程序
  在地址欄中輸入「 部署文件名稱 /jsp文件」,例如在本例中其正確的訪問是「[url]http://127.0.0.1:8080/esite/test.jsp[/url]」
 
  致謝:感謝您的耐心閱讀!
相關文章
相關標籤/搜索