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.

244 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sEvent LogThe EventLogPermission class is designed to encapsulate the rights of code to accessthe event log. Currently, however, code must be granted full trust to be able to accessthe event log. This means that a medium trust <strong>Web</strong> application cannot directly accessthe event log. To do so, you must s<strong>and</strong>box your event logging code.Accessing the Event LogFirst, ensure that the process account that is used to run your <strong>Web</strong> application (or thethread identity if your application is impersonating) is able to create event sources.For this, the process or thread identity must be able to create registry keys beneaththe following key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventlogAt minimum, the ASP.NET process identity of any impersonated identity must havethe following permissions on this registry key:● Query key value● Set key value● Create subkey● Enumerate subkeys● Notify● ReadThese settings must be applied to the key shown above <strong>and</strong> subkeys. Alternatively,you can create event sources at installation time when administrative privileges areavailable. For more information about this approach, see “Auditing <strong>and</strong> Logging” inChapter 10, “Building Secure ASP.NET <strong>Web</strong> Pages <strong>and</strong> Controls.”S<strong>and</strong>boxingTo s<strong>and</strong>box your event logging code, you create a wrapper assembly to encapsulateevent log access. You then install the wrapper assembly in the global assembly cacheso that is granted full trust by code access security policy.

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

Saved successfully!

Ooh no, something went wrong!