Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

How to call a batch file to execute from an SP Expand / Collapse
Author
Message
Posted Sunday, March 24, 2013 8:17 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:23 AM
Points: 7,098, Visits: 12,605
Sergiy (3/24/2013)
opc.three (3/24/2013)
The fact is that a system with xp_cmdshell disabled has less security exposures, has less vulnerabilities and is more auditable than a system where it is enabled.


OK.
I'm an intruder on your system.

If I'm connected using non-systemadmin credentials I cannot execute any call to xp_cmdshell anyway, and I cannot get privileges associated with it.
So, it does not really matter if it's disabled or enabled - I won't be able even to figure out that.

Now, if I'm connected as a systemadmin. First thing I will do is
EXEC sp_configure 'xp_cmdshell', 1

Immediately followed by
RECONFIGURE  WITH OVERRIDE

Voilà!
xp_cmdshell is enabled, no matter what state it was 3 ms ago.

So, where those promissed "less security exposures, has less vulnerabilities"?

You're still hung up on external scenarios.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1434729
Posted Sunday, March 24, 2013 8:19 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:23 AM
Points: 7,098, Visits: 12,605
Sergiy (3/24/2013)
opc.three (3/24/2013)
The point is, xp_cmdshell is a blunt tool that cannot be audited and allows people to run commands as someone else, possibly with more permissions than their own, without the possibility of being detected or tracked.


Would it be wiser to limit the privileges associated with the account running sqlserver service to its jon related tasks?
Read from there, write there, check on that location, execute that task.
That's it. The list is closed.
If you need to do something else - talk to your system administrator, as they say in MS messages.

This layer would be definitely harder to pass than to enable xp_cmdshell, don't you think?



All of those things should be done in addition to leaving xp_cmdshell disabled.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1434730
Posted Sunday, March 24, 2013 8:36 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:36 AM
Points: 4,576, Visits: 8,348
opc.three (3/24/2013)
You're still hung up on external scenarios.

Not really.
Replace "intruder" with "employee gone nuts".
What does it change?
Post #1434731
Posted Sunday, March 24, 2013 8:42 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:36 AM
Points: 4,576, Visits: 8,348
opc.three (3/24/2013)
All of those things should be done in addition to leaving xp_cmdshell disabled.

If those things are done there is no point of disabling xp_cmdshell.
Post #1434733
Posted Sunday, March 24, 2013 8:53 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:23 AM
Points: 7,098, Visits: 12,605
Sergiy (3/24/2013)
opc.three (3/24/2013)
You're still hung up on external scenarios.

Not really.
Replace "intruder" with "employee gone nuts".
What does it change?

Not much you can do there. But consider the employee in the sysadmin Role looking to steal data without being detected. Please re-read earlier posts. Its all laid out there. It depends on what you're protecting against and you're only focusing on the person who blazes in, does damage or steals, and doesn't care much about being detected either because they fade back to the shadows of the internet, or they are a nutso employee who just wants to do damage.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1434734
Posted Sunday, March 24, 2013 8:58 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:23 AM
Points: 7,098, Visits: 12,605
Sergiy (3/24/2013)
opc.three (3/24/2013)
All of those things should be done in addition to leaving xp_cmdshell disabled.

If those things are done there is no point of disabling xp_cmdshell.

Why do you need it? There is no need to enable it. What would you need it for if things are locked down to the point where the engine only needs to talk to the file system for writing backups, logs and trace files or other system related operations to allow the instance to function?

This conversation began discussing cross-server exchanges of data, I.e. Using xp_cmdshell to facilitate an ETL system.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1434735
Posted Sunday, March 24, 2013 9:17 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:36 AM
Points: 4,576, Visits: 8,348
opc.three (3/24/2013)
But consider the employee in the sysadmin Role looking to steal data without being detected.


And?
How adding an "sp_configure" command to a script used for stealing data will help to detect who's behind the SA user?
Post #1434736
Posted Sunday, March 24, 2013 9:27 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:23 AM
Points: 7,098, Visits: 12,605
Sergiy (3/24/2013)
opc.three (3/24/2013)
But consider the employee in the sysadmin Role looking to steal data without being detected.


And?
How adding an "sp_configure" command to a script used for stealing data will help to detect who's behind the SA user?

Version control. Change management processes. Code review. Layers...


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1434738
Posted Sunday, March 24, 2013 10:32 PM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:36 AM
Points: 4,576, Visits: 8,348
opc.three (3/24/2013)
[quote]Sergiy (3/24/2013)
Version control. Change management processes. Code review. Layers...


What all these words have to do with stealing data by launching an ad-hoc query using SA privilages?

Or you really believe someone with such intentions would submit such code for peer review before committing???
Post #1434744
Posted Monday, March 25, 2013 6:39 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, August 28, 2014 4:19 PM
Points: 51, Visits: 293
Over the years I have isolated xp_cmdshell, xp_sendmail etc from users and 3rd Party applications by using a stored procedure in front of the system procs. All inputs are checked and the made safe and logged.

Of course another option is to start using assemblies on some of this but then that starts meaning trusted databases and code that cant be read. These are different risk and potentially mopre serious risks.

It is better to help the developers/3rd Parties to change the code to something safer than just saying no. Minimal change is easier to adapt to then a completely different method accompanied by a steep learning curve


Post #1434877
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse