SlideShare a Scribd company logo
1 of 124
Download to read offline
10 Deadly Sins of
SQL Server Configuration
The untold stories of a pentest monkey
Scott Sutherland
Network and Application Penetration Tester
Twitter: @_nullbind
Code: https://github.com/nullbind
https://github.com/netspi
Slides: http://slideshare.net/nullbind
http://slideshare.net/netspi
Blog: https://blog.netspi.com/author/scott-sutherland/
Who am I?
Presentation Overview
• Why security breaks
• Where security breaks
• SQL Server security basics
• Finding SQL Servers
• 10 deadly configurations
• What can be done
• Questions
Why Security
BREAKS
Why Security Breaks
• NOT the right skill set
‒ Most dev-ops and IT admins aren’t DBAs
‒ Modern DBMS can be complicated
• NOT a high priority / requirement
‒ Functionality
‒ Availability
‒ Performance
‒ Security
• NOT enough time
Where Security
BREAKS
Where Security Breaks
…at points of integration and trust
• Access to external sources
‒ Other databases
‒ Other servers
‒ On the file system / shares
• Cached authentication
• User impersonation
• Excessive privileges
• Explicit and implicit trusts
SQL Server
Security BASICS
SQL Server Security Basics: Services
What is SQL Server?
• SQL Server is software
• Each installation is called an “instance”
which runs as a set of Windows services
separate process, port, etc
• Services run with privileges of the Windows
service account
SQL Server Security Basics: Services
SQL Server Security Basics: Principals
Windows Server Level
• Windows accounts and groups
SQL Server Level
• SQL Server logins and SQL Server roles
Database Level
• Database users and database roles
SQL Server Security Basics: Principals
Windows Server Level
• Used to log into SQL Server
SQL Server Level
• Used to log into SQL Server
Database Level
• Database users are mapped to a login/account
• Used to access databases and data
SQL Server Security Basics: Principals
Windows Operating System
SQL Server Instance 1 (Windows Service)
Database 1
Table 2 Table 2 Table 3
Windows account
Domainmyuser2
Maps to database user
myuser2
Maps to database user
myuser1
SQL Server login
myuser1
SQL Server login
Domainmyuser2
SQL Server Security Basics: Roles
Important Server Roles
• Sysadmin role = DBA
• Public role = Everyone with connect
Important Database Roles
• Database owner = owns the database
• Db_owner role = any action in the database
Findings
SQL Servers
Finding SQL Servers: Unauthenticated
TCP/UDP Port Scanning
• Pros: Finds non domain instances
• Cons: Can be slow
Tools
• Metasploit
• Nessus
• SQLping3
• OSQL/SQLCMD
Finding SQL Servers: Authenticated
Service Principal Names (SPN)
• Pros: Fast and returns most SQL Servers on
the domain
• Cons: Will miss instances on non domain
systems
Tools
• setspn.exe
• adfind.exe
• Get-Spn.psm1
10 DEADLY
Configurations
10 Deadly Configurations
1. Logins with Sysadmin Privileges
2. Logins with IMPERSONATE Privileges
3. Database User Privileges
4. Procedures with SQL Injection
5. Public EXECUTE on Dangerous Procedures
6. Service Account Privileges
7. Domain User Privileges
8. Database Link Chaining and Excessive
Privileges
9. Weak and Default Passwords
10. No Transport Encryption
#1
Logins with
Sysadmin Privileges
#1 Logins with Excessive Privileges
What’s the issue?
• Applications connecting to SQL Server with
the “sa” login
• Applications connecting to SQL Server with
another login with the sysadmin role
#1 Logins with Excessive Privileges
Why is it a problem?
• Full access to all databases on server
• Often full access to the Windows server
• Free tools available for taking over the server
‒ Metasploit mssql_payload module
‒ Metasploit mssql_payload_sqli module
#1 Logins with Excessive Privileges
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
#1 Logins with Excessive Privileges
What’s the fix?
• Don’t use the “sa” login for your application
• Don’t assigned sysadmin privileges
• Do assign only the privileges necessary for the
application to meet functional requirements
#2
Logins with
IMPERSONATE Privileges
#2 Logins with IMPERSONATE privilege
What’s the issue?
• SQL Server logins with IMPERSONATE
privileges
#2 Logins with IMPERSONATE privilege
Why is it a problem?
• Intended to decrease privileges
• Often used to increase privileges
• Allows on demand escalation with no
constraints
• Sometimes results in sysadmin privileges
#2 Logins with IMPERSONATE privilege
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
• Login has privs to impersonate another login
• For sysadmin, login must of have privs to
impersonate a sysadmin or additional
escalation path
Why is it a problem?
#2 Manual Attack
Find logins that can be impersonated
#2 Manual Attack
Impersonate logins
#2 Manual Attack
Impersonate logins
#2 Manual Attack
Impersonate logins
#2 Automating the Attack
New Tools Released
• PowerShell
‒ Invoke-SqlServer-Escalate-ExecuteAs.psm1
• Metasploit
‒ mssql_escalate_execute_as.rb
‒ mssql_escalate_execute_as_sqli.rb
Why is it a problem?
#2 Automating the Attack
PowerShell
Why is it a problem?
#2 Automating the Attack
Metasploit
#2 Logins with IMPERSONATE privilege
What’s the fix?
• Don’t use the IMPERSONATE privilege to
access external resources
• Do consider using signed stored procedures as
an alternative
#3
Database Users with
Excess Privileges
#3 Database User Privileges
What’s the issue?
• Application logins used to connect to SQL
Server are mapped to database users that can
create stored procedures
• Example = db_owner database role
#3 Database User Privileges
Why is it a problem?
• Database users can create stored procedures
that EXECUTE AS OWNER
• Sysadmins own a lot of application databases
• So…database users can execute queries as
sysadmins
#3 Database User Privileges
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
• To escalate to sysadmin
‒ Database user can create procedures
‒ Sysadmin owns the database
‒ Database is flagged as trustworthy
Why is it a problem?
#3 Manual Attack
Db_owner Example
USE MyAppDb
GO
CREATE PROCEDURE sp_escalate_me
WITH EXECUTE AS OWNER
AS
EXEC sp_addsrvrolemember
'MyAppUser','sysadmin'
GO
Why is it a problem?
#3 Manual Attack
Db_owner Example
USE MyAppDb
GO
CREATE PROCEDURE sp_escalate_me
WITH EXECUTE AS OWNER
AS
EXEC sp_addsrvrolemember
'MyAppUser','sysadmin'
GO
SYSADMIN
is the
OWNER
#3 Automating the Attack
New Tools Released
• PowerShell
‒ Invoke-SqlServer-Escalate-Dbowner.psm1
• Metasploit
‒ mssql_escalate_dbowner.rb
‒ mssql_escalate_dbowner_sqli.rb
#3 Automating the Attack
PowerShell
#3 Automating the Attack
Metasploit
#3 Database User Privileges
What’s the fix?
• Don’t provide database users with privileges
to create procedures
• Don’t allow sysadmins to own application
databases
• Don’t flag databases as trustworthy
(when possible)
#4
Procedures with
SQL Injection
#4 Procedures with SQL Injection
What’s the issue?
• Stored procedures using dynamic SQL
insecurely
• Stored procedures configured to run as a login
with excessive privileges
#4 Procedures with SQL Injection
Why is it a problem?
• Can be vulnerable to SQL injection
• Can provide unauthorized data access
• Can be used to escalate privileges in some
cases
#4 Procedures with SQL Injection
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
• Dynamic SQL is used in the procedure
• Concatenating strings
#4 Procedures with SQL Injection
What are the attack requirements?
• Privilege escalation requirements
‒ WITH EXECUTE AS OWNER
• Database does have to be marked as trusted
‒ Signed with a certificate login
• Database does NOT have to be marked as
trusted
Find Signed Stored Procedures with Dynamic SQL
#4 Manual Attack
Review Code
#4 Manual Attack
CREATE PROCEDURE sp_sqli2
@DbName varchar(max)
AS
BEGIN
Declare @query as varchar(max)
SET @query = 'SELECT name FROM
master..sysdatabases where name
like ''%'+ @DbName+'%'' OR
name=''tempdb''';
EXECUTE(@query)
END
GO
Review Code
#4 Manual Attack
CREATE PROCEDURE sp_sqli2
@DbName varchar(max)
AS
BEGIN
Declare @query as varchar(max)
SET @query = 'SELECT name FROM
master..sysdatabases where name
like ''%'+ @DbName+'%'' OR
name=''tempdb''';
EXECUTE(@query)
END
GO
PURE EVIL
Inject Query to Execute OS Commands
#4 Manual Attack
EXEC MASTER.dbo.sp_sqli2
'master'';EXEC master..xp_cmdshell ''whoami''--';
Inject Query to Execute OS Commands
#4 Manual Attack
EXEC MASTER.dbo.sp_sqli2
'master'';EXEC master..xp_cmdshell ''whoami''--';
INJECTION
Review Code
#4 Manual Attack
CREATE PROCEDURE sp_sqli2
@DbName varchar(max)
AS
BEGIN
Declare @query as varchar(max)
SET @query = 'SELECT name FROM
master..sysdatabases where name
like ''%master';EXEC
master..xp_cmdshell ''whoami''-
-%'' OR name=''tempdb''';
EXECUTE(@query)
END
GO
Inject Query to Execute OS Commands
#4 Manual Attack
#4 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-SpSource.psm1
#4 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-SpSource.psm1
Export Stored Procedures
#4 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-SpSource.psm1
View Output
#4 Procedures with SQL Injection
What’s the fix?
• Do use parameterized queries
• Don’t concatenate strings in evil ways
• Don’t use EXECUTE AS OWNER to access
external resources
• Don’t flag databases are trustworthy
#4 Procedures with SQL Injection
What’s the fix?
• Do consider using signed procedures
1. Create certificate
2. Create login from certificate
3. Only assign required privileges to the
certificate login
4. Sign procedures with certificate to provide
access to required local and external
resources
#4 Procedures with SQL Injection
What’s the fix?
-- Create procedure with sqli fix
CREATE PROCEDURE sp_sqli_fix
@DbName varchar(max)
AS
BEGIN
SELECT name FROM
master..sysdatabases WHERE name =
'tempdb' OR name = @DbName;
END
GO
No EXECUTE AS OWNER
No concatenating
strings
#5
Public EXECUTE on
Dangerous Procedures
#5 Execute on Dangerous Procedures
What’s the issue?
• Dangerous stored procedures and functions
are available to the public server role by
default
#5 Execute on Dangerous Procedures
Why is it a problem?
• Remember, public = all logins
• Impact varies depending on procedure or
function
#5 Execute on Dangerous Procedures
Why is it a problem?
• xp_regread - Read registry as service account
• xp_dirtree - Capture/crack service account
NetNTLMv2 password hashes (35 billion a sec)
• SUSER_NAME - Enumerate SQL Server logins
• SUSER_SNAME - Enumerate domain users
#5 Execute on Dangerous Procedures
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
SUSER_SNAME Example: Get domain
#5 Manual Attack
Domain of SQL Server
SUSER_SNAME Example: Get Sample RID with SUSER_SID
#5 Many Attack
Full RID of
Domain Admins group
SUSER_SNAME Example: Extract Domain SID
#5 Manual Attack
Grab the first 48 Bytes of the full RID
RID = 0x0105000000000005150000009CC30DD479441EDEB31027D000020000
SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0
SUSER_SNAME Example: Create new full RID
#5 Manual Attack
1. Start with number, 500
2. Convert to hex, F401
3. Pad with 0 to 8 bytes, F4010000
4. Concatenate the SID and the new RID
SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0
RID = 0x0105000000000005150000009CC30DD479441EDEB31027D0F4010000
SUSER_SNAME Example: Enumerate Domain Account
#5 Manual Attack
1. Start with number, 500
2. Convert to hex, F401
3. Pad with 0 to 8 bytes, F4010000
4. Concatenate the SID and the new RID
SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0
RID = 0x0105000000000005150000009CC30DD479441EDEB31027D0F4010000
Enumerated domain
user
SUSER_SNAME Example: Enumerate All Domain Accounts,
Groups, and Computers
#5 Manual Attack
1. Increment number
2. Repeat 10,000 or more times
SUSER_SNAME Example: Network Takeover
#5 Manual Attack
1. Dictionary attack
2. Escalate privileges locally
3. Escalate privileges on the domain
#5 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Enum-SqlLogins.psm1
‒ Get-SqlServer-Enum-WinAccounts.psm1
• Metasploit
‒ mssql_enum_sql_logins.rb
‒ mssql_enum_domain_accounts.rb
‒ mssql_enum_domain_accounts_sqli.rb
#5 Automating the Attack
#5 Automating the Attack
#5 Execute on Dangerous Procedures
What’s the fix?
• Do deny execute privileges on dangerous
stored procedures and functions
• Do use one of the many hardening guides
available online or provided by Microsoft and
others
#6
Service Accounts with
Excessive Privileges
#6 Service Account Privileges
What’s the issue?
• SQL Server service (Windows) accounts
configured with local or domain admin
privileges
• The same SQL Server service (Windows)
account is often used to run multiple
unrelated servers or “shared”
#6 Service Account Privileges
Why is it a problem?
• Shared SQL Server service accounts have
inherit trust relationships, because the service
account has sysadmin privileges
#6 Service Account Privileges
Why is it a problem?
• Sysadmins can impersonate the SQL Server
service account
‒ xp_cmdshell
‒ agent options like cmdexec, PowerShell, and
vbscript
‒ Custom stored procedure
#6 Service Account Privileges
Why is it a problem?
• Oh yeah, don’t forget Public logins can steal
service account password hashes
#6 Service Account Privileges
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
• Service account is configured with local or
domain admins privileges
• xp_cmdshell, xp_dirtree, or xp_fileexists
procedure can be used
#6 Manual Attack: Execute as Service
Running OS
commands as
service account
Service account
is a local
administrator
#6 Manual Attack: Shared Accounts
InternetDMZIntranet
DB2
Captain Evil
DB1
Share Account +
Xp_cmdshell+
osql -E
#6 Manual Attack: SMB Relay
Captain Evil
Server A
Server B
1
2
3
4
5
#6 Service Account Privileges
What is the fix?
• Non-clustered servers
‒ Don’t run services as LocalSystem
‒ Don’t use local or domain accounts with local
administrator privileges
‒ Do use virtual service accounts
• Like a sandboxed NetworkService account
#6 Service Account Privileges
What is the fix?
• Clustered servers
‒ Do use domain accounts configured with least
privilege
‒ Don’t use the same service account across
servers that house unrelated applications
#7
Domain Users assigned
Excessive Privileges
#7 Domain User Privileges
What’s the issue?
• SQL Server Express installed on a domain
system gives ALL domain accounts CONNECT
privileges (through privilege inheritance)
‒ It can then carry over during upgrades
• Database administrators often provide all
domain accounts with database access
#7 Domain User Privileges
Windows Operating System
SQL Server Express
Database 1
Table 2 Table 2
BUILTINUsers
NT AUTHORITYAuthenticated
Users
Domain Users
(EVERYONE)
#7 Domain User Privileges
Why is that a problem?
• All domain accounts have unauthorized access
to database servers
• During network penetration tests it often
leads to privilege escalation paths that end in
Domain Admin
#7 Domain User Privileges
What are the attack requirements?
• A domain account
• List of SQL Servers
‒ SPNs can be dumped from Active Directory
No scanning required 
#7 Manual Attack
#7 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-CheckAccess.psm1
Other Tools
• Metasploit mssql_sql module
#7 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-CheckAccess.psm1
PS C:Get-SqlServer-Escalate-CheckAccess -ShowSum | export-csv c:tempsql-server-excessive-privs.csv
[*] ----------------------------------------------------------------------
[*] Start Time: 04/01/2014 10:00:00
[*] Domain: mydomain.com
[*] DC: dc1.mydomain.com
[*] Getting list of SQL Server instances from DC as mydomainmyuser...
[*] 5 SQL Server instances found in LDAP.
[*] Attempting to login into 5 SQL Server instances as mydomainmyuser...
[*] ----------------------------------------------------------------------
[-] Failed - server1.mydomain.com is not responding to pings
[-] Failed - server2.mydomain.com (192.168.1.102) is up, but authentication/query failed
[+] SUCCESS! - server3.mydomain.com,1433 (192.168.1.103) - Sysadmin: No - SvcIsDA: No
[+] SUCCESS! - server3.mydomain.comSQLEXPRESS (192.168.1.103) - Sysadmin: No - SvcIsDA: No
[+] SUCCESS! - server4.mydomain.comAppData (192.168.1.104) - Sysadmin: Yes - SvcIsDA: Yes
[*] ----------------------------------------------------------------------
[*] 3 of 5 SQL Server instances could be accessed.
[*] End Time: 04/01/2014 10:02:00 [*] Total Time: 00:02:00
[*] ----------------------------------------------------------------------
#7 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-CheckAccess.psm1
PS C:Get-SqlServer-Escalate-CheckAccess -ShowSum | export-csv c:tempsql-server-excessive-privs.csv
[*] ----------------------------------------------------------------------
[*] Start Time: 04/01/2014 10:00:00
[*] Domain: mydomain.com
[*] DC: dc1.mydomain.com
[*] Getting list of SQL Server instances from DC as mydomainmyuser...
[*] 5 SQL Server instances found in LDAP.
[*] Attempting to login into 5 SQL Server instances as mydomainmyuser...
[*] ----------------------------------------------------------------------
[-] Failed - server1.mydomain.com is not responding to pings
[-] Failed - server2.mydomain.com (192.168.1.102) is up, but authentication/query failed
[+] SUCCESS! - server3.mydomain.com,1433 (192.168.1.103) - Sysadmin: No - SvcIsDA: No
[+] SUCCESS! - server3.mydomain.comSQLEXPRESS (192.168.1.103) - Sysadmin: No - SvcIsDA: No
[+] SUCCESS! - server4.mydomain.comAppData (192.168.1.104) - Sysadmin: Yes - SvcIsDA: Yes
[*] ----------------------------------------------------------------------
[*] 3 of 5 SQL Server instances could be accessed.
[*] End Time: 04/01/2014 10:02:00 [*] Total Time: 00:02:00
[*] ----------------------------------------------------------------------
#7 Automating the Attack
New Tools Released
• PowerShell
‒ Get-SqlServer-Escalate-CheckAccess.psm1
#7 Domain User Privileges
What’s the fix?
• Don’t provide the “Domain Users” group with
privileges to log into any SQL Server
• Do remove the default login associated with
the “BUILTINUsers” group
#8
Database Link
Chaining & Excessive Privileges
#8 Excessive Database Link Privileges
What the issue?
• Database links are being configured with
excessive privileges
• Database links can be crawled via
OPENQUERY
• xp_cmdshell can be used via OPENQUERY
#8 Excessive Database Link Privileges
Why is that a problem?
• Attackers can often gain sysadmin privileges by
crawling database link chains
• Move from low value database to high one
• Take over Windows server via xp_dirtree or
xp_cmdshell
• Cached credentials can be recovered by admins
#8 Excessive Database Link Privileges
What are the attack requirements?
• SQL injection or a direct connection with
credentials to log into SQL Server
• One or more database links
• Database links preconfigured with sysadmin
privileges
#8 Excessive Database Link Privileges
#8 Excessive Database Link Privileges
Penetration Test Stats
• Database links exist (and can be crawled) in
about 50% of environments we’ve seen
• The max number of hops we’ve seen is 12
• The max number of server crawled is 226
• Usually executed through SQL injection
#8 Automating the Attack
New Tools Released
• PowerShell
‒ Get-MSSQLLinkPasswords.psm1
By Antti Rantasaari
Old Tools Released
• Metasploit
‒ mssql_linkcrawler.rb
‒ mssql_linkcrawler_sqli.rb
#8 Excessive Database Link Privileges
What’s the fix?
• Don’t use database links if you don’t need
them
• Do configure them with least privilege
• Do configure them to inherit the privileges of
the current login when possible
#9
Weak or Default
Passwords
#9 Weak or Default Passwords
What’s the issue?
• Default sa account password
• Default vendor account passwords
• Weak passwords
‒ test:test
‒ sa:password
‒ Etc…
#9 Weak or Default Passwords
Why is it a problem?
• Attackers can quickly gain unauthorized
access to servers and data
• Tools for attack are everywhere
‒ Metasploit
‒ Hydra
‒ SQLPing3
‒ Etc..
#9 Weak or Default Passwords
What are the attack requirements?
• List of SQL Servers
‒ Usually requires scanning
#9 Weak or Default Passwords
What’s the fix?
• Do set strong password policies
‒ They can be inherited from the domain
• Do change default vendor passwords
• Do disable the default sa account
• Do enforce development environments
#10
No Transport
Encryption
#10 No Transport Encryption
What’s the issue?
• By default, database communications are not
encrypted
#10 No Transport Encryption
What is it a problem?
• Sensitive data can be exposed via MITM
• SQL injection via MITM
‒ Can result in database and system compromise
• Free tools available
‒Atticuss/SQLViking (Go see the talk!)
‒ Ettercap and fancy filters
#10 No Transport Encryption
What are the attack requirements?
• Man in the middle position or local admin on
the client/server
#10 No Transport Encryption
What’s the fix??
• Do enable SSL encryption
http://support.microsoft.com/kb/316898
What can be done?
What can be done?
Prevent Unauthorized Access
• Enforce least privilege everywhere
• Use secure impersonation methods
• Parameterize queries in stored procedures
Detect Attempted Attacks
• Profiler (server access)
• DML Triggers (data mods)
• DDL Triggers (structure mods)
• SQL Server Audit ( server/database level)
Questions?
BE SAFE and
HACK RESPONSIBLY

More Related Content

What's hot

TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsTROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsScott Sutherland
 
Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksNetSPI
 
2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQLScott Sutherland
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationScott Sutherland
 
Beyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerBeyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerScott Sutherland
 
2017 Thotcon - Hacking SQL Servers on Scale with PowerShell
2017 Thotcon - Hacking SQL Servers on Scale with PowerShell2017 Thotcon - Hacking SQL Servers on Scale with PowerShell
2017 Thotcon - Hacking SQL Servers on Scale with PowerShellScott Sutherland
 
aclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundaclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundDirkjanMollema
 
Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016Daniel Bohannon
 
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerSecure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerScott Sutherland
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedMicah Hoffman
 
Hacked? Pray that the Attacker used PowerShell
Hacked? Pray that the Attacker used PowerShellHacked? Pray that the Attacker used PowerShell
Hacked? Pray that the Attacker used PowerShellNikhil Mittal
 
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL ServerScott Sutherland
 
Outlook and Exchange for the bad guys
Outlook and Exchange for the bad guysOutlook and Exchange for the bad guys
Outlook and Exchange for the bad guysNick Landers
 
Lateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkLateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkEC-Council
 
Forging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryNikhil Mittal
 
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerBeyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerNetSPI
 
Lateral Movement - Phreaknik 2016
Lateral Movement - Phreaknik 2016Lateral Movement - Phreaknik 2016
Lateral Movement - Phreaknik 2016Xavier Ashe
 
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery BlueHat Security Conference
 

What's hot (20)

TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsTROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
 
Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary Attacks
 
2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
 
Beyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL ServerBeyond xp_cmdshell: Owning the Empire through SQL Server
Beyond xp_cmdshell: Owning the Empire through SQL Server
 
2017 Thotcon - Hacking SQL Servers on Scale with PowerShell
2017 Thotcon - Hacking SQL Servers on Scale with PowerShell2017 Thotcon - Hacking SQL Servers on Scale with PowerShell
2017 Thotcon - Hacking SQL Servers on Scale with PowerShell
 
aclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHoundaclpwn - Active Directory ACL exploitation with BloodHound
aclpwn - Active Directory ACL exploitation with BloodHound
 
Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016Invoke-Obfuscation DerbyCon 2016
Invoke-Obfuscation DerbyCon 2016
 
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerSecure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection Exploited
 
Hacked? Pray that the Attacker used PowerShell
Hacked? Pray that the Attacker used PowerShellHacked? Pray that the Attacker used PowerShell
Hacked? Pray that the Attacker used PowerShell
 
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
 
Outlook and Exchange for the bad guys
Outlook and Exchange for the bad guysOutlook and Exchange for the bad guys
Outlook and Exchange for the bad guys
 
Lateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkLateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your Network
 
Forging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active DirectoryForging Trusts for Deception in Active Directory
Forging Trusts for Deception in Active Directory
 
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerBeyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
 
I hunt sys admins 2.0
I hunt sys admins 2.0I hunt sys admins 2.0
I hunt sys admins 2.0
 
Lateral Movement - Phreaknik 2016
Lateral Movement - Phreaknik 2016Lateral Movement - Phreaknik 2016
Lateral Movement - Phreaknik 2016
 
Defending Your "Gold"
Defending Your "Gold"Defending Your "Gold"
Defending Your "Gold"
 
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
 

Similar to 10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015

Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETFernando G. Guerrero
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETFernando G. Guerrero
 
Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)Sam Bowne
 
SQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsSQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsHostway|HOSTING
 
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)Sam Bowne
 
The Spy Who Loathed Me - An Intro to SQL Server Security
The Spy Who Loathed Me - An Intro to SQL Server SecurityThe Spy Who Loathed Me - An Intro to SQL Server Security
The Spy Who Loathed Me - An Intro to SQL Server SecurityChris Bell
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)Sam Bowne
 
Exploiting Active Directory Administrator Insecurities
Exploiting Active Directory Administrator InsecuritiesExploiting Active Directory Administrator Insecurities
Exploiting Active Directory Administrator InsecuritiesPriyanka Aash
 
SharePoint Security in an Insecure World - AUSPC 2012
SharePoint Security in an Insecure World - AUSPC 2012SharePoint Security in an Insecure World - AUSPC 2012
SharePoint Security in an Insecure World - AUSPC 2012Michael Noel
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesMariaDB plc
 
Application and Server Security
Application and Server SecurityApplication and Server Security
Application and Server SecurityBrian Pontarelli
 
Oracle database threats - LAOUC Webinar
Oracle database threats - LAOUC WebinarOracle database threats - LAOUC Webinar
Oracle database threats - LAOUC WebinarOsama Mustafa
 
Isaca sql server 2008 r2 security & auditing
Isaca sql server 2008 r2 security & auditingIsaca sql server 2008 r2 security & auditing
Isaca sql server 2008 r2 security & auditingAntonios Chatzipavlis
 
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShellScott Sutherland
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityMichael Noel
 
Hack your db before the hackers do
Hack your db before the hackers doHack your db before the hackers do
Hack your db before the hackers dofangjiafu
 
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...Michael Noel
 
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint Security
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint SecuritySPTechCon SFO 2012 - Understanding the Five Layers of SharePoint Security
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint SecurityMichael Noel
 
Database security best_practices
Database security best_practicesDatabase security best_practices
Database security best_practicesTarik Essawi
 

Similar to 10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015 (20)

Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
 
Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)
 
SQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsSQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite Things
 
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S Ch 9: Attacking Data Stores (Part 2 of 2)
 
The Spy Who Loathed Me - An Intro to SQL Server Security
The Spy Who Loathed Me - An Intro to SQL Server SecurityThe Spy Who Loathed Me - An Intro to SQL Server Security
The Spy Who Loathed Me - An Intro to SQL Server Security
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
 
Exploiting Active Directory Administrator Insecurities
Exploiting Active Directory Administrator InsecuritiesExploiting Active Directory Administrator Insecurities
Exploiting Active Directory Administrator Insecurities
 
SharePoint Security in an Insecure World - AUSPC 2012
SharePoint Security in an Insecure World - AUSPC 2012SharePoint Security in an Insecure World - AUSPC 2012
SharePoint Security in an Insecure World - AUSPC 2012
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best Practices
 
Where should I be encrypting my data?
Where should I be encrypting my data? Where should I be encrypting my data?
Where should I be encrypting my data?
 
Application and Server Security
Application and Server SecurityApplication and Server Security
Application and Server Security
 
Oracle database threats - LAOUC Webinar
Oracle database threats - LAOUC WebinarOracle database threats - LAOUC Webinar
Oracle database threats - LAOUC Webinar
 
Isaca sql server 2008 r2 security & auditing
Isaca sql server 2008 r2 security & auditingIsaca sql server 2008 r2 security & auditing
Isaca sql server 2008 r2 security & auditing
 
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
2017 OWASP SanFran March Meetup - Hacking SQL Server on Scale with PowerShell
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
 
Hack your db before the hackers do
Hack your db before the hackers doHack your db before the hackers do
Hack your db before the hackers do
 
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...
Security for SharePoint in an Insecure World - SharePoint Connections Amsterd...
 
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint Security
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint SecuritySPTechCon SFO 2012 - Understanding the Five Layers of SharePoint Security
SPTechCon SFO 2012 - Understanding the Five Layers of SharePoint Security
 
Database security best_practices
Database security best_practicesDatabase security best_practices
Database security best_practices
 

More from Scott Sutherland

Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)
Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)
Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)Scott Sutherland
 
How to Build and Validate Ransomware Attack Detections (Secure360)
How to Build and Validate Ransomware Attack Detections (Secure360)How to Build and Validate Ransomware Attack Detections (Secure360)
How to Build and Validate Ransomware Attack Detections (Secure360)Scott Sutherland
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2Scott Sutherland
 
Attack all the layers secure 360
Attack all the layers secure 360Attack all the layers secure 360
Attack all the layers secure 360Scott Sutherland
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseScott Sutherland
 
Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksScott Sutherland
 
WTF is Penetration Testing
WTF is Penetration TestingWTF is Penetration Testing
WTF is Penetration TestingScott Sutherland
 

More from Scott Sutherland (8)

Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)
Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)
Into the Abyss: Evaluating Active Directory SMB Shares on Scale (Secure360)
 
How to Build and Validate Ransomware Attack Detections (Secure360)
How to Build and Validate Ransomware Attack Detections (Secure360)How to Build and Validate Ransomware Attack Detections (Secure360)
How to Build and Validate Ransomware Attack Detections (Secure360)
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2
 
Attack all the layers secure 360
Attack all the layers secure 360Attack all the layers secure 360
Attack all the layers secure 360
 
Declaration of malWARe
Declaration of malWAReDeclaration of malWARe
Declaration of malWARe
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash Course
 
Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary Attacks
 
WTF is Penetration Testing
WTF is Penetration TestingWTF is Penetration Testing
WTF is Penetration Testing
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015

  • 1. 10 Deadly Sins of SQL Server Configuration The untold stories of a pentest monkey
  • 2. Scott Sutherland Network and Application Penetration Tester Twitter: @_nullbind Code: https://github.com/nullbind https://github.com/netspi Slides: http://slideshare.net/nullbind http://slideshare.net/netspi Blog: https://blog.netspi.com/author/scott-sutherland/ Who am I?
  • 3. Presentation Overview • Why security breaks • Where security breaks • SQL Server security basics • Finding SQL Servers • 10 deadly configurations • What can be done • Questions
  • 5. Why Security Breaks • NOT the right skill set ‒ Most dev-ops and IT admins aren’t DBAs ‒ Modern DBMS can be complicated • NOT a high priority / requirement ‒ Functionality ‒ Availability ‒ Performance ‒ Security • NOT enough time
  • 7. Where Security Breaks …at points of integration and trust • Access to external sources ‒ Other databases ‒ Other servers ‒ On the file system / shares • Cached authentication • User impersonation • Excessive privileges • Explicit and implicit trusts
  • 9. SQL Server Security Basics: Services What is SQL Server? • SQL Server is software • Each installation is called an “instance” which runs as a set of Windows services separate process, port, etc • Services run with privileges of the Windows service account
  • 10. SQL Server Security Basics: Services
  • 11. SQL Server Security Basics: Principals Windows Server Level • Windows accounts and groups SQL Server Level • SQL Server logins and SQL Server roles Database Level • Database users and database roles
  • 12. SQL Server Security Basics: Principals Windows Server Level • Used to log into SQL Server SQL Server Level • Used to log into SQL Server Database Level • Database users are mapped to a login/account • Used to access databases and data
  • 13. SQL Server Security Basics: Principals Windows Operating System SQL Server Instance 1 (Windows Service) Database 1 Table 2 Table 2 Table 3 Windows account Domainmyuser2 Maps to database user myuser2 Maps to database user myuser1 SQL Server login myuser1 SQL Server login Domainmyuser2
  • 14. SQL Server Security Basics: Roles Important Server Roles • Sysadmin role = DBA • Public role = Everyone with connect Important Database Roles • Database owner = owns the database • Db_owner role = any action in the database
  • 16. Finding SQL Servers: Unauthenticated TCP/UDP Port Scanning • Pros: Finds non domain instances • Cons: Can be slow Tools • Metasploit • Nessus • SQLping3 • OSQL/SQLCMD
  • 17. Finding SQL Servers: Authenticated Service Principal Names (SPN) • Pros: Fast and returns most SQL Servers on the domain • Cons: Will miss instances on non domain systems Tools • setspn.exe • adfind.exe • Get-Spn.psm1
  • 19. 10 Deadly Configurations 1. Logins with Sysadmin Privileges 2. Logins with IMPERSONATE Privileges 3. Database User Privileges 4. Procedures with SQL Injection 5. Public EXECUTE on Dangerous Procedures 6. Service Account Privileges 7. Domain User Privileges 8. Database Link Chaining and Excessive Privileges 9. Weak and Default Passwords 10. No Transport Encryption
  • 21. #1 Logins with Excessive Privileges What’s the issue? • Applications connecting to SQL Server with the “sa” login • Applications connecting to SQL Server with another login with the sysadmin role
  • 22. #1 Logins with Excessive Privileges Why is it a problem? • Full access to all databases on server • Often full access to the Windows server • Free tools available for taking over the server ‒ Metasploit mssql_payload module ‒ Metasploit mssql_payload_sqli module
  • 23. #1 Logins with Excessive Privileges What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server
  • 24. #1 Logins with Excessive Privileges What’s the fix? • Don’t use the “sa” login for your application • Don’t assigned sysadmin privileges • Do assign only the privileges necessary for the application to meet functional requirements
  • 26. #2 Logins with IMPERSONATE privilege What’s the issue? • SQL Server logins with IMPERSONATE privileges
  • 27. #2 Logins with IMPERSONATE privilege Why is it a problem? • Intended to decrease privileges • Often used to increase privileges • Allows on demand escalation with no constraints • Sometimes results in sysadmin privileges
  • 28. #2 Logins with IMPERSONATE privilege What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server • Login has privs to impersonate another login • For sysadmin, login must of have privs to impersonate a sysadmin or additional escalation path
  • 29. Why is it a problem? #2 Manual Attack Find logins that can be impersonated
  • 33. #2 Automating the Attack New Tools Released • PowerShell ‒ Invoke-SqlServer-Escalate-ExecuteAs.psm1 • Metasploit ‒ mssql_escalate_execute_as.rb ‒ mssql_escalate_execute_as_sqli.rb
  • 34. Why is it a problem? #2 Automating the Attack PowerShell
  • 35. Why is it a problem? #2 Automating the Attack Metasploit
  • 36. #2 Logins with IMPERSONATE privilege What’s the fix? • Don’t use the IMPERSONATE privilege to access external resources • Do consider using signed stored procedures as an alternative
  • 38. #3 Database User Privileges What’s the issue? • Application logins used to connect to SQL Server are mapped to database users that can create stored procedures • Example = db_owner database role
  • 39. #3 Database User Privileges Why is it a problem? • Database users can create stored procedures that EXECUTE AS OWNER • Sysadmins own a lot of application databases • So…database users can execute queries as sysadmins
  • 40. #3 Database User Privileges What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server • To escalate to sysadmin ‒ Database user can create procedures ‒ Sysadmin owns the database ‒ Database is flagged as trustworthy
  • 41. Why is it a problem? #3 Manual Attack Db_owner Example USE MyAppDb GO CREATE PROCEDURE sp_escalate_me WITH EXECUTE AS OWNER AS EXEC sp_addsrvrolemember 'MyAppUser','sysadmin' GO
  • 42. Why is it a problem? #3 Manual Attack Db_owner Example USE MyAppDb GO CREATE PROCEDURE sp_escalate_me WITH EXECUTE AS OWNER AS EXEC sp_addsrvrolemember 'MyAppUser','sysadmin' GO SYSADMIN is the OWNER
  • 43. #3 Automating the Attack New Tools Released • PowerShell ‒ Invoke-SqlServer-Escalate-Dbowner.psm1 • Metasploit ‒ mssql_escalate_dbowner.rb ‒ mssql_escalate_dbowner_sqli.rb
  • 44. #3 Automating the Attack PowerShell
  • 45. #3 Automating the Attack Metasploit
  • 46. #3 Database User Privileges What’s the fix? • Don’t provide database users with privileges to create procedures • Don’t allow sysadmins to own application databases • Don’t flag databases as trustworthy (when possible)
  • 48. #4 Procedures with SQL Injection What’s the issue? • Stored procedures using dynamic SQL insecurely • Stored procedures configured to run as a login with excessive privileges
  • 49. #4 Procedures with SQL Injection Why is it a problem? • Can be vulnerable to SQL injection • Can provide unauthorized data access • Can be used to escalate privileges in some cases
  • 50. #4 Procedures with SQL Injection What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server • Dynamic SQL is used in the procedure • Concatenating strings
  • 51. #4 Procedures with SQL Injection What are the attack requirements? • Privilege escalation requirements ‒ WITH EXECUTE AS OWNER • Database does have to be marked as trusted ‒ Signed with a certificate login • Database does NOT have to be marked as trusted
  • 52. Find Signed Stored Procedures with Dynamic SQL #4 Manual Attack
  • 53. Review Code #4 Manual Attack CREATE PROCEDURE sp_sqli2 @DbName varchar(max) AS BEGIN Declare @query as varchar(max) SET @query = 'SELECT name FROM master..sysdatabases where name like ''%'+ @DbName+'%'' OR name=''tempdb'''; EXECUTE(@query) END GO
  • 54. Review Code #4 Manual Attack CREATE PROCEDURE sp_sqli2 @DbName varchar(max) AS BEGIN Declare @query as varchar(max) SET @query = 'SELECT name FROM master..sysdatabases where name like ''%'+ @DbName+'%'' OR name=''tempdb'''; EXECUTE(@query) END GO PURE EVIL
  • 55. Inject Query to Execute OS Commands #4 Manual Attack EXEC MASTER.dbo.sp_sqli2 'master'';EXEC master..xp_cmdshell ''whoami''--';
  • 56. Inject Query to Execute OS Commands #4 Manual Attack EXEC MASTER.dbo.sp_sqli2 'master'';EXEC master..xp_cmdshell ''whoami''--'; INJECTION
  • 57. Review Code #4 Manual Attack CREATE PROCEDURE sp_sqli2 @DbName varchar(max) AS BEGIN Declare @query as varchar(max) SET @query = 'SELECT name FROM master..sysdatabases where name like ''%master';EXEC master..xp_cmdshell ''whoami''- -%'' OR name=''tempdb'''; EXECUTE(@query) END GO
  • 58. Inject Query to Execute OS Commands #4 Manual Attack
  • 59. #4 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-SpSource.psm1
  • 60. #4 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-SpSource.psm1 Export Stored Procedures
  • 61. #4 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-SpSource.psm1 View Output
  • 62. #4 Procedures with SQL Injection What’s the fix? • Do use parameterized queries • Don’t concatenate strings in evil ways • Don’t use EXECUTE AS OWNER to access external resources • Don’t flag databases are trustworthy
  • 63. #4 Procedures with SQL Injection What’s the fix? • Do consider using signed procedures 1. Create certificate 2. Create login from certificate 3. Only assign required privileges to the certificate login 4. Sign procedures with certificate to provide access to required local and external resources
  • 64. #4 Procedures with SQL Injection What’s the fix? -- Create procedure with sqli fix CREATE PROCEDURE sp_sqli_fix @DbName varchar(max) AS BEGIN SELECT name FROM master..sysdatabases WHERE name = 'tempdb' OR name = @DbName; END GO No EXECUTE AS OWNER No concatenating strings
  • 66. #5 Execute on Dangerous Procedures What’s the issue? • Dangerous stored procedures and functions are available to the public server role by default
  • 67. #5 Execute on Dangerous Procedures Why is it a problem? • Remember, public = all logins • Impact varies depending on procedure or function
  • 68. #5 Execute on Dangerous Procedures Why is it a problem? • xp_regread - Read registry as service account • xp_dirtree - Capture/crack service account NetNTLMv2 password hashes (35 billion a sec) • SUSER_NAME - Enumerate SQL Server logins • SUSER_SNAME - Enumerate domain users
  • 69. #5 Execute on Dangerous Procedures What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server
  • 70. SUSER_SNAME Example: Get domain #5 Manual Attack Domain of SQL Server
  • 71. SUSER_SNAME Example: Get Sample RID with SUSER_SID #5 Many Attack Full RID of Domain Admins group
  • 72. SUSER_SNAME Example: Extract Domain SID #5 Manual Attack Grab the first 48 Bytes of the full RID RID = 0x0105000000000005150000009CC30DD479441EDEB31027D000020000 SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0
  • 73. SUSER_SNAME Example: Create new full RID #5 Manual Attack 1. Start with number, 500 2. Convert to hex, F401 3. Pad with 0 to 8 bytes, F4010000 4. Concatenate the SID and the new RID SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0 RID = 0x0105000000000005150000009CC30DD479441EDEB31027D0F4010000
  • 74. SUSER_SNAME Example: Enumerate Domain Account #5 Manual Attack 1. Start with number, 500 2. Convert to hex, F401 3. Pad with 0 to 8 bytes, F4010000 4. Concatenate the SID and the new RID SID = 0x0105000000000005150000009CC30DD479441EDEB31027D0 RID = 0x0105000000000005150000009CC30DD479441EDEB31027D0F4010000 Enumerated domain user
  • 75. SUSER_SNAME Example: Enumerate All Domain Accounts, Groups, and Computers #5 Manual Attack 1. Increment number 2. Repeat 10,000 or more times
  • 76. SUSER_SNAME Example: Network Takeover #5 Manual Attack 1. Dictionary attack 2. Escalate privileges locally 3. Escalate privileges on the domain
  • 77. #5 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Enum-SqlLogins.psm1 ‒ Get-SqlServer-Enum-WinAccounts.psm1 • Metasploit ‒ mssql_enum_sql_logins.rb ‒ mssql_enum_domain_accounts.rb ‒ mssql_enum_domain_accounts_sqli.rb
  • 80. #5 Execute on Dangerous Procedures What’s the fix? • Do deny execute privileges on dangerous stored procedures and functions • Do use one of the many hardening guides available online or provided by Microsoft and others
  • 82. #6 Service Account Privileges What’s the issue? • SQL Server service (Windows) accounts configured with local or domain admin privileges • The same SQL Server service (Windows) account is often used to run multiple unrelated servers or “shared”
  • 83. #6 Service Account Privileges Why is it a problem? • Shared SQL Server service accounts have inherit trust relationships, because the service account has sysadmin privileges
  • 84. #6 Service Account Privileges Why is it a problem? • Sysadmins can impersonate the SQL Server service account ‒ xp_cmdshell ‒ agent options like cmdexec, PowerShell, and vbscript ‒ Custom stored procedure
  • 85. #6 Service Account Privileges Why is it a problem? • Oh yeah, don’t forget Public logins can steal service account password hashes
  • 86. #6 Service Account Privileges What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server • Service account is configured with local or domain admins privileges • xp_cmdshell, xp_dirtree, or xp_fileexists procedure can be used
  • 87. #6 Manual Attack: Execute as Service Running OS commands as service account Service account is a local administrator
  • 88. #6 Manual Attack: Shared Accounts InternetDMZIntranet DB2 Captain Evil DB1 Share Account + Xp_cmdshell+ osql -E
  • 89. #6 Manual Attack: SMB Relay Captain Evil Server A Server B 1 2 3 4 5
  • 90. #6 Service Account Privileges What is the fix? • Non-clustered servers ‒ Don’t run services as LocalSystem ‒ Don’t use local or domain accounts with local administrator privileges ‒ Do use virtual service accounts • Like a sandboxed NetworkService account
  • 91. #6 Service Account Privileges What is the fix? • Clustered servers ‒ Do use domain accounts configured with least privilege ‒ Don’t use the same service account across servers that house unrelated applications
  • 93. #7 Domain User Privileges What’s the issue? • SQL Server Express installed on a domain system gives ALL domain accounts CONNECT privileges (through privilege inheritance) ‒ It can then carry over during upgrades • Database administrators often provide all domain accounts with database access
  • 94. #7 Domain User Privileges Windows Operating System SQL Server Express Database 1 Table 2 Table 2 BUILTINUsers NT AUTHORITYAuthenticated Users Domain Users (EVERYONE)
  • 95. #7 Domain User Privileges Why is that a problem? • All domain accounts have unauthorized access to database servers • During network penetration tests it often leads to privilege escalation paths that end in Domain Admin
  • 96. #7 Domain User Privileges What are the attack requirements? • A domain account • List of SQL Servers ‒ SPNs can be dumped from Active Directory No scanning required 
  • 98. #7 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-CheckAccess.psm1 Other Tools • Metasploit mssql_sql module
  • 99. #7 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-CheckAccess.psm1 PS C:Get-SqlServer-Escalate-CheckAccess -ShowSum | export-csv c:tempsql-server-excessive-privs.csv [*] ---------------------------------------------------------------------- [*] Start Time: 04/01/2014 10:00:00 [*] Domain: mydomain.com [*] DC: dc1.mydomain.com [*] Getting list of SQL Server instances from DC as mydomainmyuser... [*] 5 SQL Server instances found in LDAP. [*] Attempting to login into 5 SQL Server instances as mydomainmyuser... [*] ---------------------------------------------------------------------- [-] Failed - server1.mydomain.com is not responding to pings [-] Failed - server2.mydomain.com (192.168.1.102) is up, but authentication/query failed [+] SUCCESS! - server3.mydomain.com,1433 (192.168.1.103) - Sysadmin: No - SvcIsDA: No [+] SUCCESS! - server3.mydomain.comSQLEXPRESS (192.168.1.103) - Sysadmin: No - SvcIsDA: No [+] SUCCESS! - server4.mydomain.comAppData (192.168.1.104) - Sysadmin: Yes - SvcIsDA: Yes [*] ---------------------------------------------------------------------- [*] 3 of 5 SQL Server instances could be accessed. [*] End Time: 04/01/2014 10:02:00 [*] Total Time: 00:02:00 [*] ----------------------------------------------------------------------
  • 100. #7 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-CheckAccess.psm1 PS C:Get-SqlServer-Escalate-CheckAccess -ShowSum | export-csv c:tempsql-server-excessive-privs.csv [*] ---------------------------------------------------------------------- [*] Start Time: 04/01/2014 10:00:00 [*] Domain: mydomain.com [*] DC: dc1.mydomain.com [*] Getting list of SQL Server instances from DC as mydomainmyuser... [*] 5 SQL Server instances found in LDAP. [*] Attempting to login into 5 SQL Server instances as mydomainmyuser... [*] ---------------------------------------------------------------------- [-] Failed - server1.mydomain.com is not responding to pings [-] Failed - server2.mydomain.com (192.168.1.102) is up, but authentication/query failed [+] SUCCESS! - server3.mydomain.com,1433 (192.168.1.103) - Sysadmin: No - SvcIsDA: No [+] SUCCESS! - server3.mydomain.comSQLEXPRESS (192.168.1.103) - Sysadmin: No - SvcIsDA: No [+] SUCCESS! - server4.mydomain.comAppData (192.168.1.104) - Sysadmin: Yes - SvcIsDA: Yes [*] ---------------------------------------------------------------------- [*] 3 of 5 SQL Server instances could be accessed. [*] End Time: 04/01/2014 10:02:00 [*] Total Time: 00:02:00 [*] ----------------------------------------------------------------------
  • 101. #7 Automating the Attack New Tools Released • PowerShell ‒ Get-SqlServer-Escalate-CheckAccess.psm1
  • 102. #7 Domain User Privileges What’s the fix? • Don’t provide the “Domain Users” group with privileges to log into any SQL Server • Do remove the default login associated with the “BUILTINUsers” group
  • 103. #8 Database Link Chaining & Excessive Privileges
  • 104. #8 Excessive Database Link Privileges What the issue? • Database links are being configured with excessive privileges • Database links can be crawled via OPENQUERY • xp_cmdshell can be used via OPENQUERY
  • 105. #8 Excessive Database Link Privileges Why is that a problem? • Attackers can often gain sysadmin privileges by crawling database link chains • Move from low value database to high one • Take over Windows server via xp_dirtree or xp_cmdshell • Cached credentials can be recovered by admins
  • 106. #8 Excessive Database Link Privileges What are the attack requirements? • SQL injection or a direct connection with credentials to log into SQL Server • One or more database links • Database links preconfigured with sysadmin privileges
  • 107. #8 Excessive Database Link Privileges
  • 108. #8 Excessive Database Link Privileges Penetration Test Stats • Database links exist (and can be crawled) in about 50% of environments we’ve seen • The max number of hops we’ve seen is 12 • The max number of server crawled is 226 • Usually executed through SQL injection
  • 109. #8 Automating the Attack New Tools Released • PowerShell ‒ Get-MSSQLLinkPasswords.psm1 By Antti Rantasaari Old Tools Released • Metasploit ‒ mssql_linkcrawler.rb ‒ mssql_linkcrawler_sqli.rb
  • 110. #8 Excessive Database Link Privileges What’s the fix? • Don’t use database links if you don’t need them • Do configure them with least privilege • Do configure them to inherit the privileges of the current login when possible
  • 112. #9 Weak or Default Passwords What’s the issue? • Default sa account password • Default vendor account passwords • Weak passwords ‒ test:test ‒ sa:password ‒ Etc…
  • 113. #9 Weak or Default Passwords Why is it a problem? • Attackers can quickly gain unauthorized access to servers and data • Tools for attack are everywhere ‒ Metasploit ‒ Hydra ‒ SQLPing3 ‒ Etc..
  • 114. #9 Weak or Default Passwords What are the attack requirements? • List of SQL Servers ‒ Usually requires scanning
  • 115. #9 Weak or Default Passwords What’s the fix? • Do set strong password policies ‒ They can be inherited from the domain • Do change default vendor passwords • Do disable the default sa account • Do enforce development environments
  • 117. #10 No Transport Encryption What’s the issue? • By default, database communications are not encrypted
  • 118. #10 No Transport Encryption What is it a problem? • Sensitive data can be exposed via MITM • SQL injection via MITM ‒ Can result in database and system compromise • Free tools available ‒Atticuss/SQLViking (Go see the talk!) ‒ Ettercap and fancy filters
  • 119. #10 No Transport Encryption What are the attack requirements? • Man in the middle position or local admin on the client/server
  • 120. #10 No Transport Encryption What’s the fix?? • Do enable SSL encryption http://support.microsoft.com/kb/316898
  • 121. What can be done?
  • 122. What can be done? Prevent Unauthorized Access • Enforce least privilege everywhere • Use secure impersonation methods • Parameterize queries in stored procedures Detect Attempted Attacks • Profiler (server access) • DML Triggers (data mods) • DDL Triggers (structure mods) • SQL Server Audit ( server/database level)
  • 124. BE SAFE and HACK RESPONSIBLY

Editor's Notes

  1. Intro ------- im me Network/ app pentester @ netspi seen many App deployments we test defense in depth - network device/fw configurations - good - server hardening- good - app - bad (web,mobile,thick etc) - db - this talk takes place here… What happens when an attacker gets there  Moving beyond one db = da! this will focus on mis configs that compound the risk associated with sqli and weak passwords and show how they can expose the whole business ...not just the app, very common ill cover the practical attacks and provide a few demos/video examples. this is semi-technical talk, should be interested to app owners, devops, devs, but should be old news to most dbas note: many of these concepts can be applied to other database platformas like Oracle…
  2. This is a big issue, because many vendors and developers use SQL Server Express in enterprise environments.