Slashdot Mirror


Does Code Reuse Endanger Secure Software Development? (threatpost.com)

msm1267 quotes ThreatPost: The amount of insecure software tied to reused third-party libraries and lingering in applications long after patches have been deployed is staggering. It's a habitual problem perpetuated by developers failing to vet third-party code for vulnerabilities, and some repositories taking a hands-off approach with the code they host. This scenario allows attackers to target one overlooked component flaw used in millions of applications instead of focusing on a single application security vulnerability.

The real-world consequences have been demonstrated in the past few years with the Heartbleed vulnerability in OpenSSL, Shellshock in GNU Bash, and a deserialization vulnerability exploited in a recent high-profile attack against the San Francisco Municipal Transportation Agency. These are three instances where developers reuse libraries and frameworks that contain unpatched flaws in production applications... According to security experts, the problem is two-fold. On one hand, developers use reliable code that at a later date is found to have a vulnerability. Second, insecure code is used by a developer who doesn't exercise due diligence on the software libraries used in their project.

That seems like a one-sided take, so I'm curious what Slashdot readers think. Does code reuse endanger secure software development?

148 comments

  1. No. by Anonymous Coward · · Score: 0, Funny

    Glad we got that resolved.

    1. Re:No. by Doub · · Score: 5, Funny

      Don't you think some code that has been run 10 times might be more secure than code that has been run 10 million times? After all it's less worn out.

    2. Re:No. by infernalC · · Score: 1

      Geting users to patch quickly to the latest version of your software can be really hard, but if you link to libraries that they are getting automatic security updates to anyway, you're probably in a much better place. Take, for example, TLS. If I code against Schannel, and Schannel has a bug that causes a serious vulnerability, Microsoft is almost certainly going to update Schannel without changing the interface in a way that will break my code. Same goes for OpenSSL. If I link against OpenSSL and choose to package my app with a dependency on the distros' OpenSSL pacakage instead of bundling it myself, yum-cron or apt-whatever is going to take care of the problem for me.

    3. Re:No. by Darinbob · · Score: 2

      Reuse has to be done *right*. Most of the people with religious fervour about code reuse do not necessarily do it right. Doing it right means you must review the code and know what it does, know if it fits into your design, know how to fix it when it breaks (and it will), and so forth. Cutting and pasting is dangerous. For a larger piece of code you want long term support that is stable without a constantly changing API, but do not expect to actually get support unless you're a giant company. I see so many who waste so much time wheedling to get support when they could just fix it themselves in a tenth the time. To some people "code reuse" is a synonym for "never code", and they love it because it often turns out they don't know how to program anyway.

    4. Re: No. by Anonymous Coward · · Score: 0

      Reusable code, no? Unvetted public repositories? Hell yes. Keep using them, people. Keep using then.

    5. Re:No. by skids · · Score: 2

      Yup. Everyone wants a philosophical fix for the security (and general QA) problem. Nobody wants to admit the need for many hours of less-than-prestigious, methodical work.

    6. Re:No. by Z00L00K · · Score: 1

      Unless you have a package that's statically linked or you attach the old library in your installation to ensure that the tested version of the DLL/so is linked to your code and not something newer.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    7. Re:No. by Anonymous Coward · · Score: 0

      Yes, but doing that isn't "code reuse". It is copy-pasting code, just that you do it after compilation at the linking stage. It has some advantage to the programmer, but for the binary the end-result is the same.
      Copy-paste is NOT what good programmers consider code reuse.

    8. Re:No. by Half-pint+HAL · · Score: 1

      Yes, but doing that isn't "code reuse". It is copy-pasting code, just that you do it after compilation at the linking stage. It has some advantage to the programmer, but for the binary the end-result is the same. Copy-paste is NOT what good programmers consider code reuse.

      It is code reuse, and to suggest otherwise is a bit baffling. To say it's not best practice is different. It's also ignoring that at least one major software platform doesn't allow dynamic linking except to OS-provided library functions: iOS.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    9. Re:No. by Anonymous Coward · · Score: 0

      Are you insane! We must all stop using operating systems, and Firmware. And microcode! Everyone should code/build everything from scratch! "ONE APPLICATION ONE CPU!" should be our motto. And NO networking!

  2. On the balance, most likely not. by Place+a+name+here · · Score: 5, Insightful

    If you use a third-party library that has a bug in it, you'll be exposed to the same bugs that everybody else using that library are. On the other hand, if you go at it alone, your implementation will have bugs of its own. And if the library is well-maintained, it'll have fewer bugs than the thing you make from scratch.

    Implementing the common functionality from scratch can easily become another kind of "not exercising due diligence", particularly when dealing with complex code. Or to put it another way: code reuse may endanger secure software development, but not reusing code may also endanger secure software development.

    1. Re:On the balance, most likely not. by beelsebob · · Score: 3, Interesting

      The issue isn't even "using 3rd party code", it's "static linking 3rd party code". If people learned to dynamic link libraries, rather than compile them in, then this wouldn't be a problem at all. If the OpenSSL guys learned that distributing only as a static library is a bad thing, and learned to make their ABI stable, then heart bleed would be a lot less of an issue.

    2. Re:On the balance, most likely not. by Anonymous Coward · · Score: 0

      I don't know what OpenSSL library you're thinking, but the only static version of a TLS/SSL library I've every used is YaSSL/WolfSSL. I've only ever used OpenSSL as a dynamic linked library.

    3. Re:On the balance, most likely not. by Narcocide · · Score: 1

      He's most likely confusing some or another sysadmin or distro maintainer's transient mistake or error in judgement for an officially sanctioned action by the OpenSSL maintainers themselves.

    4. Re:On the balance, most likely not. by Anonymous Coward · · Score: 0

      He is also limiting himself to use-cases where dynamic linking is possible.

    5. Re:On the balance, most likely not. by Darinbob · · Score: 1

      Many environments you can't dynamically link. Small embedded systems for instance. Library makers MUST make APIs and ABIs stable, because the difficulty of adapting to changing libraries means that projects will be slow to update to newer versions.

    6. Re:On the balance, most likely not. by Z00L00K · · Score: 1

      A lot of small home routers falls into this category. Whenever you look at them they are usually built on a very old kernel with busybox and some quickly thrown together web interface with questionable security.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    7. Re:On the balance, most likely not. by Anonymous Coward · · Score: 0

      Short answer: donate to, or actually pay, the maintainers of mission critical code. And be sure you are on their mailing list.

    8. Re:On the balance, most likely not. by Kjella · · Score: 2

      If you use a third-party library that has a bug in it, you'll be exposed to the same bugs that everybody else using that library are. On the other hand, if you go at it alone, your implementation will have bugs of its own.

      But the value of the target will be proportional too, the value of compromising "every server using OpenSSL" is huge compared to a custom hack that only works for your little company because of your home grown library. It's no doubt that the main reason you use libraries is because of resource constraints, not security. If you're small enough to not matter, spending a man year re-implementing what's already done is a no-go. If you have the resources to seriously consider going it alone you're probably big enough to matter hacking just your company has value in itself.

      And if you try to skimp on the resources for doing it what's far more likely to happen in practice is that you get the worst of both worlds, your developers get "inspired" by public code and you get copy-pasta code with the same vulnerabilities but without the maintenance and fixes, so your stale code is vulnerable long after the public code is fixed. That's actually much worse because the fix will usually lead to post-hoc exploit code to hack companies that don't have good update policies and the odds of your copied code being updated is slim and none.

      --
      Live today, because you never know what tomorrow brings
  3. The problem is often maintenance by guruevi · · Score: 3

    Most people just install software like they would a washing machine, once it's in, they don't touch it anymore except to run it, after all, a washing machine has a strong motor, some controls, valves and a belt, there is virtually no maintenance necessary and if it ever does, it's cheap enough and long-lasting enough you can just throw it out and replace it.

    Maintenance is a necessary part of anything that is a very complex machine and is not protected. A car is a good example, it sits outside so it needs to be protected against burglary but also against the elements, salt and accidents as well as regular maintenance to replace worn and outdated parts.

    Computer systems are as complex and vulnerable as cars, they sit 'outside' on the Internet, where they have to be protected against 'bad people' and just regular outdatedness but often they are considered as dumb appliances (if not actually called that by a vendor).

    People need to pay more attention and fund their "computer-mechanics", not just the manufacturers of their "car" and demand that they are able to inspect and repair their own stuff regardless of who invented it.

    --
    Custom electronics and digital signage for your business: www.evcircuits.com
    1. Re:The problem is often maintenance by murdocj · · Score: 5, Insightful

      The problem is that if software is working, and you "upgrade" it, two things can happen: it can continue to work, or it can fail, often mysteriously. Given that, it's not shocking that people tend to leave software alone if it is currently functioning.

    2. Re:The problem is often maintenance by guruevi · · Score: 1

      Same goes for a car, you can try fixing it yourself and often you end up with a problem that your car doesn't start 'mysteriously' because you left the spark plugs out or something stupid like that. Even mechanics at garages have this problem, although less often and are able to fix it quicker.

      If you absolutely need a car when it needs fixing, rent one or get a second one and don't try to fix it yourself if you don't know what you're doing. Would you leave your car without an oil change just because you can't spare it for a day?

      If you don't know what caused a software upgrade to go wrong, you probably can't "see" what exactly is going wrong and fix it yourself, that means, as I said, you should be demanding from the software manufacturers that they don't weld the hood shut.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    3. Re:The problem is often maintenance by nmb3000 · · Score: 3, Interesting

      Disagree. Software is not a washing machine nor a car. It does not break down over time, it is not susceptible to the elements, and it does not age in any notable way. There is literally no reason a program written and working in 1970 cannot continue to execute as well today as the day it was written. And it does! Industrial control systems, ancient government and finance mainframes, and primitive vehicle control systems all do it every day. Software doesn't rust and bit-rot is not a thing. Telling people that they need to keep their programs polished to prevent tarnish sounds like something a sketchy Geek Squad-esque computer shop might do to squeeze a hundred bucks out naive customers.

      I update my software sparingly and with caution. Generally speaking, it's much more likely that usability to be lost or features broken than a serious security issue fixed. If it's a mobile app, it's much more likely that ads were added or made worse, or a feature I've used for 2 years was removed or horribly changed, or increased permissions are requested so that my personal info can be sent away to some third party than any features I actually want were added or bugs fixed.

      Today's model of always-updated has some advantages but every single one is counterbalanced by the negatives. Auto-updating browsers help prevent the mire of zombies that was IE6, but it also means you're at the mercy of Microsoft, Mozilla, and Google when it comes to feature removal and their incessant need to screw around with the UI for no valid reason. Or that addon you really like and rely on suddenly stopped working because the author hasn't updated it yet.

      Yes, updates to address security problems is an important topic, but all too often those updates are bundled up with all sorts of crap that few people want. It would be real nice if software companies would keep the two separate, and make it clear just what has changed between versions.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    4. Re:The problem is often maintenance by Anonymous Coward · · Score: 0

      Not to mention the elephant in the room - that software upgrades introduce MORE bugs and overall less maintainable code. Thus, keeping up-to-date has its own set of vulnerabilities along with it. A dynamic threat assessment based on situational needs is the only possible approach in the general case.

    5. Re:The problem is often maintenance by guruevi · · Score: 1

      This doesn't mean that software updates aren't necessary.

      Your mainframe software is probably rife with bugs and issues and would be very insecure if it were connected to the Internet in the same way it was in the 1970's. Back then, we "knew" the person (often by name) who was responsible simply based on IP address and thus vandalism/criminal intent wasn't as much as an issue. The bits don't age indeed but the methods, underlying hardware platforms and security models behind it do.

      The only reason we have code that still runs on old IBM mainframes is because the code is often closed source or (if available) encumbered with copyright, if it were possible to migrate code simply by recompiling and some minor fixes, we wouldn't have governments that are still tied to IBM contracts from the 80s where they are literally charging thousands of dollars just for running THEIR OWN binaries on emulators on Linux clusters.

      I agree with you regarding the problems software updates bring and I think that's a very good reason to have open, user-compilable code with a (very idealistic) separation of existing function and new features. Kind of like keeping certain versions of KDE/Gnome alive in parallel with newer versions. The Firefox/Chrome/Windows model is indeed broken and the only reason that we have Firefox clones with minimal features are because of open source, it would be ideal to have it as a compile-time switch.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    6. Re:The problem is often maintenance by Dutch+Gun · · Score: 4, Insightful

      I want to agree with you in theory (especially about how apps often get made worse for no good reason), but practice, it's simply not practical to leave most software alone - at least, not if you want it to have any sort of reasonable lifetime. The difference is that modern software rarely lives in isolation. The ecosystem on which it runs... the OS, it's system libraries, third party libraries, the tools on which the software was developed... these are all moving forward in time.

      If you leave a piece of software alone, it experiences "bit rot" NOT because it's changing, but because everything around it is probably changing. More importantly, the more time occurs between updates, the more difficult those updates tend to be, until it becomes easier to actually rewrite the damned thing, since the original development system on which it was written may not even exist in the same state anymore. You may argue that software shouldn't always be changing, but you might as well ask for the Earth to stop spinning. Security issues alone will force a minimal level of change will occur.

      Updating continuously has its pain points, but any issues that come up tend to be smaller issues, and can be dealt with more quickly. For example, just the other day I realized MacOS's system Cocoa libraries slightly changed something which broke my code in a number of places, even though I wasn't doing anything sketchy with the API. But a slight change in definition meant I needed to cast some interfaces explicitly, and add new interface functions to retrieve those explicit interfaces. It was a bit of work to track this down and solve it, even for the relatively small amount of code I was dealing with.

      I saw one person on StackExchange say they "solved" it by linking their project against the older version of the library. That "solution" just stacked some technical dept on some poor future programmer, even though it 100% works for now. It may even allow such code to propagate in the future, making the eventual conversion even worse when it happens.

      Moreover, leaving functionality alone and patching only security issues becomes a game of maintaining a *very* long history of supported versions of software. How long does support last? Yes, this is the correct answer for some software, but remember that companies generally pay very well for these long-term support versions, even for Linux, because maintaining a current build is expensive (I have some recent experience with this). For most consumers, the simplest and most economical option is just to keep everything up to date, and yeah, that means taking the bad with the good.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    7. Re: The problem is often maintenance by Anonymous Coward · · Score: 0

      This.

    8. Re:The problem is often maintenance by Anonymous Coward · · Score: 0

      > It does not break down over time, it is not susceptible to the elements, and it does not age in any notable way

      No, it depends on APIs. APIs change, software has to change or it does break, over time.

    9. Re:The problem is often maintenance by Anne+Thwacks · · Score: 1
      Same goes for a car, you can try fixing it yourself and often you end up with a problem that your car doesn't start 'mysteriously' because you left the spark plugs out or something stupid like that.

      Speak for yourself. If I service my car, I know what I need to do, and I find out what is likely to be needed in the near future. If the dealer services the car, I find out which jobs are easiest and/or most profitable. Why would I leave my car with a mechanic for an oil change when I can do it myself in less than an hour?

      Any why would you even consider using closed source software for infrastructure? Not only you cannot ever find out what evil lies below the surface, Oracle^H^H^H^H^H^H the supplier may discontinue it after your entire organization has become dependent on it.

      --
      Sent from my ASR33 using ASCII
    10. Re:The problem is often maintenance by Anne+Thwacks · · Score: 1
      bit-rot is not a thing

      Bit-rot does happen. You are obviously not a Windows user, and never experienced DOS 4.1 or even early versions of the extX file systems. I have also had hard disks that seem to lose bits over a period of years.

      Having said that, I have run OpenBSD on Sparc machines (not Internet connected) for over 5 years without an update of any kind (aside from down-time to clean the air filters annually).

      I totally agree that auto-update is a festering can of worms, and bundling makes it worse.

      --
      Sent from my ASR33 using ASCII
    11. Re:The problem is often maintenance by Anonymous Coward · · Score: 0

      Except that bit-rot isn't about the application itself suddenly failing to work. It's about the rest of the world moving on, creating new environments for which it wasn't designed, and therefore causing it to fail.

    12. Re:The problem is often maintenance by Ol+Olsoc · · Score: 1

      The problem is that if software is working, and you "upgrade" it, two things can happen: it can continue to work, or it can fail, often mysteriously. Given that, it's not shocking that people tend to leave software alone if it is currently functioning.

      This! It is a huge issue for both vendors, writers, and users. One OS vendor with a track record of updates breaking systems that led to many people refusing to update recently went no choice on us. With predictable bad results, which just reinforces the idea of not updating if it works.

      I did a data transfer on a computer a couple years ago that had a never updated Windows XP OS on it. It was in use every day, and it was not updated once. Not the OS, not the Flash, not the browser, nothing. What brought the computer in was that Google refused to connect with it any more.

      --
      The shepherds did so well protecting the flock that the sheep no longer believed that wolves existed.
    13. Re:The problem is often maintenance by Ol+Olsoc · · Score: 1

      This doesn't mean that software updates aren't necessary.

      Your mainframe software is probably rife with bugs and issues and would be very insecure if it were connected to the Internet in the same way it was in the 1970's.

      Ahh, the 1970's internet. Those were good times, were they not?

      --
      The shepherds did so well protecting the flock that the sheep no longer believed that wolves existed.
  4. They can't be serious. by mthamil · · Score: 5, Insightful

    The alternative, which is everyone writing their own mostly terrible implementations, is far worse.

    1. Re:They can't be serious. by BarbaraHudson · · Score: 3, Funny

      If it means that it would be impossible to create stuff like Twitter, perhaps the positives outweigh the negatives.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    2. Re:They can't be serious. by Anonymous Coward · · Score: 0

      If we take this to it's (il)logical conclusion, then each new release of software should be a complete rewrite. The bugs in version 1.0 have a much lower chance of making it into version 2.0 if it's all new code. I'm sure some will sneak in when lazy programmers copy/paste from the version 1.0 codebase into the 2.0 codebase, but many won't make it.

      Of course, I'm not sure if it's acceptable for version 1.1 to only contain minor changes, or if it should also be a total rewrite. I'll have to think about that more.

    3. Re:They can't be serious. by Anonymous Coward · · Score: 0

      OTOH pre-packaged hacking scripts will become useless since every system will have different vulnerabilities.
      The entire automated hacking industry would disappear in favor of targeted attacks.
      But then those who have something valuable to protect can also afford to secure their systems.

      A mono-culture is far less secure than a diverse culture even if many of the implementations are terrible.

    4. Re:They can't be serious. by skids · · Score: 1

      The bugs in version 1.0 have a much lower chance of making it into version 2.0 if it's all new code.

      A lot of "bugs" are actually design deficiencies that are later patched up in code. These patches rarely make it back into the design documents, if there even are any. Rewrites are very likely to make the same exact mistakes, because it was not obvious a mistake was made until the code was put into production.

      Or in other words, old code contains wisdom. People need to learn to read code, not just write it.

    5. Re:They can't be serious. by Anonymous Coward · · Score: 0

      A lot of "bugs" are actually design deficiencies

      I have to correct a lot of people at work over this. Someone will tell me "it's not working correctly", and I will look at the specs and say "it's working as designed or it's undefined". aka, not a bug. I will ask them to make a feature request.

  5. uh, no by Anonymous Coward · · Score: 0

    Because you could certainly code up a more secure implementation of SSL yourself. That's probably the funniest thing I've seen on slashsot, ever.

    1. Re:uh, no by K.+S.+Kyosuke · · Score: 0

      Hardly impossible especially if you avoid C and limit yourself to some useful subset of functionality, for example. Whether it's worth the hassle is another question.

      --
      Ezekiel 23:20
    2. Re:uh, no by BarbaraHudson · · Score: 1

      Because you could certainly code up a more secure implementation of SSL yourself. That's probably the funniest thing I've seen on slashsot, ever.

      It will be the most secure implementation of SSL ever. It won't work, and terminate whatever process is trying to use it. Same as if he builds an airplane, it will be super safe because it will never get off the ground :-)

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    3. Re:uh, no by Narcocide · · Score: 2, Insightful

      You're like one of those people who thinks Java was written with more Java and its just Java all the way down, aren't you?

    4. Re:uh, no by rholtzjr · · Score: 3, Insightful

      How about avoid C common mistakes instead of avoid C would be a better statement. C done right is a solid language to use depending on the project.

    5. Re:uh, no by K.+S.+Kyosuke · · Score: 1

      Some implementations were indeed designed like that. If Java is what you want...

      --
      Ezekiel 23:20
    6. Re:uh, no by K.+S.+Kyosuke · · Score: 1

      It's great on microcontrollers!

      --
      Ezekiel 23:20
    7. Re: uh, no by Anonymous Coward · · Score: 0

      How is C bad? How is any tool bad if used correctly by an experienced craftsperson?

    8. Re: uh, no by K.+S.+Kyosuke · · Score: 1

      How is assembly bad, for that matter?

      --
      Ezekiel 23:20
    9. Re: uh, no by meerling · · Score: 1

      assembly is a low level language, and as such there are fewer people that can program in it, and it tends to take more resources to write anything. (Yes, time is a resource, especially if there are bean counters or marketing weasels around)

      Of course, like anything else, it has both advantages and disadvantages. The advantages of Assembly is the compiled code, if written well, is smaller and faster than other code that does the same thing. The disadvantage, less programmers available, harder to understand, takes longer to write code.

    10. Re:uh, no by ewanm89 · · Score: 4, Interesting

      I suppose you know how timing side channel attacks are done? All those layers of abstraction make it possible to accurately predict and alter code path length? Oh, and they do automatically handle things like proper memory scrubbing of keys when no-longer valid? Right?

      These things need low level hardware access to manage, and are hard even then where there is less in the way screwing with it. It is nearly impossible to handle properly on highly abstracted languages running in managed virtual environments like Java and C#.

      Yes those abstractions help avoid specific classes of vulnerabilities, but can open a whole host of just as bad context specific ones when talking about security stuff like encryption. This is why we should only let specialists in that specific field do such implementations and have them vet each others code.

    11. Re: uh, no by Z00L00K · · Score: 1

      Depends on the case - a language with built-in bounds checking is less prone to buffer overflow issues than C, but it may be cumbersome to do some stuff that's easy in C.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    12. Re: uh, no by darkain · · Score: 1

      You forgot the other major advantage of ASM code. Access to instructions other than basic logical program flow instructions, such as instructions for manipulating hardware or accessing memory mapped devices. One of my favorite things about writing a micro-kernel for an ARM platform over a decade ago was being able to drop in some inline ASM code into C/C++ libraries and manipulate the CPU in ways otherwise not possible, such as tweaking how instruction and data cache worked.

    13. Re: uh, no by Anne+Thwacks · · Score: 1
      bean counters or marketing weasels

      - hah - these are the real source of insecurity!

      --
      Sent from my ASR33 using ASCII
    14. Re:uh, no by Anonymous Coward · · Score: 0

      So if you avoid C what language do you propose?
      What high-level language will help you avoid all those mistakes yet give you sufficiently low-level access to avoid timing attacks?
      Or was your plan to re-implement it in a way where a whole range of security issues will be unfixable core part of its design?
      Because if so, congratulations, you managed to write a SSL implementation that is not only insecure but UNFIXABLY so, which is a whole new step above and beyond anything even the OpenSSL developer managed to do!

    15. Re:uh, no by Anonymous Coward · · Score: 0

      You're like one of those people who thinks C was written with more C and its just C all the way down, aren't you?

    16. Re: uh, no by Anonymous Coward · · Score: 0

      Yeah, and it will surely be constant-time or time-blinded to avoid side-channel attacks.

    17. Re: uh, no by Ol+Olsoc · · Score: 1

      bean counters or marketing weasels

      - hah - these are the real source of insecurity!

      This truth is sitting here at only +2?

      --
      The shepherds did so well protecting the flock that the sheep no longer believed that wolves existed.
    18. Re: uh, no by Anonymous Coward · · Score: 0

      ASM is not difficult to code, it's just laborious and mostly boring other than being able to hyper-optimize. I taught myself ASM in a few days at the age of 8. I have little practice, but the fundamentals were easy. I quickly got bored when I looked at how function calls worked and realized how much yak-shaving there was going to be to write any code of scale. I spent most of those few days focusing on Intel CPU optimizations, but at least I could make use of that in C.

      Even to this day, I make use of a lot of what I learned in ASM when I code in C#. Differences in performance between pre and post optimizations can be tens of percents, but typically lower single digits. I probably understood more in my early teens than most will in a lifetime.

    19. Re:uh, no by Anonymous Coward · · Score: 0

      Ah, but C was written that way.

      In addition, C has a loose enough memory model to permit us to define kernel memory model sanely. So we can make this work. Java on the other hand, not so much. I shudder to think how to write Java code that works in an interrupt handler context.

    20. Re: uh, no by mollymoo · · Score: 1

      The "if used correctly" bit is the problem. People aren't perfect. Even the really good, really experienced, really careful ones make mistakes. It's easier to avoid certain kinds of mistakes in other languages than in C. You can, of course, write perfect, secure code in C. You can do the same programming machine code using toggle switches too. It's just harder and takes more effort, which makes it more difficult to avoid mistakes.

      --
      Chernobyl 'not a wildlife haven' - BBC News
    21. Re: uh, no by Anonymous Coward · · Score: 0

      In the old days. assembly language was fairly close to the actual machine hardware. You could actually determine precisely how long each instruction would take to execute and exactly what state the internal gates would be in at any given nanosecond.

      That's not true anymore. Thanks to extensive caching and pipelining, to say nothing of secondary operations such as memory-refresh cycles, the execution characteristics of assembly code are difficult to predict accurately - and it should be noted that a lot of exploits get their leverage from inaccuracies in what's happening when.

      An automated code generator (compiler) can handle the extra bookkeeping required to tighten up these determinations, although some factors such as memory refresh mean that even then, you're dealing more with probabilities than certainties.

      You can certainly do such computations by hand, but unless you're doing something very, very specialized, don't expect to stay employed long if you "waste" a lot of time doing so.

      Even before everything was required to be done as cheap and fast as possible, I worked in a shop where we were actively trying to do as much OS-level coding in high-level languages as possible just because human productivity rated higher than saving a few microseconds here and there. Especially, since then, as now, a more optimal algorithm would gain you orders of magnitude more improvement where instruction-level tuning might gain 10%.

    22. Re:uh, no by K.+S.+Kyosuke · · Score: 1

      Yes, that may be a problem (in certain environments). But such side channels are not solely due to the "highly abstracted languages". If I'm not mistaken, you often get side channels because of highly abstracted hardware as well. As far as such things as scrubbing keys etc. are involved, well, you're facing similar problems as with managing other resources. The abstractions often help, like C++ destructors, Lisp's UNWIND-PROTECT, or whatever other feature your language of choice gives you for managing these. Also, not all higher-level languages disallow access to low-level features. It's not an either-or situation.

      --
      Ezekiel 23:20
    23. Re: uh, no by K.+S.+Kyosuke · · Score: 1

      assembly is a low level language, and as such there are fewer people that can program in it, and it tends to take more resources to write anything.

      So is C, compared to such things as Go or D, for example.

      --
      Ezekiel 23:20
    24. Re:uh, no by K.+S.+Kyosuke · · Score: 1

      Ah, but C was written that way.

      So was Jikes RVM, Squeak, all Oberons, half of Lisps...

      --
      Ezekiel 23:20
    25. Re: uh, no by K.+S.+Kyosuke · · Score: 1

      You don't technically need assembly for this. Extensible compilers with programmer-defined transformation rules can generate any instructions you want, including special-casing normal code for the use of such instructions when these are available and applicable.

      --
      Ezekiel 23:20
    26. Re: uh, no by Anonymous Coward · · Score: 0

      The "if used correctly" bit is the problem.

      It's not that hard. Just ditch GCC (Safe coding is not a priority for them.) and enforce MISRA-C rules.
      Now you will be stuck with many of the limits that higher level languages have but your code will be a lot more stable.
      On top of that you can pick up one of the machine safety standards and code according to those guidelines.
      Now you will end up with code that you can trust your life with. (And there is no so called "safe" high level language where that lets you do that because they can't guarantee that allocation failures or exceptions can't happen.)

  6. Code reuse is a good thing by davidwr · · Score: 3, Interesting

    Granted, if it's closed-source you have to trust the library vendor. If it's open-source, you either have to do due dilligence or trust someone else who claims to have done so.

    I assume we are talking about re-using source code, linking with staticly-linked libraries, and using and "private copies" of shared libraries binaries (e.g. /usr/local/bin/applicationname/lib/lib1.so or C:\Program Files\Application\DLLs\MyDll.dll). With "public" shared binaries (/usr/lib/sharedlib.so or C:\Windows\...\MSDLL.DLL), you are relying on the library or OS vendor to keep things patched.

    Here's an example:

    I know of a popular product that uses its own private copy of Java. If the vendor doesn't update their customer's versions of Java on a regular basis, an attacker can exploit it, even if the user is updating the "Oracle" version of Java on a regular basis. That's bad. On the other hand, they would probably be in a worse of a position of the vendor re-wrote the functionality of Java in-house, as that code would have its own set of bugs and it would likely NOT be as maintined as Java is. The solution is to use the "Oracle" version of Java instead of a private copy, OR push out updates to the private copy within a day or two of Oracle pushing out their updates.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
    1. Re:Code reuse is a good thing by Anonymous Coward · · Score: 0

      Of course the problem with just using the "Oracle" version is that your software will mysteriously break in production.

      If you ship your own version of Java then you can decide to ship updates only after thorough QA. If it turns out something in your app breaks with a given update, you can ship the fix with the newer Java.

      If you rely on the customer's version of Java then you have no control over it and things can break when you least expect it. And it's quite likely that when things do break you will have no idea that the problem is an unexpected Java update.

      dom

    2. Re:Code reuse is a good thing by Anonymous Coward · · Score: 0

      I know of far too many products that do similar things.

  7. Yes ... by CaptainDork · · Score: 0

    ...

    --
    It little behooves the best of us to comment on the rest of us.
  8. It depends... by QuietLagoon · · Score: 1

    ... upon whether or not the reused code is written in a manner that is proper and secure. If insecure code is reused, well, all bets are off. If secure code is properly reused, then the results can be good.

    1. Re:It depends... by Jeremi · · Score: 1

      ... and the problem there is, nobody can really tell whether a given library is secure or insecure (exception: after an exploit is found, we can say with certainty that it was/is insecure ;) ).

      So the question becomes, how do we know which third party libraries we can afford to trust the security of our application to?

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    2. Re:It depends... by Anonymous Coward · · Score: 0

      Wrong approach. There is no such thing as "secure" software, which of course doesn't mean that you shouldn't try, but the more important thing is to actually take responsibility for your code and keep as close track on third party code you have included as your own. Maybe even closer.

      After all, it's even in the submission, the problem isn't that there are bugs and security holes, as much as the fact that the patches doesn't get propagated. How anyone leaps from that to the conclusion that it's better to write new code and give oneself the possibility to create an even worse piece of software than the one you already have included, included repeating bugs that are already fixed once, plus new ones because you're probably worse at solving the problem the actual code solves, is beyond me.

      But hey, that's work, so I guess that's off the list.

    3. Re: It depends... by Anonymous Coward · · Score: 0

      one word: wordpress

    4. Re:It depends... by meerling · · Score: 1

      It's only 'secure' until someone finds a way to exploit it.

      Always assume that they will find a vulnerability eventually, but it's still your job to eliminate all of the vulnerabilities you can, and make it as hard as feasible for any attacker to get in.

      Of course there's the issue of resource to deal with. Sure if you had infinite time & other resources to work on the software before release/implementation, you could get something that will take longer than the heat death of the universe to become vulnerable, but since when has ANYONE ever worked under such an ideal and yet utterly unrealistic situation?

      It falls down to the old development triad every time.
      The options are Good, Fast, and Cheap, but you can only choose two of those options.
      (Sometimes I think the government gets stuck with only getting one option)

    5. Re:It depends... by ArtemaOne · · Score: 1

      True, but I think the implied point is that once that exploit is discovered, then they have access to all software that uses it automatically. If people wrote their own, the flaws would have to be individually discovered. I'm not convinced on which is better.

  9. Secure Software by ledow · · Score: 5, Interesting

    What's needed is better operating system management, not better development practices.

    Once a piece of software is patched, the problem is fixed. That's not the issue at hand. The issue is that that fix then does not make it back to production systems in a decent time.

    What's needed - and I've posited this a number of times for a number of things - is a central repository which lists which, say, linux packages are secure and which are not. Which algorithms, hashes and cryptosystems are compromised or not.

    Then there needs to be an API - running a production system live on the Internet? It will check its version numbers and package hashes against the centralised "uncompromised" versions service. If there's a discrepancy -a package that's been marked as potentially compromisable, but which has an updated or patched version available - the OS is tainted much like the kernel is tainted. If MD5 is retired and any software on the machine still utilises it, the system is marked as tainted as soon as it checks into the centralised API.

    We've needed this for hashs and crypto systems for a long time. SHA-1 is retired, but how do you KNOW that? And how do you know what uses that? Nobody would recommend building a system using WEP or MD5 in this day and age but nowhere is that listed in a queryable manner.

    And then you start saying "Why weren't Facebook checking their systems against the Secure Software Database? Their own fault if they were compromised.", "Why did Yahoo not re-hash with a listed-good algorithm as soon as their existing hash was obsolete?", "Why were they compromised? Because they turned off database checks and updates? Idiots".

    There needs to be a way for production systems to algorithmically say "This is no longer acceptable practice" and start making a fuss such that the system maintainers are forced to start upgrading, with specified timescales (the API could easily obsolete stuff on a set timescale, with warning enough to test changes to newer algorithms).

    Then, if you're compromised because you ignored this, or because you hard-coded MD5 instead of using libraries, all the fault will be in the your third-party, unlisted libraries. And then you might be able to actually start forcing vendors to publicly state "All our software uses the latest database-compatible algorithms, software and patches" rather than just hope that someone at Google isn't just running Slackware 2.0.

    The software can be fixed in a trice. The problem is getting that fix out to production systems in good time, and not being able to sufficiently shame those who don't manage their systems (it's easy to blame a hack on the software, rather than your lax update practices).

    1. Re:Secure Software by Anonymous Coward · · Score: 0

      Not that it'll mean a lot coming from an AC but...

      I'm working on a new development style. It's not procedural, functional or OO; it's something new. I've already got maybe half of what you're talking about in the design (distributed awareness of current package states) but hadn't consciously aimed at advertising compromised code. I'll do that. Thanks.

    2. Re:Secure Software by Anonymous Coward · · Score: 0

      Forks.

    3. Re:Secure Software by Anonymous Coward · · Score: 0

      Dipshit, not all of us depend on OS vendor downloads!
      We require software that isn't provided by vendor repos.
      Put on the pointy hat and stand in the corner.

    4. Re:Secure Software by Anonymous Coward · · Score: 0

      updating my motorola cell phone...

      google fixes android, releases...

      verizon blocks the fix. for months. for over a year. until they are shamed by millions of users getting hacked by a zero day.

      where in your scheme is the noble omniscent vendor who does all these nice fixes for free?

      please, go get a job making the next generation of the Internet of Broken Things.

    5. Re:Secure Software by Anonymous Coward · · Score: 0

      On the other hand I'm very annoyed at SQL Server raising a deprecated alarm on HASHBYTES('MD5', ...). I'm using it in a context where a security attack is not possible, to the point where I believe I could have used HASHBYTES('CRC64', ...) if it were available. I'm not looking forward to rebuilding the multi-million rows table with a new hash. Ugh.

  10. Of course not (with caveats) by bsDaemon · · Score: 3, Insightful

    Code reuse is a fundamental tenant of secure software development lifecycles. You reduce the chance that you introduce new vulnerabillities by limiting the amount of new code per project to the core business logic and leveraging existing modules for the support infrastructure.

    That said, if the module you reuse has problems then you aren't necessarily better off. The modules need to be vetted and maintained appropriately. Code reuse isn't the problem so much as taking random crap from the internet that solves your problem without assessing its suitability for inclusion given your threat model or properly assessing it for vulnerabilities.

    Monoculture can be an issue from certain perspectives -- flaws in the libssl portion of OpenSSL affect a huge percentage of the internet. However, they only need to be fixed once and consumers of the library can all receive the update, assuming proper patch management in the environment. If your company uses 15 different libraries to perform a specific software function across different product lines without a basis in engineering requirements constraints, you're doing it wrong.

    Security being a subset of correctness, I think overall it is b.s. to say code reuse is a problem. You just need to make sure you are reusing correct, vetted and maintained code. I.e., don't take strange code from someone's github to use in your enterprise software without reviewing it.

    1. Re:Of course not (with caveats) by Anonymous Coward · · Score: 1

      Yes. And that is why we (distro developers) fight so much "embedded library copies" in Linux distros: when one of those escape tracking, a supposedly fixed bug will linger on.

      Developers cannot be trusted to keep their embedded libraries current. Ever. They won't, it is not in their best interests to do so: it takes time, effort, and breaks their build, and it is uninteresting and dull. Issues start in ecosystems where this kind of crap is the rule (the javascript scene, for example), and get truly ridiculous when it leaks into "devops" mentality (which we call "chaosops"), because your typical "devops" *never* keeps their VMs up-to-date even with the distro updates, let alone outside-of-distro updates.

    2. Re:Of course not (with caveats) by skids · · Score: 1

      This. It also helps if codebases "do one thing and do it well" and when they feel mission creep seeping in, break off extra functionality into a well separated module. That helps confine bugs to more easily audited units.

  11. Due diligence on the developer to follow packages. by Mal-2 · · Score: 1

    You're responsible for the code you write, and if you are using existing libraries, you are responsible for tracking the packages you use. If they update, and your installer includes it, you need to update your installer. You may not feel this justifies pushing updates, especially if the change is to functions you did not use, but the program really should be checking for library updates and asking the user if they should be updated – and sometimes there are reasons why they cannot. At that point, it becomes the user's problem.

    --
    How is the Riemann zeta function like Trump rallies? Both have an endless number of trivial zeros.
  12. No. by Narcocide · · Score: 1

    Dearth of independent audits endangers secure software development.

  13. Yes by Anonymous Coward · · Score: 0

    But eventually security researchers will shake out the bugs, and as long as new features stop being added to 3rd party software, then those libraries may become very secure indeed.

  14. Writing software is risky. by Anonymous Coward · · Score: 0

    Until all software is formally verified like SEL4 there will be software vulnerabilities. After that it will be a matter of choosing how much distributed verification and redundancy is necessary to mitigate hardware vulnerabilities. Fast homomorphic encryption will be the final nail in the coffin for globally accessable vulnerabilities.

    1. Re: Writing software is risky. by bsDaemon · · Score: 1

      There is no formal verification at EAL4. That is at 7. EAL4 is "methodical" design, testing and review. A lot of crap got EAL4, like Windows XP.

      Besides, you can't get an EAL evaluation under NIAP anymore, it is Protection Profile only in the US. Unless you take your stuff to Europe for CC certification you're out of luck (BSI loves EAL) if that's what you want.

      The EAL system has a lot of holes in it that enable crap products to skirt the spirit. Not that the PP system doesn't, but it is harder to do (usually)

  15. I am going with very one-sided take. by Anonymous Coward · · Score: 0

    Obviously, code reuse means that a given vulnerability will show up in more places than it otherwise would; but you can't meaningfully size up the costs of that without considering the alternatives. If people aren't reusing code, odds are that they are rolling their own(quite possibly cutting nontrivial corners since reinventing the wheel is slower than just grabbing whatever library is popular and slapping it in). Is that what secure software development looks like?

    Code reuse does increase the odds that people poking at somebody else's product will find an exploit that works on yours; but it also increases the number of people with an incentive to provide a fix that you can drop in to solve your problem.

    That won't save you if your setup is totally hopeless(eg statically linked vulnerable library and no updates to fix that, or embedded/otherwise locked down system where updating shared libraries isn't an option for the user); but if that is the quality of what you are shipping with the convenience of reusing big chunks of code, just how optimistic am I supposed to be about your all-in-house product?

    1. Re:I am going with very one-sided take. by fuzzyfuzzyfungus · · Score: 2

      (Edit: the one arguably major vice of code reuse is that it makes lazy over-inclusion easy and tempting. We had a story a few days back about some fairly common 'default' desktop linux setups that were vulnerable because of a bug in the implementation of the emulator of one of the chips in the SNES. Outside of chiptunes enthusiasts and some of the more serious console emulation wonks, almost nobody is likely to ever see SPC audio; and the few people who will are likely to know what it is and be minimally inconvenienced by having to open their package manager and install libgme. But, since it was available as a Gstreamer plugin; the more the merrier! and into the default config it went. Given that software not produced under very, very, unusual attention to detail and correctness, which is almost all software, can be reasonably expected to risk some bugs; you don't want to be throwing in libraries that you have little or no use for, just because it's easy, which is certainly less likely if everything you include you have to write yourself; but aside from that there just isn't a(realistic) better option to code reuse. If your practices are too shoddy to even keep your 3rd party dependencies up to date; your DIY attempt is unlikely to be pretty; while if you are good enough to DIY properly; you certainly aren't obligated to stop; but you can probably handle keeping an eye on 3rd party dependencies.)

    2. Re:I am going with very one-sided take. by Anonymous Coward · · Score: 0

      That is a popular example, but I don't think it is a good one.
      While this issue might have been easier to find, even in the popular, frequently used gstreamer modules I am sure you will be able to find SOME security issue.
      Android's "stagefright" is just another example of how many bugs usually end up when someone starts to implement multimedia stuff.
      The real problem here is: you should NEVER ever process random, temporary files from the internet through a multimedia library, at least not unless less you have layers and layers deep of defence against exploits.
      You MUST assumes multimedia related code is exploitable, anything else is just being irresponsible.

    3. Re:I am going with very one-sided take. by fuzzyfuzzyfungus · · Score: 1

      I'm on partial agreement with you on that: I agree that (given the sometimes fairly high complexity of media codecs; and the fact that the web is a malicious place) media rendering code needs to be given much, much more aggressive handling in terms of sandboxing/privilege restriction. If all the decoder needs to do is provide audio suitable to be fed to the soundcard; or provide a series of frames to be painted wherever the video is supposed to be playing, there is no reason for it to be running with all the privileges of the user account; much less some more-privileged account if the implementation is a real disaster.

      That said, SPC audio is still seriously obscure, and used almost exclusively by people who know exactly what it is; so given that skepticism about security is the only safe stance when approaching a media codec/component; it still would have saved a lot of people some potential risk to have omitted it. Without the architectural reforms you suggest, people who do install libgme because they are doing chiptunes stuff would still be vulnerable; but the problem could have been avoided, even without any architectural changes, for most users just by omitting it.

  16. Stating the obvious, the opposite is... by blibbo · · Score: 1

    ..reinventing the wheel. Which can easily be done badly.

    Even for the most common search / sort algorithms, there's a good chance you won't code them perfectly first time.

    Code re-use, code-from scratch. Both have their place. Both require intelligent thought.

  17. Extreme vetting: software style by jhoger · · Score: 1

    "developers failing to vet third-party code for vulnerabilities"

    LOL. What would you suggest? Code inspection by magically infallible developers who have their own work to do creating new features probably wouldn't recognize vulnerabilities in their own code?

    Most companies and projects do not employ security researchers and specialists, not for their own code and certainly not for anyone else's, and they are not about to do so. And even if they could afford it, I wouldn't be too hopeful of the bugs actually being found. In fact, spending the time to find the bugs in the first place probably creates more vulnerability than would otherwise exist.

    1. Re:Extreme vetting: software style by Narcocide · · Score: 0

      Wow, so short sighted. You're missing the part about how they're supposed to spend a small portion of the massive savings in development costs on auditing the free public software they are profiting from. Above a given critical mass of implementation complexity, unless your developers are total noobs, this will be cheaper than writing the whole thing from scratch in-house, and more secure than doing that and NOT being able to afford to audit ANY of it.

    2. Re:Extreme vetting: software style by rossz · · Score: 1

      You are assuming that everyone who codes is competent to code review all types of code. Some people are great programmers but have little or no experience with encryption. They are going to have to trust that the people who specialize in encryption actually know what the hell they are doing.

      --
      -- Will program for bandwidth
    3. Re:Extreme vetting: software style by Anne+Thwacks · · Score: 1
      Code inspection by magically infallible developers

      This ... A thousand times this!

      --
      Sent from my ASR33 using ASCII
    4. Re:Extreme vetting: software style by Anonymous Coward · · Score: 0

      > Wow, so short sighted

      You are missing the point on both sides. Your statement amounts to a nonsequitor.
      Using third party libraries has led to a widespread number of identified vulnerabilities.
      Most developers cannot vet all software.

      You then say "short sighted", as if that has anything to do with the discussion.

  18. Yes it does, and for many reasons... by FlyingGuy · · Score: 2
    Like:
    • Developers who just say, "we have to use > " because that is all they know how to use and they cannot take the time to learn the basics of good software design principles.
    • Development Managers who could not code their way out of a wet paper bag, making decisions for the development team when they know very little about anything.
    • The coders who write "tools" so they can make databases look like Java then hate the DBA's when they point out that the database is a vertical beast and not a horizontal one. And yes I am speaking about the fools who who write Hibernate / Spring which is so old, so wrong, so wrong headed as to make it practically useless in the day of a modern DB engine. Hibernate has been broken into more times then I can count.
    • SOFD, Software of the day... So a guys writes something he thinks is cool, and some fool decides its great and uses it in a forward facing system. It is never strenuously tested, and likely as not never developed further yet there it is in some critical code.
    • Using Libs or frameworks that are so badly coded that they include 10's of thousands lines of code that are never seen or tested because some 24 year old kid grabs a function that he thinks is going to save him an hour or two.
    • Because Java! Not the worst programming language ever, but the problems that come from garbage collection and programmers who THINK they understand it.

    • Because JavaScript, which is the worst period, ever written period, kludged upon period, ever written period!!

    We need to get off of the HTML/CSS/ crazy drunken bandwagon and get back to basics! Re-boot and re-tool the the entire process because if we don't we are just screwed and more break ins will happen as the things become more and more complex. You need to let DBA's build the database portions of things and secure access. You need to let Systems people write HARDENED code. Let web guys make things pretty. You need to stop demanding a a single point tool and go back to individual inter working parts, written by competent coders, which are then put through a very severe hardening process.

    --
    Hey KID! Yeah you, get the fuck off my lawn!
    1. Re:Yes it does, and for many reasons... by Anonymous Coward · · Score: 0

      But that takes time and competence, which costs money and doesn't improve quarterly profits.

    2. Re:Yes it does, and for many reasons... by Anonymous Coward · · Score: 0

      Because Java! Not the worst programming language ever, but the problems that come from garbage collection and programmers who THINK they understand it.

      Wow. You're complaining about Java GC issues and don't even mention pointer issues in C and C++? Just wow. If you really believe all that software would be better in C/C++ then you really need to re-evaluate your understanding of languages and developers. And if you weren't implying that C/C++ are better over Java then you're failing to take into account almost every other modern language uses GC and all have the basic set of GC issues as Java, so there really can't be another language you're referring to. Java memory issues are fairly rare and generally pose little risk. System breaking security issues are one typo away in C/C++ land.

  19. Depends on the library by AuMatar · · Score: 3, Insightful

    A well known, maintained library such as OpenSSL? You're far more secure using the open source library. Not only do you need to be an expert to correctly and securely implement that level of cryptography, but it can contain all sort of subtle bugs you're unlikely to catch.

    Now if you're talking about some random library you found on github because some guy on stackoverflow said to use it? That makes you less secure. Don't put random things you found on the internet into your program without reading the code, understanding what it does, and doing a full audit on it first.

    And there's a special place in hell for anyone who uses gradle, nvm, or anything else that automatically downloads the library for them without specifying an exact version. You're just asking to be screwed by a trojan horse. Leftpad was about the best case scenario, imagine if leftpad had changed their code to be a backdoor instead?

    --
    I still have more fans than freaks. WTF is wrong with you people?
    1. Re:Depends on the library by skids · · Score: 2

      Don't put random things you found on the internet into your program without reading the code, understanding what it does, and doing a full audit on it first.

      Nobody would get anything done if they had to fully audit all their dependencies.

      However, they should spend some time auditing some portion of it. Especially if they have specialized domain knowledge which allows them to audit that section better.

      In other words, improve, even if slightly, some of the things you use. Contribute. Don't just take. If everyone did that, then security would improve.

    2. Re:Depends on the library by AuMatar · · Score: 1

      Sure they would. They'd just get things done slightly slower. But the big, well known dependencies aren't the problem- they may find an occasional security bug, but they'll be quickly patched. The problem is when you use some random library that doesn't have a large user base and contributor base. If you find something on github and use it without reading and understanding every line of it, you're incompetent.

      --
      I still have more fans than freaks. WTF is wrong with you people?
  20. Oh, sure code reuse leads to insecure software. by hey! · · Score: 2

    So does reinventing the wheel. So does cut-and-paste coding.

    Code reuse leads to insecure software in much the same way that breathing leads to cancer.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  21. TITLE SHOULD READ: by Anonymous Coward · · Score: 0

    Does OpenSores Fester At Your Organization?

    The answer when we come back.

    When we come back next time.

    NO! We don't listen to the Jenny Mcarthy's of this world! WE VACCINATE! and stay clear of faster poooo and so should yoooo!

  22. OpenSource solves all of these problems... geez by Proudrooster · · Score: 1

    Code Re-use and open source software lead to super-reliable, robust, and secure code that is the foundation of the Internet. With all the eyes constantly looking over the code it continues to get better and better. And since no program or company has time to write everything from scratch, code will be reused until we can teach computers how to write code.

  23. It's not the code-reuse that's the problem by Anonymous Coward · · Score: 0

    It's just that people don't give a shit about writing secure code. They just want a fast production cycle.

  24. Stupidity endagers software development by thesandbender · · Score: 1

    Good code is good code. Bad code is bad code. Knowing the difference is what makes you a "programmer".

  25. Code reuse is good, but... by sigmabody · · Score: 1

    As has already been stated, you generally want to prefer to use a third-party library over a custom implementation, for most security-related code. This is doubly true for well-defined algorithms, which are implemented in well-tested (and preferably open source) libraries.

    However... there's an inherent danger in adopting third-party libraries based on uninformed assumptions about quality, as I'm personally well acquainted with. If you have a manager who is prone to making baseless assumptions, and downloading random packages off the internet which purport to be semi-related to the current problem development is experiencing, and insisting they be integrated as the "easy" solution for that problem, you're going to end up with bad quality software (or worse).

    As the saying goes: garbage in, garbage out. If you're doing software integrations based on garbage processes, you're still going to get garbage out, no matter what the quality of each third-party module.

  26. I write the hacking scripts, and that's misinforme by raymorris · · Score: 2

    I understand your logic. You're not being stupid, but you are misinformed.

    > hacking scripts will become useless since every system will have different vulnerabilities

    The fact is, over 90% of the CVEs are the SAME 12 or so vulnerabilities - hard-coded default passwords, SQL injection, etc. I can and do write scripts that find "new" vulnerabilities in software we've never seen before. One-off, custom software, especially web applications will pretty reliably have one or more of a gew specific vulnerabilities. You may have heard of the "OWASP Top 10"; most one-off software contains at least two or three of those ten.

    Once I (or the script) detects anything else about the software, we can know more specifically which vulnerabilities it has, before we even test it. For example, I've seen a dozen different scripts named "download.php" or similar. All but one suffered from the exact same three vulnerabilities.

  27. I maintain *exactly* that system Monday-Friday by raymorris · · Score: 1

    > central repository which lists which, say, linux packages are secure and which are not. Which algorithms, hashes and cryptosystems are compromised or not.
    >
    > Then there needs to be an API - running a production system live on the Internet? It will check its version numbers and package hashes against the centralised "uncompromised" versions service

    That's precisely what I spend 40 hours a week building and maintaining. It's a very helpful part of a comprehensive security strategy. Other good parts are having security experts available to help you make sense of the flags and decide on the best way to remedy the issues. You mentioned MD5. If you find out your HTTPS server is running MD5 and RC4, which aren't strong, which algorithms should you replace them with? Should you allow either as a fallback? Also similarly monitoring and analyzing your logs, using both good automated tools and experts. The last thing I'll mention is actually the most important - tested off-site backups.

    The version and configuration testing that you mentioned, the system I maintain for a living, is called Cloud Insight.

  28. Use the SECOND-most popular library by Tony+Isaac · · Score: 1

    Hackers will typically target the most popular libraries, because these will be found on the largest number of computers. If you want your software to be more secure, use the #2 or #3 library, assuming they have appropriate functionality. Hackers are less likely to attack these.

    This principle is beneficial in other ways as well. If you are using commercial libraries, the #2 or #3 brand will try harder to support you, the customer, because they want to catch up with #1. The #1 brand, on the other hand, tends to sit on its laurels, often failing to adequately maintain its code.

  29. No, it's the Operating System, silly! by ka9dgx · · Score: 1

    Analogy time: Imagine homes with no Circuit Breakers. Any short circuit anywhere could burn down a house. Lawyers and lawmakers arrive on the scene and declare that everything you want to plug in needs to be short proof. Every product has to be certified not to burn down houses, no matter what failure happens. The designers of even a simple lamp can end up being charged with murder, and as a result nobody really wants to use electricity.

    We have circuit breakers, which limit the amount of current to be supplied to an appliance. If you have a special big appliance, like an air conditioner, you have to use a special circuit to supply it with power. Circuit breakers serve to limit the side effects that are possible when you use electricity.

    There is no analogous circuit breaker in our widely used operating systems. When you run an application as a user, ALL of your authority is given to the program, and you have to just hope that it does the right thing. There are systems which do place limits on the side effects of a program when you run them, and they are even user friendly and fairly easy to understand.

    It's up to us to start to use operating systems that have the ability to limit the side-effects of programs. One example is the Genode project. There is also the perennially late GNU Hurd

    1. Re:No, it's the Operating System, silly! by phantomfive · · Score: 1

      That's not going to fix things, and here's why:

      Imagine a system where Apache is running as a web server, can only access the database, and nothing else. In fact, limit it further: it can't even write/read to the database, just forwards requests to an application server.

      A hacker who manages to break in to this Apache instance still has all the user data that is streaming through the server, which is quite a lot.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:No, it's the Operating System, silly! by ka9dgx · · Score: 1

      Yes, being able to copy the flow of data to a user would be bad, but not system-compromising bad. And why would an instance of Apache be able to connect to more than one IP address? Each thread would be isolated from each other, further limiting the information leakage.

    3. Re:No, it's the Operating System, silly! by ledow · · Score: 1

      In the UK, every device has to be supplied with a mains plug pre-wired.

      Every such main plug has an individual fuse in it, of the correct rating for the appliance..

      And every circuit is on an RCD / breaker on the fuse board.

      And every fuse board has an RCD / breaker.

      And the house has a fuse for the fuse board.

      Don't lay the blame at one point or one component. Isolate them all.

      As pointed out, an application with permissions to private data is vulnerable no matter what you do - a compromise is a compromise and generally gets full access as the user/program you compromised, along with any data it's given.

      The trick is to a) run everything as separate users (yes, every program / user combination should be a different user so even my web browser can't access my word processor, etc.), b) isolate the data and access of each program to the minimum required (e.g. don't let word processor see web cache etc.) and c) keep everything up to date.

    4. Re:No, it's the Operating System, silly! by phantomfive · · Score: 1

      Yes, being able to copy the flow of data to a user would be bad, but not system-compromising bad.

      Probably the most valuable thing on that system is the flow of data.

      --
      "First they came for the slanderers and i said nothing."
  30. Re:I write the hacking scripts, and that's misinfo by Anonymous Coward · · Score: 0

    For example, I've seen a dozen different scripts named "download.php" or similar. All but one suffered from the exact same three vulnerabilities.

    They all suffer from P, H and P.

  31. No by Anonymous Coward · · Score: 0

    There's really no comment needed.

  32. Re:No -- YES! by Anonymous Coward · · Score: 0

    Oh fuck too many beers.
    See the problem here?

  33. Betteridge's Law by Xtifr · · Score: 1

    One of the best examples of Betteridge's Law of headlines I've seen in quite a while! :)

    No, code reuse obviously does not endanger secure software development. It was hard enough for the experts to get ssh right, and you think you're just going to whip one up from scratch? Yer a freakin' idiot if you think that!

    Code reuse (like pretty much everything else associated with software development) has risks and benefits. Learn what those risks and benefits are, and stop searching for magical "silver bullets" that fix all your problems. Because they don't exist.

    1. Re:Betteridge's Law by Xtifr · · Score: 1

      Correction to my previous post. A real silver bullet fired directly through your CPU will solve your bug problems, because you'll no longer be able to run software--hence, no bugs. Aside from that, silver bullets that fix all your problems are imaginary. :D

  34. A possible remedy: Use Copyright Law by Ross+Finlayson · · Score: 1

    There is (conceivably) a remedy available under Copyright Law. Many "Internet of Things" devices (in particular, network cameras) run (at least some) libraries that were licensed under the GNU LGPL. One of the conditions of the LGPL is that users be able to - at will - replace the device's LGPL'd libraries with their own version (with the same API). If these devices do not have such an 'upgrade' mechanism available (and I suspect that few, if any, do), then they could find themselves legally liable.

    If the device manufacturers feel that they're at legal risk here, then this may motivate them to make their products more easily updatable in the future.

    1. Re:A possible remedy: Use Copyright Law by GuB-42 · · Score: 1

      That's the case with LGPLv3, not LGPLv2.
      And the "anti-tivoisation" clause as it is called only applies to consumer products.

    2. Re:A possible remedy: Use Copyright Law by Anonymous Coward · · Score: 0

      Believe it or not the LGPL v2 managed to require the ability to replace the library in situ where even the GPL v2 failed to do so.

  35. Shared responsibility by Anonymous Coward · · Score: 0

    The only benefit I can see in rolling your own assuming comparable code quality from a security perspective is your specific use case may allow you to significantly reduce overall complexity vs. more generalized solutions.

    When we integrate third party libraries we do try to review code and have contributed back bug fixes as a result. Yet frankly for some very commonly used libraries including OpenSSL I don't believe anyone has ever bothered to try. I don't consider this a defensible position. If your going to save a bunch of time or gain a capability that would otherwise take multiple lifetimes to implement yourself for free you should at least be willing to review the code in a way you are reasonably able to.

    There are other libraries we have looked at and rejected as too dangerous and then proceeded to implemented our own. Much of the time these efforts are not specifically about security but reliability. What we find often just amounts to poor coverage... unchecked resource allocation, unchecked I/O, nonsensical concurrency semantics and severe misuse of dangerous functions.

    Then there are the critically important libraries you can't possibly rewrite which are so helplessly fucked up they must have been written by Adobe. These we normally use IPC to talk to in an isolated process space not because security because we don't want to hear our customers bitching.

  36. Bad software endangers software development by XparXnoiaX · · Score: 1

    The reality is most companies don't care about security.

    When was the last time your boss added a security audit to your sprint? When was the last time someone said, "make sure you add enough time on this task to make it secure."? Security is not a priority for companies, so we don't spend time thinking about it.

    For these reasons I advocate irresponsible disclosure: we need to give companies motivation to improve their code.

    --
    Irresponsible disclosure is responsible
    1. Re:Bad software endangers software development by Opportunist · · Score: 1

      I'n not really going to answer those questions, for we're a very special case with very high security requirements (security is here one of the major parts of the specs, usually it's about the same length as the feature demands), so I can't complain about not being asked enough, actually, it would be nice to at least be left out of the meetings that discuss the color of the user interfaces...

      My problem is on the other hand that I cannot outsource anything. I cannot find any partners that can actually comply with our security requirements. Programming companies are so used to not giving a shit about security that their staff simply cannot handle the most basic security requirements.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  37. Do roads endanger car drivers? by Anonymous Coward · · Score: 0

    It's well documented that car drivers have lots of accidents when they share roads. Can anyone share their experiences of driving without roads? It's not like there can be any downsides, surely?

  38. It can be if done wrong by Casandro · · Score: 1

    My argument is that many programmers design needless complexity into things because they believe they can just "outsource" their problems.
    For example people design systems with complex file formats they could not parse themselves, then they load a script interpreter which will parse it for them.... and as a side effect execute any code in that file.
    If they would have chosen a simpler file format, a few lines of code would have been able to parse it perfectly well.

    Also there is one particularly toxic way of code reuse and that's dynamically linked libraries. While those sound like a decent idea at first, in reality they have the big disadvantage of not only making your system a lot more brittle, but also increasing start-up times. Increased start-up times mean that, to use the functionality of another program you can no longer economically just start up that program to do you bidding as it would take far to long. Instead people now run things like TLS in a library running in the same memory space so that buffer overruns can simply read the keys and data of other connections or even the rest of your program.

    So while code reuse has it's advantages, it can go terribly wrong when it's done wrong... and it's often done wrong.

  39. Re:I write the hacking scripts, and that's misinfo by Anonymous Coward · · Score: 0

    Not entirely wrong.
    Code variety becomes less with higher level languages so it is not surprising that the security issues are alike.

    It is also possible to argue that the problem comes from using PHP in which we are back at code reuse.
    Using a high level language with a built in library with a lot of complexity isn't really different from pulling in an external library with a lot of complexity.

    The main problem I see with code re-use is that the library functions often only do almost what you want but not entirely.
    You often end up getting a lot of security holes from functionality you didn't want to begin with.

  40. Code reuse doesn't. Cargo cult programming does. by Opportunist · · Score: 1

    It's not a problem when a programmer pulls code out of his archive to put it to new use. What is a problem, though, is people googling their problem du jour that they cannot solve, find code that more or less does what they want, adapt it to their specs and consider that programming.

    What you will usually find as one of the first hits that way is tutorial code that showcases the function that you might be after, but without any sanity checks and without the even barest minimal security in mind, simply because it is supposed to TEACH without distracting by adding code that doesn't contribute to the function.

    That's why injection is still, after over ten years, the number one on the OWASP Top 10 list.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  41. Re:No... but.... by jafiwam · · Score: 1

    Glad we got that resolved.

    But it WILL give democrats an excuse to say they were hacked by Russians.

  42. Libraries vs. Bespoke Code by RLGSC · · Score: 1

    It is indeed simplistic and one-sided to assert that "using libraries exposes systems to bugs". The problem is far deeper, and affects both library and bespoke code bases. First, consider the somewhat psychological problem that often happens when using libraries. The various flavors of public code (e.g., Open, Free, etc.) have as an implicit or explicit basis the presumption that since the source is freely available, those using the libraries will peruse the source, either to fix shortcomings or to correct bugs. In effect, it is distributed vetting. Unfortunately, as the Heartbleed vulnerability with OpenSSL demonstrated, there are many who slipstream when using such packages. When the incident occurred, the list of major computer software enterprises using OpenSSL without internal vetting (or for that matter, externally funding the OpenSSL committee's audit functions) was long and distinguished. In essence, each responsible management said to itself "Everyone else is vetting, why should I?". Those who attended a basic Economics course should recognize this as a version of the "Commons" problem (although the examples invariably discuss the origin of the problem, English common sheep grazing pastures). There is a significant (> US$ 100,000/project) benefit to NOT vetting and relying on "someone else in the community". At least until it becomes obvious that almost everyone has been assuming that someone else was vetting the code. Internally-developed code is often limited in its specification, development, and testing. Since it is developed for a specific project, the effort to make it widely applicable is often lacking. Often, bespoke code developed for one project is appropriated, officially or unofficially, for other projects. Unofficially appropriated code is particularly problematic, as the connection between the original copy and the new copy is often the developer's recollection. When corrections are made, they do not propagate to all of the copies. In summary, the problem is less code-based than human-based. Shortcuts save money and time in the short run, but cutting corners leads to quality issues.

  43. Yes, it's the worst plan available by Anonymous Coward · · Score: 0

    except for every thing else.

    Economics seems to focus private code efforts on features over bugs. (See Micr^H^H^H^H who's on top of the security alert list.)

    Open source's published, commonly used code makes it easier to develop exploits.
    But the code review and wide testing it can provide is probably our best hope for making bullet proof code.
    Unfortunately, a lesson from SSL is that for all the users, there does not appear to be that much review going on.

    Open source is our best hope, but we need more incentives for review.

  44. libraries are evil by Anonymous Coward · · Score: 0

    why are non technical people writing technical articles... it's like they've never heard of open source or libraries

  45. Yes by nuc1e0n · · Score: 1

    But more accurately, code reuse permits more software development in general, including insecure software development.

  46. Mark for upgrade by jraff2 · · Score: 1

    Put a string of password like alphabet soup in a routine. Then when that routine becomes ensconced in some other application it can still be searched for and noted for replacement of removal. It would only take about 128 bytes to clearly note application, programmer, usage, date, time, etc. It used to be a size issue but with todays Gigabyte memory size, that issue has diminished dramatically.

  47. Pointy-Haired Bosses Endanger Secure Development by jevvim · · Score: 1

    The big issue I see in my daily work life is that management acts as if using a third-party solution, be it proprietary or open-source, means we will receive perfect code at the beginning and never have to update it. We lock versions early in the dev cycle, but if a new version comes out mid-development there is a general distrust of changing to the new one.

    And then, when the inevitable critical issue is discovered after we have release, we have no efficient plan on how to update. At least GPL solves that; when users have a pure-GPL system, they can always recompile/relink everything themselves after the big patch. But if I statically link a proprietary license library into our proprietary product, we have to step in and rebuild to get the fix out there. And the lack of preparation for this process does endanger security.

    The management teams I've worked with are typically better at estimating and preparing for critical field breaks in "our" code. But that's why they like third-party, and that assumption of "perfect" that makes the future look so much better. So the bigger issue is that managers endanger secure software development.

  48. Root Cause by snadrus · · Score: 1

    The problem with unbounded pointer vulnerabilities (stack smashing, return value changing, parameter changing) is the unboundedness of the pointer. ONLY the programmer and (for some languages) the compiler know what values are legal for a pointer offset.

    Programmers aren't enough.

    So I use GoLang (but Java, Rust, Node are all similar in this regard) because I know that all my pure-GoLang 3rd-party libs cannot have unbounded pointer errors. This means Go's SSL, not Go's OpenSSL wrapper. A Userspace written in entirely managed pointer languages cannot have these problems (except at the kernel level).

    --
    Science & open-source build trust from peer review. Learn systems you can trust.
  49. Google knows the danger of code reuse (efast) by Anonymous Coward · · Score: 0

    See subject: It's a huge danger of "OpenSores" https://www.google.com/?gws_rd=ssl#q=Efast+chrome/ having it reused for nefarious purposes (fake Chrome browser exploit).

    * It's the SINGLE BIG REASON I don't give away code I write in APK Hosts File Engine 9.0++ SR-4 32/64-bit https://www.google.com/search?hl=en&source=hp&biw=&bih=&q=%22APK+Hosts+File+Engine%22+and+%22start64%22&btnG=Google+Search&gbv=1/

    (I won't give it away to have an "evil doppleganger" of my work out there doing folks wrong...)

    APK

    P.S.=> Especially since that program does users nothing but RIGHT giving them more speed, security, reliability & anonymity than any other "so-called 'solutions'" do for FAR less resource consumption slowness + bloat & moving parts for breakdown/exploit yet does FAR more using what you have natively already... apk

  50. No, and here's one reason why by davecb · · Score: 1

    In a previous life (several, in fact), we followed the "write once" rule. If you needed a queue, you looked to see if there was one, made sure it did what you wanted, and used it. If it didn't, you filed a bug and a patch, then you used it. Reuse tended to cause code review, at least enough to make sure it wasn't going to fail in the new use, and additional testing. As a result, the quality slowly increased with each additional use.

    --
    davecb@spamcop.net
  51. Re:Code reuse doesn't. Cargo cult programming does by Anonymous Coward · · Score: 0

    Yeah, because its oh-so-smart-and-wise to reinvent the wheel in a vain attempt to show how clever you are.
    Grow up, twit.

  52. It's one of my gripes by joboss · · Score: 1

    If you manually install libraries this is also going to be problematic. I've often found myself my own package maintainer. It's hard to keep track of everything and some libraries or packages can break each version needing code changes. In niche cases the libraries are being build not simply because they are out of data on the system and newer is needed. Sometimes they need to be patched in a way that wont be accepted upstream which raises the maintenance code for upgrading. VCS helps but it's still a big hassle. I try to make an effort to keep everything up-to-date but occasionally things slip. Luckily for me a lot of it isn't a security concern for most packages as they are internally used.

    The situation is actually sometimes worse with automatic package managers that bring in dependent libraries. The issue there is that you have a swarm of new development for things like npm, composer, etc but no quality control. A lot of repositories have issues with this. Things like cpan and Pear I notice has a lot of problems with lots of old unmaintained packages of varying dubious quality. Newer systems have a lot of new content with very little review and varying use or feedback. Lots of quality issues are found there as well as things like ten people developing the same thing. No one appears to even be doing basic checks before letting these packages be listed on central official repositories. Some people in the associated communities even resent the suggestion of any kind of quality control or banding for packages as some kind of foreign non-inclusive notion. It reminds me of when the schools tried to eliminate performance tiers and to make everyone a winner. These attitudes are annoying especially when its merely a grade that doesn't have to eliminate new content from being accessible, merely help people make the right choice about whether to use it or not. Grading isn't a perfect art but it can be done fairly well based on standards checks, web of trust, usage and maintenance statistics, etc.

    The problems are on multiple fronts, security, stability, compatibility, bloat, portability and even potentially licensing issues if people have bundled things inappropriately. An example of the absurd is recently I wanted to install a package for being able to execute and intercommunicate with language A from language B. Normally this process by default would compile a library for language B that uses the system includes and library for language A. Instead of doing this the package downloads the maintainers entire binary build of language A which is huge and not even compatible with the system. An option to use a custom compile of language B rather than the system is fair as an extra-option. This package however was simply half baked and wrong. I then encountered multiple other packages that did similar things.

    I tend to care and try to do what I can to verify the quality of something including things like checking how recently it has been maintained and so on. However it's really very difficult to do a really thorough job of it.

  53. Re:Code reuse doesn't. Cargo cult programming does by Opportunist · · Score: 1

    Either you replied to the wrong comment or you have trouble with reading comprehension, which one is it?

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.