Basic Tomcat Info
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Epuka kukimbia na root
Ili kuepuka kukimbia Tomcat na root, usanidi wa kawaida ni kuweka seva ya Apache kwenye bandari 80/443 na, ikiwa njia iliyotakiwa inalingana na regexp, ombi linaelekezwa kwa Tomcat inayokimbia kwenye bandari tofauti.
Muundo wa Kawaida
Folda ya
bin
inahifadhi skripti na binaries zinazohitajika kuanzisha na kuendesha seva ya Tomcat.Folda ya
conf
inahifadhi faili mbalimbali za usanidi zinazotumiwa na Tomcat.Faili ya
tomcat-users.xml
inahifadhi akidi za watumiaji na majukumu yao yaliyotolewa.Folda ya
lib
ina faili mbalimbali za JAR zinazohitajika kwa utendaji sahihi wa Tomcat.Folda za
logs
natemp
zinahifadhi faili za log za muda.Folda ya
webapps
ni webroot ya default ya Tomcat na inahifadhi programu zote. Folda yawork
inafanya kazi kama cache na inatumika kuhifadhi data wakati wa wakati wa utekelezaji.
Kila folda ndani ya webapps
inatarajiwa kuwa na muundo ufuatao.
The most important file among these is WEB-INF/web.xml
, which is known as the deployment descriptor. This file stores habari kuhusu njia used by the application and the classes handling these routes.
All compiled classes used by the application should be stored in the WEB-INF/classes
folder. These classes might contain important business logic as well as sensitive information. Any vulnerability in these files can lead to total compromise of the website. The lib
folder stores the libraries needed by that particular application. The jsp
folder stores Jakarta Server Pages (JSP), formerly known as JavaServer Pages
, which can be compared to PHP files on an Apache server.
Here’s an example web.xml file.
The web.xml
configuration above defines a new servlet named AdminServlet
that is mapped to the class com.inlanefreight.api.AdminServlet
. Java uses the dot notation to create package names, meaning the path on disk for the class defined above would be:
classes/com/inlanefreight/api/AdminServlet.class
Next, a new servlet mapping is created to map requests to /admin
with AdminServlet
. This configuration will send any request received for /admin
to the AdminServlet.class
class for processing. The web.xml
descriptor holds a lot of habari nyeti and is an important file to check when leveraging a Local File Inclusion (LFI) vulnerability.
tomcat-users
The tomcat-users.xml
file is used to kuruhusu or disallow access to the /manager
and host-manager
admin pages.
Faili linaonyesha ni nini kila moja ya majukumu manager-gui
, manager-script
, manager-jmx
, na manager-status
inatoa ufikiaji. Katika mfano huu, tunaona kwamba mtumiaji tomcat
mwenye nenosiri tomcat
ana jukumu la manager-gui
, na nenosiri dhaifu la pili admin
limetengwa kwa akaunti ya mtumiaji admin
.
Marejeleo
Jifunze na fanya mazoezi ya AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Jifunze na fanya mazoezi ya GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated