11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7: Building Secure Assemblies 159Global Assembly Cache RequirementsAny strong named assembly called by an ASP.NET <strong>Web</strong> application configured forpartial trust should be installed in the global assembly cache. This is because theASP.NET host loads all strong-named assemblies as domain-neutral.The code of a domain-neutral assembly is shared by all application domains in theASP.NET process. This creates problems if a single strong named assembly is used bymultiple <strong>Web</strong> applications <strong>and</strong> each application grants it varying permissions or ifthe permission grant varies between application domain restarts. In this situation,you may see the following error message: “Assembly .dll securitypermission grant set is incompatible between appdomains.”To avoid this error, you must place strong named assemblies in the global assemblycache <strong>and</strong> not in the application’s private \bin directory.Authenticode vs. Strong NamesAuthenticode <strong>and</strong> strong names provide two different ways to digitally sign anassembly. Authenticode enables you to sign an assembly using an X.509 certificate. Todo so, you use the Signcode.exe utility, which adds the public key part of a full X.509certificate to the assembly. This ensures trust through certificate chains <strong>and</strong> certificateauthorities. With Authenticode (unlike strong names,) the implementation ofpublisher trust is complex <strong>and</strong> involves network communication during theverification of publisher identity.Authenticode signatures <strong>and</strong> strong names were developed to solve separateproblems <strong>and</strong> you should not confuse them. Specifically:● A strong name uniquely identifies an assembly.● An Authenticode signature uniquely identifies a code publisher.Authenticode signatures should be used for mobile code, such as controls <strong>and</strong>executables downloaded via Internet Explorer, to provide publisher trust <strong>and</strong>integrity.You can configure code access security (CAS) policy using both strong names <strong>and</strong>Authenticode signatures in order to grant permissions to specific assemblies.However, the Publisher evidence object, obtained from an Authenticode signature isonly created by the Internet Explorer host <strong>and</strong> not by the ASP.NET host. Therefore, onthe server side, you cannot use an Authenticode signature to identify a specificassembly (through a code group.) Use strong names instead.For more information about CAS, CAS policy <strong>and</strong> code groups, see Chapter 8, “CodeAccess <strong>Security</strong> in Practice.”

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!