IBM DB2 – port 50000

IBM DB2 database quick reference.

Discover DB2 instances

Default instance is db2inst1.

Using Ncat

sudo ncat -nv --source-port 53 $IP 50000

Using Metasploit

See Metasploit.

msfconsole
search db2
use auxiliary/scanner/db2/db2_version
show options
SET RPORT 50000
set RHOSTS x.x.x.x
set DATABASE toolsdb

Using Nmap NSE

❗ Nmap NSE on DB2 are only for the IBM DB2 Administration Server (DAS) on TCP or UDP port 523.

ls -la /usr/share/nmap/scripts/*db2*
/usr/share/nmap/scripts/broadcast-db2-discover.nse
/usr/share/nmap/scripts/db2-das-info.nse

Install the DB2 client

💡 When possible, use SQuirreL instead!! And download db2 jdbc driver.

# Install IBM Data Server Runtime Client
# Unzip the installer
cd rtcl
./db2setup -f sysreq

# A window will open
Click Next
Directory /opt/ibm/db2/V11.5
Typical
Uncheck Create instance
Check I agree to the IBM terms
Click Next
Click Finish

Click on Post-installation Steps
# Run the validation tool
/opt/ibm/db2/V11.5/bin/db2val

export PATH="$PATH:/opt/ibm/db2/V11.5/bin"

Connect to database instance using the DB2 client

###export DB2INSTANCE=DB2_01
db2cli
db2 => CONNECT TO myIP:myPort/myDB USER myid01 USING mypw01

Default Users & Passwords

db2inst1/db2inst1
db2inst2/db2inst2
db2admin/db2admin

#-------------------------------------------------------------------------------
# Configurations / Parameters
#-------------------------------------------------------------------------------
# Configuration file

# Start

# Stop

# Execute OS commands from within client


#-------------------------------------------------------------------------------
# Default Users / Passwords
#-------------------------------------------------------------------------------
In /usr/share/metasploit-framework/data/wordlists/db2_default_pass.txt

SQL Injection

http://db2guideonline.blogspot.com/2014/09/example-sql-injection-in-db2-how-to.html