가운데 가장 중요한 파일은 WEB-INF/web.xml이며, 배포 서술자로 알려져 있습니다. 이 파일은 애플리케이션에서 사용되는 경로 및 이러한 경로를 처리하는 클래스에 대한 정보를 저장합니다.
애플리케이션에서 사용되는 모든 컴파일된 클래스는 WEB-INF/classes 폴더에 저장되어야 합니다. 이러한 클래스에는 중요한 비즈니스 로직과 민감한 정보가 포함될 수 있습니다. 이 파일들의 취약점은 웹사이트의 완전한 침해로 이어질 수 있습니다. lib 폴더에는 해당 애플리케이션에 필요한 라이브러리가 저장됩니다. jsp 폴더에는 Jakarta Server Pages (JSP)가 저장되어 있으며, 이전에는 JavaServer Pages로 알려져 있었으며, Apache 서버의 PHP 파일과 비교될 수 있습니다.
다음은 web.xml 파일의 예시입니다.
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app><servlet><servlet-name>AdminServlet</servlet-name><servlet-class>com.inlanefreight.api.AdminServlet</servlet-class></servlet><servlet-mapping><servlet-name>AdminServlet</servlet-name><url-pattern>/admin</url-pattern></servlet-mapping></web-app>
위의 web.xml 구성은 AdminServlet라는 새로운 서블릿을 정의하며, 이 서블릿은 com.inlanefreight.api.AdminServlet 클래스에 매핑됩니다. Java는 패키지 이름을 만들 때 점 표기법을 사용하며, 위에서 정의한 클래스의 디스크 경로는 다음과 같을 것입니다:
classes/com/inlanefreight/api/AdminServlet.class
다음으로, /admin에 대한 요청을 AdminServlet로 매핑하는 새로운 서블릿 매핑이 생성됩니다. 이 구성은 /admin에 대한 모든 요청을 AdminServlet.class 클래스로 보내어 처리합니다. web.xml 설명자에는 많은 민감한 정보가 포함되어 있으며, 로컬 파일 포함 (LFI) 취약점을 활용할 때 확인해야 하는 중요한 파일입니다.
tomcat-users
tomcat-users.xml 파일은 /manager 및 host-manager 관리 페이지에 대한 액세스를 허용하거나 거부하는 데 사용됩니다.
<?xml version="1.0" encoding="UTF-8"?><SNIP><tomcat-usersxmlns="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"><!--By default, no user is included in the "manager-gui" role requiredto 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.Built-in Tomcat manager roles:- manager-gui - allows access to the HTML GUI and the status pages- manager-script - allows access to the HTTP API and the status pages- manager-jmx - allows access to the JMX proxy and the status pages- manager-status - allows access to the status pages onlyThe users below are wrapped in a comment and are therefore ignored. If youwish to configure one or more of these users for use with the manager webapplication, do not forget to remove the <!.. ..> that surrounds them. Youwill also need to set the passwords to something appropriate.--><SNIP>!-- user manager can access only manager section --><rolerolename="manager-gui" /><userusername="tomcat"password="tomcat"roles="manager-gui" /><!-- user admin can access manager and admin section both --><rolerolename="admin-gui" /><userusername="admin"password="admin"roles="manager-gui,admin-gui" /></tomcat-users>
파일은 manager-gui, manager-script, manager-jmx, 그리고 manager-status 역할 각각이 무엇에 액세스 권한을 제공하는지 보여줍니다. 이 예시에서는 tomcat 사용자가 암호 tomcat으로 manager-gui 역할을 가지고 있으며, 두 번째로 약한 암호 admin이 admin 사용자 계정에 설정되어 있습니다.