Slashdot Mirror


Deserialization Issues Also Affect .NET, Not Just Java (bleepingcomputer.com)

"The .NET ecosystem is affected by a similar flaw that has wreaked havoc among Java apps and developers in 2016," reports BleepingComputer. An anonymous reader writes: The issue at hand is in how some .NET libraries deserialize JSON or XML data, doing it in a total unsecured way, but also how developers handle deserialization operations when working with libraries that offer optional secure systems to prevent deserialized data from accessing and running certain methods automatically. The issue is similar to a flaw known as Mad Gadget (or Java Apocalypse) that came to light in 2015 and 2016. The flaw rocked the Java ecosystem in 2016, as it affected the Java Commons Collection and 70 other Java libraries, and was even used to compromise PayPal's servers.

Organizations such as Apache, Oracle, Cisco, Red Hat, Jenkins, VMWare, IBM, Intel, Adobe, HP, and SolarWinds , all issued security patches to fix their products. The Java deserialization flaw was so dangerous that Google engineers banded together in their free time to repair open-source Java libraries and limit the flaw's reach, patching over 2,600 projects. Now a similar issue was discovered in .NET. This research has been presented at the Black Hat and DEF CON security conferences. On page 5 [of this PDF], researchers included reviews for all the .NET and Java apps they analyzed, pointing out which ones are safe and how developers should use them to avoid deserialization attacks when working with JSON data.

