312-50V10 · Question #273
During a penetration test, a tester finds a target that is running MS SQL 2000 with default credentials. The tester assumes that the service is running with Local System account. How can this weakness
The correct answer is D. Invoking the stored procedure xp_cmdshell to spawn a Windows command shell. The xp_cmdshell extended stored procedure in MS SQL Server allows execution of Windows OS commands, and when the service runs as Local System, this grants full system-level command execution.
Question
During a penetration test, a tester finds a target that is running MS SQL 2000 with default credentials. The tester assumes that the service is running with Local System account. How can this weakness be exploited to access the system?
Options
- AUsing the Metasploit psexec module setting the SA / Admin credential
- BInvoking the stored procedure xp_shell to spawn a Windows command shell
- CInvoking the stored procedure cmd_shell to spawn a Windows command shell
- DInvoking the stored procedure xp_cmdshell to spawn a Windows command shell
How the community answered
(30 responses)- A7% (2)
- B13% (4)
- C10% (3)
- D70% (21)
Why each option
The xp_cmdshell extended stored procedure in MS SQL Server allows execution of Windows OS commands, and when the service runs as Local System, this grants full system-level command execution.
The Metasploit psexec module leverages SMB and Windows admin shares for remote execution - it does not exploit the SQL service's stored procedures or the xp_cmdshell attack vector specific to this scenario.
xp_shell is not a valid stored procedure in Microsoft SQL Server - this name does not exist and the command would fail.
cmd_shell is not a valid stored procedure name in Microsoft SQL Server - the correct procedure name is xp_cmdshell.
xp_cmdshell is a built-in extended stored procedure in Microsoft SQL Server that passes a string to the Windows command shell for execution and returns output as rows. When MS SQL Server runs under the Local System account - a highly privileged Windows account - commands executed via xp_cmdshell inherit that privilege level, giving the attacker full control of the underlying OS.
Concept tested: MS SQL Server xp_cmdshell OS command execution
Source: https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/xp-cmdshell-transact-sql
Topics
Community Discussion
No community discussion yet for this question.