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.

622 Part V: Assessing Your <strong>Security</strong>Do You Use Delegates?Any code can associate a method with a delegate. This includes potentially maliciouscode running at a lower trust level than your code.● Do you accept delegates from untrusted sources?If so, check that you restrict the code access permissions available to the delegatemethods by using security permissions with <strong>Security</strong>Action.PermitOnly.●Do you use assert before calling a delegate?Avoid this because you do not know what the delegate code is going to do inadvance of calling it.Code Access <strong>Security</strong>All managed code is subject to code access security permission dem<strong>and</strong>s. Many of theissues are only apparent when your code is used in a partial trust environment, wheneither your code or the calling code is not granted full trust by code access securitypolicy.For more information about the issues raised in this section, see Chapter 8, “CodeAccess <strong>Security</strong> in Practice.”Use the following review points to check that you are using code access securityappropriately <strong>and</strong> safely:● Do you support partial-trust callers?● Do you restrict access to public types <strong>and</strong> members?● Do you use declarative security?● Do you call Assert?● Do you use permission dem<strong>and</strong>s when you should?● Do you use link dem<strong>and</strong>s?● Do you use Deny or PermitOnly?● Do you use particularly dangerous permissions?● Do you compile with the /unsafe option?Do You Support Partial-Trust Callers?If your code supports partial-trust callers, it has even greater potential to be attacked<strong>and</strong> as a result it is particularly important to perform extensive <strong>and</strong> thorough codereviews. Review the level configuration setting in your <strong>Web</strong> application tosee if it runs at a partial-trust level. If it does, the assemblies you develop for theapplication need to support partial-trust callers.

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

Saved successfully!

Ooh no, something went wrong!