It has become increasingly popular to allow applications written by one company to call applications that were written by another company. Some applications even combine functionality provided by multiple applications offered by multiple companies.
Whenever functionality of a particular application is exposed to other companies or parties who want to call that application from their own applications, there are increased chances that the third party application will find security holes that allow for it to perform operations that are not otherwise authorized or exposed. In other words, any time untrusted code is allowed to call a trusted DLL, a possibility of a security exploitation exists. Similarly, whenever applications from multiple companies are hosted on the same servers, such as in hosted environments, the same type of security exploitation problem exists.
Various technologies and techniques are disclosed for increasing security in execution environments. A system is described for handling DLL calls made from untrusted code. An execution environment instantiates a lower trust process when a high trust process determines a need to call untrusted code. The lower trust process is responsible for running the untrusted code. When the untrusted code makes a call to a method in an original DLL, the execution environment loads a shim DLL into the lower trust process. The shim DLL has a clone of the methods and/or method signatures in the original DLL.
In one implementation, a method for increasing security when processing calls from untrusted code is described. A shim DLL is created from an original DLL. The shim DLL is deployed such that an execution environment will load the shim DLL instead of the original DLL. When the execution environment receives a call from a caller DLL to the original DLL, the call is routed through the shim DLL.
In another implementation, a pluggable validation system for execution environments is also described. A validation request module receives a request to validate whether a call to a DLL from untrusted code running in a lower trust process is authorized. A scanner module receives the request to validate from the validation request module and accesses one or more validation rules to determine if the call is authorized. The validation rules are configurable. An execution module is responsible for executing the call when the scanner module determines the call is authorized.
This Summary was provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
The technologies and techniques herein may be described in the general context as a platform for executing code, but the technologies and techniques also serve other purposes in addition to these. In one implementation, one or more of the techniques described herein can be implemented as features within an execution framework such as MICROSOFT®.NET Framework, or from any other type of program or service that is responsible for managing calls between processes and/or DLLs. In another implementation, one or more of the techniques described herein are implemented as features within any type of application that receives and/or manages calls from lower trust processes and/or DLLs.
In order to let untrusted code perform actions with API calls allowed by the runtime environment, untrusted code will typically need to be able to call an API which accesses data, for example, in a database. These APIs may provide some security functions on top of data coming from the database, such as isolation of one customer's data from another customer's data or determining whether the caller has the right to read such data. If there is an elevation of privilege bug that is exploited by the untrusted code, the untrusted code could bypass the APIs in between and directly read and write into the database without permission.
In one implementation, techniques are described for improving security to reduce the chances of such exploitations when processing calls in an execution environment from untrusted code. The term “untrusted code” as used herein is meant to include code that comes from a third party or other source that is making a call to a higher trust DLL or is attempting to perform an operation that is reserved for higher trust DLLs. The term “execution environment” as used herein is meant to include one or more processes that are responsible for receiving and routing calls from one process or DLL to another. The term “DLL” as used herein is meant to include compiled units of code that are contained together in a dynamically linked library, executable, script, or other process that can be called from another process or DLL.
One way to improve security in such situations is by first routing calls from untrusted code that are made to trusted DLLs through a lower trust DLL that has reduced privileges, as described in detail in
Alternatively or additionally, additional validation can be performed before allowing the call to be routed to the trusted DLL that has full permission. These validation techniques are described in further detail in
In one implementation, untrusted code 19 is unaware that the method A clone 20 is not the higher trust original process/DLL 16. One technique for accomplishing this is described in further detail in
In one implementation, to help ensure that when a trusted process determines a need to call untrusted code 112 that arbitrary calls cannot be made into the original DLL 128, the secret code and tokens are used. In such an implementation, hosting service 116 shares a secret code with the proxy process 120, such as at the beginning of process startup. The term “secret code” as used herein is meant to include a code that is known by the host service and proxy process, but is not known or obtainable by untrusted code in a lower trust process. The secret code will allow the worker process proxy 120 to calculate whether a token provided by worker process 118 on later calls is a valid token or not. Host service 116 supplies worker process 118 with a token that has been hashed with the secret code that provides context. The token can include one or more constraints, such as on the timeframe, site, and user that the operations can be performed against. When code in the worker process 118 needs to call an original DLL 128 through the shim DLL 124, that request is routed to the proxy process 120 (or a proxy DLL loaded in the proxy process 120) along with the token.
The proxy process 120 (or a proxy DLL loaded in the proxy process 120) validates that the token is actually valid for the time and site specified, and if so, makes the call to the original DLL 128 as requested by the shim DLL 124. The shim DLL 124 looks to the worker process 118 like the original DLL 128 that it made the call to. One implementation for how the shim DLL 124 is made to look like the original DLL 128 is described in further detail in
Although just one worker process 118 and one proxy process 120 are shown in
In one implementation, system 100 has a configuration database 134 and a content database 138. Configuration database 134 is a data store that contains information for how one or more servers are configured and administered. Content database 138 is a data store that contains user content and customizations to that content. In one implementation, some of the techniques described in
In another implementation, code access security technologies are used in the execution environment 104 to further restrict the set of APIs that can be called from untrusted code. Essentially, the worker process 118 with lower trust is run in a code access security group with minimal permissions. For example, worker process 118 can be restricted from calling most APIs that allow it to access the file system, from doing arbitrary database calls, from accessing the network, etc.
In yet another implementation, an additional layer of defense that can be used is to monitor code execution within a process to ensure that unauthorized pieces of code are not loaded, or if those unauthorized components are loaded, that they are loaded with the same minimal rights granted to the untrusted code.
Turning now to
As a few non-limiting examples, the database access permissions can be turned off, certain file system operations (such as file system writes) can be restricted, etc. The shim DLL is deployed so that the execution environment will load the shim DLL instead of the original DLL (stage 204). In one implementation, this is accomplished by deploying the shim DLL with a higher version number than the original DLL so that it looks like the original DLL. In other words, the execution environment that is responsible for loading a DLL when it is called will be faced with deciding whether to pass the call to the original DLL or the shim DLL. In this example, since the shim DLL has been deployed with a higher version number than the original DLL, the execution environment will pass any calls to the shim DLL instead of the original DLL because it will think that the shim DLL is just a newer version of the original DLL.
For example, a managed execution environment such as the MICROSOFT® Common Language Runtime would look for the most recent version (which would be the shim DLL in this example) and would thus think that it is loading an updated version of the original DLL. This shim DLL will then work behind the scenes to proxy calls from the untrusted code to a separate process with database or other desired access rights (in original DLL).
This means that when the execution environment receives a call from a caller DLL to the original DLL (whether trusted or not), the call will first go through the shim DLL (stage 206). The shim DLL can then call the original DLL (directly or through a proxy DLL) and return the result back to the caller DLL (stage 208). In this scenario, the caller DLL has no idea that the shim DLL is the one that actually first processed the call instead of the original DLL.
In one implementation, the process described in
The scanner module 310 is responsible for receiving the request to validate from the validation request module 308 and accessing one or more validation rules 306 to determine if the call is authorized. Validation rules 306 can be stored in a configuration file, database, and/or other locations.
Validation rules 306 are configurable. Validation rules 306 can include operations that are authorized for one or more DLLs and/or operations that are not authorized to be called from untrusted code, etc. These operations can include one or more methods that can and/or cannot be called in particular DLLs from an untrusted process. Alternatively or additionally, these operations can include one or more file system operations that are prohibited by one or more untrusted processes. Yet another non-limiting example of validation rules 306 can include one or more DLLs that have been denied execution or denied access to the application due to a heightened security threat (i.e. the whole DLL can be turned off temporarily or permanently) by simply including a validation rule to indicate that no access to the DLL is allowed.
If the scanner module 310 determines that a particular call it received is authorized, then the execution module 312 is notified that the call is authorized for execution. The execution module 312 is responsible for executing any calls that the scanner module 310 determines are authorized. In one implementation, the execution module 312 can utilize the techniques described in
As shown in
Additionally, device 500 may also have additional features/functionality. For example, device 500 may also include additional storage (removable and/or non-removable) including, but not limited to, magnetic or optical disks or tape. Such additional storage is illustrated in
Computing device 500 includes one or more communication connections 514 that allow computing device 500 to communicate with other computers/applications 515. Device 500 may also have input device(s) 512 such as keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s) 511 such as a display, speakers, printer, etc. may also be included. These devices are well known in the art and need not be discussed at length here.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. All equivalents, changes, and modifications that come within the spirit of the implementations as described herein and/or by the following claims are desired to be protected.
For example, a person of ordinary skill in the computer software art will recognize that the examples discussed herein could be organized differently on one or more computers to include fewer or additional options or features than as portrayed in the examples.