Tuesday, October 17, 2017

Exploiting a VMWare File Lock Hole - LET'S GRAB THAT VMDK AND NTDS.DIT!

An interesting note on VMware file locks...




The VMDK file is locked by the ESX hypervisor when the host is active. Without access to the vCenter instance or SAN/NAS/Storage device directly, this is a problem.




This is a problem particularly when your target is privileged information... like the NTDS.DIT file for an Active Directory domain.




As you can probably guess, this was an issue I recently investigated and an attack that was devised from it.




VMware places a lock on the active VMDK file to prevent any sort of tampering/corruption/access issues with a live host. This is, by design, a safeguard against a number of attacks. When presented with hypervisor access (strictly on specific hosts), but the ability to administer parts of the system, this is a fairly easy issue to bypass.




In this case, I was after the NTDS.DIT file. This attack blended a number of operational security flaws and strategies to bypass active security controls.




First, with access to the hypervisor and disks, the issue is removing any restrictions by VMware to accessing the VMDK file which operates as the fixed disk for the host. Without a command line or vCenter, you aren't left with many options.



So what do you do?



Shoot the hostage.


Snapshot the host.




Snapshotting the host creates a new VMDK delta file. Essentially, for hypervisors, this becomes the "new hard disk", with the OLD, original VMDK file as the "reference disk." The new VMDK DELTA FILE is where the host goes to write/read any changes from the reference disk. The lock on the original disk is essentially "moved" to the new disk. The old disk exists as a reference and restore point.



From this point onward, you are able to clone/copy the original VMDK file as you see fit with NO restrictions from VMware.



Next, you take the original VMDK file and copy it to a new location. This allows you to spin up a NEW host with the old disk, enabling you to modify or play with the original machine. As Active Directory logs changes and syncs via DFS, you will have a copy of the schema as of whatever that period of update is set by the network administrator.



The problem now becomes "How do I get that NTDS.DIT file?"




I'm glad you asked.




This is an OLD SCHOOL trick from a LONG TIME ago.



You have the ability now to treat the DOMAIN CONTROLLER as if it's a physical host. In ye olden days, this was gold.



Spin up the newly cloned DC as an ISOLATED VM. DO NOT UNDER ANY CIRCUMSTANCES ALLOW IT TO CONNECT TO THE NETWORK OR YOU WILL DESTROY AD. Period. No questions asked. DON'T DO IT.



Spin up the new host and it will likely fail. This is good.



Load up an ISO (you can do this on another host, but windows security will be an issue for permissions.) that allows you to obtain file system access. (Hiren's is a nice choice.)



Boot the ISO on the new host with the ISO as your boot/live disk.

(Edit: Yes, I know that in certain environments, just loading up an ISO or live disk *cough*kali or a vanilla Linux*cough*  and copying the files out directly is much shorter and completely valid as an attack here. The issue at hand was an additional layer of security that made that type of attack here unfeasible and unnecessarily "loud".)





Navigate to the system drive: \windows\system32.



You will see two files of interest. CMD.EXE and UTILMAN.EXE.



UTILMAN is awesome. It's the accessibility option/menus for windows that HAPPENS to be accessible pre-login. (Windows + U or the icon in the lower left corner.)
Rename UTILMAN.EXE to something else. DON'T DELETE IT.



Make a copy of CMD.EXE (or whatever executable you want) and rename it UTILMAN.EXE.

Reboot the target into windows. You may want to try DIRECTORY SERVICES RESTORE MODE and it may only boot to that. Without network connections, the DC will likely take 30 minutes to boot, if at all.



Directory services restore mode is fantastic. Typically, you can't login to a DC as a local admin as windows keeps you from doing so, to prevent this exact type of attack.



DSR allows you to do so.



Eventually, you will boot into windows in DSR. Hotkey WINDOWS KEY + U or click the icon in the bottom left corner... VOILA! You are presented, prelogin with a command line running in the context of NT AUTHORITY / SYSTEM. This is a non-interactive, super user account.



Change the local password through this command line to one of your choosing.




Next, login locally to the AD domain controller with this and you are now the administrator of the machine.



From this point, extraction of the SYSTEM hive and NTDS.DIT is fairly simple. Copy/paste the files to a different location, reset the security descriptors and exfiltrate the data. Since you DON'T WANT TO HOOK IT UP TO THE NETWORK, an alternate drive/vmdk to copy to works... or you can simply add the VMDK as a hard drive on another host you do control.



That's it. A nice way to obtain privileged, secured system data from a host with only hypervisor access.




Enjoy.





Saturday, September 9, 2017

OpenVAS & Kali 2017 - Job for openvas-scanner.service failed because a timeout was exceeded

You probably found this through the same google searching I did. No real good answers.












"Job for openvas-scanner.service failed because a timeout was exceeded"




pico /etc/init.d/openvas-scanner
pico /etc/init.d/openvas-manager


Change the DODTIME=(integer)


Double the values.


Try again. Works for me.



Monday, October 3, 2016

Script Kiddie Network Mapper/Profiler

Here's a simple python script to quickly port scan a network (All TCP, default UDP via NMAP) and then Nikto scan common webserver ports (80, 443)

Written as a quick/rough tool for automation of simple "script kiddie" tasks.

Just the basics for now. System for scanning is passed as an argument. Can be individual or in CIDR notation.

Run this with correct arguments, grab a cup of coffee and come back in a few minutes.

#
#
#
#
#
# CODE STARTS HERE
import sys, os, platform
from netaddr import *

ip = IPNetwork(sys.argv[1])

# Quick Network Mapping Tool
#This will scan the target host without a ping, full TCP scan, all ports
def nmapfull(host):

    # NMAP Command
    nmap_str = "-sV -O -p 1-65535 -Pn"
    # NMAP
    return os.system("nmap" + " " + nmap_str + " " + str(ip))

#This will scan the target, with a ping, quick UDP scan
def nmapudp(host):


    # NMAP Command
    nmap_str = "-sU -O"

    # NMAP
    return os.system("nmap" + " " + nmap_str + " " + str(ip))

#This will nikto the host on port 80 (default http)
def nikto(host):

    # NIKTO Command
    nikto_str = "-h " + str(ip) + " -p" + " 80"

    # RUN NIKTO
    return os.system("nikto" + " " + nikto_str + " " + str(ip))

#This will nikto the host on port 443 (default https)
def niktossl(host):

    # NIKTO Command
    nikto_str = "-h " + str(ip) + " -p" + " 443"

    # RUN NIKTO
    return os.system("nikto" + " " + nikto_str + " " + str(ip))


for ip in IPSet([ip]):
      print(ip)
      print ("IP "  + str(ip) + " Results for FULL nmap")
      nmapfull(ip)
      print ("IP "  + str(ip) + " Results for UDP nmap")
      nmapudp(ip)
      print ("IP "  + str(ip) + " Results for port 80 nikto")
      nikto(ip)
      print ("IP " + str(ip) + " has been nikto scanned.")
      print ("IP " + str(ip) + " Results for port 443 nikto")
      niktossl(ip)
      print ("IP " + str(ip) + " has been nikto SSL scanned.")



Friday, February 26, 2016

CVE Candidate - Privilege Escalation in Compusource Real Time Home Banking

# Exploit Title: CompuSource Systems - Real Time Home Banking - Local Privilege Escalation/Arbitrary Code Execution
# Date: 2/25/16
# Exploit Author: singularitysec@gmail.com
# Vendor Homepage: https://www.css4cu.com
# Version: CompuSource Systems - Real Time Home Banking
# Tested on: Windows 7
# CVE : TBD

Note: Windows Server 2003/2008/2012  *may* be vulnerable, depending on system configuration.

This vulnerability has been reference checked against multiple installs. This configuration was identical across all systems tested.
Executables/Services:
%SystemRoot%/css50/csdir/RealTimeHomeBankingSvc.exe
HomeBankingService
Attack Detail:
The application installs with LOCAL SYSTEM service credentials in the directory %SystemRoot%/css50/csdir

Inline image 1

Inline image 2


The executables that are installed, by default, allow AUTHENTICATED USERS to modify, replace or alter the file. This would allow an attacker to inject their code or replace the executable and have it run in the context of the system.
Inline image 3

This would allow complete compromise of a machine on which it was installed, giving the process LOCAL SYSTEM access to the machine in question. An attacker can replace the file or append code to the executable, reboot the system or restart the service and it would then  compromise the machine. As LOCAL SYSTEM is the highest privilege level on a machine, this allows total control and access to all parts of the system.

Remediation:
Remove the modify/write permissions on the executables to allow only privileged users to alter the files.
Apply vendor patch when distributed.
Vulnerability Discovered: 2/25/16
Vendor Notified: 2/25/16
                                                                                         
Website: www.information-paradox.net
This vulnerability was discovered by singularitysec@gmail.com. Please credit the author in all references to this exploit.

Sunday, November 29, 2015

OSWP - A fun jaunt into Wireless Security


Worth the time if you have a few weekends to burn.

I was thoroughly impressed with OSCP and it's something I evangelize pretty frequently. Some invaluable lessons and skills are imparted, well worth the time commitment.

OSWP is a little outdated. It's mainly focused on WEP, then  goes over a few WPA/WPA2 techniques. There's not a ton you can do with WPA2 these days, but it's not uncharted territory. (WPS attacks aren't even mentioned)

