Slashdot Mirror


Ask Slashdot: Writing Hardened Web Applications?

rhartness writes "I am a long time Software Engineer, however, almost all of my work has been developing server-side, intranet applications or applications for the Windows desktop environment. With that said, I have recently come up with an idea for a new website which would require extremely high levels of security (i.e. I need to be sure that my servers are as 100% rock-solid, unhackable as possible.) I am an experienced developer, and I have a general understanding of web security; however, I am clueless of what is requires to create a web server that is as secure as, say, a banking account management system. Can the Slashdot community recommend good websites, books, or any other resources that thoroughly discuss the topic of setting up a small web server or network for hosting a site that is as absolutely secure as possible?"

14 of 333 comments (clear)

  1. Re:If you don't know, you can't do it by Anonymous Coward · · Score: 5, Insightful

    I guess we'll just halt all human endeavor, since each of us doesn't know how to do every possible thing.

    Moron.

  2. Web Applications aren't different by Elgonn · · Score: 5, Insightful

    I've seen many a question or thought like this and I don't understand the underlying wonderment. Web applications aren't different than any other networked applications. You just have a larger selection of clients that could be communicating with you. But you'd never trust ANY client would you?

    1. Re:Web Applications aren't different by b4dc0d3r · · Score: 5, Insightful

      Sounds like you're making bad assumptions. One unexpected breach and your network is no longer secure. On a secure network, you still close off all of the ports except the ones you use. You don't make assumptions that something is safe, you add IP filtering and passwords.

      Web apps are exactly the same as any other intranet app, and should be just as secure. The only difference is, you also have a web server and a framework adding potential bugs and holes. And then your code most likely has to protect against common browser-based attacks and handle user authentication/authorization on a stateless connection.

      Don't trust anything on any network, or you'll end up like Sony. Breach after breach.

    2. Re:Web Applications aren't different by nahdude812 · · Score: 5, Insightful

      You fail to actually address any of the technologies he mentioned as a layer above. You're talking about closing ports and other pretty standard bland basic intro-level security. Sure, there's overlap, but what he's saying is that a lot of common Internet problems are reliably and intelligently pre-solved for you if you control enough of the technology stack.

      I'll pick his example of TLS since that's a good example of the sort of technology stack you can rely on in an intranet application which is prohibitive to implement in an Internet application.

      If your web server has validated a TLS certificate, unless your signing authority has been compromised (and for internal purposes, that's owned by your own company's security team), you can trust the subject of the TLS cert. It is not only considered safe to assume that TLS is valid, it's widely regarded as one of the most secure possible means of authentication you can have since it includes endpoint verification on both ends. It's excellent practice, but if your CA is compromised it falls apart. Of course you're probably also relying on other proven technologies like LDAP for identification, but if someone ends up with write access to parts of LDAP they shouldn't have, this falls apart too.

      In internal applications you can make these sorts of assumption that aren't really available on the public Internet since you don't control enough of the technology stack outside your own network to do so without substantial inconvenience for your customers. That doesn't make you a bad developer. In fact the opposite is likely true. If you're building an intranet web application and you think you can do a better job of managing user credentials than LDAP or a better job of securing communications than TLS, you're deluding yourself and very likely introducing security bugs into your application.

  3. internet explorer by Anonymous Coward · · Score: 5, Funny

    For some reason, every bank we deal with (for large business types) is internet explorer only. I guess you'll have to start there.

  4. EULA baby! by cultiv8 · · Score: 5, Funny

    Why harden your web app when you can just write in your EULA that end users can't sue you? Profit!

    --
    sysadmins and parents of newborns get the same amount of sleep.
  5. Start with the W3 guide to secure CGI programming by TheEmperorOfSlashdot · · Score: 5, Informative

    http://www.w3.org/Security/faq/wwwsf4.html

    Once you understand the things they recommend and WHY they recommend them, you won't need to ask this question anymore.

  6. Get IIS 4 by Billly+Gates · · Score: 5, Funny

    And use VBScript with activeX controls mixed with sql server 6.0 and make sure the clients all have to use IE 6.

    Throw a little ASP, not asp.net or anything bloated that checks the sql agaisnt injections and you will have one rock solid platform that nothing will get hacked or get intercepted.Just ask any MCSE to secure it and you are good to go

  7. OWASP.org by LouTheTroll · · Score: 5, Informative

    Be sure to checkout out all of the fine resources at http://www.owasp.org./ It's the Open Web Application Security Project. All materials, training, libraries, and content are free. There are numerous local chapters also so be sure to search for one in your local area.

  8. Be paranoid (trustno1) by gman003 · · Score: 5, Insightful

    Trust no inputs. Check your inputs. Validate cookies. Validate parameters. Validate your validation. Encrypt whatever you can, whenever you can.

    SQL injection is the most common vulnerability. Learn how to make it impossible with prepared statements.

    If possible, hire some white-hat hackers to try to break into the site, and see if they find anything.

    Above all, trust nothing.

  9. not only prevent, but also mitigate by OleMoudi · · Score: 5, Insightful

    While one can arguably say everything can be hacked (unless air-gapped), in certain scenarios you can at least mitigate the impact of a breach to make it almost irrelevant.

    Easiest example is password storing. Some SQLi may get through and provide someone with a dump of your user passwords, but if you follow up to date recommended security practices, the data will be nearly useless.

    Beind said that, just by reading the Web Application Hacker's Handbook and following all of its recommendations you will have a pretty secured app.

    --
    ---------
    Thinking never hurt anybody --MacGyver
  10. Re:If you don't know, you can't do it by FormOfActionBanana · · Score: 5, Insightful

    That's untrue. You can assume the worst and protect your application by following secure coding checklists, code reviews and static analysis. You don't need some sort of reformed hacker on your team in order to be effective.

    --
    Take off every 'sig' !!
  11. Re:If you don't know, you can't do it by TheRealMindChild · · Score: 5, Funny

    Well, that doesn't say much for your family because it was rather easy to socially engineer you mom's pants off

    --

    "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  12. Re:If you don't know, you can't do it by Anonymous Coward · · Score: 5, Insightful

    That's untrue. You can assume the worst and protect your application by following secure coding checklists, code reviews and static analysis. You don't need some sort of reformed hacker on your team in order to be effective.

    Yeah. All You Have To Do Is... <sarcasm>

    Expect to be cracked. Unless your system is too boring and valueless to attract attackers, it will be targeted. If it IS boring and valueless expect to get targeted by automated attackers anyway. Buy insurance. Both the money kind and the technical kind (good offline backups, etc.).

    Expect your costs to go way up. Secure and "Git 'R Dun!" don't go together any more than "welding" stainless steel pipes with duct tape does. It's going to take longer and cost more. In addition to the development cost increases, there will be maintenance cost increases, plus you should be running more tests, audits and so forth.

    Once you've adjusted your expectations, look at your tools and platforms. Windows isn't quite the security nightmare that it used to be, but I still prefer to avoid it as the OS for critical servers. Likewise, certain platforms have less-than-sterling security records (RoR, PHP, for example) where others are designed from the ground up with security in mind (Java Enterprise Edition). An "insecure" platform used in a secure way trumps a secure platform used in an insecure way, but overall, it's a good idea to start with a secure basis.

    DON'T create your own security system. Most of the DIY systems I've seen can't stand 5 minutes with a 5th grader. Unless you are a full-time security professional, you'll end up with a ton of exploit points, new team members and contractors won't understand it or remember to apply it properly to new/changed code, and most DIY systems I've seen required integration into application code, meaning that changes to security can - and often does - break the business logic. J2EE has a built-in wraparound security system designed to fend off attackers before the application code is invoked and require minimal security code in the application logic. Most insecure J2EE systems I've seen ignored this capability in favor of DIY login code. I blame too many J2EE books that use "login screens" to illustrate application programming.

    DO adhere to best practices. There's no excuse for SQL injection exploits or exploits that came from trusting that what comes back from a client is what's supposed to come back from a client. Likewise, don't keep passwords in clear text in your databases. And never, ever expect that the only way people will access secured resources is by following a predetermined pathway unless you're demonstrably certain that they had no other way.

    DO read up on the literature. There's plenty out there on hardening networks, servers and systems. There's a whole genre of books on secure Java design and programming.

    Keep up to date. New exploits show up all the time. Likewise, keep your software security up to date. Test early and often.