312-50V11 · 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…
The correct answer is D. Invoking the stored procedure xp_cmdshell to spawn a Windows command shell. MS SQL Server exposes the stored procedure xp_cmdshell, which allows execution of Windows OS commands directly from the database engine when running as Local System.
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
(24 responses)- A17% (4)
- B8% (2)
- C4% (1)
- D71% (17)
Why each option
MS SQL Server exposes the stored procedure xp_cmdshell, which allows execution of Windows OS commands directly from the database engine when running as Local System.
The Metasploit psexec module is used for remote lateral movement using valid credentials, not for exploiting SQL Server stored procedures to execute OS commands directly from the database.
xp_shell is not a valid or built-in SQL Server stored procedure; it does not exist in MS SQL and would produce an error if invoked.
cmd_shell is not a valid SQL Server stored procedure; the correct name is xp_cmdshell, and cmd_shell would not execute successfully.
xp_cmdshell is a legitimate extended stored procedure in MS SQL Server that spawns a Windows command shell and returns output as rows. Because the SQL Server service runs as Local System in this scenario, any OS command executed via xp_cmdshell inherits SYSTEM-level privileges, giving the attacker full control of the host.
Concept tested: 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.