Slashdot Mirror


The Security of Popular Programming Languages

An anonymous reader writes "Deciding which programming language to use is often based on considerations such as what the development team is most familiar with, what will generate code the fastest, or simply what will get the job done. How secure the language might be is simply an afterthought, which is usually too late. A new WhiteHat Security report approaches application security not from the standpoint of what risks exist on sites and applications once they have been pushed into production, but rather by examining how the languages themselves perform in the field. In doing so, we hope to elevate security considerations and deepen those conversations earlier in the decision process, which will ultimately lead to more secure websites and applications."

33 of 189 comments (clear)

  1. Wonder how Ada 2012 would fare... by mlts · · Score: 4, Interesting

    I wonder how Ada 2012 would do in this test, although I don't know of any websites that use this language for a backend.

    1. Re:Wonder how Ada 2012 would fare... by HiThere · · Score: 2

      It's hardly a solved problem. There are approaches that can be made to work, but that's not the same thing. The current approaches are all clumsy, and often that's a charitable description. It's usually doable. Saying anything beyond that is fulsom praise.

      OTOH, because different languages have different basic derived structures, it's often not clear exactly what the best approach would be, even when one is considering things carefully. For one purpose the best I've been able to come up with is marshalling everything into a byte array, and then separating it back out. Doable, but hardly what I'd call "a solved problem". Probably an insoluble problem because the different languages map the same concept differently internally. So you need to deal with it on a special case by special case basis.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    2. Re:Wonder how Ada 2012 would fare... by gawdonblue · · Score: 2

      the best I've been able to come up with is marshalling everything into a byte array, and then separating it back out. Doable, but hardly what I'd call "a solved problem"

      COBOL: solving problems since 1959!

    3. Re:Wonder how Ada 2012 would fare... by aybiss · · Score: 2

      That's right, I need to run my webserver from my microwave.

      --
      It's OK Bender, there's no such thing as 2.
  2. ASP? by BaronAaron · · Score: 5, Insightful

    Do they mean Classic ASP? They list .NET separately so I don't think they mean ASP.NET, but they also don't include ASP in their list of "legacy" languages. I also seriously doubt 16% of companies are still using Classic ASP.

    ASP isn't even a language, it's a framework. You can write a Classic ASP app in vbscript or javascript. You can write ASP.NET in any .NET supported language. Then there is ASP.NET MVC.

    If they can't get their list of tested "languages" straight, I doubt the rest of the article.

    1. Re:ASP? by FearTheDonut · · Score: 2

      Yes, but it's far easier to say, ".NET is .NET", or, more accurately, "Microsoft is Microsoft". i.e. Proprietary.. i.e. bad. While I don't have numbers, I'd wager that Classic ASP (which runs on the .NET framework) is vastly more unsecure than ASP.NET MVC.

      Don't mistake my comment for blind support for Microsoft. But, when a study fails simply acknowledge this very basic fact about the Microsoft ecosystem, it's numbers really don't mean much.

  3. Confusing by vux984 · · Score: 3, Insightful

    I'm not even sure what the article meant by ASP vs .NET ? Surely they aren't talking classic ASP? I doubt anybody is 'starting new projects in classic ASP -- so what is ASP? and how is it not .NET ?

    The rest of the article doesn't make a lot of sense to me either.

  4. Depends on who uses them by CastrTroy · · Score: 5, Interesting

    It may be cliche, but how secure a language is depends on who is using it. PHP is very accessible, and used by a lot of newbies, so "in the field" there turns out to be a lot of vulnerabilities found. However, by following some relatively simple guidelines, code can be made pretty secure. Most of the problems in PHP code are either due to SQL injection, which can easily be avoided by using parameterized queries, or from turning on options that are known to be insecure, like register_globals. C on the other hand would only be used by a small number of highly trained individuals, at least for web applications, so it's less likely to experience problems in the wild, but due to buffer overflows and other memory management problems, it's much easier to shoot yourself in the foot without realizing it.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    1. Re:Depends on who uses them by jellomizer · · Score: 4, Funny

      That can't be, My choice language has been told to be the most secure ever.
      So
      Input $Login
      Input $Password
      Let $LoginID= SQLQuery("SELECT LoginID from Logins where Login = '" $Login "' and Password = '" $Password "'

      I am can rest comfortably knowing that I am perfectly secure.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    2. Re:Depends on who uses them by parkinglot777 · · Score: 4, Insightful

      If you read TFA, you will find out quickly that the headline (both from this site and on TFA) is seriously misleading! What TFA is talking about is doing statistic on 30k websites, and determine what language/frame work they used to implement. Then check on each of them for vulnerability attack, such as SQL injection, XSS, etc. So, the language itself has NOTHING to do with the security, but it is the implementation of the site itself! The article itself is not well written either... Too many quotes from many people in copy-and-paste style. Then the author tries to thrown in numbers (i.e. percentage of this and that) to make it look like it is that useful... NOT!

      TLDR? Below is what TFA is actually about...

      WhiteHat researchers examined the vulnerability assessment results of the more than 30,000 websites to measure how the underlying programming languages and frameworks perform in the field. With that information, the report yields key findings around which languages are most prone to which classes of attack, for how often and how long as well as a determination as to whether or not popular modern languages and frameworks yield similar results in production websites

  5. Mean number of vulnerabilities is a good metric? by 140Mandak262Jamuna · · Score: 3, Insightful
    When you reduce a complex issue to just one number, like "mean number of vulnerabilities", it is often an over simplification. It is tempting to think it is better than nothing. But are we really better off making decisions based on an overly simplified view of things?

    One bug that allows silent remote code execution on the WAN side and another bug that is a privilege escalation possibility on the LAN can not be treated as one bug each, right? This is not limited to just security vulnerabilities alone. Many software company top managers insist on looking at bug counts, sometimes sorted into 5 priority/severity levels or so.

    It gets worse in the planning and progress monitoring. They use fancy tools like rallydev.com or something, but they allow each team to define its own story points. The Bangalore team uses 1 story point = 1 engineer week. The Boston team uses 1 story point = 1 engineer day. The Bangkok team uses engineer hour. And the top management gets the report, "This SAGA feature story was estimated to take 3264 story points, and it is 2376 points complete". Complete b.s. that is.

    We pay ridiculously high salaries for the top management, and instead of expecting them to put in the time, energy and effort commensurate with that kind of pay, to make valuable judgement, hard decisions, step on people's toes, tell it like it is, and paint an accurate picture of the state of the company, we let them shirk their responsibilities.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  6. Not a useful paper by MobyDisk · · Score: 5, Insightful

    In the wake of Heartbleed, one might think that this would be talking about array bounds checking or buffer overflow mitigation. No. It is talking about web site frameworks.

    examined the vulnerability assessment results of the more than 30,000 websites

    First of all: this is not measuring the security of the programming language. This is measuring the security of the OS infrastructure and toolchains. Notice C/C++ is not on the list, since it is hardly ever used for creating web sites.

    There was no significant difference between languages in examining the highest averages of vulnerabilities per slot.

    What the heck is a slot?

    Any summary where Perl scores the best must be deeply questioned. I doubt this is an apples-to-apples comparison. Surely these Perl sites are not doing nearly as much as the sites written in other languages.

  7. Re:python?! by NotDrWho · · Score: 5, Funny

    It's the hip and cool language. If you owned vinyl records and were a vegan, like me, you would know that. But then again, I don't even *OWN* a TV and I was into that band way before they became all commercial. So I can't expect the rest of you to understand.

    --
    SJW's don't eliminate discrimination. They just expropriate it for themselves.
  8. It's not just the language, but the implementation by davidwr · · Score: 4, Insightful

    If the language specification doesn't expressly say what happen when things "outside the design" happen, then different implementations may work differently.

    For example:

    If the language design spec says

    "If an array index is out of bounds, exit the program and return a value of ABEND_ARRAY_BOUNDS_VIOLATION to the calling program,"

    that may seem very specific, but if how to "exit the program and return a value of ABEND_ARRAY_BOUNDS_VIOLATION to the calling program," isn't specified by someone (usually the operating system), then it may not be specific enough. if different operating systems specify how to do this differently, then expected "under the hood" behavior will not necessarily be consistent across operating systems.

    For example, does "exit the program" mean simply returning control to the caller, or does it mean explicitly returning any resources that were previously granted to the program by the operating system first? Or is that optional? If it's optional as far as the operating system is concerned, does the language provide a compile- or run-time switch to force such a cleanup? Does returning memory to the operating system guarantee that the OS will sanitize the memory, and if not, does the language guarantee it? If the language doesn't guarantee it, does the language provide a compile- or runtime switch so the program will sanitize memory prior to returning it to the operating system?

    These differences in language implementations and even differences in how operating systems handle the starting and stopping of processes can lead to differences in what the code actually does. Usually these differences are unimportant but sometimes they are very important.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  9. Re:PHP not the worst!!!! by beelsebob · · Score: 2

    php is not the worst because they measured completely the wrong thing. They measured how many bugs they found in the implementation of the language, not how many bugs a programmer using that language would introduce that the language would not catch for them.

  10. Re:Subtle attack against C/C++ by jythie · · Score: 3, Insightful

    I do not think C++ would have helped here, all it would have done was made things a bit more obscured. It should also be noted that you can build custom allocators in C++ too (I worked on a couple projects that used them) so that part of the problem would be there too.

    C++ makes a lot of things easier, but under the hood it is still essentially C with an expanded library and fancy pre-processor (I know modern compliers do not actually preprocess C++ into C and then compile), thu all the same problems are still there and mostly are mitigated by using libraries that wrap things up in a safer way.

  11. Re:Subtle attack against C/C++ by NotDrWho · · Score: 5, Funny

    Hey, some of us find manual memory management sexually fulfilling, you insensitive clod!

    --
    SJW's don't eliminate discrimination. They just expropriate it for themselves.
  12. Re:If you want real security by FearTheDonut · · Score: 2

    (Can't believe I'm replying to an AC).

    This sounds great and all that, but that's a very unreasonable statement. Consider C. I don't know a single person who would say that C is secure or that security wasn't built in from the get-go. The same can be said of C++. But those languages offer different benefits (speed and control both come to mind). It's a trade off, to be sure. But sometimes, you have to use a language that isn't secure "from the get-go" to build an application that needs security. We don't always have the luxury of doing the perfect (or near perfect) thing.

  13. More Important Is Ease of Writing Secure Programs by Unknown+Lamer · · Score: 2

    Ur/Web is an interesting language with a type system designed to reject vulnerable web programs as ill-typed. The compiler itself is written in a safe language — Standard ML, and there is a proof of language correctness included.

    --

    HAL 7000, fewer features than the HAL 9000, but just as homicidal!
  14. The whole approach is wrong by gweihir · · Score: 4, Insightful

    The security level of a piece of code with good security is 95% coder competence and 5% language, i.e. language is irrelevant. One thing though is that language can add to the security problems if it has insecure tun-rime implementation errors.

    One reason most security-critical software is written in C is that there, the coder gets full control. A good coder with skills in secure coding will do fine with C. A coder that does not understand software security will to badly in any language, but in C he/she might not even produce anything that works, which will be an advantage. Also in C, it will be far more obvious if somebody is clueless, which makes review easier.

    But "language is important for code security" is even more wrong than "language is important for code reliability". Language is important for code performance though, but only in the sense that it can kill it. Good language choice can also make a good coder more productive (a bad coder has negative productivity, so it hardly matters...). This nonsense about the language being capable of fixing problems with the people using is comes from "management" types that are unable to handle people that are individuals. These utterly incompetent "managers" can be found in many large companies and they believe that in IT, individuals do not matter. Typically these "managers" are not engineers and have no clue what a good engineer can do but a bad one cannot. They also believe that engineering productivity can be measured in hours spent or that all coders are equal and just implement specifications, so outsourcing is a good idea.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:The whole approach is wrong by EvanED · · Score: 2

      A good coder with skills in secure coding will do fine with C.

      I conclude from this and the list of security vulnerabilities in real life that there is no such thing as "a good coder with skills in secure coding."

      Or at least no such thing as a project that only employs or accepts contributions from such programmers.

    2. Re:The whole approach is wrong by naasking · · Score: 2

      The security level of a piece of code with good security is 95% coder competence and 5% language, i.e. language is irrelevant.

      Sure, and memory management, and program correctness, and just about any other achievable program property is 95% coder competence and 5% language by this argument. Except the coders that can guarantee 100% that said property is achieved make up 0.001% of the coder population, which means the vast majority of importance falls on the language to prevent memory leaks, out of bounds errors, and the plethora of other program correctness violations and security vulnerabilities.

      Language is important for code performance though, but only in the sense that it can kill it.

      A language implementation determines code performance, not a language.

      This nonsense about the language being capable of fixing problems with the people using is comes from "management" types that are unable to handle people that are individuals.

      No, it comes from other programmers who recognize not only their own limitations, but the limitations of nearly every other human being who can't seem to come to the same realizations. Dunning-Kruger all the way.

  15. Re:Methodology for choosing languages? by sporkbender · · Score: 3, Insightful

    I thought that PHP was born around the same time as Java (and definately way before .NET). So how is PHP a legacy language and Java isn't? Or, is the writer just throwing in words to mess with my programming language history?

  16. Re:On the Other Hand by preaction · · Score: 2

    I VOLUNTEER AS TRIBUTE ... but not for ColdFusion, ew.

  17. For the life of me.... by Primate+Pete · · Score: 2

    I can't figure out how I would use this to make make a real-world decision. Just picking the "most secure" language overlooks so many other tradeoffs that I just can't see it as a valid approach, especially when the article ends with a call for more testing, not a call to select superior languages.

    This is a non-finding.

  18. Re:Subtle attack against C/C++ by Zero__Kelvin · · Score: 2

    "Luckily for us, the people responsible for maintaining the Linux Kernel understand the difference between C and C++ "

    Yes, it is indeed lucky for us that the competent OS developers know their stuff, and they don't listen to people like yourself who have no idea why C is better for the Linux kernel (or any kernel, really). I hate to break it to you, but you aren't smarter than the top Linux developers. You simply aren't. Stop confusing yourself into thinking you know more than they do. It is pathetic to watch.

    --
    Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  19. Re:Completely missing the point by BenSchuarmer · · Score: 2

    The problem with that is that many programming languages have "features" that programmers misuse resulting in security holes (especially in PHP).

    If a language makes it difficult to do things safely, it's reasonable to blame the language.

  20. Re:Subtle attack against C/C++ by InvalidError · · Score: 2

    At the end of the day, all programming languages are about abstracting things. If you are testing the intrinsic security of a programming language, you are in essence testing how successful the language's built-in data types, built-in functions, APIs, standard libraries, etc. are at mitigating risk factors, which is all about abstraction.

    A language's intrinsic security is only as good as its abstractions.

  21. Re:Subtle attack against C/C++ by Antique+Geekmeister · · Score: 2

    > C++ (and do a lesser extent C) lose support because of their extremely poor support for utf8.

    That's because for most programming, UTF8 is not worthy of support. It's inconsistently used, it arbitrarily increases the of individual. It would be much safer used as only binary strings, not as actual characters which must be parsed and reformatted among different environments. The advent and popularity of UTF8 with its confusing and ill defined management of case and formally POSIX compliant operations such as file naming has effectively slowed system programming by many years.

  22. Re:SQL injection attacks? by JDG1980 · · Score: 2

    People are still writing code vulnerable to SQL injection attacks?

    Yes, they are. It doesn't help when lots of online tutorials give crappy information, like saying to use mysql_real_escape_string in PHP instead of a proper parameterized query. (Using the escape function is better than nothing, but it's not foolproof and is needlessly convoluted.)

    This tutorial, which ranks first on Google when I search for 'php sql', uses the escape method and does not mention parameterized queries at all. (The correct method is described here.)

  23. Re:If you want real security by david_thornley · · Score: 2

    C++, properly written, is much more secure than C. It includes memory management, type-safe I/O, and well-behaved library containers.

    --
    "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  24. Re:Subtle attack against C/C++ by Joce640k · · Score: 2

    UTF8 is great for storing data in files, but ... working with strings in memory? Insanity will follow.

    --
    No sig today...
  25. Re:If you want real security by david_thornley · · Score: 2

    Except that I gave reasons why C++ is superior in security to C. It's easier to write secure code in C++ than in C. Both are difficult to write well, but well-written C++ code is going to be more secure than well-written C code.

    --
    "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes