Database Penetration Testing
Database Penetration Testing
TESTING
TAZMEEN FATIMA
PENETRATION TESTING METHODOLOGY
OWASP
• Communication with the customer.
Pre-engagement • Outline the logistics of the test, expectations, legal implications, objectives
Interactions and goals
• Gain as much information as possible about the desired target.
Information Gathering • Domain names, network hosts, public and private IP blocks, routing tables,
SSL certificates, open ports .
Threat Modeling • To map threats that can occur in an organization and give ranks to the
discovered vulnerabilities and potential risks.
Vulnerability analysis • The process of identifying, enumerating, and prioritizing the vulnerabilities
in a system.
Exploitation • To exploit the found vulnerabilities using any program, script or tool.
Post- Exploitation • Any actions taken after a session is opened. A session is an open shell from a
successful exploit.
SQLPing tool:
• SQLPing Gathers the TCP port of each
instance by querying the SQL Server
Resolution Service on port 1434.
• Instance version and supported netlibs
are identified.
• Supports IP ranges.
• Also checks for weak passwords using
wordlists
SQLDict tool:
• SQLdict is a basic single IP brute-force MS SQL
Server password utility tool.
• Used to carry out a dictionary attack against a
specified IP address and a single user usually the sa
account.
• Enumeration is one of the crucial phases in penetration testing. The result of
the enumeration can lead to discovery of vulnerabilities that can be directly
exploited.
• Enumeration allows to gather information such as usernames, group names,
host names, algorithms etc.
• To enumerate a database and get server accounts we can use Nmap to
retrieve database information such as database name, table’s records,
username, password and etc.
• Nmap can also be used with Metasploit for enumeration.
The Following Script Performs Automatic Enumeration Using
Nmap And Metasploit
Using this script comes in handy when not much is known about the service
Warning: if there are multiple login attempts from the same account, they may get
blocked.
USING METASPLOIT
• Metasploit can alone be used for
enumeration but needs msf
credentials i.e. username and
password.
• Using Metasploit, we can set
username and password, steal
NTLM, gather information and
perform privilege escalation. The
script attached elucidates how it
can be done:
3- GET ALL USERS AND ROLES
Every database has users and have roles assigned to them. These
users have different privileges assigned to them based on their
responsibilities.
SQL server has different users and roles assigned to them. Such as
:
• Admin account sa : which is null by default. Newer versions of
SQL however, have mandated the sa account to have a
complex password.
• Dbadmin who can create, alter, drop or restore databases.
• Distributor admin: server login used for SQL replication
4-Perform Privilege Escalation