Likes Likes:  0
Resultaten 1 tot 2 van de 2
Geen
  1. #1
    Geoff Vass
    Running renamed executables with CMD.EXE
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    Running renamed executables with CMD.EXE

    A while ago I "discovered" that CMD.EXE would launch renamed executables. I
    felt that this was a security problem because until fairly recently most
    virus scanners would be checking .exe, .com, .pif etc for viruses but would
    not bother scanning .txt files, and of course email attachment filtering
    would not generally block a .txt file. So I had an email conversation with
    the fellas at secure@microsoft.com and they felt it was not a problem and
    would not be changing the behaviour.

    Coincidentally, shortly after MS issued KB811528 which says that CMD.EXE
    looks at the header of the file and because it is an executable, executes it
    and that you should only run code from trusted sources (blah blah blah).

    I still think they focused too much on the fact that to demonstrate the
    issue is basically a user-initiated client-side process, ie, you go to the
    command prompt and type "malcode.txt" and malcode will run. And so
    everybody thinks a user that does this is an idiot.

    But the real issue to my mind is that if you are a hacker and you have
    infiltrated a system a great way to hide your malcode would be to rename it
    all to .txt or .tmp and launch it when required using "cmd /c malcode.tmp".
    Of course you can say, the system has already been compromised and the
    hacker could have simply used .exe files. But if you have ever tried to
    clean an infected system or look for a possible compromise you know the
    first thing you are looking for is funny .exe files. If the files have been
    "hidden" by renaming them it is so much harder.

    Consider also that tools such as Sysinternals' Autoruns, which now has a
    function to show code not signed by Microsoft, would skip over an autorun
    entry starting with cmd.exe because cmd.exe is a legitimate part of Windows.

    I think it's a problem because we have a section of the operating system
    that behaves totally counter-intuitively, considering that every other part
    of the operating system looks at the file extension and not the contents. If
    you rename an .exe to .txt and double-click, Notepad opens. Yet CMD.EXE
    executes it. And now we have this new functionality in the shell which
    remembers which zone a file was downloaded from and prompts you according to
    its safety level yet CMD.EXE totally ignores it. And this from a company
    that went so far as to alter the DLL search order behaviour to block certain
    types of DLL spoofing, which is another obscure type of attack that assumes
    the malcode is already in your system.

    So considering all the tweaking that took place in Windows XP for SP2 it's a
    bit peculiar that this obscure and counter-intuitive behaviour has remained
    intact.

    OK, sure, it's not a vulnerability. It's completely useless until the
    malcode gets into your system and the breathless media attention to this
    issue has been ill-informed and panicky. But to a hacker it's a useful bit
    of misbehaviour that can be handy if you're trying to avoid detection. It
    really ought to be "fixed".

    Geoff Vass
    Australia


  2. #2
    Michael Wojcik
    Running renamed executables with CMD.EXE
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    RE: Running renamed executables with CMD.EXE

    > From: Geoff Vass [mailto:geoff@cadzow.com.au]
    > Sent: Saturday, 21 August, 2004 07:43
    >


    [Your messages would be easier to read if you kept them to a reasonable line
    length.]

    > A while ago I "discovered" that CMD.EXE would launch renamed
    > executables. I
    > felt that this was a security problem because until fairly
    > recently most
    > virus scanners would be checking .exe, .com, .pif etc for
    > viruses but would
    > not bother scanning .txt files,


    What's "fairly recently"? If Symantec (not, IMO, the world's greatest
    security products) is typical, then this hasn't been a problem for a while.
    According to the Symantec KB, their anti-virus products since at least NAV
    2000, except for NAV 2001, scan all files by default.[1] And while NAV 5.0
    scanned only "program files" by default, at least as far back as November
    1999 Symantec had KB articles explaining (for the daft) how to configure it
    to scan all files.[2]

    > and of course email
    > attachment filtering
    > would not generally block a .txt file.


    The only email attachment filtering that works worth a damn is common sense.
    People who are "protected" from evil attachments by filtering will fall to
    social engineering attacks such as phishing.

    > Coincidentally, shortly after MS issued KB811528 which says
    > that CMD.EXE
    > looks at the header of the file and because it is an
    > executable, executes it
    > and that you should only run code from trusted sources (blah
    > blah blah).


    MS products have been ignoring metadata for years. It's well known that IE
    attempts to determine disposition from content rather than from the HTTP
    headers.

    I suppose this makes it all the more ironic that MS is now pushing another
    metadata "security" scheme, with the file zone ADS. But really there's
    nothing new here and nothing particularly exciting.

    > But the real issue to my mind is that if you are a hacker and you have
    > infiltrated a system a great way to hide your malcode would
    > be to rename it
    > all to .txt or .tmp and launch it when required using "cmd /c
    > malcode.tmp".


    This is only great insofar as you're dealing with an incompetent
    administrator; under that assumption, there are plenty of other
    opportunities.

    To put it in more formal terms, you're worrying about pruning a rather small
    branch of the attack tree. There just aren't going to be many (if any)
    attacks which depend solely on the capability of cmd.exe to process files
    based on content inspection.

    > But if you have
    > ever tried to
    > clean an infected system or look for a possible compromise
    > you know the
    > first thing you are looking for is funny .exe files.


    No, that's not the first thing I do. Perhaps your procedures need an
    update?

    > I think it's a problem because we have a section of the
    > operating system
    > that behaves totally counter-intuitively, considering that
    > every other part
    > of the operating system looks at the file extension and not
    > the contents.


    Simply not true; IE is the most prominent example, but it's not the only
    one.

    > And now we have this new functionality in the shell which
    > remembers which zone a file was downloaded from and prompts
    > you according to
    > its safety level yet CMD.EXE totally ignores it.


    Not a big deal, since the file zone ADS isn't worth the bytes used to store
    it.

    > And this
    > from a company
    > that went so far as to alter the DLL search order behaviour
    > to block certain
    > types of DLL spoofing, which is another obscure type of
    > attack that assumes
    > the malcode is already in your system.


    If interpositioning is an "obscure" attack, then I think cmd's behavior is
    not your greatest worry. Interpositioning should be completely obvious to
    anyone with any degree of security training and understanding of Windows;
    and anyone without security training has already lost the fight by the point
    where an attacker can create files on the target.

    > So considering all the tweaking that took place in Windows XP
    > for SP2 it's a
    > bit peculiar that this obscure and counter-intuitive
    > behaviour has remained
    > intact.


    "Intuitive" is what the user expects - no more and no less. File extensions
    as metadata that determines disposition is not a universal mechanism among
    OSes. It might be "intuitive" to people who used MS-DOS and older versions
    of Windows, but it's not intuitive for Unix users, for example, and there's
    no reason it should be for people who start with XP. (And it doesn't even
    translate to, say, people using MVS via TSO and ISPF, where you might exec a
    CLIST or submit JCL, but you don't go creating programs that look like OS
    commands.) Ditto "obscure".

    I'm not saying that cmd's content-inspection execution heuristics are good,
    mind you; in fact I think that's a fairly stupid idea, particularly when
    carried to excess, as it has been. I think the Unix model (where only a few
    magic numbers are recognized, and the rules are well-known) is a decent
    compromise, and the old MS-DOS model (where there are strict execution rules
    based solely on filename metadata, ie extensions) was clumsy but workable.
    But I don't believe it's a huge threat; I think a formal model (such as a
    well-drawn attack tree based on a reasonable threat model) would show you
    that it's not; and I don't think "fixing" it is the right way to go, since
    there's little to gain and potential compatibility issues.

    1.
    http://service1.symantec.com/SUPPORT...52567ac0063608
    c/4978f97c99d2fa7b8825690d008012d6

    2.
    http://service1.symantec.com/SUPPORT...ec985256c92005
    cb9ae/2154e3ea5303ddbf85256c92005b5ce9

    --
    Michael Wojcik
    Principal Software Systems Developer, Micro Focus

Webhostingtalk.nl

Contact

  • Rokin 113-115
  • 1012 KP, Amsterdam
  • Nederland
  • Contact
© Copyright 2001-2026 Webhostingtalk.nl.
Web Statistics