The previous installment in this series described the principles of .NET Framework. This information will serve as a starting point for a discussion of code access security, which is based on functionality supplied by Common Language Runtime (CLR). Therefore, if you are not familiar with .NET Framework, we recommend reading through the previous installment.
The fourth installment in our Windows Server 2003 Security series discusses code access security, which is based on functionality supplied by Common Language Runtime and is dependent on .NET Framework.
Due to its reliance on CLR, code access security is available only for managed applications (i.e., applications written according to .NET specifications). While standard Windows applications run in the same security context as the user who launched them, the level of privileges granted to .NET applications is configurable. Computer resources can be protected not only from malicious attacks, but also from potential errors or vulnerabilities in their code. The code access security architecture is based conceptually on two main building blocks:
When a user starts a program (or a program calls a function stored in a dynamic link library file, referred to in .NET world as an assembly) CLR first checks its code for buffer overflows (their presence constitutes a vulnerability and a potential for an exploit). In addition, CLR goes through a verification stage during which it analyzes the digital signature the creator has assigned to the code to detect whether the application has been altered since its release.
If both checks produce satisfactory results, CLR checks other application properties, such as its origin (zone, site, or file system path) and code characteristics (hash, publisher, or strong name). This stage is often described as “evidence gathering.”
Next, the code is evaluated against the code groups configured for the local computer. Permission sets associated with that group determine what types of actions the application is allowed to perform.
Permission sets and code groups are configurable via the .NET Framework Configuration tool, available from the Administrative Tools menu in Windows Server 2003 (and other Windows platforms once they have .NET framework installed). It is implemented as part of the Microsoft Management Console snap-in and contains the following nodes in the tree (left) window pane.
Security policy is evaluated based on code access policies on each level, starting with the Enterprise and ending with the User. The settings are evaluated independently and intersected such that the most restrictive ones of the three are applied. It is, however, possible to configure higher-level policies (on the individual Code Group level) to prevent lower-level policies from being applied (using options available from the General tab of a code group’s Properties dialog box).
.NET Framework also includes an Application Domain policy level, which is configurable only via code (and it is also not available from .NET Framework Configuration tool).
Each policy level, in turn, contains three subnodes that determine the configuration settings:
Note that the .NET Framework Configuration tool contains the following pre-defined permission sets:
You can also define your own permission sets with extensive granularity, which includes (but is not limited to) browsing specific areas of directory services, preventing DNS access, allowing the auditing of event logs, granting read or write access to environment variables, controlling which files or folders are writable, determining which dialog boxes (e.g., Open or Save) are usable, and specifying which registry keys are readable.
As you can see, new options introduced with .NET framework offer enormous flexibility in securing managed applications. As usual, there is a tradeoff, which in this case is increased administrative overhead and level of complexity.
Marcin Policht obtained his Master of Computer Science degree about 20 years ago and has been since then working in the Information Technology field, handling variety of responsibilities, but focusing primarily on the areas of identity and access management, virtualization, system management, and, more recently private, hybrid, and public cloud services. He has authored the first book dedicated to Windows Management Instrumentation and co-written several others dealing with subjects ranging from core operating system features to high-availability solutions. His articles have been published on such Web sites as ServerWatch.com and DatabaseJournal.com. For his contributions to the Microsoft technical community, he has been awarded the title of Microsoft MVP over the last ten years.
Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.