Designing applications for the web requires an up-front security mind-set. It does not matter if the application takes credit card payments or if it hosts static web content. A public web site is just that: a public portal to computer assets that someone out there on the Internet will eventually find and will want to exploit for whatever nefarious reason entertains their interests, whatever it is.
The purpose of this post is to discuss the web application design and architecture security truisms that I have held true during my experience as a developer and architect. The following fifteen (15) security truisms are taken from Firewalls and Internet Security – Repelling the Wily Hacker, Second Edition (ISBN: 0-201-63344-X) by William R. Cheswick, et. al. These truisms are key to any security model – not just information security. For the purposes of this post, I will discuss how they relate to application design and architecture.
- There is no such thing as absolute security. Any web application deployed to a network, be it publicly on the Internet, internally on an Intranet, or even privately on an extranet, will not be absolutely secure. This is due to the fact that it is connected to a network – the level of it’s security has been diminished purely by it’s nature of been deployed. This is a fact.
- Security is always a question of economics. The amount of security that a web application design employs is dependent upon the amount of security infrastructure the application owner is willing to pay for. Though tighter security can be bought with hardware cryptography, LDAP servers, etc., it’s always a question of cost vs. how much risk the application owner is willing to accept. In the end, it’s a question of balance.
- Keep the level of all your defenses at the same height. This is a tricky one that many people overlook – balance. The level of an application’s should balance the level of security of the environment in which it is being deployed. This includes, but is not limited to, the level of physical and software firewall protection, the amount and type of intrusion detection systems, etc. It doesn’t make a lot of sense to blow out the security architecture of a web application if it’s going to be deployed in your brother’s basement on his Wi-Fi router. Conversely, it makes equally less sense to deploy a an insecure web application in a shared hosting environment that hosts credit card payment applications.
- An attacker doesn’t go through security, but around it. The web application should not be designed as another security hole in the web site’s security! Attackers will look for weaknesses in web applications deployed to a web site and exploit them.
- Put your defenses in layers.
- It’s a bad idea to rely on “security through obscurity.” Compiling the password into the source code, believing it won’t be found because it has been “obscured”, is stupid. I’m sorry, I said it. I’ve seen it done before. Put hope in the cost/benefit of hiding secrets in plain site will only reek havoc in the end.
- Keep it simple. Cleaner, well documented code is easier to maintain. Easier maintained code is even easier to secure.
- Don’t give a person or a program any more privileges than those necessary to do the job. Developers don’t need access to secured resources. The exception is source code repositories, development databases, development LDAP servers, etc. Web applications should be deployed by deployers, not developers. The production authentication credentials should be provided to system administrators that set up the web application server infrastructure. A truly well designed application architecture will not require a developer or deployer to know the production authentication credentials of protected resources such as databases, LDAP servers, or hardware key stores.
- Programming is hard. Secure programming is harder. Don’t make the job harder than it needs to be. Use common components commonly accepted by the global development community. Don’t reinvent the wheel by rewriting cryptography algorithms. Reuse code and see #7.
- Security should be an integral part of the original design.
- If you do not run a program, it does not matter if it has security holes. If you do not deploy a web application, it does not matter if it is insecure. However, no one will be able to access it.
- A program or protocol is insecure until proven secure. Run web application vulnerability scanning tools. You will be surprised what you will find – and what you will learn about secure programming practices.
- A chain is only as strong as its weakest link. Our hosting environment can provide us with the strongest firewalls and intrusion detection systems. However, we are writing software, too. The software we write is just one more link the chain. That link must be designed as strong as the rest of the links in chain.
- Security is a trade-off with convenience. And, as security often inconveniences users, the application owner will often feel inconvenienced by higher levels of security. This is where discussions on “single-sign-on” begin. For any given company, a users will want to sign-in to the web site once. To sign-in again will be an inconvenience. To have to remember more than one password is even more inconvenient. Ergo, without a “single-sign-on” solution in place, users will feel inconvenienced if they have to sign-in every time the visit a different web site that requires authentication for a given company.
- Don’t underestimate the value of your assets. Just because the web application does not perform secure payment transactions does not mean that it isn’t attractive to attackers. Any computer resource on the Internet can be used as a host for an attack for whatever reason.
All this being said, secure web application design is possible, affordable, and necessary. It must be thought out and balanced against the needs of the application owner and deployment environment. As technology professionals, we are all responsible for the web applications that we design, implement, and deploy because, as any software being run in a remote hosting environment, we provide the gateway between our computer assets and the world wide web.