vb201503 Dylib Hijacking PDF
vb201503 Dylib Hijacking PDF
com
Covering the
global threat landscape
DYLIB HIJACKING ON OS X attacker’s library before the legitimate DLL and blindly load
it into the context of the vulnerable application.
Patrick Wardle
Synack, USA This is illustrated in Figures 1 and 2, where a vulnerable
application (Figure 1) is hijacked by a malicious DLL that
has been planted in the primary search directory (Figure 2).
(This paper was presented at CanSecWest 2015.)
DLL hijacking is a well known class of attack which was
always believed only to affect the Windows OS. However,
this paper will show that OS X is similarly vulnerable to
dynamic library hijacks. By abusing various features and
undocumented aspects of OS X’s dynamic loader, attackers
need only to ‘plant’ specially crafted dynamic libraries to
have malicious code automatically loaded into vulnerable
applications. Using this method, such attackers can perform
a wide range of malicious and subversive actions, including
stealthy persistence, load-time process injection, security Figure 1: Loading the legitimate system DLL.
software circumvention, and a Gatekeeper bypass (affording
opportunities for remote infection). Since this attack
abuses legitimate functionality of the OS, it is challenging
to prevent and unlikely to be patched. However, this
paper will present techniques and tools that can uncover
vulnerable binaries as well as detect if a hijacking has
occurred.
BACKGROUND
Before detailing the dynamic library (dylib) hijacking attack Figure 2: Loading the attacker’s malicious DLL.
on OS X, dynamic link library (DLL) hijacking on Windows
will briefly be reviewed. As the two attacks are conceptually DLL hijacking attacks initially gained notoriety in 2010
quite similar, examining the well-understood Windows attack and quickly grabbed the attention of both the media and
can help in gaining an understanding of the former. malicious attackers. Also known as ‘binary planting’,
‘insecure library loading’ or ‘DLL preloading’, the discovery
DLL hijacking on Windows is best explained by Microsoft:
of this vulnerability is often attributed to H.D. Moore [2, 3].
‘When an application dynamically loads a dynamic link However, the NSA was actually the first to note this flaw,
library (DLL) without specifying a fully qualified path 12 years prior to Moore, in 1998. In the NSA’s unclassified
name, Windows tries to locate the DLL by searching ‘Windows NT Security Guidelines’, the organization both
a well-defined set of directories. If an attacker gains describes and warns of DLL hijacking:
control of one of the directories, they can force the
‘It is important that penetrators can’t insert a “fake”
application to load a malicious copy of the DLL instead
DLL in one of these directories where the search finds it
of the DLL that it was expecting.’ [1]
before a legitimate DLL of the same name.’ [4]
To reiterate, the default search behaviour of the Windows
To an attacker, DLL hijacking affords many useful scenarios.
loader is to search various directories (such as the
For example, such attacks can allow a malicious library to
application’s directory or the current working directory)
stealthily be persisted (without modifying the registry or
before the Windows system directory. This can be
other components of the OS), privileges to be escalated, and
problematic if an application attempts to load a system
even provides the means for remote infection.
library via an insufficiently qualified path (i.e. just by its
name). In such a scenario, an attacker may ‘plant’ a malicious Malware authors were fairly quick to realize the benefits of
DLL (the name of which matches that of the legitimate DLL hijacking. In a blog post entitled ‘What the fxsst?’ [5],
system DLL) in one of the primary search directories. With Mandiant researchers described how they had uncovered
this malicious DLL in place, the Windows loader will find the various unrelated malware samples all named ‘fxsst.dll’.
MARCH 2015 1
VIRUS BULLETIN www.virusbtn.com
Upon closer inspection, they found that the samples were Specifically, the research sought to answer the question:
all exploiting a DLL hijacking vulnerability in the Windows could an attacker plant a malicious OS X dynamic library
shell (Explorer.exe), that provided a stealthy method of (dylib) such that the OS’s dynamic loader would load
persistence. Specifically, as Explorer.exe was installed in it automatically into a vulnerable application? It was
C: \Windows, planting a library named fxsst.dll in the same hypothesized that, much like DLL hijacking on Windows,
directory would result in the persistence of the malicious such an attack on OS X would provide an attacker with a
DLL as the loader searched the application’s directory before myriad of subversive capabilities. For example, stealthy
the system directory where the legitimate fxsst.dll lived. persistence, load-time process injection, security software
Another example of malware using a DLL hijack can be circumvention, and perhaps even ‘remote’ infection.
found within the leaked source code for the banking trojan It should be noted that several constraints were placed
‘Carberp’ [6]. The source code shows the malware bypassing upon this undertaking. First, success was constrained
User Account Control (UAC) via a DLL hijack of by disallowing any modification to the system – except
sysprep.exe (see Figure 3). This binary is an auto-elevated for the creation of files (and if necessary folders). In
process, meaning that it requires no UAC prompt to gain other words, the research ignored attack scenarios that
elevated status. Unfortunately, it was found to be vulnerable required the subverting of existing binaries (e.g. patching)
to a DLL hijacking attack and would load a maliciously or modifications to existing OS configuration files (e.g.
planted DLL (named cryptbase.dll) into its elevated process ‘auto-run’ plists, etc.). As such attacks are well known and
context [7]. trivial both to prevent and to detect, they were ignored. The
These days, DLL hijacking on Windows is somewhat research also sought a method of hijack that was completely
uncommon. Microsoft was swift to respond to attacks, independent of the user’s environment. OS X provides
patching vulnerable applications and detailing how others various legitimate means to control the environment in
could avoid this issue (i.e. simply by specifying an absolute, a manner that could coerce the loader to load malicious
or fully qualified path for imported DLLs) [8]. Moreover, libraries automatically into a target process. These
OS-level mitigations were introduced, which if enabled via the methods, such as setting the DYLD_INSERT_LIBRARIES
SafeDllSearchMode and/or CWDIllegalInDllSearch registry environment variable, are user-specific and, again, well
keys, stop the majority of DLL hijackings generically. known and easy to detect. As such, they were of little
interest and were ignored.
The research began with an analysis of the OS X dynamic
DYLIB HIJACKING ON OS X linker and loader, dyld. This binary, found within /usr/bin,
It has always been assumed that dynamic library hijacking provides standard loader and linker functionality including
was a Windows-only problem. However, as one astute finding, loading and linking dynamic libraries.
StackOverflow user pointed out in 2010, ‘any OS which As Apple has made dyld open source [10], analysis was
allows for dynamic linking of external libraries is fairly straightforward. For example, reading the source code
theoretically vulnerable to this’ [9]. It took until 2015 for provided a decent understanding of dyld’s actions as an
him to be proved correct – this paper will reveal an equally executable is loaded and its dependent libraries are loaded
devastating dynamic library hijack attack affecting OS X. and linked in. The following briefly summarizes the initial
The goal of the research presented here was to determine steps taken by dyld (focusing on those that are relevant to the
whether OS X was vulnerable to a dynamic library attack. attack described in this paper):
2 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
1. As any new process is started, the kernel sets the is wrapped in a try/catch block to detect dylibs that fail to
user-mode entry point to point to __dyld_start load.
(dyldStartup.s). This function simply sets up the stack
then jumps to dyldbootstrap::start(), which in turn calls
the loader’s _main().
2. Dyld’s _main() function (dyld.cpp) invokes link(),
which then calls an ImageLoader object’s link() method
to kick off the linking process for the main executable.
3. The ImageLoader class (ImageLoader.cpp) exposes
many functions that dyld calls in order to perform
various binary image loading logic. For example,
the class contains a link() method. When called, this
invokes the object’s recursiveLoadLibraries() method to
perform the loading of all dependent dynamic libraries.
4. The ImageLoader’s recursiveLoadLibraries() method
determines all required libraries and invokes the
context.loadLibrary() function on each. The context
object is simply a structure of function pointers that
is passed around between methods and functions. The
loadLibrary member of this structure is initialized with
the libraryLocator() function (dyld.cpp), which simply Figure 4: Error logic for dylib load failures.
calls the load() function.
Unsurprisingly, there is logic to throw an exception (with a
5. The load() function (dyld.cpp) calls various helper message) if a library fails to load. Interestingly though, this
functions within the same file, named loadPhase0() exception is only thrown if a variable named ‘required’ is set
through to loadPhase5(). Each function is responsible to true. Moreover, the comment in the source code indicates
for handling a specific task of the load process, such as that failure to load ‘weak’ libraries is OK. This seems to
resolving paths or dealing with environment variables indicate that some scenario exists where the loader is OK
that can affect the load process. with missing libraries – perfect!
6. After loadPhase5(), the loadPhase6() function Digging deeper into the loader’s source code revealed
finally loads (maps) the required dylibs from the file where this ‘required’ variable is set. Specifically,
system into memory. It then calls into an instance of the doGetDependentLibraries() method of the
the ImageLoaderMachO class in order to perform ImageLoaderMacho class parses the load commands
Mach-O-specific loading and linking logic on each dylib. (described below) and sets the variable based on whether
With a basic understanding of dyld’s initial loading logic, or not the load command is of type LC_LOAD_WEAK_
the research turned to hunting for logic that could be abused DYLIB.
to perform a dylib hijack. Specifically, the research was Load commands are an integral component of the Mach-O
interested in code in the loader that didn’t error out if a dylib file format (OS X’s native binary file format). Embedded
wasn’t found, or code that looked for dylibs in multiple immediately following the Mach-O header, they provide
locations. If either of these scenarios was realized within various commands to the loader. For example, there are load
the loader, it was hoped that an OS X dylib hijack could be commands to specify the memory layout of the binary, the
performed. initial execution state of the main thread, and information
The initial scenario was investigated first. In this case, it about the dependent dynamic libraries for the binary. To
was hypothesized that if the loader could handle situations view the load commands of a compiled binary, a tool such as
where a dylib was not found, an attacker (who could MachOView [11] or /usr/bin/otool (with the -l command-line
identify such situations) could place a malicious dylib in flag) can be used (see Figure 6).
this presumed location. From then on, the loader would The code in Figure 5 shows the loader iterating over all the
now ‘find’ the planted dylib and blindly load the attacker’s load commands within a binary, looking for those that specify
malicious code. a dylib import. The format of such load commands (e.g.
Recall that the loader calls the ImageLoader class’s LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, etc.) can
recursiveLoadLibraries() method to both find and load all be found in the mach-o/loader.h file.
required libraries. As shown in Figure 4, the loading code
MARCH 2015 3
VIRUS BULLETIN www.virusbtn.com
4 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
import that is not found, an attacker can place a malicious Dyld will iterate over an rp->paths vector, dynamically
dylib in this presumed location. From then on, the loader will building paths (held within the ‘newPath’ variable) which are
‘find’ the attacker’s dylib and blindly load this malicious code then loaded via the loadPhase4() function. While this does
into the process space of the vulnerable binary. seem to fulfil the requirement of the second hijack scenario
(i.e. dyld looking in multiple locations for the same dylib), a
closer examination was required.
The comment on the first line of dyld’s source in Figure
10 mentions the term ‘@rpath.’ According to Apple
documentation, this is a special loader keyword (introduced
in OS X 10.5, Leopard) that identifies a dynamic library as
a ‘run-path-dependent library’ [12]. Apple explains that a
Figure 9: Hijacking an application via a malicious ‘weak’ run-path dependent library ‘is a dependent library whose
dylib. complete install name (path) is not known when the library
Recall that another hijack attack was hypothesized if a is created’ [12]. Other online documentation such as [13]
scenario existed where the loader searched for dynamic and [14] provides more detail, describing the role of these
libraries in multiple locations. In this case, it was thought that libraries and explaining how the @rpath keyword enables:
an attacker would be able to place a malicious dylib in one ‘frameworks and dynamic libraries to finally be built only
of the primary search directories (if the legitimate dylib was once and be used for both system-wide installation and
found elsewhere). It was hoped that the loader would then embedding without changes to their install names, and
find the attacker’s malicious dylib first (before the legitimate allowing applications to provide alternate locations for a
one), and thus naively load the attacker’s malicious library. given library, or even override the location specified for a
deeply embedded library’ [14].
On OS X, load commands such as LC_LOAD_DYLIB
always specify a path to the dynamic library (as opposed While this feature allows software developers to deploy
to Windows, where just the name of the library may be complex applications more easily, it can also be abused to
provided). Because a path is provided, dyld generally does perform a dylib hijack. This is true since in order to make use
not need to search various directories to find the dynamic of run-path-dependent libraries, ‘an executable provides a list
library. Instead, it can simply go directly to the specified of run-path search paths, which the dynamic loader traverses
directory and load the dylib. However, analysis of dyld’s at load time to find the libraries’ [12]. This is realized in code
source code uncovered a scenario in which this generality did in various places within dyld, including the code snippet that
not hold. was presented in Figure 10.
Looking at the loadPhase3() function in dyld.cpp revealed Since run-path dependent libraries are relatively novel and
some interesting logic, as shown in Figure 10. somewhat unknown, it seemed prudent to provide an example
of building both a legitimate run-path-dependent library and a
sample application that links against it.
A run-path-dependent library is a normal dylib whose install
name is prefixed with ‘@rpath’. To create such a library in
Xcode one can simply set the dylib’s installation directory to
‘@rpath’, as shown in Figure 11.
MARCH 2015 5
VIRUS BULLETIN www.virusbtn.com
run-path of the dylib. Specifically, the ‘name’ (path) within command with the run-path-dependent dylib tells the loader,
the LC_ID_DYLIB load command contained the dylib’s ‘I depend on the rpathLib dylib, but when built, I didn’t know
bundle (rpathLib.framework/ Versions/A/rpathLib), prefixed exactly where it would be installed. Please use my embedded
with the ‘@rpath’ keyword (see Figure 12). run-path search paths to find it and load it!’
The run-path search paths that were entered into the
‘Runpath Search Paths’ list in Xcode generated LC_RPATH
load commands – one for each search directory. Dumping
the load commands of the compiled application revealed
the embedded LC_RPATH load commands, as shown in
Figure 15.
6 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
With a list of all embedded run-path search paths, dyld can The astute reader will recognize that this loader logic opens
now ‘resolve’ all dependent run-path-dependent libraries. up yet another avenue for a dylib hijack attack. Specifically,
This logic is performed in the loadPhase3() function in if an application is linked against a run-path-dependent
dyld.cpp. Specifically, the code (shown in Figure 17) checks library, has multiple embedded run-path search paths, and the
to see if a dependent library’s name (path) is prefixed with the run-path-dependent library is not found in a primary search
‘@rpath’ keyword. If so, it iterates over the list of extracted path, an attacker can perform a hijack. Such a hijack may
run-path search paths, replacing the ‘@rpath’ keyword in the be accomplished simply by ‘planting’ a malicious dylib into
import with the current search path. Then it attempts to load any of the primary run-path search paths. With the malicious
the dylib from this newly resolved directory. dylib in place, any time the application is subsequently run,
the loader will find the malicious dylib first, and load it
blindly (see Figure 19).
MARCH 2015 7
VIRUS BULLETIN www.virusbtn.com
8 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
As can be seen, the loader invokes the doGetLibraryInfo() Once again, the exception was quite verbose, explaining
method to extract compatibility and current version numbers exactly why the loader threw it, and thus killed the
from the LC_ID_DYLIB load command of the library that application. Applications link against dependent libraries
is being loaded. This extracted compatibility version number in order to access functionality (such as functions,
(‘minVersion’) is then checked against the version that objects, etc.) that are exported by the library. Once a
the application requires. If it is too low, an incompatibility required dylib is loaded into memory, the loader will
exception is thrown. attempt to resolve (via exported symbols) the required
It was quite trivial to fix the compatibility issue (and thus functionality that the dependent library is expected to
prevent the exception) by updating the version numbers in export. If this functionality is not found, linking fails and
Xcode, and then recompiling, as shown in Figure 25. the loading and linking process is aborted, thus crashing
the process.
There were various ways to ensure that the hijacker
dylib exported the correct symbols, such that it would be
fully linked in. One naive approach would have been to
implement and export code directly within the hijacker
dylib to mimic all the exports of the target (legitimate)
dylib. While this would probably have succeeded, it
seemed complex and dylib specific (i.e. targeting another
Figure 25: Setting the compatibility and current version dylib would have required other exports). A more elegant
numbers. approach was simply to instruct the linker to look elsewhere
for the symbols it required. Of course, that elsewhere was
Dumping the LC_ID_DYLIB load command of the the legitimate dylib. In this scenario, the hijacker dylib
recompiled hijacker dylib confirmed the updated (and now would simply acts as a proxy or ‘re-exporter’ dylib, and as
compatible) version numbers, as shown in Figure 26. the loader would follow its re-exporting directives, no linker
errors would be thrown.
MARCH 2015 9
VIRUS BULLETIN www.virusbtn.com
10 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
scanner script revealed a surprising number of vulnerable at [15]), was created to perform this customization. First,
applications, including (as expected) the vulnerable test the script finds and parses the relevant LC_ID_DYLIB load
application, rPathApp.app. command within the target dylib (the legitimate dylib which
the vulnerable application loads). This allows the necessary
compatibility information to be extracted. Armed with this
information, the hijacker dylib is similarly parsed, until its
LC_ID_DYLIB load command is found. The script then
updates the hijacker’s LC_ID_DYLIB load command with
the extracted compatibility information, thus ensuring a
precise compatibility versioning match. Following this, the
re-export issue is addressed by updating the hijacker dylib’s
LC_REEXPORT_DYLIB load command to point to the
target dylib. While this could have been achieved by updating
the LC_REEXPORT_DYLIB load command manually, it
proved far easier simply to execute the install_name_tool
Figure 33: Automatically detecting vulnerable applications. command.
As can be seen in Figure 33, the scanner script found nearly Figure 34 shows the Python script automatically configuring
150 vulnerable binaries just on the author’s work laptop! a generic hijacker dylib in order to exploit the vulnerable
Interestingly, the majority of vulnerable applications fell into example application, rpathApp.app.
the more complex (from a prerequisite standpoint) ‘multiple
rpath’ category. Due to space constraints, the full list of
vulnerable applications cannot be shown here. However,
Table 1 lists several of the more widespread or well-
recognized applications that were found by the scanner script
to be vulnerable to a dylib hijack.
MARCH 2015 11
VIRUS BULLETIN www.virusbtn.com
scenario affords the attacker a fairly high level of stealth. or mail client) may be targeted as well. Alternatively, a
First, it simply requires the planting of a single file – no legitimate vulnerable application could easily be made
OS components (e.g. startup configuration files or signed persistent in a variety of ways (for example registering it as
system binaries) are modified. This is important since such a Login Item, etc.), then persistently exploited. Although this
components are often monitored by security software or are latter scenario increases the visibility of the attack, the attacker
trivial to verify. Second, the attacker’s dylib will be hosted dylib would, of course, prevent any UI from being displayed.
within the context of an existing trusted process, making it Thus, it’s unlikely that the majority of users would notice a
difficult to detect as nothing will obviously appear amiss. legitimate (Apple) binary automatically being started (and
Of course, gaining such stealthy and elegant persistence exploited) in the background.
requires a vulnerable application that is automatically Process injection, or coercing an external process into
started by the OS. Apple’s iCloud Photo Stream Agent loading a dynamic library, is another useful attack scenario of
(/Applications/iPhoto.app/Contents/Library/LoginItems/ dylib hijacking. In the context of this paper, ‘injection’ refers
PhotoStreamAgent.app) is started automatically whenever a to load-time injection (i.e. whenever the process is started)
user logs in, in order to sync local content with the cloud. As as opposed to run-time injection. While the latter is arguably
luck would have it, the application contains multiple run-path more powerful, the former is far simpler and often achieves
search directories and several @rpath imports that are not the same level of damage.
found in the primary run-path search directory. In other
words, it is vulnerable to a dylib hijack attack. Using dylib hijacking to coerce an external process into
persistently loading a malicious dylib is a powerful and
stealthy technique. As with the other dylib hijack attack
scenarios, it does not require any modifications to OS
components or binaries (e.g. patching the target process’s
on-disk binary image). Moreover, since the planted dylib
will persistently and automatically be loaded into the
target process space each time the process is started, an
attack no longer needs a separate monitoring component
Figure 35: Apple’s vulnerable Photo Stream Agent. (to detect when the target process is started, then inject a
malicious dylib). Also, since the attacker simply requires a
Using the createHijacker.py script, it was trivial to configure malicious hijacker dylib to be planted, it neatly side-steps the
a malicious hijacker dylib to ensure compatibility with the complexities of run-time process injection. Finally, as this
target dylib and application. It should be noted that in this injection technique abuses legitimate functionality provided
case, since the vulnerable import (‘PhotoFoundation’) was by the OS loader, it is unlikely to be detected by personal
found within a framework bundle, the same bundle structure security products (which often attempt to prevent remote
was recreated in the primary run-path search directory process injection by monitoring ‘inter-process’ APIs).
(/ Applications/iPhoto.app/Contents/Library/LoginItems/).
With the correct bundle layout and malicious hijacker dylib Xcode is Apple’s ‘Integrated Development Environment’
(renamed as ‘PhotoFoundation’) placed within the primary (IDE) application. It is used by developers to write both
run-path search directory, the loader found and loaded the OS X and iOS applications. As such, it is a juicy target
malicious dylib whenever the iCloud Photo Stream Agent for an advanced adversary who may wish to inject
was started. Since this application was executed by the OS, code into its address space to surreptitiously infect the
the hijacker dylib was stealthily and surreptitiously persisted developer’s products (i.e. as a creative autonomous malware
across reboots. propagation mechanism). Xcode and several of its various
helper tools and utilities are vulnerable to dylib hijack
attacks. Specifically, run-path-dependent dylibs, such as
DVTFoundation are not found in Xcode’s primary run-path
search directories (see Figure 37).
The process injection hijack against Xcode was fairly
straightforward to complete. First, a hijacker dylib was
Figure 36: Hijacking Apple’s Photo Stream Agent for configured, such that its versioning information was
persistence. compatible and it re-exported all symbols to the legitimate
DVTFoundation. Then, the configured hijacker dylib was
As a final note on persistence, if no vulnerable applications are copied to /Applications/Xcode.app/Contents/Frameworks/
found to be started automatically by the OS, any vulnerable DVTFoundation.framework/Versions/A/ (Frameworks/
application commonly started by the user (such as a browser, being the primary run-path search directory). Now, whenever
12 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
into the context of a trusted process, the code will inherit the
process’s trust, and thus the firewall will allow its outgoing
connections.
GPG Tools [17] is a message encryption suite for OS X that
provides the ability to manage keys, send encrypted mail,
or, via plug-ins, enable cryptographic services to arbitrary
Figure 37: Apple’s vulnerable IDE, Xcode. applications. Unfortunately, its products are susceptible to
dylib hijacking.
MARCH 2015 13
VIRUS BULLETIN www.virusbtn.com
Relying on trickery to infect a remote target will probably The concept of Gatekeeper is simple, yet highly effective:
not work against more computer-savvy individuals. A more block any untrusted software from executing. Behind the
reliable (though far more advanced) technique relies on scenes, things are a little more complex, but for the purposes
man-in-the-middling users’ connections as they download of this discussion, a higher-level overview suffices. When
legitimate software. Due to the constraints of the Mac any executable content is downloaded, it is tagged with a
App Store, most software is still delivered via developer ‘quarantined’ attribute. The first time such content is set to
or company websites. If such software is downloaded run, Gatekeeper verifies the software. Depending on the
via insecure connections (e.g. over HTTP), an attacker user’s settings, if the software is not signed with a known
with the necessary level of network access may be able Apple developer ID (default), or from the Mac App Store,
to infect the download in transit. When the user then Gatekeeper will disallow the application from executing.
runs the software, they will become infected, as shown in With Gatekeeper automatically installed and enabled on
Figure 43. all modern versions of OS X, tricking users into installing
14 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
MARCH 2015 15
VIRUS BULLETIN www.virusbtn.com
16 MARCH 2015
VIRUS BULLETIN www.virusbtn.com
there appears to be no easy fix for the core issue of dylib within countless Apple and third-party applications, this
hijacking as it abuses the legitimate functionality of the OS. attack class opens up a multitude of attack scenarios to both
However, it is the opinion of the author that Gatekeeper local and remote attackers. From stealthy local persistence
should certainly be fixed in order to prevent unsigned to a Gatekeeper bypass that provides avenues for remote
malicious code from executing. infections, dylib hijacking is likely to become a powerful
Users may wonder what they can do to protect themselves. weapon in the arsenal of OS X attackers. And while Apple
First, until Gatekeeper is fixed, downloading untrusted, or appears apathetic toward this novel attack, secure software
even legitimate software via insecure channels (e.g. via the downloads and tools such as DHS can ensure that OS X users
Internet over HTTP) is not advised. Refraining from this will remain secure... for now.
ensure that remote attackers will be unable to gain initial
access to one’s computer via the attack vector described in
this paper. Due to the novelty of dylib hijacking on OS X, it
REFERENCES
is unlikely (though not impossible) that attackers or OS X [1] Secure loading of libraries to prevent DLL
malware are currently abusing such attacks locally. However, preloading attacks. http://blogs.technet.com/cfs-
it can’t hurt to be sure! file.ashx/__key/CommunityServer-Components-
PostAttachments/00-03-35-14-21/Secure-loading-of-
To detect local hijacks, as well as to reveal vulnerable
libraries-to-prevent-DLL-Preloading.docx.
applications, the author created a new application named
Dynamic Hijack Scanner (or DHS). DHS attempts to uncover [2] DLL hijacking. http://en.wikipedia.org/wiki/
hijackers and vulnerable targets by scanning all running Dynamic-link_library#DLL_hijacking.
processes of the entire file-system. The application can be [3] Dynamic-Link Library Hijacking.
downloaded from objective-see.com. http://www.exploit-db.com/wp-content/themes/
exploit/docs/31687.pdf.
MARCH 2015 17
VIRUS BULLETIN www.virusbtn.com
18 MARCH 2015