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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Contents xiiiChapter 7Building Secure Assemblies 145In This Chapter ....................................................................................................... 145Overview ................................................................................................................ 145How to Use This Chapter ......................................................................................... 146<strong>Threats</strong> <strong>and</strong> Countermeasures ................................................................................. 146Unauthorized Access or Privilege Elevation, or both................................................ 147Code Injection .................................................................................................... 147Information Disclosure ........................................................................................ 148Tampering .......................................................................................................... 149Privileged Code....................................................................................................... 149Privileged Resources ........................................................................................... 150Privileged Operations .......................................................................................... 150Assembly Design Considerations ............................................................................. 150Identify Privileged Code ....................................................................................... 150Identify the Trust Level of Your Target Environment................................................. 151S<strong>and</strong>box Highly Privileged Code............................................................................ 152Design Your Public Interface................................................................................. 153Class Design Considerations ................................................................................... 153Restrict Class <strong>and</strong> Member Visibility..................................................................... 153Seal Non-Base Classes ....................................................................................... 153Restrict Which Users Can Call Your Code.............................................................. 154Expose Fields Using Properties ............................................................................ 154Strong Names ........................................................................................................ 155<strong>Security</strong> Benefits of Strong Names ....................................................................... 156Using Strong Names ........................................................................................... 156Delay Signing...................................................................................................... 157ASP.NET <strong>and</strong> Strong Names................................................................................. 158Authenticode vs. Strong Names ........................................................................... 159Authorization .......................................................................................................... 160Exception Management ........................................................................................... 161Use Structured Exception H<strong>and</strong>ling....................................................................... 161Do Not Log Sensitive Data................................................................................... 162Do Not Reveal Sensitive System or <strong>Application</strong> Information .................................... 162Consider Exception Filter Issues .......................................................................... 162Consider an Exception Management Framework .................................................... 163File I/O .................................................................................................................. 164Avoid Untrusted Input for File Names.................................................................... 164Do Not Trust Environment Variables...................................................................... 164Validate Input File Names .................................................................................... 164Constrain File I/O Within Your <strong>Application</strong>’s Context............................................... 165Event Log ............................................................................................................... 165

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

Saved successfully!

Ooh no, something went wrong!