Slashdot Mirror


The Most Dangerous Programming Mistakes

snydeq writes "Fatal Exception's Neil McAllister discusses the most dangerous programming mistakes, and what can be done to avoid them. 'Even more than input validation errors, this year's list is rife with application security blunders of all kinds. Some of them sound fairly esoteric, such as "inclusion of functionality from untrusted control sphere." But of all such errors, the highest-ranking one on the list is "missing authentication for critical function" — in other words, the attacker was able to gain access because there was no lock on the door to begin with,' McAllister writes. 'With the pace of Internet attacks accelerating, now is not the time to cut QA staff or skimp on testing and code review.'"

213 comments

  1. Better link by Chris+Mattern · · Score: 5, Informative

    If you'd like to read what the mistakes *are*, instead of a fluff piece that amounts to "oh, they're so awful! And people make them all the time, too!", here's the actual original article: http://cwe.mitre.org/top25/index.html

    1. Re:Better link by frinkster · · Score: 5, Insightful

      If you'd like to read what the mistakes *are*, instead of a fluff piece that amounts to "oh, they're so awful! And people make them all the time, too!", here's the actual original article: http://cwe.mitre.org/top25/index.html

      Is one of the mistakes "Not being able to click on a link"? I would check myself, but I can't click on the link.

    2. Re:Better link by fnj · · Score: 2

      Slashdot is busted as usual. Cut and paste.

    3. Re:Better link by the_humeister · · Score: 1

      No list is complete without Therac-25

    4. Re:Better link by Anonymous Coward · · Score: 0

      This is in fact a dupe from 2-3 months back.

    5. Re:Better link by countertrolling · · Score: 1

      Right-click - Open Link in New Tab

      --
      For justice, we must go to Don Corleone
    6. Re:Better link by baKanale · · Score: 3, Insightful

      Switch back to the Classic Discussion System.

    7. Re:Better link by sorak · · Score: 2

      For me, the slashdot break also breaks the context menu. As far as I can tell, the only way to follow a link is to reply, quote parent, and copy and paste from parent's HTML.

    8. Re:Better link by Anonymous Coward · · Score: 0

      Ditto, in Firefox 5 I get no context menu, although I do get a context menu with IE9. But it's not all links, the ones in the summary work fine.

    9. Re:Better link by Qzukk · · Score: 2

      I think they tried to fix the "clicking anywhere opens parent comment" bug by blocking you from clicking anywhere. Not the first time they broke slashdot this way. Expect things to go back to the old brokenness in about 2 weeks, I think that's how long it took them last time.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    10. Re:Better link by fast+turtle · · Score: 1

      Strange. I'm not seeing any problems on FF5 and Win7-64. Not sure what the problem is for everyone else.

      --
      Mod me up/Mod me down: I wont frown as I've no crown
    11. Re:Better link by Tx · · Score: 1

      You have javascript disabled, we don't.

      --
      Oh no... it's the future.
    12. Re:Better link by Anonymous Coward · · Score: 0

      You can drag the links to the tab bar and it will open just fine. (FF4/5 at least)

    13. Re:Better link by Chris+Mattern · · Score: 1

      Ah, that's why it's a link for me and not him. It's not good to force people to run javascript; I'll stop being lazy and make sure I use HTML links from now on.

    14. Re:Better link by Chris+Mattern · · Score: 1

      It's a listing of generic errors for the past year, not specific disasters across history. Not "Therac-25" and "the AT&T switch network crash", but "SQL injections" and "buffer overflows".

    15. Re:Better link by satuon · · Score: 1

      I was wondering about that, too. It started happening since yesterday or the day before yesterday I think. I click on a link and nothing happens, but 'Open in new tab/window' works well enough. Is this browser-specific? I use only Google Chrome, but what do those using IE or Firefox have to say?

    16. Re:Better link by tepples · · Score: 3, Insightful
      Obviously, not all mitigations on the list apply to all situations. Here are some examples where they wouldn't apply so easily:

      Where possible, avoid implementing custom authentication routines and consider using authentication capabilities as provided by the surrounding framework, operating system, or environment.

      This can prove cost prohibitive when the authentication capabilities provided by the surrounding operating system are marketed for use only by privileged employees, not by the public. Consider the case of an operating system that charges per user account. (Microsoft calls this the "client access license" model.) One might be tempted to use or create an authentication and authorization library that runs independently of the operating system's own auth facility, so that one needs to buy a system user account for only the web server, not for each member of the public who creates a user account on the web site.

      For outbound authentication: store passwords, keys, and other credentials outside of the code in a strongly-protected, encrypted configuration file or database that is protected from access by all outsiders

      Say I encrypt the keys that a web server uses to communicate with other web services, such as the key used to communicate with a payment processor. Now how do I store the key to decrypt those keys?

      For inbound authentication: Rather than hard-code a default username and password, key, or other authentication credentials for first time logins, utilize a "first login" mode that requires the user to enter a unique strong password or key.

      So how do we prevent an attacker from attacking a system while it is still in "first login" mode?

      Clearly specify which data or resources are valuable enough that they should be protected by encryption.

      Firesheep shows that this includes users' passwords and cookies containing authenticated session tokens. But with StartSSL having suspended operations and Internet Explorer on Windows XP still not supporting Server Name Indication, how can hobbyist web developers get the certificate and dedicated IPv4 address needed to host an SSL site?

      If possible, create isolated accounts with limited privileges that are only used for a single task.

      Please see my comment above about the CAL pricing model.

      Generate a unique nonce for each form, place the nonce into the form, and verify the nonce upon receipt of the form.

      If you've ever seen errors about a "form key" on Slashdot, Slashdot is doing exactly this.

      Do not use the GET method for any request that triggers a state change.

      Is a hit counter a state change?

      Use a built-in path canonicalization function (such as realpath() in C)

      According to this page: "The realpath() function is not described in the C Standard." It's available only in UNIX, not in Windows.

      Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a username is valid or not.

      Does this mean don't bounce messages to nonexistent users but instead treat them as delivered and discard them? That would provide a bad user experience for people attempting to contact these users.

      Use code signing technologies such as Authenticode.

      How does a hobbyist afford the certificate for Authenticode?

      For all configuration files, executables, and libraries, make sure that they are only readable and writable by the software's administrator.

      Writable I agree with, but readable I'm not so sure. If configuration files are readable only by the adm

    17. Re:Better link by countertrolling · · Score: 0

      I'm beginning to suspect that the site is designed by committee, where everybody is isolated from each other.. I hope none of these guys write programs for nuclear power plants. On the other hand that could be quite interesting, when observed from a safe distance

      --
      For justice, we must go to Don Corleone
    18. Re:Better link by Anonymous Coward · · Score: 0

      It's the other way round - the links works when JavaScript is disabled. It's nothing you did in your post, it's something the slashdot code is doing.

    19. Re:Better link by GooberToo · · Score: 1

      Ya, that's a classic.I love how the company gets all the blame for that but the people who are truly at fault are only ever glossed over.

      Machine: "Hi, I'm operating so completely out of allowed parameters I'm going to completely stop functioning. Here's a 'MALFUNCTION' warning to make sure you get me serviced before you continued."

      Operator: "How annoying. The stupid machine is trying to prevent me from dosing massive levels of radiation. Oh well, its just radiation and they're not my loved one. I'll just ignore and pretend the machine didn't just stop my dangerous attempt to kill/poison a patient."

      In the real world, its known as negligent homicide and attempted murder. But we'll just blame the company and pretend the morons involved had no role to play, ignoring that it was the ONLY first order contributing factor.

    20. Re:Better link by Anonymous Coward · · Score: 0

      What have you ever done that's better, big mouth?

    21. Re:Better link by sorak · · Score: 1

      I don't know if you'll see this, but tepples pointed out that in Firefox 5, you can double-right-click a link to get the context menu up.

    22. Re:Better link by AdamHaun · · Score: 1

      Hold down the right mouse button in an empty space, move it over the link, then release. That got me a context menu.

      --
      Visit the
    23. Re:Better link by cp.tar · · Score: 1

      In Firefox 7 nightly builds the link works just fine as it is.

      --
      Ignore this signature. By order.
    24. Re:Better link by colinrichardday · · Score: 1

      Worked for me.

    25. Re:Better link by Pentium100 · · Score: 1

      No, it was more like:

      Machine: "Hi, I'm operating so completely out of allowed parameters I'm going to completely stop functioning. Here's a 'MALFUNCTION' warning to make sure you get me serviced before you continued."

      Operator: "The manual does not say anything about it, also, the machine seems to be working, so it's probably some false positive. Let's continue."

      Also this was a transient error - it only happened sometimes, so even if someone serviced it it could be that the failure was not triggered.
        If anything this is an example of why vague error messages are bad.

      Same thing with cars. Now, I understand that my car (made in 1982) does not have a computer and so it cannot detect if something is wrong, I have to do that based on the symptoms (if something is wrong with the way the car works). However, a new car, that can detect a malfunction and display "something is wrong" on the screen, should also display what it thinks is wrong, since, well, the CPU somehow detected the malfunction, why not tell the driver what is it (or, more accurately, why does it think that something is wrong).

    26. Re:Better link by ColdWetDog · · Score: 0

      Slashdot is busted as usual. Cut and paste.

      Maybe frinkster has a Windows 7 Phone, you insensitive clod.

      --
      Faster! Faster! Faster would be better!
    27. Re:Better link by Hamsterdan · · Score: 1

      I just love doing a double right-click just to get to the context menu. That and getting the working spinning wheel when closing a tab.

      (and no, my computer isn't broken, it only does that on /. )

      --
      I've got better things to do tonight than die.
    28. Re:Better link by Anonymous Coward · · Score: 0

      Both a pure fluff.

      You want "dangerous" you start with stuff like the [Therac-25](http://en.wikipedia.org/wiki/Therac-25) incident and go up from there.

      Calling any of these 25 "dangerous" shows what insulated and pussified world these clowns live in. Here's a hint for them: if nobody friggin' died - not dangerous.

    29. Re:Better link by Anonymous Coward · · Score: 0

      Maybe he made a website where you CAN click on the links? Dohohohohoho!

    30. Re:Better link by Neil+Boekend · · Score: 1

      Same thing with cars. Now, I understand that my car (made in 1982) does not have a computer and so it cannot detect if something is wrong, I have to do that based on the symptoms (if something is wrong with the way the car works). However, a new car, that can detect a malfunction and display "something is wrong" on the screen, should also display what it thinks is wrong, since, well, the CPU somehow detected the malfunction, why not tell the driver what is it (or, more accurately, why does it think that something is wrong).

      "Somethings wrong because the voltage at pin 15 of the ADC is 6,3V instead of 4,2V." would help loads of course.

      --
      Well, I might have a way, but it only works on a semi spherical planet in a vacuum.
    31. Re:Better link by mijelh · · Score: 1

      Locking out a targeted account [after failed login attempts]

      My grandma ran into her credit union's online banking web site's policy of three strikes and you have to wait from Friday night to Tuesday morning for a branch to be open again. The tone of her voice indicated that this is not a pleasant user experience.

      Still a better user experience than getting your account hijacked

    32. Re:Better link by Pentium100 · · Score: 1

      What is that pin connected to? Write that with the error message.

      Also, when the guy connected a PC to the car, he got the error type, it was something that I, for example, can type to google and see if the problem is critical (as in my car is going to fall apart if I drive anywhere other than the mechanic) or not. I will make an appointment with the mechanic anyway, but I will know whether I can use the car until then or I have to borrow another one.

      Even the error message that you wrote is good enough if I can find schematics or find it using google, but less practical than CKP SEN/CIRCUIT

    33. Re:Better link by GooberToo · · Score: 1

      From what I read, in all cases where excessive radiation was administered to a patient, it was immediately proceeded by the operator encountering a malfunction indicator whereby they promptly ignored it. Only after negligently poisoning the patient did they call to have the machine serviced. And that's why the company was resistant to admit fault (or that an issue even existed), because the dumb fucking operator cleared the error codes, so they could poison their patience. Then when the machines were serviced, they never found any reported errors. After all, you sure wouldn't want the operator's schedule fucked up waiting for a malfunction to be serviced. Better to clear a known problem and poison your patient than to fuck the schedule up. I mean, they have lunch to get to, which is obviously far more important than somebody's life.

      Basically, dumb fucking criminal operators who negligently attempted to murder people created the problem all the way around. The company, having absolutely no evidence there was a problem, denied there was a problem specifically because the dumb fucking murderous operators were erasing the evidence of the problem so as to allow them to murder their innocent victims.

      Long story short, everyone wants to blame the company but 99.99999999% of the problem was dumb fucking, murderous, operators who clearly had absolutely no concern for the patience's welfare. They should be prison for negligent homicide.

    34. Re:Better link by Anonymous Coward · · Score: 0

      Web 2.0 may be pretty, but hard as hell to get right.

  2. why am I not surprised sql injection is first? by youn · · Score: 2

    Hopefully the increased use of frameworks that write sql will decrease that problem

    --
    Never antropomorphize computers, they do not like that :p
    1. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      Or, move to PICK and never worry about it again.

    2. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 1

      Dear Web Developers:

      SANITIZE YOUR FUCKING INPUTS.

      Sincerely,

      Anonymous Coward.

    3. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      Yeah, SQL injection attacks and why sanitising data is important are just lost on some people though.

      A few months back, I went onto a web store to buy some stuff, and it just plain didn't work. The checkout didn't let me process my order, items randomly disappeared from my shopping cart. Frustrated, I decided to report this to them. As they didn't provide an email, phone number, anything, I had to use their "wonderful" contact form.

      Guess what happened when I used an apostrophe in the contact form? Yup. SQL dump to the screen, for the whole world to read. I removed all the punctuation marks from the message and sent it, also noting the horrific SQL I was shown, but I never heard back. I wouldn't be shocked if they hadn't even received the message.

    4. Re:why am I not surprised sql injection is first? by Sl0vi · · Score: 1

      It's only one of the oldest, most well known and easiest to defend against security issues that exist and pretty much all frameworks today have an easy and built in way to prevent sql injection. Still it's all to common to see people doing something like: string query = "SELECT * FROM table WHERE Id = " + id;

    5. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      The easiest way to defend against it is to use a query language that actually only does queries. The biggest security hole is the fact that you can insert/update/delete through a query language

    6. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      What's with all those Minecraft posts? It's like COBOL, only with blocks ;)

    7. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      As a penetration tester I can assure you that I can do plenty of damage with just a SELECT statement.

      SELECT from table CC where CC='1' OR '2' = '2'

    8. Re:why am I not surprised sql injection is first? by Joce640k · · Score: 3, Insightful

      Dear Web Developers,

      Stop using toy languages. A strongly typed language that only accepts type "SanitizedString" as an SQL function parameter will end this problem forever.

      --
      No sig today...
    9. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      You're assuming a query language that will allow that, though. That will do absolutely nothing in ENGLISH

    10. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      He's assuming you're not an idiot or being an ass.

    11. Re:why am I not surprised sql injection is first? by Dog-Cow · · Score: 1

      To be fair, that won't do anything in SQL either.

    12. Re:why am I not surprised sql injection is first? by Joce640k · · Score: 1

      Still it's all to common to see people doing something like: string query = "SELECT * FROM table WHERE Id = " + id;

      Thing is ... this could be safe:

      safe_string query = "SELECT * FROM table WHERE Id = " + id;

      All you need is a "safe_string" object with suitable operator overloads and all the sanitization will be done by the compiler. It's impossible to not sanitize the input.

      Problem is: It needs a proper programming language, not kiddiescript 2.6.

      --
      No sig today...
    13. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      Um, sure it will. You lack imagination.

      It should return a massive number of results (depending on the size of the database), which may do any number of things: it might take a really long time to run. It might negatively affect the performance of the SQL server for the other people who're trying to use it. It might cause the script to time out and abort. It might cause the SQL server or the script to run out of memory and crash or abort. It might result in an error message that reveals information that an attacker needs to mount another attack (although that's more a problem with your error reporting). Or it might just let them see a bunch of records that they're not supposed to be able to see.

    14. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      Except what essentially amounts to denial of service is much different than the typical sql injection. The biggest problem with sql injection is the fact that it lets you alter the database, not that you can hammer the server with a select statement. True, both are security issues, but one is greater than the other

    15. Re:why am I not surprised sql injection is first? by Anonymous Coward · · Score: 0

      http://en.wikipedia.org/wiki/Pick_operating_system?

      IT people are their expectation that people will understand what they mean...

    16. Re:why am I not surprised sql injection is first? by gorzek · · Score: 1

      You don't even have to use a different query language. Let's say you have a Web frontend to a database that lets people enter search terms. An obvious avenue for SQL injection, right? Not if you run it with a user that has only permission to SELECT, and not to INSERT or DELETE or anything else.

      Some of these things are really not hard to address, just seems a lot of Web developers are pathologically lazy.

    17. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      Yes, PICK os/db. Today it functions within *nix as a virtualized/emulated database/os with a network connectivity layer to allow communication. This is the implementation I've used(there are others, by varying cos). Doing comparative tests, the speed of it as a querying system is ridiculously fast compared to SQL, primarily due to the superior file system(which also acts as the db hierarchy) that allows for very fast location of data

    18. Re:why am I not surprised sql injection is first? by bhcompy · · Score: 1

      Oh, I understand. Read only users are necessary for all sql implementations that have that kind of connectivity. The problem I have is more implementation based. It's a major security issue to allow a querying language to allow updates/inserts/deletes in general. A better system would be to have separate implementations for both(the one I'm most experienced with uses compiled code for updates/inserts/deletes and the query language is read only by design. thus there is no room for injection of any kind, except maybe the select variety mentioned above if the input isn't sanitized and the query language allows it).

    19. Re:why am I not surprised sql injection is first? by Bengie · · Score: 1

      Parameters are still better because they can support data-types that can't be passed in as a string. Also, the SQL engine is actually more efficient when using parameters as the SQL command and the parameters are sent via separate data streams. This also means you can't "accidentally" mess up your sanitization as it is not even required.

    20. Re:why am I not surprised sql injection is first? by Ant+P. · · Score: 2, Interesting

      Dear Academic Language Elitists Who Have Never Used The Languages They Are Criticising:

      Slashdot is coping just fine with "only" Perl 5 and DBI. Wikipedia doesn't have a problem using PHP and PDO. Reddit serves a million users a day with Python code. Show us your code or kindly get bent.

    21. Re:why am I not surprised sql injection is first? by Broolucks · · Score: 1

      That would not work. Let's say that id is a string and contains "blabla AND 1 = 1". "SELECT * FROM table WHERE Id = " is a string. id is a string. The + operator has a string on its left and a string on its right. Therefore, it will do a string-on-string operation, yielding "SELECT * FROM table WHERE Id = blabla AND 1 = 1". And THEN, there will be a type conversion to safe_string. But it is too late! How exactly do you think you can sanitize the string now?

      In general, when you build a query, there are strings you want to sanitize, and other strings which you do not want to sanitize. Consider the following:

      string a = "SELECT * from ";
      string b = table;
      string c = " WHERE id = ";
      string d = id;
      safe_string query = a + b + c + d;

      We want to sanitize b and d, but we don't want to sanitize a and c (or the result would not be a query). How exactly is your type system (or any type system for that matter) supposed to figure this out? You're just screwed. The only way your system can work is if the user explicitly marks every single string that must be sanitized, but that completely defeats the purpose.

    22. Re:why am I not surprised sql injection is first? by maxwell+demon · · Score: 1

      That would not work. Let's say that id is a string and contains "blabla AND 1 = 1". "SELECT * FROM table WHERE Id = " is a string. id is a string. The + operator has a string on its left and a string on its right. Therefore, it will do a string-on-string operation, yielding "SELECT * FROM table WHERE Id = blabla AND 1 = 1". And THEN, there will be a type conversion to safe_string. But it is too late! How exactly do you think you can sanitize the string now?

      In general, when you build a query, there are strings you want to sanitize, and other strings which you do not want to sanitize. Consider the following:

      string a = "SELECT * from ";
      string b = table;
      string c = " WHERE id = ";
      string d = id;
      safe_string query = a + b + c + d;

      We want to sanitize b and d, but we don't want to sanitize a and c (or the result would not be a query). How exactly is your type system (or any type system for that matter) supposed to figure this out? You're just screwed. The only way your system can work is if the user explicitly marks every single string that must be sanitized, but that completely defeats the purpose.

      With C++0x user string literals and a type "sqlstring" where conversion from string to sqlstring sanitizes input, I think you could do:

      sqlstring a = "SELECT * from "sql; //sql suffix means "Do not sanitize"
      string b = table;
      sqlstring c = " WHERE id = "sql;
      string d = id;
      sqlstring query= a + b + c + d; // implicit conversion from string to sqlstring sanitizes input.

      You probably would just write:

      sqlstring query = "SELECT * from "sql + table + " WHERE id = "sql + id;

      --
      The Tao of math: The numbers you can count are not the real numbers.
    23. Re:why am I not surprised sql injection is first? by Broolucks · · Score: 1

      Interesting. That wouldn't be too bad, since forgetting to tag SQL code parts with the suffix would cause SQL code to become user data rather than the opposite. So for instance, declaring c as a string would just append c and d to the table name, likely causing a runtime error.

      A similar idea could be implemented in pretty much any language, by using sql("abc") instead of "abc"sql, though I'm worried some people would misunderstand the purpose and wrap user data with it (which is at least not possible with a suffix on literals). I tend to prefer a more structured approach, but at least this one doesn't look like it would cause any security issues in practice (at first glance, anyway).

    24. Re:why am I not surprised sql injection is first? by DocHoncho · · Score: 1

      I'm pretty sure the "injection" portion of "SQL Injection" refers to the fact that the attacker is injecting SQL into a particular query, not necessarily that they are injecting bad data into your db. The typical example is something like:

      "select * from users where username='bob' or 1=1"

      which, in the right circumstances (from the attackers point of view) causes the app to display a bunch of information which was supposed to remain hidden.

      A SQL injection attack may or may not let you alter a database, depending on what kind of privileges the user performing the query has.

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
    25. Re:why am I not surprised sql injection is first? by oursland · · Score: 3, Interesting

      Because you can doesn't mean that everyone should.

      You cited a few shining examples of people doing the right thing. Unfortunately, those languages make it so damn easy to do the wrong thing and that is precisely the problem.

    26. Re:why am I not surprised sql injection is first? by AngryDill · · Score: 1

      Using Pick WRITE and READ statements may avoid the need for escaping quotes (or - preferably - using prepared statements) that SQL INSERT/UPDATE/SELECT queries need, but you still need to be careful. MVDBMSs carry the risk of unchecked delimiter character (@AM, @VM, etc.) injection. Plus if you use an SELECT/SSELECT query for record selection, you run the same risk of quote-based injections that SQL has.

      -a.d.-

      --


      I'm Erwin Schrodinger and I approve of this message, and I do not approve of this message!
    27. Re:why am I not surprised sql injection is first? by mvdwege · · Score: 3, Insightful

      Bull. 2 out of those three examples make it easy to do the right thing.

      Perl has DBI, which does parametrised queries very well, and in fact makes quoting a pain, because all the nice functions like binding variables to query results do not work well (if at all) with quoted queries. And if DBI is too low-level, there is always the DBIx::Class ORM.

      Python's DB-API 2.0 is the standard to do databases in Python, and it too makes parametrised queries a lot simpler than quoting. And on top of that you can use SQLAlchemy.

      I agree with PHP being bad. Sure it has parametrised query support in various libraries, but the default is still to use MySQL as backend and use the various mysql_yes_really_quote_it_correctly_this_time() functions. Given that until recently even the maintainers of the language didn't have clue as to how to do security right, PHP is by far the most unsuitable language to do secure web programming in.

      Mart

      --
      "I know I will be modded down for this": where's the option '-1, Asking for it'?
  3. overvalued derivatives weren't a programming error by Anonymous Coward · · Score: 0

    That was a pure greed, a Wall Street/Main Street feeding frenzy that would seize on the flimsiest evidence to justify the conclusion that the boom would continue indefinitely, enriching those with the foresight to seize the day. Coupled with willful lack of regulation and oversight from Washington and New York.

    Newsflash!

  4. Those aren't "programming" mistakes... by ThosLives · · Score: 4, Insightful

    ...Those are system design mistakes.

    A programming mistake is one where you meant to type x+1 and instead you write x-1. Missing something like authentication or checking is a requirements or design problem, not a programming problem.

    If software was a car, you wouldn't say it's a manufacturing problem if the car didn't have a place to install a lock - you'd say it's a design problem. It would only be a "programming" issue if it had a place for a lock but it was left uninstalled.

    (Yes, I don't consider "programming" to include the design aspects; I consider "programming" to mean "conversion of requirements into computer code." The errors about which this article talks are mostly requirements problems, not implementation problems.

    --
    "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    1. Re:Those aren't "programming" mistakes... by fuzzyfuzzyfungus · · Score: 1

      Wait, wait: Are you saying that "programmer", "software engineer", and "computer scientist" aren't actually synonyms?

    2. Re:Those aren't "programming" mistakes... by L4t3r4lu5 · · Score: 1

      I disagree. Sticking with cars (as is appropriate here), I'd consider it a design error if the stereo volume control knob was a SPST switch, a manufacturing error if it was installed connected to the seating controls, and a programming error if it caused the drivers seat to fold completely flat, then completely fold forward, three times a second.

      --
      Finally had enough. Come see us over at https://soylentnews.org/
    3. Re:Those aren't "programming" mistakes... by ThosLives · · Score: 1

      Yes, that's a much better car analogy... I was having a tough time thinking of one, sadly.

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    4. Re:Those aren't "programming" mistakes... by countertrolling · · Score: 1

      Is neglecting to close a parenthesis a programming error or design error?

      --
      For justice, we must go to Don Corleone
    5. Re:Those aren't "programming" mistakes... by antifoidulus · · Score: 1

      You obviously didn't read the article then. Many of the things listed are in fact *programming* mistakes(among them integer overflows, uncontrolled format strings, and tons about not trusting inputs). My favorite of the list is "CWE-676: Use of Potentially Dangerous Functions" It's amazing how many programmers just totally brush aside compiler warnings, and while not all warnings have security implications, many do....

      But ultimately here's a hint people, the compiler isn't warning you for kicks, there's usually a pretty valid reason for the warning and you shouldn't just ignore it because your code still compiles..... but then again, maybe I shouldn't be the one making these calls, after all I have Ada experience :P

    6. Re:Those aren't "programming" mistakes... by OddJobBob · · Score: 1

      I can't agree more. The number of times I have raised issues before deployment only to be told that it is "not a requirement" is beyond me. It is very hard to fix these things afterwards and I suspect that the reason these issues are ignored is because the requirements/software architect (same person in my case) has designed something so inflexible that they cannot change anything. Using something like DOORS is all well and good but garbage in still results in garbage out.

    7. Re:Those aren't "programming" mistakes... by Short+Circuit · · Score: 5, Interesting

      You seem to be advocating a distinction of responsibility of knowledge where programmers should not need knowledge of design. I would dispute that.

      First, all you've done is replace "programmer" with "compiler." If you posit that there is no need for programmers to do anything more than convert a design specification to code, then all you've done is define programmers as transcoders operating on a higher-level formal langauge than current compilers already do. That seems ridiculous; you'd be able to replace "programmers" with "compilers" for this higher-level language ("Technical writing in English") your design spec is written in. At that point, your designers are doing nothing more than programming in a higher-level language...making them programmers again. Look at the trends in new and redeveloped languages to include declarative behaviors for evidence of this already happening; dataflow-driven and declaration-driven language features are getting a lot of attention.

      Second, if your programmers aren't expected to have or build knowledge of good design and design practices, then they won't be able to identify mistakes--especially critical mistakes such as the ones discussed in TFA. People are people, people make mistakes. Without other people or tools (created by people) there to catch some the mistakes, more of the mistakes slip past. And while it's perhaps easy to build a unit test suite from a design document, that unit test suite is going to be better at detecting flaws in the code, not in the design.

    8. Re:Those aren't "programming" mistakes... by ThosLives · · Score: 1

      Perhaps I'll just say I was testing the forum software's ability to check syntax =D

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    9. Re:Those aren't "programming" mistakes... by ThosLives · · Score: 1

      You seem to be advocating a distinction of responsibility of knowledge where programmers should not need knowledge of design.

      Hrm. That was not my intent. Basically what I was saying is that there is a difference in types of errors between design errors which persist even if you program them correctly versus the type of errors which are due to writing code that doesn't match the design.

      Personally, I do agree that there is a more hazy line between "software engineering" and "programming" than just "implement design as code", and people that only implement design as code tend to make more errors than those who understand the system. I have seen this first hand; it's not necessarily a question of ability either - but if you have "coders" with no exposure to or understanding of the system, it's easy to make an implementation which really doesn't meet design intent (because often times the specifications are poor).

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    10. Re:Those aren't "programming" mistakes... by countertrolling · · Score: 1

      :-) Probably depends on the browser you use. We're all beta testers here these days. For instance, some of us are testing the forum software's ability to open links on click.. Seems that everybody is getting different results.. Just like people, each program interprets the same instructions in their own unique way

      --
      For justice, we must go to Don Corleone
    11. Re:Those aren't "programming" mistakes... by nitehawk214 · · Score: 1

      Yes, that's a much better car analogy... I was having a tough time thinking of one, sadly.

      Yeah, I need a car analogy on making car analogies.

      --
      I'm a good cook. I'm a fantastic eater. - Steven Brust
    12. Re:Those aren't "programming" mistakes... by DougReed · · Score: 2

      As the CTO of a small startup. My first programming mistake would be to hire someone who would build a car with no lock because the original drawing had no dot where the assumed lock would go. My old boss would love you. He thought 'programming' meant writing a thousand page Word document that got debated and revised over several months of meetings and finally coded by a 'clerk typist' with a degree in languages. Our department was disbanded because in a year, we did not manage to produce anything but 5,000 pages of MS Word. I got dinged on my review because the only thing we produced in that time was one program I wrote where the users told me what they wanted and I wrote it in a few days. He thought I was writing Word. When I showed it working... he hit the ceiling. The user's loved it.

    13. Re:Those aren't "programming" mistakes... by Dog-Cow · · Score: 1

      I prefer to refer to people who translate requirements into functional code as "coders". As in (en)coders that translate English (or whatever your analysts write in) into something the computer (compiler) can understand. I hate coders with a passion because they are devoid of thought.

    14. Re:Those aren't "programming" mistakes... by graveyhead · · Score: 1

      I half agree. Some of the items in the list are indeed design mistakes, but others really are programmer mistakes.

      The SQL injection one is the primary one I'm thinking is really a programmer error. Take this case from Drupal/PHP:

      db_query("SELECT * FROM {foo} WHERE bar='" . $_GET['bar'] . "'");

      That is totally incorrect and SQL can easily be injected into the statement from outside. When the API is used *correctly* this is not an issue:

      db_query('SELECT * FROM {foo} WHERE bar="%s"', $_GET['bar']);

      The difference is pretty subtle here and can easily be lost on newbies. As parameters to the db_query function, untrusted inputs are cleaned. I have seen the former code on several sites that I took over from a former developer, they are certainly NOT design errors.

      --
      std::disclaimer<std::legalese> sig=new std::disclaimer; sig->dump(); delete sig;
    15. Re:Those aren't "programming" mistakes... by kbielefe · · Score: 1

      Only 3 of the 25 deal with missing requirements or design. The rest are implementation details. Sure, you can make a design that makes writing code vulnerable to SQL injection more difficult, but it's still something the programmer has to watch out for. Also, I expect programmers to bring up glaring omissions in the requirements or design, just like I would hope a worker on a car manufacturing floor would bring issues to the attention of engineering. They are on the front lines and see things designers miss.

      --
      This space intentionally left blank.
    16. Re:Those aren't "programming" mistakes... by _0xd0ad · · Score: 1

      I don't like "subtle" code. I prefer to just make it very obvious what you're doing, and why:

      db_query("SELECT * FROM {foo} WHERE bar = '" . addslashes($_GET['bar']) . "';");

    17. Re:Those aren't "programming" mistakes... by graveyhead · · Score: 1

      Well, sure, and that's why in more recent Drupal versions they switched to using PHP's PDO, which is much more explicit about what you need to do.

      The point was, the tool works if you use it correctly. Using the car lock analogy from above, the place for the lock was there but the developer failed to put a lock in the hole.

      --
      std::disclaimer<std::legalese> sig=new std::disclaimer; sig->dump(); delete sig;
    18. Re:Those aren't "programming" mistakes... by mwanaheri · · Score: 1

      well some of the mistakes definitely are programming mistakes. If the requirement states 'take input from field A and store it in table C' then it is a programming mistake not to use a prepared statement but to dynamically build a statement. On the other hand, the promotion of frameworks may make the software over-engineered and the architecture more complicated than necessary. That again can cause many problems...

      --
      Idha khatabahum lijahiluna qalu salaman
    19. Re:Those aren't "programming" mistakes... by DocHoncho · · Score: 1

      So, if letting the db_query function escape strings for you is "subtle" how is

      int * foo = malloc(sizeof(int)*20);

      any less subtle? Or do you prefer to write all the mechanics of every function out by hand every time?

      The GP's example is much more easy on the eyes, easier to type and all around more idiot proof than expecting every half-assed dimwit PHP coder to remember to call addslashes() on query they have in their code. How is it subtle that security requires that all input from users be sanitized and that the function you're using is documented as performing that low level work for you?

      If your DB library is really smart all you really have do do is write


      db_query("SELECT * FROM foo WHERE bar=%s", $_GET['bar'])

      or

      db_query("INSERT INTO blah (x, y, x) values (%s, %s, %s)", x, y, z);

      (or in la-la-land)
      db_query("INSERT INTO blah (x, y, z) VALUES ('"+x+"','"+y+"',"+z+"')");

      By some amazing "subtle" magic, the placeholder versions quote and escape your input and you don't have to lift a finger. As a bonus, it's easier to both take a query someone gave you and put it in your code.

      Say your DBA gave you the following (mysql) query:


      select x, y, z from some_table where id=[ID] and date > [DATE]

      To put that in your program, all you have to do is paste that query in, replace the placeholders with %s or ? or whatever, pass your data in and you're off and running. Your method requires adding a bunch of error prone quotes and pluses and other junk. Now what if the query is quite a bit more complex, and you have to debug it? Using the simple place holder method, you paste it into whatever tool you use to develop queries and replace the placeholders with your test data. In your method you have to painstakingly remove all the PHP cruft that the DB doesn't care about AND put the proper test data in. It's just stupid.

      You've got library functions for a reason, let them do their job so yours is that much easier.

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
  5. QA - Microsoft is really to blame. by Anonymous Coward · · Score: 1

    QA has always been considered the bastard children of software development. I've never worked on a project where they weren't treated like shit. I'm guilty too; which is really bad because I started out in QA/QC.

    And on the business side, stop this horseshit of releasing code and having the customer find the bugs. Of course that won't happen. Some dipshit mgr is thinking, "Why have QA when the customers will find the bugs. We'll fix the first few and the charge them for a new and better release!" Now, this is the one time when blaming/bashing Microsoft is proper. They are the ones who made it the industry norm.

    1. Re:QA - Microsoft is really to blame. by fuzzyfuzzyfungus · · Score: 1

      QA has the unfortunate status of "Cost Center". And, no matter what their best intentions are, people and organizations inevitably face a strong pressure toward hating those. It's the same as those prick 'mechanics' with their "safety concerns" who cause flight delays. All cost centers attract a certain amount of dislike, ones that also have the power to cause schedule slips, or whose work deals with heading off things that merely might be a problem, are especially at risk. QA, unfortunately for them, fulfills all three: They cost money, the issues they point out have to be fixed, and can cause deadlines to slip, and(thankfully for the existence and survival of complex software in the world) many bugs are only harmful under unusual conditions, or are never discovered and exploited, this leaves them open to the charge that they are delaying important things with their insistence on fixing purely theoretical issues.

    2. Re:QA - Microsoft is really to blame. by countertrolling · · Score: 2

      That's how the legislators write law also.. Throw out anything, and let the courts sort it out.. a public works program for lawyers

      --
      For justice, we must go to Don Corleone
    3. Re:QA - Microsoft is really to blame. by jlusk4 · · Score: 1

      Development is also a cost center. Those whiners are constantly bitching about architecture. That's why we look for cheap developers who won't raise objections or otherwise make waves (like, with bright ideas), they'll just code. It's just a simple matter of programming, what the heck is up with them, anyway?

    4. Re:QA - Microsoft is really to blame. by OddJobBob · · Score: 1

      Our QA department doesn't have a single person with a background in software and when I raised this concern to the engineering manager he didn't see my point.

      We had a general manager who said that only quality products should be released to customers and as engineers we wholeheartedly agreed with him. The problem was that the vice-president of engineering had the view that it is best to be first to market and you can make it better after it ships. The general manager also said that he would not entertain a project that returned less than 40c on the dollar, yet the company only made 6% net profit in exceptionally good years and usually more like 2 to 3%.

    5. Re:QA - Microsoft is really to blame. by frinkster · · Score: 1

      QA has always been considered the bastard children of software development. I've never worked on a project where they weren't treated like shit. I'm guilty too; which is really bad because I started out in QA/QC.

      And on the business side, stop this horseshit of releasing code and having the customer find the bugs. Of course that won't happen. Some dipshit mgr is thinking, "Why have QA when the customers will find the bugs. We'll fix the first few and the charge them for a new and better release!" Now, this is the one time when blaming/bashing Microsoft is proper. They are the ones who made it the industry norm.

      Microsoft's Visual C++ compiler will throw a huge number of warnings for things like strcpy, telling you to use strncpy_s or something like that. If you follow the recommendation, potential buffer overflows become pretty obvious very quickly because the function zeros out the entire memory area that it is allowed to reach based on the parameters passed to it - and then does the copy. Your program will blow up during testing.

      The current favored design pattern for a C# application is MVVC - model-view-view controller. This pattern makes it very easy to write test cases to automate testing of your interface.

      I enjoy bashing MS when appropriate, but if you actually follow their recommendations you can avoid a lot of problems.

    6. Re:QA - Microsoft is really to blame. by acoster · · Score: 1

      With some versions of Visual Studio (and the Xbox 360 extensions for VS) Microsoft ships a static analysis tool, which is also very useful in finding potential problems.

      --
      "Go forth, and be excellent to each other" --Bill & Ted
    7. Re:QA - Microsoft is really to blame. by Anonymous Coward · · Score: 0

      Testers and developers are natural enemies.

      A developer's job is to create while a tester's is to tear apart. If the developer takes pride in their work they can easily slip into considering the tester's bug reports as a personal insult. Especially since testers usually think the bugs they find should not be there (technically true) or should be easily fixed, so it's easy for a tester to slip into talking down to the developer about that bug that's still there from two versions ago. From the other direction if the developers fail to fix a bug for long enough it's easy for the testers to think the devs are ignoring them (especially if they response with "that's a feature" at any point).

      Add to this that depending on the corporate setup, you can get a blame game going if the project's deadline is slipping (developers say it's late because QA wouldn't approve it, QA says they can't approve it because the developers haven't met the spec), and it's trivially easy for an antagonistic relationship to form between development and QA.

      And since technically you can release software that hasn't been tested, but you can't release software that hasn't been developed, developers tend to have the high ground when push comes to shove.

    8. Re:QA - Microsoft is really to blame. by tompaulco · · Score: 1

      And on the business side, stop this horseshit of releasing code and having the customer find the bugs.
      Well, management thought outsourcing is such a wonderful idea, so surely outsourcing QA is also a good idea. Unfortunately, when you outsource to your customers, they may just decide to drop your crappy product and go to the competition. But as a savvy manager, after having received a large bonus for firing the QA department, you have smartly moved on to ruin a different company.

      --
      If you are not allowed to question your government then the government has answered your question.
    9. Re:QA - Microsoft is really to blame. by Thud457 · · Score: 1

      QA has always been considered the bastard children of software development. I've never worked on a project where they weren't treated like shit. I'm guilty too; which is really bad because I started out in QA/QC.

      Partially because QA is mostly made up of bastard children /jk

      --

      the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

    10. Re:QA - Microsoft is really to blame. by DragonWriter · · Score: 1

      We had a general manager who said that only quality products should be released to customers and as engineers we wholeheartedly agreed with him. The problem was that the vice-president of engineering had the view that it is best to be first to market and you can make it better after it ships.

      These two requirements, as stated, are common in industry, and are pretty much exactly what Agile is directed at: You release quality product with a limited feature set first tat fills an unfilled need, and then expand the feature set in subsequent releases. You are, therefore, able to both release only quality product and release it quickly, making subsequent improvements that expand features after the initial release, without sacrificing quality.

    11. Re:QA - Microsoft is really to blame. by Methuseus · · Score: 1

      Most places don't see development as only a cost center because they reap real benefits from it. Granted, some companies do, but I haven't personally seen them.

      --
      Two things are infinite: the universe and human stupidity, though I'm not yet sure about the universe. - A Einstein
    12. Re:QA - Microsoft is really to blame. by Joce640k · · Score: 4, Informative

      Microsoft's Visual C++ compiler will throw a huge number of warnings for things like strcpy, telling you to use strncpy_s or something like that.

      You shouldn't even be using strcpy(). std::string has been around for more than ten years now.

      Similarly arrays: Don't use them, use std::vector instead. Visual C++ vector even does range checking by default so this throws an exception instead of corrupting memory:

      std::vector foo(10);
      foo[11] = 123; // Will throw an exception in VC++...

      A few basic changes in programming style can make C++ as safe as Java (but with none of the drawbacks). If you're still writing C code with your C++ compiler you're Doing It Wrong.

      --
      No sig today...
    13. Re:QA - Microsoft is really to blame. by OddJobBob · · Score: 1

      These two requirements, as stated, are common in industry, and are pretty much exactly what Agile is directed at: You release quality product with a limited feature set first tat fills an unfilled need, and then expand the feature set in subsequent releases. You are, therefore, able to both release only quality product and release it quickly, making subsequent improvements that expand features after the initial release, without sacrificing quality.

      Good point but in this case, although eventually we (unsuccessfully) went for an agile approach, releasing in this way didn't suit our customers. Each release would have to be re-qualified by them which costs hundreds of thousands of dollars, deployment could be anywhere in the world and if it didn't work for whatever reason they would switch the system off and lose revenue.

    14. Re:QA - Microsoft is really to blame. by bill_mcgonigle · · Score: 1

      QA has the unfortunate status of "Cost Center".

      Don't work for a crappy company.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    15. Re:QA - Microsoft is really to blame. by Anonymous Coward · · Score: 1

      You shouldn't even be using strcpy(). std::string has been around for more than ten years now.

      You're very correct, and this falls into the "if you're still writing C code with your C++ compiler you're Doing It Wrong" advice. However, some of us use C. Not only that, but we need to write standard code that will compile in multiple platforms, so we can't use the secure form of strcpy. I personally find it unacceptable that a compiler would throw warnings recommending the use of a non-standard function, and thus I tend to hate microsoft's C support (plus they still haven't gotten around to implementing C99 support). I'm in support of such a secure copy function making it into the C standard, though.

      Similarly arrays: Don't use them, use std::vector instead. Visual C++ vector even does range checking by default so this throws an exception instead of corrupting memory

      No, no, GOD NO. Use vectors when you need resizing functionality. If your array will remain the same size for the lifetime of the array, then you use a goddamned array.

      At some point programmers just need to be held accountable for the code they write. If you're writing in C++, you use an array when you need an array, and you damn well do bounds checking. If you're a C++ programmer, you should know how to do that.

    16. Re:QA - Microsoft is really to blame. by c++0xFF · · Score: 2

      You left out some details about bounds checking that deserve some notice:

      According the the C++ Standard, std::vector::operator[] does not do bounds checking -- if you want an exception to be thrown, use std::vector::at(). As an aside, I which they would have switched which one does checking and which one doesn't, but it is the way it is.

      Visual C++ has an extension to do bounds checking on operator[]. Compile with _SECURE_SCL 1, which is the default. When an access goes out of bounds, the program will terminate. You can set another macro if you want an exception to be thrown, however.

      I' think that Visual C++'s behavior is completely acceptable according to the standard (which only requires undefined behavior). However, it makes some C++ programmers uneasy because it's adding overhead to a very common operation that will often be found in inner loops (and with the safe option readily available). Hopefully the compiler can eliminate most of the checks by detecting loop bounds or somesuch.

      Another detail about vectors: I've repeatedly heard that you can't use vectors when interfacing with C functions, as they operate on normal arrays. This isn't the case: just pass in the address of the first element (&vect[0]). Yes, this behavior is backed by the standard. The only caveat I'm aware of is that you have to be careful when doing anything to the vector that would cause it to move around in memory (such as call push_back() when it's already full) -- but that's already true of C arrays created with malloc().

      However, there is one good reason to use C arrays in C++: when you need a small array allocated on the stack. As of C++0x, however, you should be using std::array for this purpose instead. The only other factor to consider are VLAs, which aren't part of standard C++ and I don't think Visual C++ supports them anyway.

    17. Re:QA - Microsoft is really to blame. by Joce640k · · Score: 1

      Not only that, but we need to write standard code that will compile in multiple platforms, so we can't use the secure form of strcpy. I personally find it unacceptable that a compiler would throw warnings recommending the use of a non-standard function, and thus I tend to hate microsoft's C support (plus they still haven't gotten around to implementing C99 support). I'm in support of such a secure copy function making it into the C standard, though.

      STILL Not an excuse for using strcpy() - you can easily implement your own safe copy using the standard function then do:

      #define strcpy you_shouldn't_be_using_this_use_safe_strcpy_instead;

      (or whatever)

      No, no, GOD NO. Use vectors when you need resizing functionality. If your array will remain the same size for the lifetime of the array, then you use a goddamned array.

      Why? I've looked at the assembly output for both versions and its the same. OTOH with arrays:

      You have to know the size of the array and pass it around to functions.
      You can't use iterators or algorithms.

      With vector your code is neater, safer and more flexible.

      --
      No sig today...
    18. Re:QA - Microsoft is really to blame. by Joce640k · · Score: 1

      You can't keep long-lived pointers to elements inside a vector - they might move somewhere else if the vector grows. Apart from that it works just like an array.

      --
      No sig today...
    19. Re:QA - Microsoft is really to blame. by Jason+Pollock · · Score: 1

      Because vectors can't be initialized from initializer lists. At least, not until C++0x:

      std::vector v = { "xyzzy", "plugh", "abracadabra" };

      Won't compile with older C++ compilers.

      While the following works now:

      char *foo[] = { "xyzzy", "plugh", "abracadabra" };

      http://en.wikipedia.org/wiki/C%2B%2B0x#Initializer_lists

  6. Re:overvalued derivatives weren't a programming er by fuzzyfuzzyfungus · · Score: 2

    Only little people are capable of error, so it must have been a programming mistake.

  7. In C++: by cpscotti · · Score: 1

    Virtual destructor on base class.

    1. Re:In C++: by cpscotti · · Score: 1

      Mistake: the lack of it!

    2. Re:In C++: by Joce640k · · Score: 2

      My compiler warns me about this if I forget...

      --
      No sig today...
  8. Summary of Article by Anonymous Coward · · Score: 2, Insightful

    "Java and C# are better than PHP" wrapped in buzzwords and it mentions "SQL Injection attacks" (yawn).

    The whole thing is insulting to read for everyone more competent than management. As usual.

    0/10

  9. #1 by macraig · · Score: 1

    This data type/structure is big enough; why would I need more to store larger values than I can anticipate right now? Keeping It Simple Stupid saves some bytes, too. Why would we ever need to store a four-digit year, anyway? What could possibly go wrong?

  10. Re:Better Better link by Anonymous Coward · · Score: 1

    Why not go to a good source from actual devs?

    If an exploding ball of fire isn't dangerous, what is?

  11. More Testers / QA is needed and stop the overtime by Joe_Dragon · · Score: 2

    More Testers / QA is needed and stop the overtime working 80+ hour weeks just leads to more errors and bugs.

    Also don't get me started on rush jobs that just become try to work around the bugs and not take the time to fix them.

  12. Headline reveals slashdot philosophy? by damn_registrars · · Score: 5, Insightful

    it's-probably-fine,-we'll-test-it-live

    Could describe every "upgrade" to slashdot that has happened since ... well probably ever.

    --
    Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
  13. Therac-25 and nudie scanners by spoonist · · Score: 2

    The Therac-25 had some "Dangerous Programming Mistakes".

    I wonder if the nudie scanners have any similar mistakes.

    1. Re:Therac-25 and nudie scanners by BitterOak · · Score: 1

      The Therac-25 had some "Dangerous Programming Mistakes".

      I wonder if the nudie scanners have any similar mistakes.

      The Therac-25 had two fundamental flaws, not one. One was a programming mistake. The other was lack of a hardware safety interlock to prevent electron beams from being emitted at dangerously high levels. That was a design mistake: leaving it to software to ensure that no lethal beams were directed at patients. I consider the latter mistake to be the more serious.

      --
      If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?
    2. Re:Therac-25 and nudie scanners by RyuhoKudo · · Score: 1

      Hey my professor wrote his dissertation on the Therac-25 accident, it was interesting to hear the story from him.

  14. Remember Y2K? It's the tools that need to improve by Tony+Isaac · · Score: 1

    Y3K will never happen.

    Is this because programmers learned from Y2K and changed their ways? Well, not exactly. Before 2000, most programming languages did not have a built-in date type, so programmers had to make their own, using either numeric or text fields. They didn't want to write ALL the code necessary to do ALL kinds of date calculations, so they just wrote the ones they needed, and these often ignored the first two digits of the year.

    NOW programmers in nearly every language have handy date variables they can use, that perform date arithmetic easily and reliably. Programmers naturally use these date variables, because it makes their lives easier.

    Today, it is difficult to incorporate good security practices into software. This is because we largely have to roll our own. We therefore write just enough code to do what we think we need, and we don't consider all the possible ways security can be breached. ONLY when the tools improve to the point that security comes automatically, will software, as a rule, be secure.

  15. The first answer is not QA by jlusk4 · · Score: 1

    tl;dr (yet)

    But I do have something to say about the immediate response of "QA". These are design issues (as has been mentioned). QA is not where you test out that sort of thing. Up-front design (not necessarily Big) should be the first response. Now is not the time to slack off on design, just because a lot of the components have already been written.

  16. Did you try double right-click? by tepples · · Score: 3, Informative

    To work around Slashdot's brokenness, did you try double right-click, then open in new tab? It appears to work for me in Firefox 5.

    1. Re:Did you try double right-click? by djdanlib · · Score: 1

      What wizardry is this?!

    2. Re:Did you try double right-click? by cowboy76Spain · · Score: 2

      I got it.

      Double left click, right click, left click, triple right click, A, A, B, A, Up, Up, Up and I can see almost see slashdot as any other forum!

      --
      Why can't /. have a rich-text editor? Editing your own HTML is so XXth century.
    3. Re:Did you try double right-click? by CraftyJack · · Score: 1

      Same here. double right click works.

    4. Re:Did you try double right-click? by FrootLoops · · Score: 1

      A fast enough series of right clicks worked for me, though I think it took more than 2. The key seemed to be speed. It's gone now, but this happened to me a day or two ago.

    5. Re:Did you try double right-click? by SockPuppetOfTheWeek · · Score: 1

      Double-click speed just depends on the OS setting. If you don't click fast enough, it registers two independent click events. If you do, it's a double-click. It has nothing to do with the browser, and if you click fast enough for the OS to register a double-click, it only takes 2 clicks.

    6. Re:Did you try double right-click? by EuclideanSilence · · Score: 3, Funny

      I got it.

      Double left click, right click, left click, triple right click, A, A, B, A, Up, Up, Up and I can see almost see slashdot as any other forum!

      It's pretty much the same command in Emacs.

    7. Re:Did you try double right-click? by sorak · · Score: 1

      To work around Slashdot's brokenness, did you try double right-click, then open in new tab? It appears to work for me in Firefox 5.

      Yeah. The context menu doesn't appear for me in Firefox 5.

    8. Re:Did you try double right-click? by sorak · · Score: 1

      To work around Slashdot's brokenness, did you try double right-click, then open in new tab? It appears to work for me in Firefox 5.

      Sorry. Reading comprehension failure: I didn't see the double-right-click. That worked. Thanks.

    9. Re:Did you try double right-click? by black+soap · · Score: 1

      Wait, am I supposed to be using the shift key somewhere in there? the middle of the right-triplet?

    10. Re:Did you try double right-click? by maxwell+demon · · Score: 1

      I got it.

      Double left click, right click, left click, triple right click, A, A, B, A, Up, Up, Up and I can see almost see slashdot as any other forum!

      It's pretty much the same command in Emacs.

      Actually in Emacs it's Meta double left click, Ctrl right click, Shift Alt left click, triple right click, Super A, Meta A, Ctrl Meta B, Shift Alt A, Super Shift Up, Ctrl Shift Up, Super Alt Up.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    11. Re:Did you try double right-click? by FrootLoops · · Score: 1

      This is a right click, not a left click, so OS-specific double click timing is irrelevant.

  17. Inadequate tools by Anonymous Coward · · Score: 0

    Of course mistakes are made when the tools are inadequate. For example, using SQL in a program by formatting a command and asking SQL to understand it. That is just crazy. Instead there should be a proper API which clearly tells SQL what is wanted. Then there would be no possibility of SQL injection.

    1. Re:Inadequate tools by Qzukk · · Score: 1

      There are APIs, it's called a parameterized query. Depending on your language and API, using them adds anywhere from 1 to dozens (bindparam) of extra lines of code compared to the string concatenation version. Apparently nobody thinks anyone would ever want to query($database,"select * from foo where baz=:baz",$_POST); so one-off queries end up being several lines of step-by-step piecewise execution (oh, and don't forget the return value checks between each step!)

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
  18. Re:Remember Y2K? It's the tools that need to impro by twidarkling · · Score: 1

    So you're saying programmers are lazy fucks who don't consider the consequences of their actions, and can't be trusted to figure out anything for themselves. Or that's how it reads, any way. I'd like to disagree with that.

    Your scope isn't nearly broad enough. Change programmers to "95% of people" and you've got it about right.

    --
    Canada: The US's more awesome sibling.
  19. Re:Remember Y2K? It's the tools that need to impro by Tony+Isaac · · Score: 2

    No, I'm not saying programmers are lazy. It's just that there is always tension between getting a job done, and getting EVERY detail right.

    They ALSO are not always as knowledgeable as they should be. How many programmers know that in 1752, when the Julian calendar was replaced by the Gregorian calendar, September 2 was followed by September 14? How many programmers care? Why should they? Yet this arcane bit of knowledge could make a difference in some software that deals with antiquities.

    Just as there are arcane bits of knowledge needed to make perfectly precise date calculations, the same is true of security considerations. Programmers should HAVE TO KNOW every possible arcane exploit in order to write good code. They framework/language should take care of this.

  20. Table-valued parameters; query by example by tepples · · Score: 2

    pretty much all frameworks today have an easy and built in way to prevent sql injection.

    True, parameterized queries work in most cases. But I've found a few places where they're not ideal, and I wrote a bit of framework to implement other ways to pass strings to SQL safely.

    A lot of SQL APIs don't support parameterizing a query that includes a table-valued parameter, such as the anonymous single-column table on the right side of an IN expression (e.g. username IN ('bluebear', 'chief', 'filbert')). So I wrote and tested a function mysqli_escape_list($connection, $array) to escape each item in an array and then format it as such a table expression, and then I use this function every time I need a variable number of literals on the right side of IN or VALUES. A web site called bobby-tables.com strongly recommends against this method, instead preferring code that constructs a string of question marks, a string of types, and an array of reference variables in parallel and then calling $stmt->bind_param() through call_user_func_array(). This appears hairier than the method that I use.

    A lot of database search user interfaces are based on the general concept of query by example: present a form representing a blank record to the user, then find records whose values match the fields that the user specified and ignore fields that the user left blank. There are two ways to implement this search in SQL. One is to include two separate parameters in the query for each field (e.g. "name", "ignore name", "town", "ignore town"). The other is to generate a WHERE expression and make sure to escape it properly. The first way is good when all fields are known up front; the second way is probably needed when the list of fields will expand in the future.

    1. Re:Table-valued parameters; query by example by Sl0vi · · Score: 2

      Funny that Microsoft is way ahead of php and mysql on this area. .Net allows you to use parameters in reqular sql queries. Just add parameters to the command object as your are building your query. You never have an excuse not to use parameterized queries.

    2. Re:Table-valued parameters; query by example by Dog-Cow · · Score: 1

      Your second example is wrong. If you have to include every column in the where clause, but you only want to test non-blank entries, you use code like the following fragment:
      where (columnA is not null or columnA = :columnA and (columnB is not null or columnB = :columnB)

      If the table may change, you just generate your where clause dynamically, using the RDMS's data dictionary to get the column names.

    3. Re:Table-valued parameters; query by example by petermgreen · · Score: 1

      There are two ways to implement this search in SQL. One is to include two separate parameters in the query for each field (e.g. "name", "ignore name", "town", "ignore town"). The other is to generate a WHERE expression and make sure to escape it properly. The first way is good when all fields are known up front; the second way is probably needed when the list of fields will expand in the future.

      Another option is to generatea parameterized where clause. That way you get the flexibility to easily change the field list (from an allowed list of fields of course) while at the same time avoiding issues due to escaping mistakes (forgetting to escape, using the wrong escaping function* etc).

      * The existence of things like mysql_real_escape_string vs mysql_escape_string in php shows how this sort of thing can be fucked up.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    4. Re:Table-valued parameters; query by example by mvdwege · · Score: 3, Insightful

      In Perl this is easy. Let's say that @args holds your argument list. Then it goes like this:

      my $query = "select * from table where column in (";

      # Use $#args to get the index value of the last member of the array @args. This gives us a loop that's one iteration shorter than the lenght of the argument list.

      for (1..$#args) { $query .= ' ?, '}

      $query .= '? )';

      my $sth = $dbh->prepare($query);

      $sth->execute(@args);

      # Bind result columns with $sth->bind_col

      while ($sth->fetch) {

      # Do something with the results.

      }

      Mart

      --
      "I know I will be modded down for this": where's the option '-1, Asking for it'?
  21. Missing a Big One by Salamander · · Score: 3, Interesting

    The Mitre list does include "Use of a Broken or Risky Cryptographic Algorithm" but in my experience that's far less common than improper use of a perfectly good algorithm. Many algorithms and modes have known weaknesses that require specific generation/handling of keys and initialization vectors to maintain good security. Most algorithms and modes that are secure against unauthorized *reading* of data still require an extra MAC step to prevent unauthorized *modification* of that data (including targeted bit-flips). Developers often take shortcuts in these areas because doing all of "the right things" adds a lot of extra complexity and can absolutely kill performance. Look at recent events involving Dropbox and Jungledisk for examples. I don't think the Mitre list adequately conveys that cryptographic security requires not just good low-level algorithms like AES or Blowfish but also good higher-level (usually domain-specific) algorithms governing how the low-level algorithms and their inputs are used.

    --
    Slashdot - News for Herds. Stuff that Splatters.
  22. No, it really won't. by SanityInAnarchy · · Score: 1

    The sort of developers who continue to make this mistake will make it even in that language -- how do you generate a SanitizedString?

    The correct response is to make it easy to do right. A good ORM in pretty much any language should help with this -- there's plenty of support for parameterized SQL in Rails, but you can (and should) avoid even that problem entirely by not writing any SQL at all.

    Strong typing might help, but even there, the solution is the same -- syntactic sugar on the Right Thing, syntactic vinegar on the Wrong Thing, and focus on making it easy to do right, rather than hard to do wrong, since people will find a way to do it wrong anyway.

    --
    Don't thank God, thank a doctor!
    1. Re:No, it really won't. by Joce640k · · Score: 2

      how do you generate a SanitizedString?

      Via the object constructor.

      SanitizedString s = UserInput; or doSQL(SanitizedString(UserInput));

      If you allow implicit constructors then this: SQLfunc(UserInput); will pass a secretly sanitized version of the string to the SQL function.

      Point is: If you stick to using the provided SQL library then it's impossible to pass unsanitized strings to it, the program won't even compile. This sort of thing should really be the default by now except language designers are too busy figuring out ways to let programming noobs multiply strings by fractions.

      --
      No sig today...
    2. Re:No, it really won't. by Joce640k · · Score: 1

      I forgot the obligatory link: This article is usually held up as a shining example of how to do it right, I've seen it quoted hundreds of times on programming forums.

      As Mythbusters would say: "There's your problem..."

      --
      No sig today...
    3. Re:No, it really won't. by SanityInAnarchy · · Score: 1

      Point is: If you stick to using the provided SQL library then it's impossible to pass unsanitized strings to it, the program won't even compile.

      I'm not sure what this buys you -- is your SanitizedString then going to be concatenated with other non-sanitized strings inside that SQLfunc? If so, you're relying on each SQLfunc to only accept SanitizedStrings instead of ordinary Strings, which seems no less risky than relying on each SQLfunc to sanitize the strings themselves. Or is the idea that you build other SanitizedStrings inside your SQLfunc through some unsafe constructor, so that you can concatenate only SanitizedStrings together? IF so, you're now relying on the user not constructing their own unsafe "sanitized" strings.

      You're also going to need to go around it anytime you need to build a complex query by hand, which means you're going to need some sort of way to send a raw SQL string to the database and have your program still compile.

      All of this means we're back where we started -- all we're doing is making the bad code look bad, so we can (hopefully) police it with grep. I can do that just as well with DataMapper:

      User.first :login => username

      That username will be sanitized for you later on, and as a bonus, this syntax isn't SQL-specific; DataMapper has a number of backends, and not all of them are relational. You could do this:

      User.first :conditions => ["login=#{username}"]

      But this makes SQL injection both harder to do than the correct way (since the correct way doesn't even involve learning SQL), and easy to track down with grep (just look for :conditions).

      In practice, on a large Rails project, I can count on one hand the number of query conditions we wrote by hand. Almost all of them were in plugins, so it's reasonable to think of them as becoming part of the SQL library.

      This sort of thing should really be the default by now except language designers are too busy figuring out ways to let programming noobs multiply strings by fractions.

      Why would even a programming noob want that? Yes, Ruby lets me evaluate "'1.5' * 0.5", and it evaluates to an empty string. C++ would let me do the same thing -- this has nothing to do with noobs or dynamic typing and everything to do with operator overloading and convenience.

      It's also clear from your use of "strong typing" earlier that you don't understand the distinction. Ruby is strongly typed:

      ruby-1.9.2-p180 :001 > 'foo' / 5
      NoMethodError: undefined method `/' for "foo":String
              from (irb):1
              from /home/dave/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'

      It is also dynamically typed. JavaScript is (unfortunately) weakly typed, and so is Perl. But there's nothing preventing any of them from doing the same thing -- in fact, JavaScript and Perl both have a hash syntax, so you could even get a very similar syntactic sugar.

      --
      Don't thank God, thank a doctor!
    4. Re:No, it really won't. by SanityInAnarchy · · Score: 1

      That article? Joel has some good things to say sometimes, and there are aspects of this article that make sense, but really...

      I think the plan will be to lull you almost completely to sleep and then to sneak the Hungarian=good, Exceptions=bad thing on you when you’re sleepy and not really putting up much of a fight.

      ...really?

      This article in particular falls down here:

      What if we made a coding convention that said that when you write out any string you have to encode it?... Well, that doesn’t quite work sometimes you have little bits of HTML around in your code and you can’t encode them.

      Sorry, no. I have absolutely no HTML in my code outside the actual templates. The templates have easy and safe ways to output sanitized strings, and more verbose and uglier ways to output unsanitized strings in the rare occasion I need one (likely the result of calling another template), but it's still something which is visible right there, on the output page. Whenever I see unsanitized output, it should be obvious right there, from the method name I'm calling, whether I'm expecting it to spit out HTML or not -- and if not, it's a mistake.

      But if you see that same snippet of code in C++, you don’t know anything. Nothing. The only way to know what’s really happening in C++ is to find out what types i and j are, something which might be declared somewhere altogether else.

      In C++, at least, a decent IDE will tell you. But he's talking about:

      i = j * 5;

      You would hope there would be enough context so that you have some idea of what i and j actually are. This doesn't mean adding an arbitrary prefix to every variable. It means you're only allowed to use names like i and j for insanely brief periods of time, where it's obvious what they are, and everything else should have a descriptive name.

      While I'm at it...

      I wrote that I don’t like exceptions because they are, effectively, an invisible goto, which, I reasoned, is even worse than a goto you can see...

      Except they're not. They go one place, up the stack. And...

      When you have code that says

      dosomething();
      cleanup();

        your eyes tell you, what’s wrong with that? We always clean up!

      Actually, I immediately want to know what cleanup() does, and why it's important, and why dosomething() didn't cleanup() after itself. And...

      But the possibility that dosomething might throw an exception means that cleanupmight not get called.

      It also generally makes sense for it not to be called unless we actually know what to do with the exception at this point. If we don't, we probably want our program to crash loudly and noisily -- it makes sense for cleanup() not to be called at that point. We also need to think about what cleanup() does, and whether it's safe to call if dosomething() failed.

      It's also funny how he talks about locality of information, and then goes and bashes exceptions in favor of, what, error codes in return values? Actually, yes, that is exactly what he suggests, which means that what would be five lines of code with exceptions now becomes fifty lines of code without exceptions, with all the error-handling stuff mixed in with actual program logic -- all of which means it's become ten times harder to figure out what the actual program logic is supposed to be when things go right.

      --
      Don't thank God, thank a doctor!
    5. Re:No, it really won't. by Broolucks · · Score: 1

      The program could still compile, as long as it fails at runtime. Point is, I understand what you are saying, but such a library could be implemented in pretty much all languages that allow the definition and checking of custom types. It is perfectly possible to implement this feature in Python, Ruby or even the train wreck that is PHP, so at best it is really more a standard library problem than a language problem. But typing really doesn't have much to do with anything anyway: the first line of SQLfunc can very well be "sane_input = sanitize(input)", and then you don't even need a new type.

      The real problem lies with writing SQL queries and passing them to a generic "execute" function. All languages will allow you to build a string like ("SELECT * FROM some_table WHERE column = " + name) which is not sanitized at all. If there is a way to execute that query, terrible things will happen and there is absolutely nothing you can do about it, because a SQL query string cannot be sanitized, you wouldn't be able to execute it otherwise. The only solution is to have libraries that do not allow executing SQL queries as strings, ever, period. But if that is the case, sanitizing inputs is not your problem anymore, it's the library's job. For instance you could write "results = select(ALL, table, where(equals(column, name)))", and obviously it should be part of these functions' contracts to sanitize their inputs. Virtually all languages can do this.

  23. What kind of mistakes they are by DragonWriter · · Score: 4, Informative

    Those are system design mistakes.

    While TFS and TFA call them "programming" mistakes, the actual source refers to them as the "Top 25 Most Dangerous Software Errors".

    A programming mistake is one where you meant to type x+1 and instead you write x-1.

    No, that's a typographical error, not a programming mistake.

    A programming mistake is when you incorrectly analyze the requirements and think you need to type x-1 to correctly implement them when in fact you need to type x+1.

    But either one results in a "software error"; the list and the original source are fine, the fluff piece in between the original source and Slashdot (and, consequently, the Slashdot summary) is the only potential problem here.

    If software was a car, you wouldn't say it's a manufacturing problem if the car didn't have a place to install a lock - you'd say it's a design problem. It would only be a "programming" issue if it had a place for a lock but it was left uninstalled.

    While its fun to construct ways to point the finger somewhere else in an organization, or to pedantically categorize errors in to narrow boxes, what I'd say is that its a failure of each and every person who had sufficient contact with the product that they should have seen the relevant facts, and sufficient technical skill that they should have recognized the error, and who either did not recognize the error or who did recognize the error but did not take action to have it corrected [whether that was implementing a fix or providing notice up the line]. Plus all the people responsible for the process that produced the error.

    And most of the errors on the list are things that, whether or not they should be explicitly foreseen in requirements, programmers are positioned to recognize and ought to be taking steps to prevent. Programming isn't narrowly constrained assembly-line work, at least in any organization that expects to produce quality software.

    1. Re:What kind of mistakes they are by cpricejones · · Score: 2

      Another type of mistake or error that should be considered is the attempt to program or write code for something at all. I remember watching a lecture about this topic at some point and I cannot find the link anymore. The general message was that no programs are bug-free, and in some circumstances it's unethical to even attempt to program for certain devices because undetected coding errors could end up killing many people. An example would be an automated missile defense system in which someone out there has to write code for the system. Think about the bug testing for a system that fires missiles at other missiles. (Apologies if this is a tad offtopic.)

    2. Re:What kind of mistakes they are by Anonymous Coward · · Score: 0

      No, that's a typographical error, not a programming mistake.

      No, it's a typing error. A typographical error would be something like mixing tabs and spaces, or putting more than one unrelated statement on a single line of code, or using Comic Sans as your editor font.

  24. NoSQL & Ajax fail by laffer1 · · Score: 1

    Not a shocker. I've heard time and time again from NoSQL fans that it's ok to put your database on the public internet over HTTP with no locks. In fact, early versions of CouchDB didn't have security.

    Another problem is that many novice programmers forget to secure their AJAX endpoints.. when you have 20 calls happening all over returning json, you often forget to check session or ensure authentication + authorization.

    During my computer science courses, very few times did security come up. I had one professor who cared enough to discuss input validation, authentication, etc. It's this magic thing that we'll just figure out right?

    1. Re:NoSQL & Ajax fail by julesh · · Score: 1

      I've heard time and time again from NoSQL fans that it's ok to put your database on the public internet over HTTP with no locks.

      Really? Are you sure you're not confusing NoSQL fans with blethering idiots who jump on any bandwagon they think will make them look hip?

      In fact, early versions of CouchDB didn't have security.

      Yes, but it only accepted connectsion from localhost, which is adequate security for about 90% of applications (ie, web services or three-tier services where everything running on the same machine is trusted). And even if this weren't the case, it would still be considered standard practice to have your server behind a firewall that prevented external connections to anything other than defined public services.

    2. Re:NoSQL & Ajax fail by Anonymous Coward · · Score: 0

      Are you sure you're not confusing NoSQL fans with blethering idiots who jump on any bandwagon they think will make them look hip?

      A distinction without a difference?

  25. You are indeed correct by Anonymous Coward · · Score: 0

    These days, someone writes the program specs and hands same to a programmer, who (rightfully) assumes that the spec writer knows what he is doing.
    One certainly cannot fault the programmer for faulty specs. One can and should fault management for the problems of faulty specs. Of course, most IT
    management I ever encountered was incompetent (to say the least), and some of it was downright criminally stupid.

  26. Jump to the list by cjjjer · · Score: 1

    Here is the the actual list.

  27. General programming by pr0nbot · · Score: 1

    CWE is about "weaknesses", i.e. security. Does anyone know of a similar group or research into classifying and ranking common software errors? For example:

    - dereferencing null pointers
    - memory leaks
    - stack corruption via buffer overflow
    - out-by-one errors
    - errors in error handling code that is infrequently run
    - deadlock/resource contention
    - faults characteristic of concurrency
    - use of globals and code with side-effects

    etc. All the stuff you learnt about at university, and then went on to rediscover in your job.

    I've always thought that anyone designing a new programming language should have a big list of these and consider in each case what the language/compiler/library provides to mitigate/avoid these (garbage collection, static analysis, etc).

    Anyway - anyone know of such a list/research?

    1. Re:General programming by Anonymous Coward · · Score: 1

      They are there. The Top 25 list is simply 25 out of the actual 693 weaknesses, 142 categories and 26 views of the CWE (http://cwe.mitre.org).
      They also have mitigations recommended that can be effective whether you are worried about security or general quality.

      - dereferencing null pointers - CWE-476 Null Pointer Dereference

      - memory leaks - CWE-772: Missing Release of Resource after Effective Lifetime

      - stack corruption via buffer overflow - "Stack corruption" is a consequence of the weakness. BO is 3 on the Top 25 list

      - out-by-one errors - CWE-193: Off-by-one Error

      - errors in error handling code that is infrequently run - There are 19 different types of issues under CWE-388: Error Handling

      - deadlock/resource contention - CWE-833: Deadlock

      - faults characteristic of concurrency - CWE-557: Concurrency Issues; CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') with 11 sub-issues

      - use of globals and code with side-effects - This is a bit ambiguous and could include a wide swath of issues

    2. Re:General programming by pr0nbot · · Score: 1

      Ah wow. Very cool indeed, thanks.

  28. If little people are the problem by tepples · · Score: 1

    Only little people are capable of error

    Mitigation: Quit buying Fisher-Price toys.

    Mitigation 2: Don't hire people of short stature. Not advisable due to disability discrimination laws targeted at conditions such as heightism.

    1. Re:If little people are the problem by Thing+1 · · Score: 1

      The tall make more money than the short; this has been studied. The reason is historical: on the plains, tall people could see food/predators/other tribes at a farther distance, and hence were more valued.

      --
      I feel fantastic, and I'm still alive.
  29. Here's one by Anonymous Coward · · Score: 0

    Had a friend who worked in the Mailing industry who liked to clean his own mailing lists (Rather than letting the experts in IT do it) in Access & Excel on one occasion accidentally sent 30,000 letters to the same man. As my friend put it "It was all right though because he was German!". Though the mailing house is now defunct and my friend now rides a motor bike it is somewhat reasuring to know that he is still a pratt!!!

  30. The cost of .NET by tepples · · Score: 1

    You never have an excuse not to use parameterized queries.

    Other than that one is trying to save money by not using a Windows server.

    1. Re:The cost of .NET by Sl0vi · · Score: 1

      Then use mono or some other framework that allows you to build sql queries in a sane way. The only good thing about php and mysql is that it is free.

  31. ACLs on search columns by tepples · · Score: 1

    where (columnA is not null or columnA = :columnA and (columnB is not null or columnB = :columnB)

    What is this :columnB syntax? MySQLi allows only a question mark as a placeholder. Did you mean "switch from MySQLi to something else"?

    using the RDMS's data dictionary to get the column names.

    For privacy and load reasons, we allow the public to search only on some columns and not others. So we'd store the column names in an ACL instead of the INFORMATION_SCHEMA. Is that OK?

  32. The unmentioned BIGGER mistake... by ka9dgx · · Score: 4, Insightful

    Using a system where the program has to be trusted to do its job correctly is the bigger mistake. When you hand your car keys to a valet, you don't also give him power of attorney to sell your house, liquidate your stocks, savings, etc... but every operating system out there does something like that when you tell it to run a program. The program you run can do anything you are authorized to do. The default assumption is that it should have permission to do anything, no matter how stupid, dangerous, or downright evil.

    This practice needs to end, about 10 years ago it should have ended... and we'll probably have to wait 10 more years because it's so freaking hard to get this idea across, nobody seems to be ready for it yet, by the way things seem to be going.

    A user should be able to decide exactly which and how much of the resources they are authorized to use will be allowed to be accessed by a program they choose to run. If you want to run a program with read/write access to /sandbox, and the ability to read from the internet using a filtered http driver (one that doesn't allow puts, for example), you should be able to do so, without having to do any fancy footwork.

    If put in to place, this type of system, which explicitly states what access things get, make it almost trivial to never get a virus or worm ever again. It's time to stop trusting programs, and only have to trust the hardware and OS to enforce our wishes.

    I impatiently await the arrival of capability based security.

    1. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      Actually, this is done some of the time under Linux, it's called AppArmor.

      Getting capabilities fully integrated into Linux, in a user friendly format, should be feasible, if there were a community that wanted to make it happen, and we could get Linus to go along with it. The whole SE/Linux and security plugin infrastructure gets us part way there.

      There's no need to re-write apps, it's just a matter of a few more errors if the app tries to do something forbidden.

      Even Windows could support it, with current apps, but then Microsoft wouldn't be able to use it to push Office 2020.

    2. Re:The unmentioned BIGGER mistake... by Sl0vi · · Score: 2

      Android sort of does this. Applications have to request the permissions they need at install time and the user has to grant them.

    3. Re:The unmentioned BIGGER mistake... by Seyedkevin · · Score: 2

      In UNIX operating systems it's common practice to use separate user accounts for daemons and to not run anything as root. Isn't that enough to do what is being asked? In addition, we've PAM, SELinux, PaX, and more that's capable of locking down the system beyond filesystem permissions and user accounts.

      These systems probably aren't configured by home users at all, but it's practically mandatory in enterprise.

    4. Re:The unmentioned BIGGER mistake... by Sl0vi · · Score: 1

      You can severely limit what an application can do on windows by running it under a user with very limited priviledges, configuring your firewall properly etc. Not exactly easy for the average user tho.

    5. Re:The unmentioned BIGGER mistake... by Lord_Naikon · · Score: 1

      There is similar work being done on FreeBSD:
      http://www.cl.cam.ac.uk/research/security/capsicum/

    6. Re:The unmentioned BIGGER mistake... by Dr_Barnowl · · Score: 1

      .NET applications have a fairly fine-grained security model to draw on, but it seems that few people actually use it.

    7. Re:The unmentioned BIGGER mistake... by benjymouse · · Score: 2

      Parent is completely right. Windows registry is one of the biggest examples of this problem, but even on Linux any program can modify nearly any other file of any other program the user has access to.

      What? The Windows registry is securable per key - as in each key has its own (but usually inherited from its container) ACL. To have the equivalent in Linux where most configuration is kept in text files you would have to be able to assign an ACL to each line of the file. The Windows registry also supports mandatory integrity control (MIC) which does not allow a lower-integrity process to write to a higher-integrity key even if the user account it runs under formally has write-permission.

      It sound like you believe that you can only be granted access to the registry on a full-registry or hive-level only. If so, you are mistaken. It goes as granular as you want it to. And this level of control is also being used by the operating system, utilities and most 3rd party software (although the latter type can usually ignore it as long as values are stored in the user-private hive - HKCU).

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
    8. Re:The unmentioned BIGGER mistake... by benjymouse · · Score: 2

      Even Windows could support it, with current apps, but then Microsoft wouldn't be able to use it to push Office 2020.

      Ahem. Windows does support "capabilities". They are called privileges in Windows. Unlike in Linux/Unix where you need to elevate to the all-powerful root, Windows actually allows delegation of privileges, such as shutting down/restarting, back up, change system time, change timezone etc.

      There was actually a push to create a POSIX standard for "capabilities". Unfortunately it was abandoned/retracted. Still, Linux does actually support a number of "Linux Capabilities" - but they are woefully underused. Theoretically they should allow programs such as ping to *not* be of the dangerous setuid root variety, but as it stands I don't think that even a single system utility actually use/respect Linux capabilities. Windows is way ahead here.

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
    9. Re:The unmentioned BIGGER mistake... by Anonymous Coward · · Score: 0

      I see 3 reasons why this hasn''t materialised on consumer machines;

      1. This security model requires the user to actually know what is going on because HE/SHE has to decide the restructions. The average user cant deal with that.

      2. If everything is sandboxed then DRM will be even easier to bypass and crapware would be easy to uninstall The industry doens't want this.

      3. If everything is sandboxed then its a lot easier to make platform compatibility layers like Wine. Microsoft doens't like this.

      A consumer OS that you discribe would take power away from software makers (that they do not like to lose) and give it to the user (who wouldn't know how to use it).

    10. Re:The unmentioned BIGGER mistake... by Anonymous Coward · · Score: 0

      while i agree with the premise that basic security should be of a similar model to what you describe, you are forgetting 90%+ of the people out there don't know what an OS is, or what their software is or is doing. "Hay man, i check what I found on the internet.... ain't it cool? what? all my data just got stolen????"

      I don't see how what you propose wouldn't require HUGE amounts of basic education to the general populous. likely starting in gradeschool and requiring at least a few generations to accomplish.

      Can you see some manner around the basic 'cost' of what you propose? or am I missing something? all i could see was $$$$$ expense when I read your post... and corporate america is loath to do ANYTHING until well after it effects their bottom line, if even then.....

    11. Re:The unmentioned BIGGER mistake... by Anonymous Coward · · Score: 0

      I impatiently await the arrival of capability based security.

      Why haven't you implemented it yet? Why hasn't anyone implemented it yet?

    12. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      Cool... thanks for the pointer, I've added to my delicious bookmarks about capabilities

    13. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 4, Interesting

      It is unfortunate that it's necessary to try to overload an existing term with a new, slightly different definition, but that's what has happened here.

      Capabilities in a capability based system (cabsec for short) are fine grained access rights to things like single files, a directory, etc. They are explicitly granted at run time to a process, they are not persistent.

      This is in contrast to the Access Control List permissions of VAX/VMS, inherited by Windows, and the User/Group/World permissons of Unix/Linux, both of which are geared towards restricting the rights of a user, and are generally persistent.

      For example, if you give a process write access to a log file, and I/O access to the internet, and 1% of total cpu use....it could watch something on the net, and log the results. It could not access anything other than the log file, no matter what... this means a buffer overflow bug, or any other fault could not cause data to leak from the system.

      In a permissions/ACL based system, the administrator decides the rights of users, and the programs they run, without distinction

      With cabsec capabilities, the user decides which of their rights they wish to delegate to a process or program. This frees the user from the need to trust a given program with all of their rights. This also frees the system administrator from having to set up extra accounts with limited permission for each new service or daemon that needs to be run.

      I see cabsec as a very useful extension to the existing user permissions systems. Combined you get the best of both worlds.

    14. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      Security via access list is nice, but it is per user and persistent. It is not something automatically revoked when a process terminates, nor is it assigned only to one task. Setting up a new process with access to only 3 files, and 3 registry keys requires explicitly setting up an account for the process, and setting the permissions on everything it might be able to touch, to limit access to only those things.

      It is much simpler to have a list of explicitly granted rights, with the default to be no access if it's not in the list. This is the power of capability based security. (Cabsec)

    15. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      It was implemented a long time ago in a system called Multics, but that got displaced when a couple of guys did a light-weight clone with a lot less need for security... called Unix.... this then got cloned by Linus in Linux.

      There was also a system named KeyKos which was used on mainframes to great effect, in the 1980s.

      In the mean while, we've had personal computers which didn't need good security since they weren't widely networked, until very recently. So now really good security is just becoming a concern again. Eventually the pendulum will swing back to the point where people realize things need to change.

      Capability Based Security will be making it to your machines, it's just a question of time. The sooner the better.

    16. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      People drive cars without understanding the intricacies of internal combustion, electronic ignition, anti-lock brakes, etc... but they do understand capabilities.... it's called car keys.

      If you hand someone the keys, they can access your car... it's simple.

      Capability based security (cabsec) is just a hand full of keys, instead of one. A key for each resource. It's quite intuitive.

    17. Re:The unmentioned BIGGER mistake... by Anonymous Coward · · Score: 0

      It was implemented a long time ago in a system called Multics

      Multics was not a capability system.

      There was also a system named KeyKos which was used on mainframes to great effect, in the 1980s.

      [citation needed]

      Capability Based Security will be making it to your machines, it's just a question of time.

      Enjoy your delusions.

      But do tell, how does a relational database system work with capabilities? You'd need a capability to access the database, and each table, and each row? How does that work?

      You'll need better than a toy system, son.

    18. Re:The unmentioned BIGGER mistake... by randyleepublic · · Score: 0

      That's why I grimace whenever I read, "A virus proof operating system is a fantasy," and the like. Garrgh!

      --
      Social Credit would solve everything...
    19. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      Multics was not a capability system.

      You're right... Multics didn't have capabilities, my mistake, I thought it did... a myth shattered.

      There was also a system named KeyKos which was used on mainframes to great effect, in the 1980s.

      [citation needed]

      KeyKos didn't get off the ground util 1987, according to http://www.redbug.org/dba/sharerpt/share70/o609.html

      Capability Based Security will be making it to your machines, it's just a question of time.

      Enjoy your delusions.

      But do tell, how does a relational database system work with capabilities? You'd need a capability to access the database, and each table, and each row? How does that work?

      You'll need better than a toy system, son.

      Perhaps I am deluded... I hope not. You've killed some of the misconceptions I had about it, and for that I thank you. I believe the idea still has great merit, though... because we really shouldn't be forced to trust software beyond the OS itself. All of the examples I've given in my other replies point out the need to remove the default permit design decision that's baked into everything. We must fix this, it's a question of becoming aware of the problem, then becoming aware of possible solutions, then actually solving the problems, for good.

      Most of the capabilities concepts I'm familiar with our file oriented, but it should be possible to do the same thing with records, fields, etc... in a database. There's nothing stopping someone from adding them as a layer on top of a database, just like the layer of permissions that some databases support.

      Another approach is to hand a database capability to a filter program, and give the filtered capability to the untrusted program, to prevent misbehavior from successfully breaking security.

    20. Re:The unmentioned BIGGER mistake... by benjymouse · · Score: 1

      It is unfortunate that it's necessary to try to overload an existing term with a new, slightly different definition, but that's what has happened here.

      Capabilities in a capability based system (cabsec for short) are fine grained access rights to things like single files, a directory, etc. They are explicitly granted at run time to a process, they are not persistent

      Interesting. So one would not be able to implement capsec through a process token? Because it still sounds a lot like Windows Privileges/Linux Capabilities except that those privileges/capabilities are binary (has the privilege or has not) and you gave examples of privileges which would need to be parameterized (cpu load, target IP addresses, target urls).

      In Windows a process token may differ from a user token. Not so in Unix/Linux where the effective uid refers to a, well, uid. The fact that the system can change a process token to have fewer privileges allows a process to run with fewer privileges than the user account or parent process. Sounds like the concept of process token is not just a requirement for capsec but may also be half-way there when you consider capabilities to be represented by SIDs

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
    21. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      Interesting. So one would not be able to implement capsec through a process token? Because it still sounds a lot like Windows Privileges/Linux Capabilities except that those privileges/capabilities are binary (has the privilege or has not) and you gave examples of privileges which would need to be parameterized (cpu load, target IP addresses, target urls).

      If you wanted to hand off access to a new process, which had ALL of the permissions of another process, this would work. However, if there were ANY differences at all, you'd have to create a new account, then set up permissions on all of the system resources to match your new desired access for the new account, and then pass along information via inter-process pipes, shared files, etc. Otherwise you run right back into the need to trust programs, and bad security.

      Because capability based systems only let you get at resources in the list for given process, it's very transparent (to the user, programmer, administrator) what's going on.

      Here's an example to make the point:
      If you want to write a program that takes a file access capability as input and gives a corresponding read-only capability to the same file, it's easy to do, and as long as the code isn't flawed, the protection is iron clad. If that filter program has a flaw, the very worst possible case is that the original capabilities leak through.

      Another way to think about it is that capabilities are like a parameter list, and the only possible side effects to a given process are limited (by the OS) to those parameters.

      I hope that clarifies the differences.

    22. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      It's enough, in theory, to do this. However, in practice it is not.

      If you have a web server you want to run, to serve up files from /usr/mike/www and to log files to /usr/mike/logs/www, you'd have to build a new account for the daemon, and set permissions on all of the files system wide to make sure the web server task couldn't access them.

      Once that's done... the web server is secure... however, you've had to modify a lot of security settings for this one-off job, and those persist unless you clean them up.

      Those settings may not be possible from a user account, which means a lot of administrator involvement, and reduced functionality for the users.

      With capabilities, you give the web server program a read capability to /usr/mike/www, and a write token to /usr/mike/logs/www, and a token to listen and communicate on port 80, and you're done. If you decide to stop serving web pages, there's no cleanup.

      If the user has permissions to do all of those things, the can delegate them to a task... and revoke them at will, without having to bother the administrator.

    23. Re:The unmentioned BIGGER mistake... by benjymouse · · Score: 1

      If you wanted to hand off access to a new process, which had ALL of the permissions of another process, this would work. However, if there were ANY differences at all, you'd have to create a new account, then set up permissions on all of the system resources to match your new desired access for the new account, and then pass along information via inter-process pipes, shared files, etc.

      No, not on Windows. Windows has a per-process token and the privileges of that token does not have to match any account at all. The token consists of a list of SIDs which can represent groups (which in turn appear in ACLs) *or* the SIDs represent privileges, e.g. setting time zone, restarting the system, log on as batch service etc. You do *not* need to set up an account with the desired privileges. You just need to prune the token itself.

      On Linux there are also "Linux Capabilities" which are a few number of bits which represent capabilities that are not linked to any specific resource. These can even be considered "mini tokens" as they appear in the process descriptor as well. They are poorly implemented, though, and woefully underused.

      What you cannot do with Windows process token is represent more advanced (parameterized) privileges such as CPU quota.

      --
      Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
    24. Re:The unmentioned BIGGER mistake... by ka9dgx · · Score: 1

      No, not on Windows. Windows has a per-process token and the privileges of that token does not have to match any account at all. The token consists of a list of SIDs which can represent groups (which in turn appear in ACLs) *or* the SIDs represent privileges, e.g. setting time zone, restarting the system, log on as batch service etc. You do *not* need to set up an account with the desired privileges. You just need to prune the token itself.

      On Linux there are also "Linux Capabilities" which are a few number of bits which represent capabilities that are not linked to any specific resource. These can even be considered "mini tokens" as they appear in the process descriptor as well. They are poorly implemented, though, and woefully underused.

      What you cannot do with Windows process token is represent more advanced (parameterized) privileges such as CPU quota.

      These generic privileges are defined system wide, whereas capabilities are specific to a single file, device, etc. If you have access to files a,b, and c, it's not possible to give another process access to only a and c with privileges, but it's trivial with capabilities.

      I hope that adequately explains the difference.

    25. Re:The unmentioned BIGGER mistake... by Qzukk · · Score: 1

      These generic privileges are defined system wide, whereas capabilities are specific to a single file, device, etc. If you have access to files a,b, and c, it's not possible to give another process access to only a and c with privileges, but it's trivial with capabilities.

      I think you're running into a name conflict here. "Linux Capabilities" exists, but is separate from the filesystem and is basically a set of flags like "can reboot the system" and "can increase process priority".

      SELinux is more like what you are looking for (in fact, modern systems with it on by default drive people up the wall when they try to put DocumentRoot in some weird place like /usr/www/ instead of where the distribution told SELinux apache should be able to read), but it's not really a runtime kind of setting (ie if I want to run the program once with permission to access "a" and then a second time with permission to access "b" I'll need to reconfigure selinux/relabel the files/possibly reboot)

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    26. Re:The unmentioned BIGGER mistake... by Anonymous Coward · · Score: 0

      You just described Mandatory Access Control (minus the 'without any fancy footwork'). The problem there is that someone needs to analyze what the program needs access to. The one group best equipped to do this (the developers) is who MAC doesn't trust in the first place. End users can't do it (remember, a lot of people have problems with putting in a password to run Ubuntu's Update Manager). Community repo might be able to do it.

      SELinux actually implements MAC. Here's the thing: No one outside departments that absolutely need top-flight security actually uses it, because it renders the computers nearly unusable by sysadmins, let alone normal users.

      Try it some time. Nothing will ever 'just work' again, especially if your requirements change.

  33. bind_param by tepples · · Score: 1

    Another option is to generatea parameterized where clause.

    If I generate parameterized SQL, how will I know the type and number of ?s in advance in order to do $stmt->bind_param('iss', $var1, $var2, $var3)? And if you say I should build three things (the statement, type string, and list of variables passed by reference) in parallel and then use call_user_func_array(), a mistake in keeping all three of those in the same order is no less likely than a mistake in $conn->escape_string($value). Or did you mean "switch from MySQLi to something else"?

    The existence of things like mysql_real_escape_string vs mysql_escape_string in php shows how this sort of thing can be fucked up.

    I understand that the reason for existence of the _real_ functions is that the correct escape varies based on the current SQL mode. This is why I always use the connection's escape method $conn->escape_string($value).

    1. Re:bind_param by petermgreen · · Score: 1

      If I generate parameterized SQL, how will I know the type and number of ?s in advance in order to do $stmt->bind_param('iss', $var1, $var2, $var3)? And if you say I should build three things (the statement, type string, and list of variables passed by reference) in parallel and then use call_user_func_array(), a mistake in keeping all three of those in the same order is no less likely than a mistake in $conn->escape_string($value). Or did you mean "switch from MySQLi to something else"?

      Personally I use PHP data objects (mainly because I want the option to switch database engine) to access mysql. PHP data objects allows parameters to be bound by name and one by one so there is no need to use call_user_func and no need to worry if the order of binding is the same as the order in the query string.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  34. countertrolling & the trolltalk.com crew by Anonymous Coward · · Score: 0

    Cheat the moderation system - here's how they downmod others unjustly to troll and harass them, in detail.

    This is where countertrolling explains what he's doing while he trolls others (to his fellow trolltalk.com friends):

    http://slashdot.org/comments.pl?sid=2245866&cid=36491652

    And, here's where countertrolling's "troll mechanics" for downmodding others is explained in detail by someone that got sick of it happening:

    http://slashdot.org/comments.pl?sid=2271908&cid=36579618

    As far as bogus up moderations, the trolltalk.com bunch (tomhudson, countertrolling, & others) collectively "team up" to upmod one another, in teams, as favors to one another.

    (Talk about low, and bogus!)

    ---

    In fact, here's what he says about it, why he does it, and to all of us here:

    "What the skiddies here don't understand is that I don't give a shit about dumbass 'karma' on the internet.. I'm here for the jollies with nothing to lose or fight for.. watching them destroy their world.. They can go absolutely nuts as far as I'm concerned.. It's nothing but pure entertainment (and data points) for me and mine... Tragicomedy is probably the best word I can think of to describe it" - by countertrolling (1585477) on Thursday June 30, @10:26AM (#36622502) Journal

    QUOTED VERBATIM FROM -> http://slashdot.org/comments.pl?sid=2281808&cid=36622502

    Sounds like a sick individual to me.

  35. They make the same errors over and over... by Anonymous Coward · · Score: 0

    I recently had a chat with a developer who decided his opinion on security was better than everyone else's. "It's media making a big deal out of nothing."
    Developers, like all people, make up their minds first and look at reality only when they it bites them in the ***.
    This won't get better until the enterprise forces them to follow good practices.

  36. Re:Remember Y2K? It's the tools that need to impro by Anonymous Coward · · Score: 1

    You just illistrated that you are too young to understand the Y2K issue. The issue was not the lack of date types or lazy programmers. The issue was storage and cost. Dropping 2 bytes over 10 million records, saved roughly 40 MB (that's meg) at a time when a 10 MB pc hard drive cost more than your laptop does now. Now take those 2 bytes for the DOB, date of death, injury, start and end dates, etc. That's 5 dates times 10 million records, or roughly 200 MB. How many dates you do have in current system? Bet it's a lot more than 5. If you consider mainframe storage, those original diskpacks cost more than your car. Now justify the cost of 2 cars just so you can storage a bunch of 19's or 20's.

  37. Re:More Testers / QA is needed and stop the overti by PoorCoder · · Score: 1

    Yep... I agreed. (Also mentioned in "The Clean Coder" by Robert C. Martin.)

  38. Re:Remember Y2K? It's the tools that need to impro by Anonymous Coward · · Score: 0

    How many care when the Gergorian calendar was created in 1582. I think there is a lost of four years somewhere in the calendar, but can remember where. The issue for antiquities can be more complicated when countries still rely on their original calendars, or when each country adapted the Gergorian calendar.

    Most programmers don't think more than year/4 as a leap year conversion. Never mind the /100 or /400 calc. I still have to look up Pascals formula for calculating Easter.

    While I do know a variety of issues and calculations, I still rely on the customer to tell me how to calculate something. If they say 2+2=5, then I make it happen. In 25 years, I have only disputed two calcs that made it to senior management and lawyers.

    Back to the point, which is we can't know every exploit, but we can code for what we do know. How do you convey these issues to someone out of school or only a few years experience? This is stuff that gets learned by hard knocks.

  39. Re: Private Key Storage by Anonymous Coward · · Score: 0

    The "Key Management" section of Foundations of Security (2007) doesn't say much either on where to store the private keys other than Smart Cards, HSMs or a Key-Store accessible by admin only. Is storing it on a DB (separate server) any good?

  40. Lol by nog_lorp · · Score: 1

    Inclusion of functionality from untrusted control sphere != missing authentication for critical function != input validation error?

    Same fucking difference.

    My favorite is attempting to prevent access by not printing the link / form control, and then doing no validation.

    1. Re:Lol by maxwell+demon · · Score: 1

      Are you sure? I haven't read the article, but I'd guess they mean different things:

      • Inclusion of functionality from untrusted control sphere: Relying on code outside of your control (like many web pages use googleapis.com, but possibly with code from more shady places).
      • missing authentication for critical function: The data is valid and interpreted as intended, but it isn't checked that the user is actually allowed to do that.
      • input validation error: This input isn't valid, but the page doesn't detect it.
      --
      The Tao of math: The numbers you can count are not the real numbers.
  41. Actual most dangerous programming error by maxwell+demon · · Score: 1

    We may hit this one soon. I've found the following code in universe.h:

    struct particle particles[37];
     
    #define ELECTRON 0
    #define ELECTRON_NEUTRINO 1
    #define MYON 2

    I skip a few lines here, to come to the relevant one.

    #define HIGGS 37

    It's obvious what will happen if we ever produce a Higgs particle at LHC.

    I've already sent a bug report to god, but I haven't yet gotten an answer.

    --
    The Tao of math: The numbers you can count are not the real numbers.
    1. Re:Actual most dangerous programming error by mcswell · · Score: 1

      I have received your bug report, and added it to the database of bugs.

      If you wish to speak to a human, dial P-R-I-E-S-T. If you wish to talk to my Son, dial...

  42. Step inside (I'd like to discuss something w/ U) by Anonymous Coward · · Score: 0

    http://it.slashdot.org/comments.pl?sid=2282088&cid=36639318

    SanityInAnarchy?

    Additionally - I really do NOT like you talking behind my back either... but, show up there, and we can discuss what I brought up (see you there).

    APK

  43. Step inside, need 2 discuss something w/ U! by Anonymous Coward · · Score: 0

    http://it.slashdot.org/comments.pl?sid=2282088&cid=36639318

    SanityInAnarchy?

    Additionally - I really do NOT like you talking behind my back either... but, show up there and we can discuss what I brought up (see you there).

    APK

  44. Step inside, need 2 discuss something w/ U! by Anonymous Coward · · Score: 0

    http://it.slashdot.org/comments.pl?sid=2282088&cid=36639318

    SanityInAnarchy?

    Additionally: I really do NOT like you talking behind my back either... but, show up there, and we can discuss what I brought up (see you there).

    APK

  45. You keep misunderstanding. by warrax_666 · · Score: 1

    The point is that there is no way to pass anything other than a SanitizedSQLString to the "raw" database layer. The only way to produce a SanitizedSQLString is via a strictly defined set of "safe constructors".

    The DB access library defines the "safe constructors", not you, nor should there be any way to "convert" a String to a SanitizedSQLString without going through one of the "safe constructors" (which properly escapes or throws exceptions on "invalid" input).

    A proper module system with real abstraction boundaries can enfore that restriction trivially. In languages with poor module support, say Java, judicious application of "final" (or your language's equivalent) would probably be enough for "practical" safety -- i.e. ensuring that you never accidentally circumvent the "safe constructors".

    --
    HAND.
    1. Re:You keep misunderstanding. by SanityInAnarchy · · Score: 1

      The DB access library defines the "safe constructors", not you, nor should there be any way to "convert" a String to a SanitizedSQLString without going through one of the "safe constructors" (which properly escapes or throws exceptions on "invalid" input).

      In other words, there is no way to execute an arbitrary SQL statement, and we end up with two options: Either you can patch the library and add the feature you need (so you again have very localized places you could potentially introduce this vulnerability), or you can't patch the library or cut around it to the raw layer, meaning certain queries will be insanely less efficient because the library isn't expressive enough to represent them.

      Option #2 seems impractical, and option #1 is pretty much where we are with Rails again -- very localized, easy to recognize potential vulnerabilities.

      --
      Don't thank God, thank a doctor!
  46. Total garbage by kuzb · · Score: 1

    Articles like this are bad. Not because there isn't a serious problem, but because the article doesn't address the problem with solutions. Writers like this don't help the situation any.

    --
    BeauHD. Worst editor since kdawson.
  47. I don't see any method called bind_col() by tepples · · Score: 1

    # Bind result columns with $sth->bind_col

    I don't see any method called bind_col() in the left column of this page. All I see are bind_param() and bind_result(), both of which use a variable number of arguments passed by reference to the method rather than taking an array as an argument.

    1. Re:I don't see any method called bind_col() by mvdwege · · Score: 1

      Well, that's your problem for using a language without a decent database binding, now is it?

      Snarkiness aside, I did mention I gave a Perl example right? Your objection against parametrised queries is not generally applicable, seeing as that other libraries to do them with are available. I concede that it is valid in your particular case, but that just reinforces my prejudice against PHP, sorry about that.

      But really, does PHP not have a library that allows constructing the query dynamically while at the same time still executing that query as a parametrised query? That's...brain-dead. Even if it doesn't have an equivalent for bind_col() (which has nothing to do with constructing and executing the query, merely how you get the results), dynamically constructing a prepared statement is something that is so useful that I'd expect every language to be able to do it.

      Mart

      --
      "I know I will be modded down for this": where's the option '-1, Asking for it'?
    2. Re:I don't see any method called bind_col() by tepples · · Score: 1

      PHP appears to have such a library (PDO) that I've been told is better in some ways than MySQLi, but it'd take a lot of refactoring to switch to it because I don't think PDO and MySQLi can share a connection object.

  48. OLPC Bitfrost? by listentoreason · · Score: 1

    I think Bitfrost is supposed to do this? It was never clear to me how extensive or how granular it was, or how mature it has become. Or for that matter if it would be deemed "acceptable" by users or developers. The later should ideally suck it up and "do it right", but if the users walk away there's still a social problem that needs more engineering.