About xp_cmdshell .. Pay attention to security!

Source: Internet
Author: User

From: http://www.cnblogs.com/lbk/archive/2005/04/28/146973.html

 

I read a bit about the stored procedure yesterday, and I talked about xp_mongoshell. I used to only know that hackers can intrude into your system through the MSSQL vulnerability. After knowing the power of xp_mongoshell, I tried it and it was a bit open. Here is something about it.

Xp_cmdshell allows the system administrator to execute the specified command string in the operating system command line interpreter,
And returns any output in the form of text lines. It is a very powerful extended storage process.
In general, xp_mongoshell is not necessary for the Administrator. The elimination of xp_mongoshell will not cause the server
Any impact.
You can remove xp_cmdshell:
Use master
Exec sp_dropextendedproc n 'xp _ export shell'
Go

If necessary, you can restore xp_mongoshell back:
Use master
Exec sp_addextendedproc n 'xp _ cmdshell', n'xp log70. dll'
Go

Xp_cmdshell command shell
This process is an extended stored procedure used to execute a specified command string and return any output as a text line.
Syntax:
Xp_cmdshell command_string [, no_output]
Command_string command string to be executed
No_output does not return the output of Command Execution
Note:
When you grant the execution permission of xp_cmdshell to a user, you can run
The account that runs SQL Server Shell (usually a local system) has any execution privilege
Operating system commands.
Example:
1. Exec master .. xp_cmdshell "dir *. EXE"
Returns the list of executable files.
2. Exec master .. xp_mongoshell "Copy D: \ test1.jpg E: \" no_output
No output is returned.
3. Especially for execution
Exec master.. xp_mongoshell "Net start awhost32"
Exec master.. xp_mongoshell "net stop awhost32"
You can start and stop remote pcAnywhere services. It is very helpful for remote server operations.

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.