{"id":7262,"date":"2013-12-10T10:00:32","date_gmt":"2013-12-10T16:00:32","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/blog\/?p=7262"},"modified":"2022-11-22T13:22:12","modified_gmt":"2022-11-22T19:22:12","slug":"10-security-mistakes-web-application-developers-should-never-make","status":"publish","type":"post","link":"https:\/\/www.mrc-productivity.com\/blog\/2013\/12\/10-security-mistakes-web-application-developers-should-never-make\/","title":{"rendered":"10 security mistakes web application developers should never make"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2010\/11\/Education.jpg\" alt=\"Education\" width=\"76\" height=\"100\" class=\"alignleft size-full wp-image-725\" \/>Just when you thought that the healthcare.gov debacle was finally on the uptick, a \u201cwhite hat\u201d hacker just testified on Capitol Hill that <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Outside Link', 'Healthcare security']); \" href=\"http:\/\/www.cnbc.com\/id\/101225308\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">security was never properly built into the site<\/span><\/a>. He claims that fixing the critical-to-high exposures could require up to a year of work. <\/p>\n<p>Not exactly what you want to hear about a website that stores your most sensitive information.<\/p>\n<p>I bring this up to highlight an important point: Despite the rising importance of proper security, best practices are often ignored. Basic security mistakes still plague many web applications&#8230;including healthcare.gov.<\/p>\n<figure id=\"attachment_7271\" aria-describedby=\"caption-attachment-7271\" style=\"width: 240px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2013\/12\/small_6818192898.jpg\" alt=\"photo credit: elhombredenegro via photopin cc\" width=\"240\" height=\"180\" class=\"size-full wp-image-7271\" \/><figcaption id=\"caption-attachment-7271\" class=\"wp-caption-text\">photo credit: <a href=\"http:\/\/www.flickr.com\/photos\/77519207@N02\/6818192898\/\">elhombredenegro<\/a> via <a href=\"http:\/\/photopin.com\">photopin<\/a> <a href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\">cc<\/a><\/figcaption><\/figure>\n<p>As more development shifts to the web, and more data is stored on the cloud, security is a critically important topic. A single security misstep can compromise confidential business data or your customer\u2019s personal information. <\/p>\n<p>Today, let\u2019s get back to the basics. While web application security is a broad topic, I\u2019d like to focus on the security mistakes that web application developers should never make. These are the \u201cbasic\u201d security principles that should never be ignored. <\/p>\n<p>So, what are these security principles? What security mistakes should you never make? To help you answer those questions, we\u2019ve compiled advice from some experts in the field (as well as some of my own) and listed everything below. Here are 10 security mistakes you should never make when developing web applications:<br \/>\n<a name=\"20131209\"><\/a><!--more--><\/p>\n<h3>1. Developing your own security methods<\/h3>\n<p>Some developers make the flawed assumption that a homegrown algorithm or authentication method is actually safer. After all, hackers have never seen it before, so they\u2019ll have more trouble cracking it&#8230;right? Wrong. <\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><figure id=\"attachment_6722\" aria-describedby=\"caption-attachment-6722\" style=\"width: 150px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2013\/08\/small_8627901200.jpg\" alt=\"photo credit: ePublicist via photopin cc\" width=\"150\" height=\"150\" class=\"size-full wp-image-6722\" \/><figcaption id=\"caption-attachment-6722\" class=\"wp-caption-text\">photo credit: ePublicist via <a href=\"http:\/\/photopin.com\">photopin<\/a> <a href=\"http:\/\/creativecommons.org\/licenses\/by-nd\/2.0\/\">cc<\/a><\/figcaption><\/figure>\n<p>\u201cDeveloping your own authentication or login methods is a mistake, because you will make a mistake that hackers will discover,\u201d says James Kelley, a Security Engineer at <span style=\"color: red;font-weight: bold\">Kelley Consulting Company, LLC<\/span>. \u201cInstead, rely on existing libraries which have been thoroughly tested.\u201d<\/p>\n<\/blockquote>\n<p>Why are existing libraries more secure? Because they\u2019re constantly tested by the security community. As such, they\u2019re less likely to include major security holes that one person might overlook. As the famous security specialist, Bruce Schneier, likes to say: \u201cAnyone can invent an encryption algorithm they themselves can&#8217;t break; it&#8217;s much harder to invent one that no one else can break.\u201d<\/p>\n<h3>2. Accessing a database directly with user supplied information<\/h3>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n&#8220;When developing an application, particularly a web application, many developers fail to adequately validate the input they receive from users,\u201d says Dwayne Melancon, Chief Technology Officer at <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'Tripwire']); \" href=\"http:\/\/www.tripwire.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">Tripwire<\/span><\/a>. \u201cThis has a &#8216;data hygiene&#8217; impact in that it can allow invalid data to enter your customer database, for example, but it has even greater security implications. Failure to validate input (whether from a web form or via an API) is what allows SQL injection, cross-site scripting, command injection, buffer overruns, and other common web exploits to succeed.\u201d\n<\/p><\/blockquote>\n<p>This is one of the most common mistakes found in web applications. If unprotected, users can use input fields to inject malicious scripts into your application or access proprietary data from your database. Of course, most users will never attempt anything malicious, but you must approach user input with a defensive mindset.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cDo NOT trust user input, EVER,\u201d says <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'Campbell']); \" href=\"http:\/\/electricalchemy.net\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">David Campbell<\/span><\/a>, a serial entrepreneur and security expert. \u201cValidate input client side (e.g. Javascript validation), but make sure you also validate it server side. Failing to do this is what creates serious vulnerabilities like cross site scripting and SQL injection.\u201d\n<\/p><\/blockquote>\n<h3>3. Focusing on components, not the overall system<\/h3>\n<p>With larger development projects&#8211;where multiple developers work on different parts of an application&#8211;the tendency to focus on individual components arises. Sure, each part may be secure, but&#8230;how secure are they as a whole? Remember, your application is only as strong as its weakest point. <\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><figure id=\"attachment_6894\" aria-describedby=\"caption-attachment-6894\" style=\"width: 240px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2013\/09\/small_4273913228.jpg\" alt=\"photo credit: Horia Varlan via photopin cc\" width=\"240\" height=\"160\" class=\"size-full wp-image-6894\" \/><figcaption id=\"caption-attachment-6894\" class=\"wp-caption-text\">photo credit: <a href=\"http:\/\/www.flickr.com\/photos\/horiavarlan\/4273913228\/\">Horia Varlan<\/a> via <a href=\"http:\/\/photopin.com\">photopin<\/a> <a href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\">cc<\/a><\/figcaption><\/figure>\n<p>&#8220;Many security issues happen not within components themselves, but during the &#8216;handoffs&#8217; that occur as data and processes flow from one part of a business process to the next,\u201d explains Melancon. \u201cDevelopers are often charged with working on one portion of a business process and may not understand other parts of the process. This lack of visibility can allow insecure handoffs to occur, which can expose data to various attacks such as &#8220;man in the middle&#8221; attacks, data integrity problems, and information leakage.<\/p>\n<p>It is vital to have a system view of your business service so you can understand how all the components work together and how they can be secured as a combined entity.&#8221;<\/p>\n<\/blockquote>\n<h3>4. Adding security at the end of development<\/h3>\n<p>The problem with the healthcare.gov site: security was never built in. It\u2019s not something you can simply add on at the end. It\u2019s a function of your entire application architecture. As I explained in this <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Inside Link', 'Architecture']); \" href=\"https:\/\/www.mrc-productivity.com\/blog\/2013\/03\/application-architecture-ignore-at-your-own-risk\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">article<\/span><\/a>, architecture is the most important aspect of application development because it affects all other aspects of the application&#8230;including security. <\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n&#8220;While there are any number of symptoms of this mistake, such as misconfigurations and vulnerabilities, they all trace back to treating security like a feature that you can add at the end of development,\u201d explains Tim Erlin, Director of IT Security and Risk Strategy at <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'Tripwire']); \" href=\"http:\/\/www.tripwire.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">Tripwire<\/span><\/a>. \u201c&#8217;Great, all the functionality works. Now let&#8217;s secure it.&#8217; This mentality increases risk by creating architectural security flaws. It&#8217;s incredibly hard to deal with things like Cross Site Request Forgery and the many types of SQL injection after the application is fully deployed.&#8221;\n<\/p><\/blockquote>\n<h3>5. Letting users create weak passwords<\/h3>\n<figure id=\"attachment_7269\" aria-describedby=\"caption-attachment-7269\" style=\"width: 240px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2013\/12\/small_450222658.jpg\" alt=\"photo credit: David Chartier via photopin cc\" width=\"240\" height=\"23\" class=\"size-full wp-image-7269\" \/><figcaption id=\"caption-attachment-7269\" class=\"wp-caption-text\">photo credit: David Chartier via <a href=\"http:\/\/photopin.com\">photopin<\/a> <a href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/\">cc<\/a><\/figcaption><\/figure>\n<p>Every time hackers breach a popular web application and expose user passwords, one thing becomes instantly clear: Users have horrible security habits. The most popular password in most every instance: 123456. As a web application developer, you can\u2019t let users create weak passwords.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cA strong password is one that is short enough to remember, but long enough to make it difficult for others to guess,\u201d says Steven Pickles, Co-Founder of <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'Recourier']); \" href=\"https:\/\/www.recourier.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">Recourier<\/span><\/a>. \u201cRequire a minimum length of at least 10 alphanumeric characters, though passwords that make sense to human brains are more likely to be longer and more effective. Keep in mind it takes eons longer to randomly guess the password \u2018waterdownmobileboomeranggrease\u2019 than it does &#8216;%sdJil*7m&#8217;.\u201d\n<\/p><\/blockquote>\n<p>He brings up a great point. The best passwords aren\u2019t necessarily the most complex. Forcing users to create overly complex passwords (that they\u2019ll never remember) often leads the user into unsafe practices, like writing their password down and taping it to their computer. The best passwords are both long and memorable.<\/p>\n<h3>6. Storing passwords in plain text<\/h3>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cThe most common mistake web application developers make is failing to secure user authentication credentials,\u201d explains Pickles. \u201cUsers implicitly trust sites to get this right, but, unfortunately, too many get it wrong. By and large, the culprit is a weakness in the way passwords are handled and stored.\u201d\n<\/p><\/blockquote>\n<p>The question is, how can you store user passwords correctly? While we could focus an entire article on the proper storage of user authentication credentials, today let\u2019s highlight just one of the most common&#8211;yet insecure&#8211;practices: storing passwords in plain text.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cNever store passwords in plain text in your database,\u201d says Tirthesh Ganatra, Co-Founder &#038; Lead Developer at <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'pricebaba']); \" href=\"http:\/\/www.pricebaba.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">PriceBaba<\/span><\/a>. \u201cThis is perhaps the most common mistake we have seen. Many large companies have been shamed in public for this kind of a lapse. Any compromise in your database should not put user data at risk, especially the passwords they use. Thus passwords and other important details of a user should be encrypted and stored in the database.\u201d\n<\/p><\/blockquote>\n<h3>7. Storing data unencrypted in your database<\/h3>\n<p><span style=\"line-height: 1.7em;\">A good security rule of thumb: Assume you will get hacked. It\u2019s not a matter of \u201cif\u201d a hacker will gain access to your database. It\u2019s a matter of \u201cwhen\u201d. When a hacker accesses your database, how easily can they steal your data? When left unencrypted, this often leads to massive loss of personal and financial information.<\/span><\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><figure id=\"attachment_7274\" aria-describedby=\"caption-attachment-7274\" style=\"width: 175px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mrc-productivity.com\/blog\/wp-content\/uploads\/2013\/12\/small_4635132087.jpg\" alt=\"photo credit: Travis Goodspeed via photopin cc\" width=\"175\" height=\"135\" class=\"size-full wp-image-7274\" \/><figcaption id=\"caption-attachment-7274\" class=\"wp-caption-text\">photo credit: <a href=\"http:\/\/www.flickr.com\/photos\/travisgoodspeed\/4635132087\/\">Travis Goodspeed<\/a> via <a href=\"http:\/\/photopin.com\">photopin<\/a> <a href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\">cc<\/a><\/figcaption><\/figure>\n<p>\u201cJust because the database engine requires a username and password doesn&#8217;t mean one cannot simply grab the data files and get the information from within,\u201d says Raju Trivedi, Founder of <span style=\"color: red;font-weight: bold\">privateborders.com<\/span>. \u201cAnd there is a reliance on the database engine&#8217;s security which if flawed would give hackers easy access. This is why so many big gaming and ecommerce sites get hacked and all the personal information including credit card data stolen so often.\u201d<\/p>\n<\/blockquote>\n<h3>8. Passing variables through the URL path name<\/h3>\n<p>Here\u2019s another dangerous, yet common practice: Many developers place variables in the URL itself, opening the door for hackers to exploit other applications or data. How big of a security risk is this mistake? As you\u2019ll see from the story below, it\u2019s huge.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cNever allow variables that a user interacts with to be part of a path name to a file on your system,\u201d explains Kelley. \u201cWhen auditing a web application, I was once able to exploit a system by making use of a link that allowed downloading a free sample of the product. Coded into the script&#8217;s URL was the path to a file to download. I changed the URL to reference a different file, and was able to download the file containing their passwords.\u201d\n<\/p><\/blockquote>\n<h3>9. Only performing authorization on the client side<\/h3>\n<p>As I touched on in a recent <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Inside Link', 'New Realities']); \" href=\"https:\/\/www.mrc-productivity.com\/blog\/2013\/10\/5-new-realities-that-developers-must-learn-to-accept\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">article<\/span><\/a>, we\u2019re seeing more and more development move towards the client side. While this creates faster and more powerful applications, it can create security problems if authorization is handled improperly.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cMore web app developers are relying on the client-side browser to do work that was formerly done server side,\u201d says  Jarred White, CISSP, Manager of Security Engineering Services for <a onclick=\"_gaq.push(['_trackEvent', 'Blog', 'Source', 'ControlScan']); \" href=\"https:\/\/www.controlscan.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"color: red;font-weight: bold\">ControlScan<\/span><\/a>. \u201cThis creates a huge lack of control from a security standpoint, because you don&#8217;t know what kind of client is being used. It may not even be a browser at all. Anything that happens on the client side can&#8217;t be trusted, so you shouldn&#8217;t rely on Javascript or client-side code for critical functions, especially those involving payment information and other sensitive data.\u201d\n<\/p><\/blockquote>\n<h3>10. Assuming it won\u2019t happen to you<\/h3>\n<p>Two of the most dangerous mistakes you can make when developing web applications: assuming your application won\u2019t be attacked, or assuming you won\u2019t make a mistake. Both of these assumptions lead to lax security practices. Always assume your application will be attacked, and that you will make a security mistake. This mindset will help you avoid future security breaches, and could possibly save your company from embarrassment or financial loss.<\/p>\n<blockquote style=\"line-height: 1.7em; background-image: none; margin-left: 0; padding-left: 18px; height: auto;\"><p>\n\u201cEverybody makes mistakes,\u201d says Campbell. \u201cIf you can find your mistakes before the hackers do, then you&#8217;re in good shape! Open source tools like the OWASP ZAP can help you scan your applications for common issues before you push to production.\u201d\n<\/p><\/blockquote>\n<p>So, what do you think? Obviously, this list could be far longer, but I hope I\u2019ve covered some of the most basic, yet important security mistakes. If you think anything should be added to this list, feel free to share in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just when you thought that the healthcare.gov debacle was finally on the uptick, a \u201cwhite hat\u201d hacker just testified on Capitol Hill that security was never properly built into the site. He claims that fixing the critical-to-high exposures could require up to a year of work. Not exactly what you want to hear about a &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.mrc-productivity.com\/blog\/2013\/12\/10-security-mistakes-web-application-developers-should-never-make\/\"> <span class=\"screen-reader-text\">10 security mistakes web application developers should never make<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","slim_seo":{"title":"10 security mistakes web application developers should never make - mrc&#039;s Cup of Joe Blog","description":"Just when you thought that the healthcare.gov debacle was finally on the uptick, a \u201cwhite hat\u201d hacker just testified on Capitol Hill that security was never pro"},"footnotes":""},"categories":[8],"tags":[71],"class_list":["post-7262","post","type-post","status-publish","format-standard","hentry","category-education","tag-security"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/posts\/7262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/comments?post=7262"}],"version-history":[{"count":20,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/posts\/7262\/revisions"}],"predecessor-version":[{"id":14054,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/posts\/7262\/revisions\/14054"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/media?parent=7262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/categories?post=7262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/blog\/wp-json\/wp\/v2\/tags?post=7262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}