The course will take you some time. You'll need to buy some hardware to make headway. I strongly suggest taking your time and reading the materials before you purchase.

Exam:

Exam was very easy, if you do the course. They give you 3 and a half hours. About 90 minutes in, I was submitting my report.

I think everyone has an issue with the labs. A quick reboot of my machine fixed an issue. Use multiple SSH sessions!

If you're curious about security, particularly wireless security.. this is a good starter cert.

Thursday, July 2, 2015

Update on CVE-2014-9141: Thomson Reuters Fixed Assets CS <= 13.1.4

Received notification from vendor today:

"We appreciate your report and attention on the connectbgdl.exe vulnerability.  We are scheduled to address this with our next major release, 2015.1.0, scheduled for November of 2015.  This will be our first opportunity to address it since it came to our attention following our last major release of 2014.1.0 in November of 2014.  As of this point in time, we have seen no reports of this vulnerability being exploited within our customers' systems."

This patch should be immediately applied when released. Steps to remediate this vulnerabilityshould be taken until the next major release.


Update on CVE-2015-2081 : Multiple Vulnerabilities in Datto Siris and Alto



Interesting post on the DATTO vulnerabilities we had discovered in February (and some additional items that were not covered in our post):
http://silentbreaksecurity.com/tearing-apart-a-datto/
Our investigation turned up a vulnerable webserver as well. As part of that, we investigated some of the pages and services available. We decided to keep these findings private with the vendor and publishing as a CVE at the time and we did so. As another security researcher has posted some of these findings as well and rooted the box publicly, we're releasing this as it's useful for remediation of additional issues that are present on the device.
The below pages and information were available from the webserver embedded, without authentication.

Potentially Dangerous Information Leakage:
/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 
/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
/?=PHPE9568F34-D428-11d2-A769-00AA001ACF42
/?=PHPE9568F35-D428-11d2-A769-00AA001ACF42
 All of these help determine what is running the webserver and versioning behind it.



/admin.php
/test.php
/esx.php
/home.php
/tech.php
/network.php
/report.php
/filters.php
/test.php
/status.php
/ticket.php
/ajax.php
/virtualization.php
/logout.php
/agent.php
/permissions.php
/push.php 
Session Expired when visited. This suggests the request is processed and the server may be vulnerable to cookie stealing or session hijacking 
 

/includes
/scripts
/registration
Access is Forbidden. Not a internal message or error, suggests the same finding as above. 


/lib
/log
/sc
/api
/vendor
/junk
Significant amount of PHP scripts for launching just about any function on the device, unauthenticated. Extremely critical to fix. Can be used to establish a reverse shell, a foothold in the server or any number of attacks against the device and data.


/status
Processes, blank page.

/tmp
Temp directory, reveals sensitive information. For example, the desktop screenshot gives username, system name, OS version, internal directory structure and software information

/cgi-bin
Internal 500 error. Useful if structure can be determined.

/images
Useful for determining what software and attack surfaces are available. For example, Ajax is vulnerable and it can be determined with this directory that it's installed and available.

/scripts/jquery.js
/index.php
/scripts/jquery-ui.js
/scripts/prototype.js
/log/
/scripts/scriptaculous.js
/scripts/setup.js
/scripts/common.js
/scripts/network.js
/scripts/base64.js
/scripts/adminSettings.js
/scripts/ga_stats.js
Can view/download JavaScript code, extremely useful for any number of attacks.


/index2.php
Reveals a lot of private information about the box. May be by design.


/about (and its subdirectories)
Significant amount of useful information for determining software loads, versioning


/branding
Empty. Available to view

/debian
internal structure, software loads and setup scripting.

/css
All of the css sheets. Very useful for a number of attacks. 

The vendor was made aware of these issues in February and stated they were working on remediation.