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]”
 
  致谢:感谢您的耐心阅读!
相关文章
相关标签/搜索