nCircle.com >> 360 Security

« Operating System Vulnerabilities | Main | SCADAGard SIG To Be Established »

Die, XML

One of the guys that runs our network here, Storms, pointed out that the OVAL pseudo code for the WMF check is rather amusing (I'll show just the XP case):

vulnerable software section:
Windows XP is installed
------------------------------------------------------
-- registry_test:
o the hive 'HKEY_LOCAL_MACHINE' exists
o the key 'SOFTWARE\Microsoft\Windows NT\CurrentVersion' exists
o the name 'CurrentVersion' exists
o the value equals '5.1'

While I was still in a good mood, I scrolled down and saw that the basis of the script/check/definition is XML:

<oval xmlns="http://oval.mitre.org/XMLSchema/oval" xmlns:oval="http://oval.mitre.org/XMLSchema/oval" xmlns:windows="http://oval.mitre.org/XMLSchema/oval#windows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval oval-schema.xsd " >

    <generator >
      <schema_version > 4.2 </schema_version>
      <timestamp > 20051229114905 </timestamp>
    </generator>
    <definitions >
      <definition id="OVAL1433" class="vulnerability" >
        <affected family="windows" >
          <windows:platform > Microsoft Windows XP </windows:platform>
          <windows:platform > Microsoft Windows Server 2003 </windows:platform>
          <product > Operating System </product>
        </affected>
        <dates >
          <submitted date="2005-12-28-10:07" >
            <contributor organization="ThreatGuard" > Robert L. Hollis </contributor>
          </submitted>
          <status_change date="2005-12-29-11:27" > DRAFT </status_change>
        </dates>
        <description >
          'Microsoft Windows allows remote attackers to execute arbitrary code via a crafted Windows Metafile (WMF) format image, possibly related to the Windows Picture and Fax Viewer (SHIMGVW.DLL), a different vulnerability than CVE-2005-2123 and CVE-2005-2124, and as originally discovered in the wild on unionseek.com.'
        </description>
        <reference source="CVE" > CVE-2005-4560 </reference>
        <status > DRAFT </status>
        <version > 0 </version>
        <criteria >
          <software operation="OR" >
            <criterion test_ref="wrt-2" comment="Windows XP is installed" negate="false" />
            <criterion test_ref="wrt-61" comment="Windows Server 2003 isinstalled" negate="false" />
          </software>
        </criteria>
      </definition>
    </definitions>
    <tests >
      <registry_test id="wrt-61"comment="Windows Server 2003 is installed" check="at least one" xmlns="http://oval.mitre.org/XMLSchema/oval#windows" >
        <object >
          <hive > HKEY_LOCAL_MACHINE</hive>
          <key > SOFTWARE\Microsoft\Windows NT\CurrentVersion </key>
          <name > CurrentVersion </name>
        </object>
        <data operation="AND" >
          <value operator="equals" > 5.2 </value>
        </data>
      </registry_test>
      <registry_test id="wrt-2" comment="Windows XP is installed" check="at least one" xmlns="http://oval.mitre.org/XMLSchema/oval#windows" >
        <object >
          <hive > HKEY_LOCAL_MACHINE </hive>
          <key > SOFTWARE\Microsoft\Windows NT\CurrentVersion </key>
          <name > CurrentVersion </name>
        </object>
        <data operation="AND" >
          <value operator="equals" > 5.1 </value>
        </data>
      </registry_test>
    </tests>
</oval>

What's the point? Isn't this the exact kind of thing that a well thought out custom scripting language would be better for? Or a file/stream containing key/value pairs (ie. "foo=123") like a conf or config.sys file?

XML is hideous, looks ugly, and complicates matters unecessarily in my opinion. It suffers from one of the same general issues that I see Java suffering: It's like using an RV when all you need is a bicycle. But I guess when you're an XML-head, everything looks like a problem in need of an XML solution. Gah.

[Edit: I felt bad about throwing around the words 'god' and 'retarded' so casually; I pulled them from the 2nd to last paragraph.]

Comments (6)

terlin:

Byron,

You might take a little time to understand the purpose of XML before you go bad-mouthing it. You could start with the Wiki entry:

http://en.wikipedia.org/wiki/XML

The point of XML is to provide a *standard* markup language. Application developers are dealing with various types of data all the time. If, as used to be and still is often the case, everyone used a different data format standard, you'd get frustrated *very* quickly. A 'custom scripting language' would be just that: custom. The value of XML is that once you learn to manage it, you don't have to understand all the data to work with it.

It may be that you pay for a text-based standard with some overhead, but in the machine world it's well worth it. XML is not intended for human consumption! That's also why OVAL provides 'psuedo-code' that's much more human readable.

Let's look at the case you provide: what if OVAL provided a custom scripting language for this stuff? Well, first of all, you'd have to throw out all the standard tools for dealing with XML that exist in most languages. So the overhead of processing XML is outweighed by the fact that you have to write a new library for dealing with the custom scripts.

Now expand that outside of OVAL specifically. If I'm a developer I'd much rather build an application off of a recognized standard than a custom language, right? So OVAL can more easily take advantage of the pool of developers who are comfortable with XML instead of trying to convince developers to learn their custom language.

Whatever weaknesses XML may have, it's clearly better than using a custom data format for every application out there.

Byron Sonne:

That's the great thing about 'standards' - there's so many to choose from.

I'll believe there are 'standard' XML tools and 'standard' ways of doing things when I see everyone using XML in a 'standard' way ;)

Christ, we can't even get HTML properly standardized across browsers... now we want another new markup/data standard for use across an even wider variety of applications? Feh.

"XML is not intended for human consumption!" - You gotta be kidding me... let's see, it's written in English, it's text, and it's a markup language. Those are all indications that mean, intended or not, that it can and will be consumed by humans.

Hey, all we need to do now is muck it up even more with some ASN.1 and BER too.

Just for giggles, I spent a couple minutes and this is probably something like how I'd do it:

schema_version="4.2"
timestamp="20051229114905"
definition="vulnerability"
id=OVAL1433
family="windows"
os="Microsoft Windows XP","Microsoft Windows Server 2003"
arch="x86","ia64","x86-64"
submitted date="2005-12-28-10:07"
contributor organization="ThreatGuard"
contributor="Robert L. Hollis"
status="draft"
status_change date="2005-12-29-11:27"
description="'Microsoft Windows allows remote attackers to execute arbitrary code via a crafted Windows Metafile (WMF) format image, possibly related to the Windows Picture and Fax Viewer (SHIMGVW.DLL), a different vulnerability than CVE-2005-2123 and CVE-2005-2124, and as originally discovered in the wild on unionseek.com.'"
reference source=cve,"CVE-2005-4560", draft, 0
test_types="registry"
registry test="Windows XP is installed", "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion", equals, 5.1
registry test="Windows Server 2003 is installed", "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion", equals, 5.2

There we go... machine and human readable, simple to parse, and without the XML fluff that in my mind adds nothing of great use.

Paraphrasing Peter Weill:

"XML is like cardboard. It is a very useful packing material because it is malleable and self-describing. Cardboard is itself a large worldwide industry because it is so useful. Often the cardboard used in packaging is heavier than the actual contents of the package. So we should not really be complaining about the “angle brackets” because that’s really not the point."
(Source: http://jimbots.com/blog/?p=12)

Byron Sonne:

The cardboard analogy is quite good.

Especially since I frequently receive stuff from fools and businesses all the time where items the size of a pencil or deck of cards is packaged in a cardboard box big enough to hold a couple large dictionaries. The same kind of idiots that you see retailing a single nail-file shrink-wrapped to a piece of carboard 8" tall and 4" wide.

Cardboard is used far too frequently and in far too large amounts, is a mess to manufacture, and generally bad for the environment. Just like XML!

You know it would be very trivial to use one of the standard XML parsing libraries out there to convert this to the key/value pair format you described.

Byron Sonne:

I have no doubts it would be easy. But why bother going through this step at all?

It's not like it matters, the deal is done, but I still get to gripe about it ;)

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on January 5, 2006 7:25 AM.

The previous post in this blog was Operating System Vulnerabilities.

The next post in this blog is SCADAGard SIG To Be Established.

Many more can be found on the main index page or by looking through the archives.