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.

616 Part V: Assessing Your <strong>Security</strong>4. Check output strings.Check if your code uses a StringBuilder to receive a string passed back from anunmanaged API. Check that the capacity of the StringBuilder is long enough tohold the longest string the unmanaged API can h<strong>and</strong> back, because the stringcoming back from unmanaged code could be of arbitrary length.5. Check array bounds.If you use an array to pass input to an unmanaged API, check that the managedwrapper verifies that the array capacity is not exceeded.6. Check that your unmanaged code is compiled with the /GS switch.If you own the unmanaged code, use the /GS switch to enable stack probes todetect some kinds of buffer overflows.Managed CodeUse the review questions in this section to analyze your entire managed source codebase. The review questions apply regardless of the type of assembly. This sectionhelps you identify common managed code vulnerabilities. For more informationabout the issues raised in this section <strong>and</strong> for code samples that illustratevulnerabilities, see Chapter 7, “Building Secure Assemblies.”If your managed code uses explicit code access security features, see “Code Access<strong>Security</strong>” later in this chapter for additional review points. The following reviewquestions help you to identify managed code vulnerabilities:● Is your class design secure?● Do you create threads?● Do you use serialization?● Do you use reflection?● Do you h<strong>and</strong>le exceptions?● Do you use cryptography?● Do you store secrets?● Do you use delegates?

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

Saved successfully!

Ooh no, something went wrong!