Module 16 Flashcards

(53 cards)

1
Q

What type of database management system is Microsoft SQL Server?

A

It is a proprietary relational database management system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is one way to enumerate SQL server instances that use Kerberos authentication?

A

Query for the Service Principal Names (SPNs) associated with the SQL service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What information can be obtained by enumerating MSSQLSvc SPNs?

A

The hostname of the SQL servers and the service accounts used to run them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the ldapsearch filter used to find MS SQL Server SPNs?

A

(&(samAccountType=805306368)(servicePrincipalName=MSSQLSvc*))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If a SQL server isn’t configured for Kerberos, what is an alternative enumeration method?

A

Scanning for open ports commonly used by MS SQL Server, such as TCP port 1433.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What service, if running, allows for minimal information gathering about a SQL instance without any specific roles?

A

The SQLBrowser service, which typically runs on port 1434/UDP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the command in the provided material to query the SQLBrowser service?

A

beacon> sql-1434udp [ip_address]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the minimum role a user needs on a SQL instance to perform further interaction beyond basic SQLBrowser enumeration?

A

The ‘public’ role.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the SQL-BOF command to get detailed information about a SQL server instance, like its version, service account, and authentication mode?

A

beacon> sql-info [hostname]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which SQL-BOF command is used to query for the current user’s roles and permissions on a SQL instance?

A

beacon> sql-whoami [hostname]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name three privileged roles on a SQL instance that are of particular interest to an attacker.

A

serveradmin, securityadmin, and sysadmin.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What permission does the ‘public’ role grant that is useful for data-hunting?

A

It grants permission to query the database instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the SQL-BOF command to execute an arbitrary SQL query?

A

beacon> sql-query [hostname] “[SQL_QUERY]”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What SQL query can be used to retrieve the name of the current SQL server?

A

SELECT @@SERVERNAME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the sql-databases command do?

A

It lists the available databases on the SQL instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which command is used to list the tables within a specific database?

A

The sql-tables command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In MS SQL exploitation, what is the most common prerequisite role needed to enable code execution techniques?

A

The ‘sysadmin’ role.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The _____ stored procedure is the most well-known method for executing shell commands via a SQL server.

A

xp_cmdshell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What SQL query is used to check if xp_cmdshell is enabled?

A

SELECT name,value FROM sys.configurations WHERE name = ‘xp_cmdshell’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

In the configuration table, what value indicates that xp_cmdshell is disabled?

A

A value of 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What SQL-BOF command enables the xp_cmdshell stored procedure?

A

beacon> sql-enablexp [hostname]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Under what user context are commands executed via xp_cmdshell typically run?

A

The context of the principal running the sqlservr process, often SYSTEM or a service account.

23
Q

What is the SQL-BOF command for executing a system command using xp_cmdshell?

A

beacon> sql-xpcmd [hostname] “[command]”

24
Q

Which of the code execution techniques discussed (xp_cmdshell, OLE, CLR) is the only one that can return command output directly?

25
What is the SQL-BOF command to disable `xp_cmdshell` after use?
beacon> sql-disablexp [hostname]
26
What does OLE stand for in the context of SQL Server?
Object Linking and Embedding.
27
Which set of stored procedures allows a SQL server to interact with arbitrary COM objects?
OLE Automation stored procedures.
28
Name two of the OLE Automation stored procedures.
sp_OACreate, sp_OADestroy, sp_OAGetProperty, sp_OAMethod, etc.
29
The `sql-olecmd` BOF uses which COM object to run shell commands?
WScript.Shell
30
What SQL query checks if OLE Automation Procedures are enabled?
SELECT name,value FROM sys.configurations WHERE name = 'Ole Automation Procedures'
31
What is the SQL-BOF command to enable OLE Automation Procedures?
beacon> sql-enableole [hostname]
32
What is a major limitation of using OLE Automation for code execution compared to `xp_cmdshell`?
It cannot return output from the executed command.
33
What is the SQL-BOF command for executing a system command via OLE Automation?
beacon> sql-olecmd [hostname] "[command]"
34
What is the SQL-BOF command to disable OLE Automation Procedures?
beacon> sql-disableole [hostname]
35
What feature introduced in SQL Server 2005 integrated the .NET Framework, allowing stored procedures to be written in languages like C#?
SQL Common Language Runtime (CLR).
36
For a C# method to be compatible with SQL CLR, it must be decorated with what attribute?
The SqlProcedureAttribute.
37
What SQL query checks if SQL CLR is enabled?
SELECT value FROM sys.configurations WHERE name = 'clr enabled'
38
What SQL-BOF command is used to enable SQL CLR?
beacon> sql-enableclr [hostname]
39
What is the SQL-BOF command to load a custom .NET assembly and execute a procedure from it via SQL CLR?
beacon> sql-clr [hostname] [path_to_dll] [procedure_name]
40
What should be done with SQL CLR after a successful attack?
It should be disabled using the `sql-disableclr` command.
41
What feature in SQL Server allows an instance to connect with other data sources, including other SQL servers?
Linked Servers.
42
What is the SQL-BOF command to enumerate the links a server has with other SQL instances?
beacon> sql-links [hostname]
43
How can you execute a query on a linked server using the `sql-query` BOF?
By specifying the linked server's name in the final argument of the command.
44
The security context you receive on a linked server depends on what?
It depends on how the link itself is configured (e.g., hardcoded credentials or inherited context).
45
It is possible to have _____ privileges on a linked server even if you don't have that access on the initial server.
sysadmin
46
What setting must be enabled on a server link to allow the calling of stored procedures (like `sp_configure`) on the linked server?
RPC Out.
47
Which SQL-BOF command can be used to check the RPC status of a server's links?
beacon> sql-checkrpc [hostname]
48
What is the command to enable `RPC Out` on a specific link?
beacon> sql-enablerpc [hostname] [linked_server_name]
49
What kind of account is `NT Service\MSSQLSERVER`?
A local virtual account that can access network resources using the computer account's credentials.
50
SQL service accounts often have interesting token privileges that can be abused for _____.
privilege escalation
51
What specific token privilege, often held by service accounts, can be abused to impersonate a SYSTEM process and escalate privileges?
SeImpersonatePrivilege.
52
What is the name of the tool mentioned in the source material for exploiting token privileges like SeImpersonatePrivilege?
SweetPotato.
53
Describe the general process by which SweetPotato escalates privileges.
It creates a named pipe, coerces a SYSTEM process to connect, impersonates that process's token, and uses it to spawn a new process as SYSTEM.