Nytro Posted August 27, 2010 Report Posted August 27, 2010 # Visit Exploiting DLL Hijack in the real world to see a html version of this paper# ----------------------------------------------------------------------------# Title: Exploiting DLL Hijack in the real world# Date: 27/08/2010# Author: Bruno Filipe (diwr) - bmilreu[]at[]gmail.com# ----------------------------------------------------------------------------Dll hijacking is the new hype on Windows exploiting. This vulnerabilityis caused by a misbehavior practiced by all versions of Windows, as faras I’m concerned. This misbehavior can be found explained in this MSDNpage <link at bottom> (see Remarks). Note that many people consider thisflaw a feature and not a real bug because it was intended to be made this wayby Microsoft. I strongly disagree as I can’t think of a single legitimateusage of a dll being loaded from the same directory of a opened file.I won’t go into minor details about this issue, as they can be found inreference links at the bottom of this article. I recommend reading themfirst if you don’t know what Dll Hijacking is. Basically, it works bycreating a custom malicious dll and putting it in the same directory of aclean file. When this clean file is opened by a vulnerable application,your custom dll will be loaded and your code executed. This malicious dllmust have specific filenames for each vulnerable application, which canbe discovered using any simple debugging tool.There are vulnerabilities in many major programs, so it’s possible tobundle a dll with almost any filetype, like pdf, html, jpg, mp3, avi,ANYTHING. Even some programs included with Windows are vulnerable. PeterEeckhoute from corelan team started an unofficial list that you mightwant to check <link at bottom>. You’re almost certainly using manyexploitable applications so it’s a must to check there if you use Windowsregardless of it’s version or edition.This is a major security issue that affects every Windows version andcannot be patched universally as it would break many existingapplications. Inside this article I’ll also provide some tips about howyou can try to protect yourself and your network. There’s nobullet-proof solution at this moment but you can certainly avoid gettingexploited in many cases.This article is focused on showing how this flaw can be exploited in areal world scenario from an attacker’s side. This is important becausethere are many possible attack vectors that can be used either making useof another vulnerability or even some simple social engineering. I’llexplain some of them and how can be possibly avoided by an user orsysadmin.* Using a SMB/WebDav shared folderThis is perhaps the most common way dll hijacking is being used, probablybecause it can be exploited remotely. There are already a module forMetasploit which uses this vector. It works by putting together amalicious dll and a clean file that triggers it inside a share and thenmaking your target open this clean file. Remember a shared folder linkalways starts with double slashes like \\123.45.67.890.Real world examples:1. Attacker sends a shared folder link to a victim. Victim opens and sees some .html files and double-clicks one of them. When a vulnerable browser or application opens this file it loads a dll directly from this share, and victim is now infected.2. Attacker posts a link in a forum that looks like a http link but redirects victim to a shared folder. Victim opens a simple .pdf file and gets infected.3. Attacker gains access to a trusty website and puts iframes or redirects to his share. Victim trusts this site and opens a mp3 file inside the shared folder and… gets infected as well.4. Attacker uses the .lnk bug or any browser vulnerability together with any of above examples and thus increase his infect rate.Tip: This kind of attack can be neutralized blocking any outboundconnection to a smb/webdav share. Ports are 445 and 135.* A compressed package (.zip, .tar.gz, .rar etc)This vector can be exploited by putting together a bunch of clean filesand a malicious dll inside a compressed folder/package. Target willextract these files and open one of them, getting attacker’s dll loaded.Real world example:1. Attacker compresses 30 jpg pictures and a dll in a zip file. Victim extracts everything to a folder and double-clicks one of the pictures. Infected.I won’t provide any other example of this because it’d look the same.Tip: Before opening any kind of file, specially downloaded from theinternet, check if there’s any dll file in the same directory. Don’tforget to enable show hidden files and show all extensions on your FolderOptions. It’s also recommended to move only the files you need to opento another directory created by you. This should make you safe.* TorrentsThis one is kinda nasty and can be very effective to contaminate largeamounts of people. A torrent can contain large numbers of files and canbe used to get a malicious dll downloaded together with clean fileswithout being noticed. This is very dangerous, specially if a big torrenttracker or database can be compromised.Real world examples:1. Attacker posts a custom torrent in a public tracker, which contains a pack of mp3?s and a malicious dll. Victim goes listen it’s new song album and get infected.2. Attacker gains admin access to a torrent database (this actually happened to ThePirateBay not so long ago) and changes a legitimate high-traffic torrent for a infected one. This could cause a massive infection in a matter of minutes.Tip: Same tip as above. Make sure there are no dlls in the current folderbefore opening any kind of file. If you own a tracker or database makesure your webserver and/or database are not vulnerable to any kind ofvulnerability like SQL injections, XSS etc.* Exploiting multiple application hijacksWe have not seen yet a real world malware that uses dll hijacks to it’smax but one of the ways attackers can (and will) use to increase theirsuccess rate is putting multiple dlls to exploit the same filetype.Real world example:* Attacker shares a folder which contains a bunch of .avi files and three malicious dlls: one for VLC, other for MediaPlayer Classic and, finally, the last one for Winamp. Attacker can now exploit three apps in the same attack, increasing the chance of victim getting infected.These are just some of the many ways we might seem this breach beingexploited in real world in a very near future. You might wanna check allvulnerable apps and discover your own way or you can also try to discoveryour own vulnerable apps using this kit, provided by HD Moore (creator ofMetasploit) <link at bottom>.- Bruno Filipe (diwr)Links:[MSDN page]SetDllDirectory Function (Windows)[hdm’s DLL Hijack Audition kit and instructions]Metasploit: Better, Faster, Stronger: DLLHijackAuditKit v2[Rapid7 Blog advisory about DLL Hijacking flaw]Application DLL Load Hijacking Rapid7 Network Security Blog[Corelan blog – Unofficial list of vulnerable apps]http://www.corelan.be:8800/index.php/2010/08/25/dll-hijacking-kb-2269637-the-unofficial-list/[exploit-db list of vulnerable apps]DLL Hijacking – Vulnerable Applications[sample DreamWeaver CS5 exploit]Adobe Dreamweaver CS5 <= 11.0 build 4909 DLL Hijacking Exploit (mfc90loc.dll) Quote
swaMp Posted August 27, 2010 Report Posted August 27, 2010 MEGAUPLOAD - The leading online storage and file delivery servicesper ca acest eBook sa iti deschida ochii Quote
Paul4games Posted August 27, 2010 Report Posted August 27, 2010 O metoda foarte bune de spreading mai ales cea cu torentele!mersi raman dator:) Quote