187 comments

  1. Simpler solution by BarbaraHudson · · Score: 1, Insightful

    Just don't use JSON or XML. You can thank me later.

    --
    "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    1. Re:Simpler solution by vadim_t · · Score: 1

      So what do you recommend instead?

    2. Re: Simpler solution by Anonymous Coward · · Score: 0, Informative

      "What do you recommend?"
      "Don't do anything."

      Fuck off, troll.

    3. Re:Simpler solution by hord · · Score: 5, Interesting

      JSON or YAML are probably both fine. XML is simply wasteful and unnecessary. Personally I think we should be using something like s-expressions (lisp-like). People hate them because of the parens but every other encoding has as many negative points in different ways. The advantage is that the syntax is far simpler to understand and parse leading to safer software. Some might say that having an "executable" format is bad but I'd point to bugs like this as being proof that even "text" formats are just executables in disguise. The Lisp creed is "data is code" and I've come to agree.

    4. Re:Simpler solution by Anonymous Coward · · Score: 0

      If you can't say anything not mentally retarded, don't say anything at all.

      Have you built ANYTHING this millenium? Damn.

    5. Re:Simpler solution by vadim_t · · Score: 1

      That doesn't really answer the question I asked.

    6. Re: Simpler solution by alvinrod · · Score: 3, Funny

      XML is like violence. If it's not solving your problem, you're not using enough.

    7. Re:Simpler solution by Anonymous Coward · · Score: 0

      FYI, it's not age discrimination.

    8. Re: Simpler solution by Anonymous Coward · · Score: 1

      ASN.1

    9. Re:Simpler solution by Applehu+Akbar · · Score: 2

      Serialization without using one of these standards is going back to the bad old days of proprietary silos. You must work for Sony.

    10. Re:Simpler solution by Tablizer · · Score: 1

      web apps. Especially ones that need so many 3rd party libraries that they can never be secure.

      But PHB's want their shiny dancy UI/UX toys or they won't pay you.

    11. Re: Simpler solution by Anonymous Coward · · Score: 0

      A better option is to use XML and/or JSON, but to do so from a language like Rust that was designed from the very beginning to be thread safe and memory safe.

    12. Re:Simpler solution by Anonymous Coward · · Score: 0

      XML was originally created for system configuration. Those of us at the time were widely using the same concepts. XML simply formalized what everyone was already doing.

      Then people thought XML would be good for shared communication of state and configuration, while allowing for future extensibility.

      Then idiots decides we needed RPCs and protocols designed around these ideas. Thusly we wound up with JSON and XMLRPC, SOAP, and other such idiocy. Which in turn has hugely shaped the external interfaces for services, which has largely become "web services."

      There's nothing wrong with concepts like REST and HTTP forms. Or if you wish to be crazy, binary protocols.

    13. Re: Simpler solution by Anonymous Coward · · Score: 0

      REST is academic wankery. It's utterly impractical for any real system. It's basically OO, but limiting yourself to 4 instance methods (GET, POST, PUT, DELETE) on each object. And you lose the concepts of classes, inheritance and polymorphism.

      Any real software system will have a much more complex data model than can be represented using REST. That's why any real-world API you examine deviates significantly from REST. REST is ivory tower nonsense.

    14. Re:Simpler solution by Anonymous Coward · · Score: 0

      "Don't do anything."

      Wish there was a way to hide all of your worthless posts.

    15. Re:Simpler solution by Sloppy · · Score: 1

      I understand why you'd recommend against JSON since it was originally intended to be an expression (and some fuckwits would eval() it) rather than really intended to do quite the same thing as, say, Python's pickles. But what's the beef with XML?

      --
      As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    16. Re:Simpler solution by angel'o'sphere · · Score: 4, Informative

      The serialization format has nothing to do with the deserialization vulnarabilities.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    17. Re:Simpler solution by Anonymous Coward · · Score: 0

      Deserialization issues in Java affect not just JSON, XML but other serialization formats as well, for example default binary format. Therefore not using JSON or XML doesn't solve anything, it's just another bad idea.

    18. Re: Simpler solution by skids · · Score: 1

      (mandatory missing sarcasm tag warning)

      Not that many developers would base a decision on an AC slashdot post, but...

    19. Re: Simpler solution by Anonymous Coward · · Score: 0

      It's not about thread safety or memory safety. The problem is deserializing XML/JSON/etc into arbitrary code and just running that.

    20. Re: Simpler solution by Anonymous Coward · · Score: 1

      YAML. XML without pretending to solve a bunch of problems it doesn't solve.

    21. Re: Simpler solution by Anonymous Coward · · Score: 0

      I've never understood why PUT things/1/subthing/52 is somehow better than POST /api?thing=1&subthing=52. And the second one works without over complicated mod rewrite rules (though you could certainly add a very simple one to decouple your filesystem from your app).

    22. Re: Simpler solution by Anonymous Coward · · Score: 0

      Memory safety includes making sure data isn't unexpectedly executed as code. Don't you know anything about the von Neumann model of computing?

    23. Re:Simpler solution by Anonymous Coward · · Score: 0

      How in fucks name could anyone fuck up deserialising a stream of JSON?

      Numbers. Strings. Booleans. As Arrays or Objects.

      That's -literally- it.

      How fucking retarded are you as a programmer not to be able to write, from scratch, a JSON parser, and not have it working bug free within a few days?

    24. Re: Simpler solution by Anonymous Coward · · Score: 0

      Bullshit. Real Computer Scientists Devise à grammar and the Scanner/Parser for it.

    25. Re:Simpler solution by hey! · · Score: 1

      Yep. Gin up your own solution with the exact same security flaws.

      I don't care how smart you are; everyone else is collectively smarter than you are. From a security standpoint you want to use popular frameworks that take security seriously and respond to the inevitable exploits promptly. Doing things in an idiosyncratic way is not protection because (a) systems can be probed using black-box methods like fuzzing and (b) chances are your way of doing it has been used thousands of times before.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    26. Re:Simpler solution by Anonymous Coward · · Score: 0

      > I don't care how smart you are; everyone else is collectively smarter than you are.

      Provably not true. If you want a high-quality library with clean interfaces, make sure it is the work of a single smart person.

    27. Re:Simpler solution by Anonymous Coward · · Score: 0

      spoilers: JSON is executable javascript. In fact, that's how it started. More than a decade ago, websites would use an iframe to download the JSON and then eval() the contents into a variable.

    28. Re: Simpler solution by WaffleMonster · · Score: 1

      I've never understood why PUT things/1/subthing/52 is somehow better than POST /api?thing=1&subthing=52. And the second one works without over complicated mod rewrite rules (though you could certainly add a very simple one to decouple your filesystem from your app).

      It's because the Internet meme machine and lemming followers continually confuse exceptionally poor implementations of useful concepts for progress.

      Selling point of REST (via HTTP) was simplicity + reuse. Having objectively failed to deliver on both accounts vs. coherently designed HTTP APIs REST is a nonstarter to even consider at this point. Nobody wants to deal with it.

    29. Re: Simpler solution by Anonymous Coward · · Score: 0

      Only a Rust programmer could be so fucking stupid. You completely failed to understand the problem. Your response was as incoherent gibberish.

      Maybe you should be less concerned about diversity and social justice, and concentrate on programming.

    30. Re:Simpler solution by hey! · · Score: 1

      Libraries are neither here nor there. This is 2017, not the 1970s. To build the kind of apps people want today to run on the platforms they use, you're using a framework, and it's going to be huge and complex.

      Now sure, we still use libraries. And sure, if you are talking about a small, simple library that will never handle information from a source you don't trust. by all means gin up your own if that's easier for you. But if you're gluing a javascript browser app to a server back end, if you're not using JSON (or a mature alternative like ASN.1), you're going to end up recreating a substantial subset of it, not as well.

      Now as for "provable" -- that's laughable when it comes to security, because security is a non-functional requirement domain. It's the behavior of the system in *abnormal* situations that's of concern; situations you haven't imagined yet. It doesn't matter how smart you are, you just don't have time to dream up all the things people might do.

      Anyone can convince themselves that they're a security genius, because anyone can gin up security measures they *themselves* can't break.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    31. Re: Simpler solution by BarbaraHudson · · Score: 1

      Au contraire, I did not say "do nothing". So STFU until you learn how to read, svp.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    32. Re:Simpler solution by BarbaraHudson · · Score: 1

      ... says the anonymous coward. Next you'll be spouting nonsense about how the W3C did the world a huge solid with emojis.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    33. Re:Simpler solution by BarbaraHudson · · Score: 1

      Maybe because the question doesn't really pose a question. Define the problem you're trying to solve; without that, how would you make any recommendations? Crystal ball? Mind reading? Time machine?

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    34. Re:Simpler solution by phantomfive · · Score: 1

      Your comment is prescient and face-palm worthy.......because it is clear and succinct.

      Face-palm worthy because a few years ago, a lot of these bugs were found in XML Java deserializers. A lot of people said, "Don't use XML! It's insecure!" then went off to write the same frameworks, but using JSON instead. They ended up with all the same bugs.

      I guess next people will rewrite them in YAML or binary.....nah, binary is scary, you never know what people could put in there!

      --
      "First they came for the slanderers and i said nothing."
    35. Re:Simpler solution by BarbaraHudson · · Score: 1

      What the hell are you talking about? Can you be any more off-topic?

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    36. Re:Simpler solution by BarbaraHudson · · Score: 1

      Nonsense. There are plenty of ways to store data and transmit it that aren't proprietary. It's not like this is unique to xml and json.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    37. Re:Simpler solution by BarbaraHudson · · Score: 1

      So go work somewhere else. It's not like you have to work for an idiot. There are at least 50 ways.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    38. Re:Simpler solution by BarbaraHudson · · Score: 1

      You can close your eyes. Won't change the fact that xml was a bad idea adopted by the w3c "because". Same as emojis.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    39. Re:Simpler solution by BarbaraHudson · · Score: 1

      Seriously? It's not like there weren't plenty of ways to store data that were far less verbose, more self-documenting, and took up less space and cpu both to create and search through.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    40. Re:Simpler solution by BarbaraHudson · · Score: 1

      Where is this "default binary format" you speak of? It sure wasn't the default for anyone with any brains who was storing and searching data before xml or json.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    41. Re:Simpler solution by Tony+Isaac · · Score: 1

      I remember life before XML or JSON. It wasn't pretty. I've reverse-engineered the .doc and .xls file formats. It was a time when everybody made up their own file formats, and there were no libraries to help you read and write those formats. No, thank you, I'll live with the potential serialization issues.

    42. Re: Simpler solution by Anonymous Coward · · Score: 0

      That's not the issue. The issue is that people use perfectly functioning parsers and then wrote a framework around it that serializes entire object graphs in a generic way. When you read them, the framework then translates pure data into class names and method names to call as it reconstructs the object graph. So that gives an attacker an avenue to reach unexpected behavior, since developers usually don't scope things like "only classes in this package" or "only classes with this annotation or interface" can be deserialized.

      This has nothing to do with the storage format, or java vs .net either. You can do this with many formats and many languages. Including rust or whatever flavor of the day. Also even if you have separate memory areas for data and code to prevent accidental execution, it wont prevent deliberate frameworks that have this issue. And assembly. Especially assembly :)

    43. Re:Simpler solution by BarbaraHudson · · Score: 1

      Obviously not that retarded, because the old solutions worked, and it was far quicker to implement and debug than "a few days".

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    44. Re:Simpler solution by BarbaraHudson · · Score: 1

      And there's your problem - you or your user was using a shitty format. This is a long-solved issue. Even plain text or SDF or tab-delimited or fixed field width are quick and easy to implement, and variable-field-width can also be made self-documenting with just a bit of work. All are far easier to implement than xml or json, and if it's become corrupted, you'll usually be able to see exactly where pretty quickly and recover everything else.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    45. Re:Simpler solution by Anonymous Coward · · Score: 0

      I was serializing Java objects to binary in the 90s. My first Java game engine did this.

    46. Re: Simpler solution by PmanAce · · Score: 1

      So what would you do instead of XML or json?

      --
      Tired of my customary (Score:1)
    47. Re: Simpler solution by Anonymous Coward · · Score: 0

      Are you people _still_ using JSON? Jesus buttfucking christ, its 2017. Use Thrift.

    48. Re:Simpler solution by Anonymous Coward · · Score: 0

      That isn't true. A LOT of the faults with XML is in the XML spec. If you implement the System Entity part of the xml spec, then you will get a bunch of massive problems with it. It is a security hole you can drive a truck through built into the spec itself.

      JSON didn't end up with all the same bugs, for the simple reason that the spec was simpler, and not full of bugs itself.

    49. Re:Simpler solution by Tablizer · · Score: 1

      Leaving idiots doesn't scale.

    50. Re: Simpler solution by Anonymous Coward · · Score: 0

      YAML and JSON are flip sides of the same coin

      JSON is made to be easily read by computers, and is pretty easy for humans to read.
      YAML was made to be easily read by humans, and is pretty easy for computers to read.

      XML was made to be hard for computers to read, and even harder for humans.

    51. Re: Simpler solution by Anonymous Coward · · Score: 2, Funny

      You haven't used XML until you had to decode base64 encoded xml documents stored in xml attributes of a different xml document.

    52. Re:Simpler solution by Bongo · · Score: 1

      > I don't care how smart you are; everyone else is collectively smarter than you are.

      Provably not true. If you want a high-quality library with clean interfaces, make sure it is the work of a single smart person.

      As the first statement is oversimplified to make a point, maybe there's a better way to write it (given I am now part of the "everyone else who is smarter"):

      How many skilled people hours have already been spent on project x which were focussed on solving the quality issues, compared to the hours I can spend on it now? And are my own skilled hours following a very similar approach to the one they used, or am I consciously or accidentally pursuing a different approach which may lead to a different, perhaps better outcome? And am I holding this as an open question where there is no predefined "right" answer?

    53. Re:Simpler solution by vadim_t · · Score: 1

      The problem is exchanging tabular and hierarchical data structures, containing arbitrary values.

      So for instance the simplest of such structures is a table of id, state, name, description. The description field can of course contain arbitrary characters including quotes, commas and newlines.

      Sometimes there's metadata for the table. For instance think of the results of a mysql query: You want a table of the results, but there's also a list of the datatypes of each column, plus the time it took to answer the query.

      A more complex one is a directory tree structure, with the usual metadata.

      Of course in both cases there's the requirement to be able to add additional fields later, while retaining backwards compatibility.

    54. Re:Simpler solution by Anonymous Coward · · Score: 0

      Exactly, there is nothing wrong with the Java serialization protocol, there is a problem with the de-serialization API, as it doesn't allow you to validate input prior to creating objects.

      A re-implementation of ObjectInputStream that validates input and guards against DOS (checks array size etc before creating), reuses the existing Java serialization protocol:

      https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/io/AtomicMarshalInputStream.java

    55. Re:Simpler solution by vadim_t · · Score: 1

      The parent is talking about .doc and .xls formats. These are absolutely not suitable for something as simple as tab or fixed field formats. They can contain arbitrary data like embedded images and videos. They have a very complex markup system. They have features like versioning, scripts, and oodles of metadata. They have to deal with arbitrary data of arbitrary length. They can attach arbitrary amounts of parameters to some piece of text. .doc and similar is one of the few cases where XML is actually not overkill for the task, because XML was made to solve precisely that sort of problem in the first place.

    56. Re: Simpler solution by Dog-Cow · · Score: 1

      In context, we are talking about data that is executed as code on purpose, you worthless bag of shit.

    57. Re:Simpler solution by Dog-Cow · · Score: 1

      If someone ripped your brain out and placed it on your dinner plate, no one would notice. That's how completely useless and unattractive both you and your cooking is.

    58. Re:Simpler solution by Dog-Cow · · Score: 1

      You are such a stupid shit that it's amazing that you can even string together coherent phrases. Or is someone ghost-writing for you?

    59. Re: Simpler solution by Anonymous Coward · · Score: 0

      You implied it because it's the logical conclusion of having to work in a JSON web API inter-connectivity age. We could use Google's Protocol Buffers internally, but we still need to externally interface with customers and partners who either use XML or JSON for everything.

    60. Re:Simpler solution by DarkOx · · Score: 1

      I will agree the XML is highly over prescribed. It is however useful in situations that do require heterogeneous systems to exchange complex and potentially changing data structures where changes cannot be 100% coordinated.

      That said XML is often hobbled for security reasons such that applications don't actually process DTDs etc. If you are doing those things you giving up a lot of the flexibility while keeping most of the complexity. You probably should be asking from a design perspective if perhaps XML isn't the correct solution.

      I don't understand you objections to JSON. Its easy to parse safely and for smallish data structures its easy enough for humans to understand. Virtually every ecosystem has tools for JSON parsing so you won't be left reinventing the wheel for some integration task. TML and YAML are good for more complex structures without introducing the complexity of XML. They might not as widely supported though, but even if you had to develop your own parser neither would be difficult.

      --
      Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
    61. Re:Simpler solution by Anonymous Coward · · Score: 0

      JSON is only executable in a JavaScript engine. If you're passing JSON to a Java application or a .Net application, unless you instantiate a JSON interpreter and hand off the code it is nothing more than an ASCII or UTF-8 text representation of a data structure.

      None of these ASCII or UTF-8 formats have a security vulnerability, blinding taking the data you don't trust and turning that into an object is where the vulnerability lies.

      All of the XML and JSON parsers I've worked with simply instantiate an instance of the class the parser is told is the root of the text data, then parses that text data setting the fields of the object to the contents from the text file then the created object is handed back. I can see where blindly accepting binary versions of serialized objects might open a threat avenue but simply reading text and calling setter methods on objects being a way to open a threat avenue seems a bit contrived.

    62. Re: Simpler solution by Anonymous Coward · · Score: 0

      If an application turns a text file into a data object, how is that executed to begin with? And exactly how would Rust prevent that? All that is happening is that the physical state of an object is being translated into text, sent to another application where it is translated back into a structure that other application can work with. It isn't the data or the serialization that is the issue here, it is how the data is blindly being used when it is received. That is the application's issue, not the data's issue.

    63. Re:Simpler solution by bad-badtz-maru · · Score: 1

      Sure, you can use some crufty protocol like X12 EDI, which will help you understand the benefits of XML.

    64. Re: Simpler solution by bad-badtz-maru · · Score: 1

      And signed, don't forget that the inner document is signed to truly enable misery. See IBM Datapower appliance for that joy.

    65. Re:Simpler solution by angel'o'sphere · · Score: 1

      Bugs in XML deserialization don't allow for arbitrary code execution.
      Neither does JSON or YAML.

      So, what exactly would be the attack vectors (in a VM) via text only (de)serialization?
      I mean: buffer overflows, putting code on the stack or changing return adresses for JSRs obviously are impossible.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    66. Re:Simpler solution by Anonymous Coward · · Score: 0

      ...Yet, you had no problem offering your "don't use json or xml" solution earlier.

      *now* you want to hear about the problem ?

    67. Re:Simpler solution by phantomfive · · Score: 1

      The main thing is when you deserialize an object that has a constructor that does something (or a setter or a getter that does something). Since there are many objects of this type in the Java/C# standard library, an attacker can send a serialized copy of one of these objects, and send it over the wire. The deserializer will happily deserialize it.

      Buffer overflows are kind of rare these days. Because of things like ASLR, they are hard to exploit. It's mainly about logic bugs of various types.

      --
      "First they came for the slanderers and i said nothing."
    68. Re:Simpler solution by Gr8Apes · · Score: 1

      Your problem is incorrectly proposed. XML is ALWAYS a bad solution, at least for communication transports. It's a fine solution for markup, which is the realm it grew out of. I disagree with the json statement, however. json is fine for a sensibly specced communications protocol. I personally think that if your communications protocols can't be easily done as json, then it better be a closed distributed monolithic system, because otherwise you're in for a world of hurt.

      --
      The cesspool just got a check and balance.
    69. Re:Simpler solution by angel'o'sphere · · Score: 1

      And exactly that e.g is the reason why 'standard' deserialization of objects in Java/JVM does neither use ctors nor setters.
      No idea about .Net

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    70. Re:Simpler solution by phantomfive · · Score: 1

      Which one is the standard deserializing library in Java?

      --
      "First they came for the slanderers and i said nothing."
    71. Re:Simpler solution by Gr8Apes · · Score: 1

      Perhaps the better answer is to not try to instantiate an arbitrary object directly.

      --
      The cesspool just got a check and balance.
    72. Re:Simpler solution by vadim_t · · Score: 1

      I agree that XML is usually insanely overkill for most purposes. Still, there are worse choices than insanely overkill, such as trying to shoehorn a complicated hierarchical data structure into something like TSV, CSV or a fixed length format, as BarbaraHudson seems to be proposing in this discussion.

    73. Re:Simpler solution by Anonymous Coward · · Score: 0

      JSON is fine for nothing.

    74. Re:Simpler solution by Anonymous Coward · · Score: 0

      Were you born this stupid, or is it the result of continued exposure to lead paint?

    75. Re:Simpler solution by Gr8Apes · · Score: 1

      I agree that XML is usually insanely overkill for most purposes. Still, there are worse choices than insanely overkill,

      CORBA comes to mind, or EDI, both of which suck hugely for different reasons. If I never have to see either one again it will be too soon.

      The real point for a heterogeneous environment is that you need to look at the basic units you have in common across all players, and then design with those limitations in mind. One of the first and major stumbling blocks for most is that the data representation may vary across the components, and some may have a concept radically different that even the minimum required by the system as a whole.

      --
      The cesspool just got a check and balance.
    76. Re:Simpler solution by angel'o'sphere · · Score: 1

      The build in ObjectOutputStream and ObjectInputStrream.

      They allow serialized objects to either implement java.io.Serializable or java.io.Externalizable

      https://docs.oracle.com/javase...
      https://docs.oracle.com/javase...

      ( Why google finds the 7 version and not the 8 as first hits is beyond me :D )

      The vulnerability comes from the option to overwrite "readObject()". Serialized data objects contain usually the classes as well. So when you read them, you also read and link the code, and hence use the supplied "readObject()" method.

      However the vulnerability in the Apache.Commons libraries was a different one (don't remember right now how exactly), they exploited a bug in the library, so you could sent "code" without sending really a classfile.

      https://blogs.apache.org/found...

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    77. Re:Simpler solution by Anonymous Coward · · Score: 0

      And exactly that e.g is the reason why 'standard' deserialization of objects in Java/JVM does neither use ctors nor setters.
      No idea about .Net

      You do realize that the 'standard' deserialization had glaring bugs of the same kind as in the article. Even the summary references them, no need to read the article. Are we starting a new page in history where we don't even read the summary now?

    78. Re:Simpler solution by Tony+Isaac · · Score: 1

      In fact, the new docx and xlsx formats are implemented in XML.

      There are many data sets that don't work well as CSV. Anything, for example, that has one-to-many relationships such as customer order history with names, addresses, billing info, etc., doesn't work well as CSV. That's the whole point of XML / JSON--you can easily store and retrieve data sets that are more complex than a spreadsheet. And that is just about everything.

    79. Re: Simpler solution by BarbaraHudson · · Score: 1

      Depends on the problem to be solved. There's no such thing as a one size fits all solution, unless it's "one size fits all - badly"

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    80. Re:Simpler solution by BarbaraHudson · · Score: 1
      Go look at the ascii table. You have 4 control characters that are used expressly for schemes to transmitting data that can be composed of fields of variable length (FS - 0x1c - the File Separator, GS - 0x0d - the group separator, RS -0x1e the record separator, and US - 0x1f - the unit separator. You can construct tables constructed of variable or fixed length units ended with US (today we'd all them fields). Each row of fields would be ended with an RS - the record separator. A table or collection of rows would be ended with GS - the group separator. And you can stuff multiple "tables" into one "file", delimited with the FS.

      There's no reason why multiple "files" can't be stored in a single physical file, so you could have multiple databases, each with multiple tables, that you can write to a single stream when you want to serialize, and read from a single stream when you want to unserialize.

      You can also adopt a "standard" that makes the first row of every table the field names, and the second row the data types.

      Or whatever else you want. This has been around since 7-bit ASCII and it worked just fine. Or you could just store a bunch of text files (such as email) linearly, separated by whichever control character you wanted. It's the same situation as xml - you still have to define your data format - but there's a lot less tag soup.

      Also, if you use fixed-width units or fields, it's trivial to do a bsearch to find an individual row in a "table" if it's sorted on that field. Unlike Microsoft's "binary xml."

      Why reinvent the wheel?

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    81. Re:Simpler solution by syntotic · · Score: 0

      Looks just like the ineptitude of self called programmers and guys paying anonymous third parties to say the guy is a programmer. We would be deprived of a few good applications for a while if we admit programming is ALSO a matter of being born a programmer, not just extruded through a system (pun). The problem is perennial and unsolvable, it was called deep vs shallow copying in its time. Either your object is all born like that ready (struct), or it has to be initialized somehow (object) or you have to ensure the object is internally homeostatic and correct, due initialization or not. Late to the polemic, the way it was put (...) we just fell into Y2K again and out.

    82. Re:Simpler solution by BarbaraHudson · · Score: 1

      Then just send them as one big binary blob with a list of offsets, sizes, and file names to the beginning of each separate file as a virtual header using a tab between each offset, size, and file name, followed by a cr. Be a hell of a lot more compact, and extraction of an individual file is as simple as an lseek to the offset, read the size and filename and read(size) number of bytes. Modify as needed, and you can store ANYTHING pretty much in its original form. XML is not needed. Same as emojis. The world would be a better place if neither existed.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    83. Re:Simpler solution by BarbaraHudson · · Score: 1

      Arbitrary data serialization was solved back before the PC was invented. See the following ASCII control codes

      0x1c - FS - File separator The file separator FS is an interesting control code, as it gives us insight in the way that computer technology was organized in the sixties. We are now used to random access media like RAM and magnetic disks, but when the ASCII standard was defined, most data was serial. I am not only talking about serial communications, but also about serial storage like punch cards, paper tape and magnetic tapes. In such a situation it is clearly efficient to have a single control code to signal the separation of two files. The FS was defined for this purpose.

      0x1d - GS - Group separator Data storage was one of the main reasons for some control codes to get in the ASCII definition. Databases are most of the time setup with tables, containing records. All records in one table have the same type, but records of different tables can be different. The group separator GS is defined to separate tables in a serial data storage system. Note that the word table wasn't used at that moment and the ASCII people called it a group.

      0x1e - RS - Record separator Within a group (or table) the records are separated with RS or record separator.

      0x1f - US - Unit separator The smallest data items to be stored in a database are called units in the ASCII definition. We would call them field now. The unit separator separates these fields in a serial data storage environment.

      If any of these control characters appear in your data, escape them as you serialize the data, the same as in c. It's not that complicated, and it works well with multiple databases, each with their own collection of tables, and each individual table having its own set of records, and each record having its own set of fields.

      And the fields don't have to be fixed size.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    84. Re:Simpler solution by BarbaraHudson · · Score: 1

      No more stupid than the folks who solved serialization back in the 60s using 0x1c, 0x1d, ox1e, and 0x1f to store multiple databases each with their own tables in a single file. And certainly not stupid enough to throw out a solution that was simple and worked for a piece of shit just because it's trendy.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    85. Re:Simpler solution by BarbaraHudson · · Score: 1

      This problem was solved in the 60s. See my comments here and here.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    86. Re:Simpler solution by Tony+Isaac · · Score: 1

      There is nothing that is inherently more secure about ASCII control codes over XML or JSON. And it's inherently less human-readable. There's a reason the world has moved on past ASCII control codes!

    87. Re:Simpler solution by Anonymous Coward · · Score: 0

      No, using your frameworks willy-nilly (or a multitude of them) makes your simpler project large and overbearing.

      If you have to maintain a relatively small application that requires a framework with a relatively small team, pick one, understand it properly, and override it where you need to (not where the tutorials tell you to).

      If you have a complex application which needs to run a long period, invest in your own framework or stratify the "frameworks" into their owning components properly, ensure component constraints apply to the whole, and ensure there is no abstraction leakage.

    88. Re:Simpler solution by vadim_t · · Score: 1

      First of all, all those meanings of those ASCII symbols are long obsolete and forgotten. Just because there's a character called "file separator" doesn't mean anybody uses it for any purpose, except perhaps some fossilized piece of software for dealing with tape drives from the 60s.

      Second, such an approach would suffer from various problems. For instance you obviously can't use such characters without escape sequences, which means you can't just stick a file in between file separator characters, you've got to process and escape it first, which is inconvenient as hell.

      Third, it's generally an inconvenient and annoying way of doing things. Besides escape sequences such a system means you don't know how much memory to allocate in advance, which is annoying to deal with.

      Fourth, it's not really suitable for dealing with hierarchical structures and nested pieces of information.

      Fifth, it's all a binary mess that's absolutely not self-documenting in any manner, not editable by hand, not humanly understandable without extensive skill with the very specific format, fragile, lacking in validation and error reporting without doing extensive work on that, the list goes on.

      Sixth, characteristics like extensibility and backwards compatibility are often very tricky in such formats, and make them full of bizarre hacks for those reasons.

      Seventh, all of this stuff requires a lot of specific parsing code that's boring to write and very error prone.

      And really, for what gain? If you want something easy and self-documenting, there's JSON. Key-value pairs in plain text are readable and editable by humans, the structure of the data is visible with the unaided eye, it's easy to skip past uninteresting sections, and it's often possible to do useful work with zero documentation.

      XML has some features that are well fit for various complicated needs. For instance namespaces allow nesting one document inside another, while DTDs provide a formal definition of what's supposed to go where. Now isn't that neat -- you can write a formal specification than any user, in any language can check a document against without writing thousands of lines of validation logic by hand. XPath allows to make queries against a document -- if you just want to say, extract the title of a document, you don't even need to write code that walks through the structure of it.

      XML may be somewhat ugly to the eye and has features that aren't needed for most purposes, but if you need the complication it's far better than some binary mess.

      Things like JSON and XML were created because binary formats were an enormous pain in the ass, and because for some uses, the benefits greatly outweigh the inefficiency. In modern times, programmer time is far more expensive than memory, CPU or disk space, so turning a document from a compact 1K of binary data into 32K of human readable text is extremely often a very good tradeoff.

  2. Real Developers never Deserialize into objects by zifn4b · · Score: 4, Informative

    Real developers use an XML or JSON reader instead of using direct deserialization. Trust me I've built systems both ways and deserialization directly into objects is no bueno. You end up with more problems with version compatability alone to negate the benefits. There are also performance issues as well.

    --
    We'll make great pets
    1. Re: Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      What do you mean by a reader in this context? I mean how do you handle the data contained in the JSON/XML?

    2. Re: Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      It means that you read XML and JSON as document trees, then you spend half your project's development time writing and testing code to walk the document trees and get the data you need.

    3. Re:Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      You're an idiot. All of your systems are slow, burn memory like nothing else, and have random mappings between shit XML and shit Java code.

      Do you work for one of the big outsourcers by any chance?

    4. Re:Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      Nope, try again dumb amateur.

      Java programmers really have fucked the industry.

    5. Re:Real Developers never Deserialize into objects by edxwelch · · Score: 1

      You are 100% correct.
      Unfortunately, going by the amount of projects affected by the bug, it seems that most programmers are not "real programmers"

    6. Re: Real Developers never Deserialize into objects by Sloppy · · Score: 1

      Parser loop.

      --
      As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    7. Re:Real Developers never Deserialize into objects by phantomfive · · Score: 2

      Trust me I've built systems both ways and deserialization directly into objects is no bueno.

      Yeah, running a auto-deserializer on untrusted data is basically guaranteed to be a security flaw. The NSA and FSB will pwn you at that point, along with anyone else who wants to (just ask PayPal).

      --
      "First they came for the slanderers and i said nothing."
    8. Re:Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      While it is certainly your right to post vapid, derisive posts based on zero knowledge of your target....

      You may wish to consider that your efforts produce no value at all, and don't benefit your overall psychological health, either. I am going to go out on a limb here and suggest that you are actually capable of greater things, and of being a greater person. Your failure to achieve this potential is just that...your failure.

    9. Re:Real Developers never Deserialize into objects by Anonymous Coward · · Score: 0

      But can't you pretty much avoid this issue by means of predefining the allowed structure(s) for the data? If the deserialized/serialized data does not match the predefined schema, it's discarded as invalid. Also do data verification/validation to avoid any issues related to that.

      I'm not what old timers would call a "real programmer", I'm just an IT guy with *some* knowledge of various scripting and programming languages. But I don't see why I would need to write my own serializer/deserializer or other type of data processor for XML/JSON if I simply implement to the required V&V steps to the processed data and its structure.

      But I think this is an interesting issue, so please do correct me if I'm wrong. I just think that the standard serialization/deserialization libraries out there have been likely created by programmers a lot smarter than me, so I have some level of trust in them. But like anything else, even the best tools can easily be misused and to me it seems this is the case here too.

      So I guess what I want to ask you is that doesn't the problem here lie in data (and structure) verification and validation instead of the serialization/deserialization libraries?

    10. Re:Real Developers never Deserialize into objects by bad-badtz-maru · · Score: 1

      Absolutely correct. Any additional development overhead or memory use is acceptable in return for the gained compatibility, reliability and security.

    11. Re:Real Developers never Deserialize into objects by phantomfive · · Score: 1

      But can't you pretty much avoid this issue by means of predefining the allowed structure(s) for the data? If the deserialized/serialized data does not match the predefined schema, it's discarded as invalid.

      The deserializer reconstructs the objects by calling the constructor, or setters and getters. The setters and getters have logic bugs that allow arbitrary code execution.

      I just think that the standard serialization/deserialization libraries out there have been likely created by programmers a lot smarter than me,

      No, you're definitely wrong here. If you spend a few weekends, you could probably make one of these yourself. Then getting people to use it is a matter of marketing and such.

      --
      "First they came for the slanderers and i said nothing."
  3. Not a .NET problem by Anonymous Coward · · Score: 1

    This is a programming problem that can happen anywhere. No language is immune. No project is automatically secure from exploits, or able to patch framework universally for all deployments.

    Java and .NET will always have security issues, along with literally every other programming language. Anyone shocked, surprised, upset, or hostile to that concept is in the wrong profession.

    Assume everything is compromised. Assume nothing is secure. Design around that assumption and you will survive.

    1. Re: Not a .NET problem by peppepz · · Score: 3, Insightful

      The title is sensationalistic. Even the original bug the author talks about, calling it repeatedly a "Java" bug, was actually a bug in the Apache Commons Collections library, not in the platform, and it could only be triggered if a server using the library allowed customers to provide serialized data for itself to deserialize, which is severely wrong in the first place (it's akin to eval()-ing client-provided text).

    2. Re:Not a .NET problem by Tablizer · · Score: 2

      Assume everything is compromised. Assume nothing is secure. Design around that assumption and you will survive.

      But you won't be able to compete with shortcut takers. They will look more productive than you. The penalty for shortcut taking is not just large enough, I hate to say. I'm just the messenger.

    3. Re:Not a .NET problem by Anonymous Coward · · Score: 0

      This is a programming problem that can happen anywhere. No language is immune.

      You can design languages inherently immune by imposing contextual constraints. I've been there, done that. A counterintuitive aspect this offers programmers more freedom to get away with things otherwise viewed as forbidden / extraordinarily dangerous and become more productive as a result.

      No project is automatically secure from exploits

      Perusing automatic constraint based immunity is the only tractable path forward to improving outcomes. The concept serves as the basis for all systems I design.

      Systems designed where security requires being extra careful and unflinching attention to every detail have already failed before a single line of code was ever written.

      Assume everything is compromised. Assume nothing is secure. Design around that assumption and you will survive.

      If one were to follow such advice what would be the point in caring about security at all? Unbounded paranoia is counterproductive. ASSumptions generally are not helpful.

    4. Re: Not a .NET problem by Anonymous Coward · · Score: 0

      So weit better die Not use that NSA invention called C ?

      I agree With that...

    5. Re: Not a .NET problem by Anonymous Coward · · Score: 0

      Do Not.

    6. Re:Not a .NET problem by Tablizer · · Score: 1

      Correction: "just not large enough...".

      Lexdysia

  4. Prevent data by Anonymous Coward · · Score: 0

    prevent deserialized data from accessing and running certain methods automatically

    How exactly does data access anything?

    1. Re: Prevent data by Anonymous Coward · · Score: 0

      SQL injected into a string can execute as a command.

    2. Re: Prevent data by Anonymous Coward · · Score: 0

      Then it's not "pure" data, it's executable or scripted data.

      Keep those domains separate and this problem goes away. Granted we seem to have in some fit of malreasoning abandoned the separation in recent years which is causing a manner of difficulty. Witness your SQL injection. This is a problem of poor architecture propagated in mass inertia. It should not and need not exist.

    3. Re:Prevent data by bugs2squash · · Score: 1

      I presume that the code performing the marshaling or unmarshaling of objects tries to be overly generic and so treats it's input as if it were a mini scripting language of it's own. ie crawls through the input and handles what it finds by having the input dictate what methods to call to get the job done. I'm sure it can be done safely, but it's probably easy to err on the side of "clever generic" code that is exploitable.

      --
      Nullius in verba
    4. Re:Prevent data by hord · · Score: 1

      Data by itself doesn't do much. The way to think about data is that it is being fed into a machine that is doing stuff. That means I can program the internal state of that machine using data. Normally we just call this "processing" but bugs like this illustrate that you have to be very careful with how you handle state. Even for "simple" formats that are just "text" like JSON, XML, YAML, and everything else. Image (binary) formats are also not immune as there have been browser attacks using bugs in common image libraries. If your data is used as input, it is executing passively.

    5. Re: Prevent data by phantomfive · · Score: 1

      These frameworks will de-serialize any object. Send them a Process object in .NET, and the framework will deserialize it into something that can fork a new process. The APIs in Java and .NET are so huge, that it is extremely difficult to filter out every kind of object that might cause problems (some frameworks try......and fail).

      There is no 'pure' data here, the purpose of these frameworks is to deserialize into objects, and objects by definition are functions combined with data.

      --
      "First they came for the slanderers and i said nothing."
    6. Re:Prevent data by skids · · Score: 1

      In this case it happens when "Object Oriented" is taken too literally. People think of data as inert. People think of "Objects" as inert. So they figure translating between data and objects is just transforming one inert thing into another.

      But "objects" are not inert in almost any dynamic language. They are quite active, with instantiation methods, etc., and some are quite dangerous. One has to adjust one's paradigm when learning OO programming from a procedural background.

    7. Re: Prevent data by Anonymous Coward · · Score: 0

      These frameworks will de-serialize any object.

      You missed the point.

    8. Re: Prevent data by phantomfive · · Score: 1

      Please clarify instead of posting cryptic pointless posts.

      --
      "First they came for the slanderers and i said nothing."
    9. Re: Prevent data by YoungManKlaus · · Score: 1

      > will deserialize it into something that can fork a new process

      Only if you tell it "hey please put this into this insanely insecure class that will fork a process". Serialize your shit into stupid DTOs and you are dandy. That has nothing to do with the API surface.

  5. Re: Real Developers never Deserialize into object by Anonymous Coward · · Score: 0

    Extract data via methods, using strings, and populate your objects manually.

    Using direct xml to hard-coded class fields is a nightmare. Changing the field name breaks deserialization.

  6. It's a trap! by Anonymous Coward · · Score: 3, Interesting

    Completely agree. We used .net binary serialization/deserialization because it was such a quick way to get things up and running...with like two lines of code. The fact that the serialized objects were about 10x bigger than they needed to be was not a problem.

    It turns out the namespaces are included in the serialized data, so the moment we did an ounce of lightweight refactoring we broke it. It took us less than a day to write our own serializer, but an extra three days of combined manpower to get a format converter built and deployed.

    We would have saved all that if we had just started with our own serializer.

    Prefab solutions to simple problems are a deal with the devil. Beware!

    1. Re:It's a trap! by Anonymous Coward · · Score: 0

      Prefab solutions to simple problems are a deal with the devil.

      Prefab solutions to simple problems are the only thing most programmers are able to do any more given the lowering of bars.

  7. Yeah, serialization can be annoying. by RyanFenton · · Score: 2

    I'm kind of surprised this hasn't already built into a more prominent issue over time.

    Performance issues I can stomach - there's going to be some unavoidable parsing logic no matter how you go at translating from runtime to storage or network logic - but instead, large swaths of objects just get ignored in major libraries. When using unity, for instance, can't serialize dictionaries, and many other objects in the default serializer - which is a major oversight.

    Google actually has provided some rather nice tools to help with this - I tend to use their 'Protocol buffer' libraries for their rather nice serialization options. This doesn't address security on its own - nothing does completely, but designing careful locked signal processing and independent cross-checking steps can help a lot. Well-salted encryption alone won't really save you.

    My pet peeve with protocol buffers the need to give everything an index number, with no real auto-numbering for rapid design - I can see the logical need, to be able to rely on that order for processing - it's just an extra babysitting step that gets me sometimes. For what it does, it's still the best I've found to be consistent between diverse projects and still leaving room for decent security.

    Ryan Fenton

    1. Re:Yeah, serialization can be annoying. by hord · · Score: 1

      I've looked at protocol buffers but everything I've ever read about people actually using them in production says they are a nightmare over time because they are binary. Supposedly the object versioning alleviates some of this but I think people were complaining about how to deal with mandatory fields over time. I can't remember but I suspect this plus JavaScript being in the browser is what makes JSON so prevalent. I have no idea why XML is used. I can't even think of a single advantage it has over anything. I guess I should just be glad ASN.1 didn't become more popular.

    2. Re:Yeah, serialization can be annoying. by Anonymous Coward · · Score: 0

      I have no idea why XML is used. I can't even think of a single advantage it has over anything.

      Then you haven't looked. Just off the top of my head, compared with JSON, XML has better tooling and validation. JSON really only has a message size advantage, which granted, can be quite important in some scenarios.

    3. Re: Yeah, serialization can be annoying. by Anonymous Coward · · Score: 0

      Readability. Json boils down to key value pairs. XML adds attributes, which are entirely useless constructs, and make readability awful. And for some reason all xml ends up looking like this:

      at:Attribute at:attribute1="number" at:attribute2="has-2-attributes">4</at:Attribute>

    4. Re: Yeah, serialization can be annoying. by Anonymous Coward · · Score: 0

      JSON is hardly a paragon of readability itself. The lack of object identifiers and any kind of standard date format can be maddening in even the simplest JSON data.

      { "Name" = "foo", "Date" = 1502660746 }

      For example, what do you think the above represents? Without resorting to a conversion tool, what date and time is represented?

      Part of the reason JSON is so lightweight is that it tosses-out contexual data and assumes both the sender and receiver have this additional information. I suspect even the worst XML structures would have made what the data above represents more obvious.

    5. Re: Yeah, serialization can be annoying. by Anonymous Coward · · Score: 0

      Json-LD just called, it says it found your missing context

  8. Free time =/= 20% time by PRMan · · Score: 1

    Google engineers banded together in their 20% time.

    --
    Peter predicted that you would "deliberately forget" creation 2000 years ago...
  9. Re: Real Developers never Deserialize into object by Anonymous Coward · · Score: 1

    Walking a data tree is 1st year CS level work. If you're spending half your efforts on it then you're either vastly short on resources or your coders suck donkey balls.

  10. Re:Bottom-line... apk by hord · · Score: 2

    Personally I think "exposing" objects is the problem. Your border should be a mailbox that exchanges messages and those messages should be inspected carefully before internal delivery. I have no idea why people want to dump a class they wrote onto a live internet service and just hope that it dumps data into the correct table somewhere. They dragged the "security api" icon onto the project space so it's secure.

  11. Agree. by Anonymous Coward · · Score: 2, Insightful

    It appears that the market is flooded with developers who can write scripts but not algorithms. They believe that something like parsing JSON is really hard and complicated, that any home-grown solution to doing that will be extremely buggy and slow, all because they themselves haven't taken the mental step-up.

    Of course, this mental step-up used to be a standard part of a CS degree. College students would be writing code that does this sort of thing as homework. This has changed, and I have seen the change in the candidates we interview. I ask them questions about their courses in algorithms and what they did, and they say things like "we learned what the foundational algorithms are and how to compare their performance." Did you actually write a merge sort? "No, there's no need because every major language has that sort of thing built in."

    So, there's the rub. They paid good money for a degree that glanced over the most important bits. Naturally, they feel completely justified in their beliefs that stringing third-party solutions together is the best way to write code.

    And a whole new crop of these scripters hits the job market every year, more than we have seen in a decade. Colleges have been lowering the bar due to higher interest among students that aren't really cut out for it, that in turn due to successful social engineering on the part of the tech giants.

    At least, that's my hypothesis.

    1. Re:Agree. by Joviex · · Score: 4, Insightful

      I ask them questions about their courses in algorithms and what they did, and they say things like "we learned what the foundational algorithms are and how to compare their performance." Did you actually write a merge sort? "No, there's no need because every major language has that sort of thing built in."

      Consider me a cultist follower of your hypothesis. 20 years in CS, the last 10 I have seen it take a sharp dive. The only explanation I have is the explosion over 15 years ago in OSS and that what you espouse is true: Everyone thinks they can develop or engineer, because the code is tied up in nice little solution blocks.

      Need a sort algo? Just codeproject.com
      Need some bi-directional comm between remotes? Just github.com...etc....

      The number of people I have turned away in the first two days of testing, who could not even write a simple priority Q... its more than disheartening.

      These are the "developers" who are supposed to code my future? Fuck me! I'll be working till I die.

    2. Re:Agree. by hawkinspeter · · Score: 2

      Although knowing how to write algorithms is a very fundamental part of programming (and they SHOULD cover that in a CS degree), I'd agree with the young developers in not writing their own implementations in the real world. Writing good algorithms is hard and I'd prefer the expert developers to put the most useful algorithms into libraries rather than the less experienced developers who are straight out of college.

      I reckon most coding jobs only really involve manipulating/displaying data from databases and having a nice GUI and you don't really need to be expert with algorithms for that.

      --
      You're a temporary arrangement of matter sliding towards oblivion in a cold, uncaring universe
    3. Re: Agree. by Anonymous Coward · · Score: 0

      Are we talking FIFO? Thats the only priority Queue they taught us. Had to teach myself the rest.

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

      Given the PHP experience i suggest you better roll your own stuff. Much less hoffen backdoors.

    5. Re:Agree. by Anonymous Coward · · Score: 0

      Everything is a trade-off.

      When you utilize other people's solutions, you inherit other people's bugs (as in the case of the present article).

      When you write your own solutions, you write your own bugs.

      That trade-off isn't neutral though. If what you need is simple and the available pre-fab solutions are fancy, the bugs are more likely in the pre-fab. If what you need is complex and fancy and the pre-fab solution is mature and well-vetted, then the bugs are more likely in your code.

      And in any case coding it yourself costs your employer time and money, that you've got to justify.

      Every decision like this has a lot of variables at play, with ups and downs on all sides. So, always a trade-off.

    6. Re:Agree. by Anonymous Coward · · Score: 0

      If you are testing on problems which were solved 20 years ago - maybe you are using the wrong tests?
      Would you test using punch cards given the choice.

    7. Re:Agree. by Joviex · · Score: 1

      If you are testing on problems which were solved 20 years ago - maybe you are using the wrong tests? Would you test using punch cards given the choice.

      Bro, if you think that Priority Qs are "old", you are the problem.

      Stop trying to use things like "outdated" to mean "I dont know how".

      Grow some balls, dont be an A.C. and make ignorant claims about things you obviously dont even know are in use (i.e hint PQ are just heaps) when they are the literal foundation of modern caches and heaps.

      Thanks for making my point.

    8. Re:Agree. by Anonymous Coward · · Score: 0

      If the problem is such "old news," then why is it so hard for you to solve?

      It's just code. Can't you write it?

    9. Re:Agree. by Anonymous Coward · · Score: 0

      So you want someone to write a round-robin, lockless thread pool on a whiteboard in 30 minutes? Good luck finding that guy and keeping him more than 2 months. Almost all programming is drudgery. If you're programming 'creatively' then you're doing it wrong. There aren't new problems and there's no need for new solutions. Use what's been proven to work time and time again if you want to make quality software within deadlines and within budgets. You can't do that if you don't know those solutions.

    10. Re:Agree. by Anonymous Coward · · Score: 0

      exactly

      it may be beneficial for engineering students to learn how wheels work, but no one would seriously recommend that then when they get jobs they go around recreating wheels for every project

    11. Re:Agree. by Anonymous Coward · · Score: 0

      Writing good algorithms is hard and I'd prefer the expert developers to put the most useful algorithms into libraries rather than the less experienced developers who are straight out of college.

      The "experts" who writes the libraries "everybody use" has to get an education too. Hence, CS education has to teach the basics that these experts are supposed to master. Not "punched cards" but sorting algorithms, priority queues and so on. I teach CS, and you don't get an A unless you can program & run some variant of Dijkstras algorithm on real road map data. That, and about 10 other such algorithms.

      Using building blocks to create apps is nice - but you're not much use if you cannot also create the occational low-level building block yourself.

      Those who go for "CS light" create horrible apps because high-level programming only seems easier - you find all the performance traps there too, such as quadratic or worse behaviour when a smart implementation would be linear or at worst n*log(n). Then they implement horribly slow algorithms like bubblesort (repeated needlessly for each container insertion) and done in some slow language like javascript. And no, computers are no longer getting faster every year - more's law broke in the early 2000s.

      I reckon most coding jobs only really involve manipulating/displaying data from databases and having a nice GUI and you don't really need to be expert with algorithms for that.

      Perhaps. But if that is all they can do - don't call them 'programmers'. 'Data presenter' perhaps? Don't pretend they can do general programming.

    12. Re:Agree. by hawkinspeter · · Score: 1

      Your comments about the "CS light" programmers are exactly why I wouldn't trust a typical programmer to write a top quality algorithm.

      What to call these "CS light" people - I prefer the term "code monkey".

      --
      You're a temporary arrangement of matter sliding towards oblivion in a cold, uncaring universe
    13. Re:Agree. by Anonymous Coward · · Score: 0

      You could have shortened all of that into a simple:
      "university found the money jack pot, and immediately exploited it and the world is worse off because of it."

    14. Re:Agree. by Joviex · · Score: 1

      So you want someone to write a round-robin, lockless thread pool on a whiteboard in 30 minutes?

      No, I want someone to KNOW HOW, logically, to solve THAT PROBLEM.

      And I said DAYS, not hours. Reading comprehension is an obvious skill that has gone down with this "new" education paradigm,

    15. Re:Agree. by Anonymous Coward · · Score: 0

      I was responding to the AC, not to you. I agree with your higher standings. However, "The number of people I have turned away in the first two days of testing" can easily be interpreted as the number of people you rejected during your first two days of interviewing candidates for a position, not that the candidates were being tested for multiple days.

      Blame English. It sucks. Lets all speak Ido.

    16. Re:Agree. by zifn4b · · Score: 1

      Consider me a cultist follower of your hypothesis. 20 years in CS, the last 10 I have seen it take a sharp dive. The only explanation I have is the explosion over 15 years ago in OSS and that what you espouse is true: Everyone thinks they can develop or engineer, because the code is tied up in nice little solution blocks.

      Our education system is broken. Not many developers have Computer Science degrees because that's actually a had degree to achieve. A lot of them have some type of Computer Science lite degree like Information Technology or something like that. I don't see it getting any better. Insisting it should is unfortunately wishful thinking at this point. Some people value the field of Computer SCIENCE. Some people are just in it for the money.

      --
      We'll make great pets
  12. JSON does not have code-execution ability by Anonymous Coward · · Score: 5, Insightful

    JSON only defines a bunch of basic data types. It defines no ability to run anything. These bugs are in (de)serialization layer above it, which uses JSON as a transport and extend the meaning of the data stored to be able to deserialize higher-level objects.

    JSON or XML are not the problem here. The same problem could happen if you serialized to CSV or TXT or anything else for that matter.

    1. Re:JSON does not have code-execution ability by Tablizer · · Score: 1

      It's probably a problem with "generic" reconstruction of objects based on data. If the data is used to (re) construct objects, then some objects can potentially have behavior because that's how objects are defined. If the data is "clever" enough, it may end up constructing objects you don't want.

      It's probably better to parse out to low-level "scalar" values and hand-code the part that stuffs them into objects or databases rather than let a parser actually build objects or object trees itself.

    2. Re:JSON does not have code-execution ability by phantomfive · · Score: 1

      It's probably better to parse out to low-level "scalar" values and hand-code the part that stuffs them into objects or databases rather than let a parser actually build objects or object trees itself.

      This is exactly right. Because the data is untrusted, you need to verify it anyway, and adding parsing code to that usually doesn't add much overhead (it can often be the same code).

      In the defcon talk they made a strong case that these generic de-serialization libraries are extremely difficult if not impossible to use securely. They were just grabbing at low-hanging fruit, as soon as you've imported these libraries, you're compromised. They didn't even discuss ways that the libraries might be used incorrectly.

      Say no to generic deserializers on untrusted data.

      --
      "First they came for the slanderers and i said nothing."
    3. Re:JSON does not have code-execution ability by Anonymous Coward · · Score: 0

      The problem is prevalent because of the ubiquity of dependency injection in a lot of communication frameworks. No one likes to hand-massage these APIs because that means for every small insignificant change you have to do regression tests. But you open your whole process to infiltration because you designed it to be infiltrated in the first place (that's what inversion of control principal is all about, right?).

    4. Re:JSON does not have code-execution ability by Anonymous Coward · · Score: 0

      * principle

      Reed an off books, on tilled you're leaps stop moving.

    5. Re:JSON does not have code-execution ability by pjt33 · · Score: 1

      It's probably better to parse out to low-level "scalar" values and hand-code the part that stuffs them into objects or databases rather than let a parser actually build objects or object trees itself.

      If you're dealing with enough different datatypes then it might be a big development and maintenance saving to have a generic object builder in your deserialiser. The key is to make it so that you whitelist the datatypes it will deserialise.

    6. Re:JSON does not have code-execution ability by Anonymous Coward · · Score: 0

      As far as I can tell.. it'd be like (psuedocode; xml version):
      <myClass>
      <System.Data.SqlClient attribute="attribute" />
      </myClass>

      Basically, it'd trick the deserialiser into creating an object from an irrelevant or system namespace, and then call various setter methods on it to configure it to do something nefarious. I don't know if the above xml would really create a System.Data.SqlClient; or if it'd throw some kind of exception, but I think this the general idea behind this attack.

      JSON or XML that deserialises to schemaless dynamic objects or any deseraliser that ensures it only creates instances of classes once it knows they are valid children of the class would be in better shape to withstand this.

    7. Re:JSON does not have code-execution ability by Anonymous Coward · · Score: 0

      Look up SYSTEM ENTITY in the xml spec. Any parser which fully supports the xml spec is an insecure parser.

      Don't think for a moment that XML and JSON are the same in this way.

    8. Re:JSON does not have code-execution ability by Tablizer · · Score: 1

      I see a problem with white-listing. Objects are often part of a bigger ecosystem. You may have to white-list sub-sets of objects to do it right, making it non-trivial to guarantee you didn't leave a current or future hole.

      You are right that it might be a big saving to have auto-object generation, but at a risk.

    9. Re:JSON does not have code-execution ability by Anonymous Coward · · Score: 0

      A Python deserializer for JSON could be made by simply calling eval() with an environment that set true = True; false = False; null = None.

      This would be a very unsafe way to do it, but it would "work."

      The trouble isn't that the format is bad, it is that it looks like code, so lazy people (not thinking about security) treat it like code.

  13. PRIVATE should WORK though by Anonymous Coward · · Score: 0, Troll

    See subject: When you design a class for your objects THAT is the point of "private" classification protection & apparently? It falls apart in these slower bugprone & NOT LIVING UP TO WHAT THEY SAID THEY WERE (safe) interpreted languages.

    APK

    P.S.=> As far as serialization & protection of these objects/classes member functions & data + consistency of reload again? See my other post & HOW what I tend to use most protects vs. it (no problem afaik to date in it either) & OTHER serious issues https://it.slashdot.org/comments.pl?sid=10984357&cid=55003119/ - however, if you want to "rig" C/C++ vs. buffer overflows I note there (like you have to rig C for errhandling)? Two pointers, 1 double the length of the 1st, sent thru a char array/string, can determine its length vs. that (when larger one no longer advances, you have midpoint & w/ that, you can determine string length easily (or use strlen functions etc. which IS probably that code RIGHT there in fact I'd wager (odd vs. even check too)) ... apk

  14. Untrue & apparently you missed this by Anonymous Coward · · Score: 0

    http://www.theregister.co.uk/2017/08/11/malware_in_dna/ triggering buffer overflow. Perhaps NOT the best example b ut the point's there.

    Buffer overflow (data driven) is the point though.

    APK

    P.S.=> "Garbage in/garbage out" is an old saying about data too - misinformation & disinformation? Another... apk

  15. Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

    No language is immune

    That's a pretty broad generalization to be making. There's a good possibility that a safe-by-default language like Rust wouldn't be susceptible. It doesn't even have legacy objects like Java and C# have. Rust is also statically typed, and it enforces thread safety and memory safety.

    1. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      This is complete bullshit, basically the same as saying "if you had written that in Java instead of C you wouldn't have any bugs".

      I've not tried Rust yet, I like its ideas, but in this context your post is just nonsense.

    2. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      I've not tried Rust yet

      If you haven't used Rust then you're in no position to criticize it. You obviously don't understand how it works. It's not at all comparable to Java, like you think it is. Rust is a whole new way of thinking about programming. Until you've actually used it you will never understand how innovative it is.

      Take your ignorant Rust bigotry somewhere else!

    3. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      Wow! By the way you prise it, I predict Rust will replace every language in no more than two years and step software engineering into a new level.

    4. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      I've not tried Rust yet

      If you haven't used Rust then you're in no position to criticize it. You obviously don't understand how it works. It's not at all comparable to Java, like you think it is. Rust is a whole new way of thinking about programming. Until you've actually used it you will never understand how innovative it is.

      Take your ignorant Rust bigotry somewhere else!

      s/Java/C/g
      s/Rust/Java/g

      There. I just make your arrogant rant read just like it did 20 years ago when Java evangelists were singing the same damn tune.

      At least Java didn't come with close-minded SJW asshattery..

    5. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      That comparison is invalid and if you actually knew how unique Rust is you'd understand. Rust is a new paradigm. It isn't just Smalltalk with a C-like syntax and a shitty VM. Rust is a totally new way of looking at computing. Again, take your ignorant anti-Rust bigotry elsewhere.

    6. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      Oh god please fuck off.

    7. Re: Is Rust vulnerable? I'd expect not. by Anonymous Coward · · Score: 0

      That comparison is invalid and if you actually knew how unique Rust is you'd understand. Rust is a new paradigm. It isn't just Smalltalk with a C-like syntax and a shitty VM. Rust is a totally new way of looking at computing. Again, take your ignorant anti-Rust bigotry elsewhere.

      ROFLMAO.

      The kool-aid is strong in this one.

      "Totally new way of looking at computing" That's hilarious. It'd be even funnier if you actually believe that.

      Get a clue. People alive today aren't any smarter than people alive 10, 100, or 1000 years ago.

      Sorry, they're not. People today have nicer toys and more resources. People today don't have "totally new way[s] of looking at" anything.

      If you really think so, you are not only ignorant, your arrogance is of mythical proportions.

      But do go one. You're funny as shit.

    8. Re: Is Rust vulnerable? I'd expect not. by blackpaw · · Score: 1

      He'll be telling us Rust is webscale next

  16. Right. It's a programming language problem. by Anonymous Coward · · Score: 0

    You're absolutely right. A lot of people here are missing the fact that it's not a serialization problem, it's a programming language problem. This is what happens when dynamic languages, which these days include Java and C# even if they are compiled to some degree, are used instead of a static language like Rust that guarantees memory and thread safety.

  17. I don't get it by Hentes · · Score: 1

    Can someone explain what the problem is here? Serialized objects are just code, and if you're running untrusted code you've got bigger problems than bugs in your serialization libraries.

    1. Re:I don't get it by PhrostyMcByte · · Score: 3, Informative

      General rule of thumb as always... a vague security announcement is never as big a deal as its title makes it out to be.

      There really isn't much of a problem. Reading TFA, a few vulnerabilities have been discovered in a couple applications and libraries. None of these were part of .NET, and no systemic issues in how people code for .NET have been found.

  18. "Houston, Java & .NET have a problem..." by Anonymous Coward · · Score: 0

    If marshalling objects exposes privatized members of your objects it's "houston, we have a problem" - fix it.

    * My preferred "weapon of choice" compiled statically (can be runtime driven but I avoid performance hits this way) Delphi stores object persistence in its .DFM file so that they are consistent & reload "on the fly" (no problems like this afaik, UNLESS you were to use .NET in Delphi apparently, which yes, you can (funniest part about that is Delphi had .NET working in it before MS comiplers did)).

    It's a SMART & LONG PROVEN safer high-performance language (beat the shit out of Java, MSVC++ where it matters in what's MOST used, all programs do some math & strings as far back as 1997 in of all places, "Visual Basic Programmers Journal" Sept issue "INSIDE THE VB5 COMPILER ENGINE" issue where they ADMITTED it kicked the crap out of them both, even DOUBLING C++ performance there) & unlike say, C/C++? It's also not prone to buffer overflows like C/C++ are (string length is incorporated in Delphi's strings)

    If you want to "rig" C/C++ vs. buffer overflows I note there (like you have to rig C for errhandling)? Two pointers, 1 double the length of the 1st, sent thru a char array/string, can determine its length vs. that (when larger one no longer advances, you have midpoint & w/ that, you can determine string length easily (or use strlen functions etc. which IS probably that code RIGHT there in fact I'd wager (odd vs. even check too))

    APK

    P.S.=> THIS is WHY I avoid using others' 3rd party libs (other than OS apis) WHEN/IF possible - something always "turns up" in them that's rotten sooner or later & you're vulnerable/exposed UNTIL THE VENDOR of said lib/dlll (or interpreter engine) ISSUES A FIX (IF they do) - e.g.: SQLite. I could've used it in APK Hosts File Engine 9.0++ SR-7 32/64-bit but it turned up a decade++ long issue recently & it's written in C (iirc)... apk

  19. Never heard of those libraries by PmanAce · · Score: 1

    They aren't part of. Net itself, just third party libraries.

    --
    Tired of my customary (Score:1)
  20. REST not OO by Anonymous Coward · · Score: 0

    REST is not object oriented, for all the reasons you pointed out.
    It's just an RPC (remote procedure call) interface, but highly restricted on the encoding and selection of the procedures. The whole "all procedures must correspond to Create, Read, Update, or Delete" is an inappropriate joke a lot of the time. But we shoehorn it in and make it fit! ;-)

  21. Re: Simpler solution - Secure you data with hashes by Goldfish1974 · · Score: 0

    Add something like an Authenticating Hash that depends on a secured secret (eg. Cert that is installed in non-removal mode in window slls store. Run the check on the binary stream of JSON before using JSON deserializer type inference. Alternatively, maybe add JSON schema to validate first... or be explicit with the expected types for what is being deserialised...so no type inference is used. N.B. i haven't read the paper yet...but will in a few hrs time. So i could possibly amend this comment.

  22. JSON.NET is not vulnerable by default by Tony+Isaac · · Score: 1

    As stated int he linked document, for JSON.NET to be vulnerable, you have to explicitly set an option making it less secure.

    As with encryption and security libraries, you are better off using well-established libraries like JSON.NET than rolling your own. A solo developer, or corporate team, just doesn't have the resources or time to work out all the security vulnerabilities, as can be done with a dedicated library.

  23. the problem is CRAP coders by Anonymous Coward · · Score: 0

    trained by CRAP people.

    A commerce site I recently used rejected my credit card because a 5+4 ZIP code couldn't be parsed. WTF!!!!

  24. Re:Bottom-line... apk by Anonymous Coward · · Score: 0

    Dumping the class is faster and easier than creating, sending, then parsing and validating messages. But I agree with you. Most of the software I write is completely message based. That model works well.

  25. DOS attacks on .NET and Java by jens.dietrich · · Score: 1

    This is not surprising ! We discovered recently some "billion-laughs"-style DOS attacks that exploit vulnerabilities in Java, and ported some of them to .NET and Ruby. Details here: http://drops.dagstuhl.de/opus/... (paper, there is also an artefact to run attacks in a VM), and the source code is here: https://bitbucket.org/jensdiet... . We did have some problems porting this from Java to .NET but managed eventually. Interestingly, some of these problems were caused by a bug in .NET: a broken contract between equals and hashcode (see https://github.com/dotnet/core...) .

  26. Re: Real Developers never Deserialize into object by zifn4b · · Score: 1

    Walking a data tree is 1st year CS level work. If you're spending half your efforts on it then you're either vastly short on resources or your coders suck donkey balls.

    Correct and then 2nd year CS work is red/black trees and other advanced algorithms. The whole time you're learning this you're taking increasingly higher levels of mathematics. You see the problem I run into is that many people couldn't make it to the 2nd year in Computer Science and went into Information Technology or some other "Computer Science Lite" field of study. These are the majority of people in the field now that really lack to ability to understand the difference between different implementations logically and mathematically. Computer Science is a hard degree. It's called Computer _SCIENCE_ for a reason.

    --
    We'll make great pets
  27. Re:Addendum... apk by Anonymous Coward · · Score: 0

    Too bad all you can ever manage is shit toy problems.

    Please tell me about how you created hosts file engine cocksucker edition and how the Chinese copied you and not every other person who has done the same but better and/or earlier.

    Please provide a bunch of quotes from people that no one can find or you have taken out of context.

    Actually I really want you to whine and bitch about AC posts since you are just a whiny little bitch.

  28. Lisp? Lisp?? by Anonymous Coward · · Score: 0

    I'm not one to advocate for fashion in computer languages, but Lisp? Really?

    Lisp had it's shot. If Lisp ideas were going to dominate, or even just achieve some niche popularity, it would have done so by now. Lisp has had way, way over a half century to achieve commercial popularity and it has not done so. Lisp is a niche even in academia!

    Geezus, Cold Fusion had more popularity. BASIC had more relevance. Clipper/dBase/FoxPro had more commercial relevance. Focus had more customers.

    Lisp??