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 1: <strong>Web</strong> <strong>Application</strong> <strong>Security</strong> Fundamentals 11<strong>Security</strong> PrinciplesRecommendations used throughout this guide are based on security principles thathave proven themselves over time. <strong>Security</strong>, like many aspects of softwareengineering, lends itself to a principle-based approach, where core principles can beapplied regardless of implementation technology or application scenario. The majorsecurity principles used throughout this guide are summarized in Table 1.4.Table 1.4: Summary of Core <strong>Security</strong> PrinciplesPrincipleCompartmentalizeConceptsReduce the surface area of attack. Ask yourself how you will contain aproblem. If an attacker takes over your application, what resources can heor she access? Can an attacker access network resources? How are yourestricting potential damage? Firewalls, least privileged accounts, <strong>and</strong> leastprivileged code are examples of compartmentalizing.Use least privilegeApply defense in depthDo not trust user inputCheck at the gateFail securelySecure the weakestlinkCreate secure defaultsReduce your attacksurfaceBy running processes using accounts with minimal privileges <strong>and</strong> accessrights, you significantly reduce the capabilities of an attacker if the attackermanages to compromise security <strong>and</strong> run code.Use multiple gatekeepers to keep attackers at bay. Defense in depthmeans you do not rely on a single layer of security, or you consider that oneof your layers may be bypassed or compromised.Your application’s user input is the attacker’s primary weapon whentargeting your application. Assume all input is malicious until provenotherwise, <strong>and</strong> apply a defense in depth strategy to input validation, takingparticular precautions to make sure that input is validated whenever a trustboundary in your application is crossed.Authenticate <strong>and</strong> authorize callers early — at the first gate.If an application fails, do not leave sensitive data accessible. Returnfriendly errors to end users that do not expose internal system details. Donot include details that may help an attacker exploit vulnerabilities in yourapplication.Is there a vulnerability at the network layer that an attacker can exploit?What about the host? Is your application secure? Any weak link in the chainis an opportunity for breached security.Is the default account set up with least privilege? Is the default accountdisabled by default <strong>and</strong> then explicitly enabled when required? Does theconfiguration use a password in plaintext? When an error occurs, doessensitive information leak back to the client to be used potentially againstthe system?If you do not use it, remove it or disable it. Reduce the surface area ofattack by disabling or removing unused services, protocols, <strong>and</strong>functionality. Does your server need all those services <strong>and</strong> ports? Doesyour application need all those features?

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

Saved successfully!

Ooh no, something went wrong!