Slashdot Mirror


English Shell Code Could Make Security Harder

An anonymous reader writes to tell us that finding malicious code might have just become a little harder. Last week at the ACM Conference on Computer and Communications Security, security researchers Joshua Mason, Sam Small, Fabian Monrose, and Greg MacManus presented a method they developed to generate English shell code [PDF]. Using content from Wikipedia and other public works to train their engine, they convert arbitrary x86 shell code into sentences that read like spam, but are natively executable. "In this paper we revisit the assumption that shell code need be fundamentally different in structure than non-executable data. Specifically, we elucidate how one can use natural language generation techniques to produce shell code that is superficially similar to English prose. We argue that this new development poses significant challenges for in-line payload-based inspection (and emulation) as a defensive measure, and also highlights the need for designing more efficient techniques for preventing shell code injection attacks altogether."

72 of 291 comments (clear)

  1. This is by Anrego · · Score: 4, Funny

    quite terrifying :(

    If hackers convert arbitrary x86 shell code into sentences that read like spam, but are natively executable .. we're all screwed :(

    We'll either need to tighten up how architectures execute instructions to make it harder to execute shell code in the first place.. or come up with sophisticated AI to help filter out the shell code. Of course, as soon as we do that, hackers will develop AIs which can write convincing (and even compelling) shell code.. and THEN what the hell do we do.

    Now where I live you can get a pretty decent hair cut for $17 (they even trim up the beard). You can't get anything fancy.. but a decent, professional-ish type haircut is definitely no problem.

    My employer is giving us a pretty generous Christmas vacation.. really looking forward to that!!

    Also this time of year is great cause CHRISTMAS is everywhere :D

    1. Re:This is by BradleyUffner · · Score: 4, Funny

      I beleive you missed the virus he just sent you. :)

    2. Re:This is by Wovel · · Score: 4, Informative

      Guess you missed their "compromised" machine assumption. "..After successful exploitation of a software vulnerability, we assume that a pointer to the shellcode..." . The sky is not really falling any faster today than it was yesterday.

    3. Re:This is by blueg3 · · Score: 5, Informative

      Pinning down terminology use by security researchers is tricky.

      In this case, what they mean is that the system has a vulnerability that enables code from a remote source to be executed, and that the input from the remote source is being run through a filter that attempt to identify executable code (in order to block it) versus English text.

      On an already-secure system, this makes no difference at all. Those don't exist, much. If you were relying on a "looks like executable code" filter to protect you, this is a tip that it's not that secure. The paranoid should already assume so (based on things that already are available in Metasploit, if nothing else).

    4. Re:This is by afidel · · Score: 2, Insightful

      Isn't this what NX is supposed to stop, execution of arbitrary data as code?

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    5. Re:This is by mysidia · · Score: 2, Funny

      I propose the x86 instruction set be altered to add an additional byte to every instruction, a NUL byte or NUL word, so every instruction will have an additional 2 to 8 bytes of overhead, at least 1 must be set to all bits 0, and the following byte must be set to all bits 1.

      Since the NUL byte cannot be expressed in a sentence and commonly causes I/O to terminate (i.e. delineates the end of the string), x86 code can then not be disguised as a sentence.

      Also, the following byte being all bits 1, assures that the instruction cannot be transmitted over protocols that do not provide 8-bit support.

      Further, the all-bits 1 sequence should be removed from ASCII and banned from use by any network protocol: to transmit such bits, you must encode in Base64.

    6. Re:This is by x2A · · Score: 2, Insightful

      Well then that won't be the x86 instruction set, will it?

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    7. Re:This is by mysidia · · Score: 2, Interesting

      No, it won't be the legacy x86 instruction set.

      But we can call it the "Secure x86 instruction set" or the "Enhanced x86 instruction set"

      Market it properly, and everyone will switch to it, because they think it's faster and safer.

    8. Re:This is by nneonneo · · Score: 2, Interesting

      Unfortunately, this does not fully solve the problem. Say, for instance, that you've managed to get a buffer overflow on a system, and you now have control over the stack (which is marked RW, but not X). Then, you overwrite the return address of the current function to mprotect() and stick some arguments on it which change the stack protection to RX (there are good reasons for doing this in actual practice, e.g. executable compressors like UPX, or executable thunks on the stack); this type of attack is known as a "return-to-libc" attack. If you can successfully overwrite the next lower return address as well, then you can ensure that your shellcode is executed after mprotect returns.

      Even if we assume that the stack is permanently fixed at RW, this does not prevent heap spray attacks which place executable code on the heap and overwrite return addresses on the stack to point at the heap. If the heap is marked RW, then we can just repeat the same process as used above to call mprotect.

      Prohibiting execution on writable segments seems sensible, but in the face of functions which can change the protection bits, it is ineffective. Further, simply restricting the use of those functions is potentially too restrictive, as in the case of some runtime environments which rely on the ability to execute dynamically generated trampoline code to implement key features (for instance, GCC may generate trampoline code to call nested functions), as you mentioned with your second paragraph.

    9. Re:This is by blueg3 · · Score: 3, Insightful

      Even better: inputs that can overwrite the stack can perform arbitrary code execution even if the stack is never executable, via "return-to-libc" programming.

    10. Re:This is by x2A · · Score: 2, Insightful

      If you've got the ability to market a processor that won't run peoples old software, and using it makes software slower, take up more memory (think for single byte instructions, a single byte of padding is doubling the space it takes up, which is in effect halving the size of your L1/L2 caches), to a level sufficient enough to get people to actually buy it, then you may as well not even bother with the CPU, just convince them to give you money for nothing, as obviously your marketing team are that good that they could do that!

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    11. Re:This is by wvmarle · · Score: 4, Insightful

      As is being argued all the time: security is about layers. Layer upon layer. One layer to prevent executable code to reach your system in the first place by looking at the content of a message. Another layer to prevent code that does reach your system to be executed at all. Another layer to prevent untrusted code that does manage to be executed to do any damage (sandbox, permissions). Relying on a single layer of defense is not secure, no matter what that layer is or how strong that layer is. Breach that one layer and you're in.

      This research gives at the very least a proof-of-concept on how to breach that first layer of security. And that of course is significant.

      Of course there are no 100% secure systems - but the more layers of defense, the more secure it becomes. This takes away one layer of defense, thus making a system less secure. So yes it does make a difference even on "already-secure" systems.

    12. Re:This is by c1t1z3nk41n3 · · Score: 2, Insightful

      I think this will have nasty applications for web email providers. GMail and I'm guessing the other major ones filter out executable attachments to prevent spread of email worms. If this can beat their filters there are surely plenty of people still unwary enough to run programs emailed to them.

  2. Oh great - that love letter from the IRS by rcpitt · · Score: 3, Funny

    just formatted my hard disk and installed Windows 7 - how low can you get :(

    --
    Been there, done that, paid for the T-shirt
    and didn't get it
  3. Re:The syntax should not matter.. by benjamindees · · Score: 3, Informative

    They don't mean shell commands. They mean code that exploits a vulnerability in order to start a shell.

    --
    "I assumed blithely that there were no elves out there in the darkness"
  4. Re:In other news... by blueg3 · · Score: 5, Informative

    Good job not reading the article.

    It's not that shellcode can be written in text and then compiled to an executable form. It's not that shellcode can be compiled to an intermediary form, translated or compiled into machine instructions by a piece of code (this is common in malware now, to pass input restrictions -- as the article says). It's that the executed machine instructions themselves -- the compiled binary data that can be run raw on an x86 processor -- looks like English text.

  5. This very comment by ewg · · Score: 5, Funny

    Why, this very comment prints a list of prime numbers less than one hundred!

    --
    org.slashdot.post.SignatureNotFoundException: ewg
    1. Re:This very comment by The+MAZZTer · · Score: 4, Funny

      Where do the numbers print out I don't see325072$OGO^%$#G@!!)%@^)&@!^%$$36PEER TIMEOUT

  6. OMG! by mhajicek · · Score: 5, Funny

    Now your brain can catch a virus just by reading!!!1

    1. Re:OMG! by Nethead · · Score: 5, Funny

      Leave the bible out of this!

      --
      -- I have a private email server in my basement.
    2. Re:OMG! by wizardforce · · Score: 4, Interesting

      You joke but what is a meme (religions are "memes") really other than a self replicating piece of language? The *extreme* bits act in many ways like a virus does: self replication, performing specific tasks, adapting to their environment (like some of the more insidious malware) and neither viruses nor memes can replicate on their own; they need a "host."

      --
      Sigs are too short to say anything truly profound so read the above post instead.
    3. Re:OMG! by Nethead · · Score: 5, Funny

      So now that you've explained my joke, do you get it?

      --
      -- I have a private email server in my basement.
    4. Re:OMG! by Concerned+Onlooker · · Score: 3, Funny

      Yes, its' a simple head code. Any English schoolboy could catch it.

      --
      http://www.rootstrikers.org/
  7. Re:Confused by icebraining · · Score: 2, Insightful

    It's a shellcode; it's actually written in machine code.

  8. That was rather pretty by jaymz2k4 · · Score: 2, Interesting

    I just have to point out how well that PDF looked from a purely graphic point of view... That is all. Interesting content to boot.

    --
    jaymz
    1. Re:That was rather pretty by sten+ben · · Score: 2, Informative

      Looks like LaTeX with a CHI template. But maybe that was what you were getting at? Pretty it is.

    2. Re:That was rather pretty by gzipped_tar · · Score: 2, Informative

      The PDF file itself was generated using Adobe Distiller for Mac. Not sure what is used to generate the original. Since they were using Adobe, it's not likely that they were using LaTeX.

      --
      Colorless green Cthulhu waits dreaming furiously.
    3. Re:That was rather pretty by sten+ben · · Score: 2, Informative

      Since they were using Adobe, it's not likely that they were using LaTeX.

      Except the .dvi file extension. And: Creator: dvips(k) 5.97 Copyright 2008 Radical Eye Software

      Acrobat was probably only used to convert the ps to pdf.

    4. Re:That was rather pretty by dubaiguy · · Score: 4, Informative

      It's latex with an ACM template. I'm pretty sure their workflow was latex (.dvi) to dvips (.ps) to Acrobat Distiller (.pdf).

  9. Re:In other news... by Knightman · · Score: 2, Insightful

    And how do you suppose they generate the text then? They have a system they train with text pulled from various sources, then they use it to generate an innocent looking text that can be executed with a predicted result, no? In other words, an assembler/compiler....

    See, I did read the pdf....

    Btw, I missed that there where 4 researchers, not 3...

    --
    --- Reality doesn't care about your opinions, it happens anyway and if you are in the way you'll get squished.
  10. Re:The syntax should not matter.. by Wovel · · Score: 4, Insightful

    And nothing in their article is helping with that. They assume they are exploiting a software vulnerability. If I know there is a software vulnerability, there are 1 million and 1 less complex ways for me to blow right by any inline scanner. (One stupid enough not to look and see what the actual bytes were anyway)

  11. Re:Confused by The+MAZZTer · · Score: 3, Informative

    Nope, you're confusing assembly code and shell/machine code, which are two different things.

    Assembly is text-based, and is readable for people who know the language. Each operation is a keyword, and some take arguments. It's basically the lightest-weight possible programming language (although it's not really considered a programming language, it's so light weight!) A computer cannot run assembly code directly.

    Machine code is what you get if you take the assembly and run it through an assembler to produce code that the computer can understand. The computer can then execute it. It is not human readable unless you've memorized which opcodes correspond to which assembly keywords. Far easier to pipe it through a disassembler to get the assembly code back and read that.

    To answer the GP's question this sounds like they mean shell code. It wouldn't be very useful as assembly code anyway. ("To claim your free iPod, run this sentence through masm and run the resulting EXE file.") Most people don't have an assembler and the ones who do aren't usually susceptible to malware anyway.

  12. Re:In other news...BAN THE PARENT by HEbGb · · Score: 4, Informative

    This is the sixth spam message this user has posted, will SLASHDOT please BAN this guy already? Come on.

  13. Re:In other news... by Knightman · · Score: 3, Interesting

    An assembler/compiler doesn't necessarily use a high-level language input.

    In this instance they (as you say) 'takes as input executable machine code and generates executable machine code with a very narrowly-defined statistical property' which tells me they have an assembler that reads executable code and assembles executable code that looks like English text, in other words an assembler.

    --
    --- Reality doesn't care about your opinions, it happens anyway and if you are in the way you'll get squished.
  14. Re:In other news...BAN THE PARENT by Tynin · · Score: 5, Informative

    This is the sixth spam message this user has posted, will SLASHDOT please BAN this guy already? Come on.

    He must be making new logins. I've seen him posting for a few weeks, he surely has more than 6 spams that I've seen alone. Going on that idea... lets see:
    http://slashdot.org/~coolforsale117
    http://slashdot.org/~coolforsale116
    http://slashdot.org/~coolforsale115
    http://slashdot.org/~coolforsale114
    http://slashdot.org/~coolforsale112
    http://slashdot.org/~coolforsale110

    No doubt there is a TON of them. So I'd guess they are banning him, he just keeps making new uids (and siphoning a ton of moderation points to keep him marked at troll / offtopic). I know I've used many mod points keeping this bastard down.

  15. Re:In other news... by calmofthestorm · · Score: 2, Interesting

    No, it translates assembly to different assembly that's also English. This is actually a rather interesting piece of work. They didn't just write a program that converts assembly to English assembly, they wrote one in English assembly.

    --
    93rd rule of Slashdot: No matter how obvious my sarcasm is, my comment will be taken seriously by someone.
  16. Re:In other news... by mysidia · · Score: 2, Funny

    FAIL. It cannot be an assembler if the input is not assembly.

    It's a translator.

  17. Re:In other news... by blueg3 · · Score: 2, Informative

    Technically, machine code -- assembly is the pseudo-English text version of machine code.

    But otherwise, yes.

  18. Re:In other news... by mysidia · · Score: 2, Interesting

    It is indeed a translator.

    It doesn't translate assembler code.. it translates x86 machine code.

    (Which also implies that it cannot be an assembler, since assemblers only accept Assembly code as input)

  19. Binaries that opt out of NX by tepples · · Score: 2, Informative

    Isn't this what NX is supposed to stop, execution of arbitrary data as code?

    Then you compromise a binary that has opted out of strict NX, such as a Java virtual machine that needs to dynamically recompile JVM bytecode to x86 bytecode.

  20. Antelope museum by beej · · Score: 5, Funny

    Consume more trains, Elvis! He, and snorkels, drink elephant's sock puppet master. Steamed cabbage can reverse big piles of ducks. Additionally, cheese log cabin nightmare.

    You're screwed now, x86 suckas!

    1. Re:Antelope museum by slashqwerty · · Score: 5, Informative
      For those that are curious, here is some actual exploit code from the paper:

      There is a major center of economic activity, such as Star Trek, including The Ed Sullivan Show. The former Soviet Union. International organization participation Asian Development Bank, established in the United States Drug Enforcement Administration, and the Palestinian territories, the International Telecommunication Union, the first ma

      The bold characters are code. The rest have no net effect.

      Their strategy is to break the exploit into two pieces, a small executable decoder, and the payload. As you might imagine, the decoder decodes the payload. The payload is encoded in a benign-looking format which is simple enough. Their goal was make the decoder also look like benign data. To achieve that, their tool takes an existing decoder and automatically converts it to English-looking prose like the paragraph above. The tool is able to convert a decoder is less than an hour on commodity hardware.

  21. Re:In other news...BAN THE PARENT by spud603 · · Score: 2, Insightful

    Is it spam, or is it shellcode? things like "this treatementOur goal" look fishy to me.

  22. Re:The syntax should not matter.. by x2A · · Score: 2, Informative

    It's a research paper, not an exploit, not instructions on how to make an exploit, not recommendations on how to make an exploit. God what's with you people on this site, you can't just see something for what it is, you have to see it for how it serves no purpose to you or how you can do it so much better.

    If they could exploit a machine by sending a point across, they'd get it past you lot every time, you'd never detect that huh.

    --
    The revolution will not be televised... but it will have a page on Wikipedia
  23. Re:The syntax should not matter.. by istartedi · · Score: 2, Insightful

    There are indeed times when I think that we built the Internet, and that it taught us only one lesson:

    I'm right and you're wrong.

    This is not quite as concise as "42". Also, a second Internet will have to be built to determine who is "I" and who is "you".

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  24. Re:In other news... by DoctorBit · · Score: 4, Informative

    It's a translator that takes any arbitrary x86 machine code as input, and produces as output functionally equivalent self-modifying machine code that starts off looking like English text. The same approach also works with other non-x86 machine codes, and other languages, such as Russian, French, etc... Very interesting work. It goes to show that for an OS to allow any code to self-modify can produce results that are very difficult to predict. Self-modifying code has an almost biological nature.

  25. I CAN BE PLAYED ON RECORD PLAYER X by rpresser · · Score: 2, Insightful

    Let the T-C wars continue!

  26. So what? by Fnord666 · · Score: 2, Interesting

    I guess I don't see the big deal in this paper. Yes, they can encode the shell code into English sentences. It's still meaningless to the recipient and should raise suspicion. It would be far easier to use simple steganographic techniques to embed the shell code into any image transmitted between two systems. The recipient would not suspect any alteration and filters would not have the original image for comparison. Just a thought. Maybe I should write a response paper.

    --
    'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
  27. Linux version by noidentity · · Score: 5, Funny
    They also came up with a Linux version, which even works on non-x86 architectures, all the while looking like plain English:

    "Please type the following on your command-line:

    rm -rf *

    Thank you."

    1. Re:Linux version by maxume · · Score: 2, Funny

      I thought all you Linux types like to make fun of Windows for having names like "My Documents" and what not?

      --
      Nerd rage is the funniest rage.
  28. Re:In other news...BAN THE PARENT by Ethanol-fueled · · Score: 2, Funny

    At least the /b/ spammers are polite enough to do their homework and know the demographic (all /b/ spams are porn). Air Jordans and POLO hoodies for Slashdot? And handbags and UGG boots, even though there are no women on Slashdot. At least try to sell us motherboards and shit...

  29. Excellent Presentation by rochberg · · Score: 5, Informative

    This talk was probably my favorite at CCS this year. Unlike MANY researchers, the lead author of this paper was quite entertaining. Regarding the work itself, there are a few details that the current discussion has missed.

    First, I would not say that they can convert arbitrary shell code to English-like prose. Rather, the only instructions that can be used are the ones that are identical to the ASCII encoding of the alphabet. For instance, the ASCII encoding of the letter "r" is identical to the binary for the unconditional jmp instruction. Granted, the authors showed that you can do a lot with this limited set of instructions, but I still wouldn't call it arbitrary.

    Second, he showed several examples of the sentences created. They make about as much sense as "Lorem ipsum dolor sit amet..." The tight constraints on the instructions that can be encoded into ASCII make crafting decent English syntax nearly impossible. Spam filters based on natural language processing could probably detect and flag them.

    While disguising the binary as ASCII is cool, I don't see that it's all that different than other exploits. Once a sentence containing an exploit is detected, you'll have signatures just like any other type of virus/trojan. I highly doubt that contemporary anti-virus scanners stop working on data that looks like ASCII. Rather, they look for tell-tale signs of particular instructions that appear in particular orders, etc.

    And, as many others have pointed out, this code is only harmful if it is executed in the right context (i.e., you have a vulnerability to exploit). Disguising the code as ASCII doesn't really make it different than any other type of zero-day attack.

    This work was very sophisticated, and there's no way that script kiddies could build something like this. I don't know that more advanced attackers would bother, because I really don't see all that much of a payoff given the amount of work that this attack requires. It's a whole lot easier to take over a vulnerable web server and launch a XSS attack. The incentives simply do not seem to suggest that this technique will become widespread.

    So, no, I don't think the sky is falling because of this attack. Having said that, though, this was a very cool piece of work.

    1. Re:Excellent Presentation by dubaiguy · · Score: 3, Informative

      First, I would not say that they can convert arbitrary shell code to English-like prose. Rather, the only instructions that can be used are the ones that are identical to the ASCII encoding of the alphabet. For instance, the ASCII encoding of the letter "r" is identical to the binary for the unconditional jmp instruction. Granted, the authors showed that you can do a lot with this limited set of instructions, but I still wouldn't call it arbitrary.

      According to the PDF it does convert arbitrary shell code. FTA: What follows is a brief description of the method we have developed for encoding arbitrary shellcode as English text... It looks like they can encode anything once they have built an English-like decoder (judging by their language and the 3rd figure).

      The tight constraints on the instructions that can be encoded into ASCII make crafting decent English syntax nearly impossible. Spam filters based on natural language processing could probably detect and flag them.

      If they were sending SPAM... which they aren't.

    2. Re:Excellent Presentation by rochberg · · Score: 2, Interesting

      First, I would not say that they can convert arbitrary shell code to English-like prose. Rather, the only instructions that can be used are the ones that are identical to the ASCII encoding of the alphabet. For instance, the ASCII encoding of the letter "r" is identical to the binary for the unconditional jmp instruction. Granted, the authors showed that you can do a lot with this limited set of instructions, but I still wouldn't call it arbitrary.

      According to the PDF it does convert arbitrary shell code. FTA: What follows is a brief description of the method we have developed for encoding arbitrary shellcode as English text... It looks like they can encode anything once they have built an English-like decoder (judging by their language and the 3rd figure).

      Ah, I forgot about that part. Yes, the first part of the shell code decodes the remaining message so that they are no longer limited to just typical ASCII characters. You are correct.

      The tight constraints on the instructions that can be encoded into ASCII make crafting decent English syntax nearly impossible. Spam filters based on natural language processing could probably detect and flag them.

      If they were sending SPAM... which they aren't.

      Here, you missed my point. I was not implying that they were actually sending spam. The sentences they crafted are essentially identical to the kinds of sentences you see in spam. My point was that NLP techniques could be applied to flag these sentences just as they are with spam.

  30. You have... by slimjim8094 · · Score: 2, Funny

    You have
    a virus
    Didn't you know?
    You shouldn't be
    running Windows
    Burma Shave

    --
    I have developed a truly marvelous proof of this comment, which this signature is too narrow to contain.
  31. Hello, World! by nneonneo · · Score: 2, Insightful

    There is a major center of economic activity, such as Star Trek, including The Ed Sullivan Show. The former Soviet Union. International organization participation Asian Development Bank, established in the United States Drug Enforcement Administration, and the Palestinian territories, the International Telecommunication Union, the result of the collapse of large portions of the three provinces to have a syntax which can be found in the case of Canada and the UK, for the carriage of goods were no doubt first considered by the British, and the government, and the Soviet Union operated on the basis that they were the US Navys interpretation of the state to which he was subsequently influenced by the new government was established in 1951, when the new constitution approved it you King, he now had the higher than that the M.G.u, and soul shouters like Diane. There's a mama maggot including the major justifications that the test led to his own. This is usually prepared by the infection of the Sinai to the back and the Star Destroyers in the parliament, by the speed of these books and the revival of environmental problems of their new Arab states of the Arctic as a more and they possess power to the effort she was especially valuable as the Union and that would have said, as to note that the goods, which the night that if ever I rode after the word Father upon His Church to claim that the peace that had permitted him the city are as a hand of one into I thought of Mr. Crow and the Jews by the days of the C.Cs front garden which had first to St Cyriacus. All of a theology in the setting in a human heart as the tale of this day. I have it to friendship and the States that the way the English of the St Lawrence seven miles of an adjutant...

    Now, would you have guessed that this is executable machine code (shellcode)? Honestly, it looks more like the garbage that spammers use to defeat statistical analysis (indeed, this is code generated with a similar goal).

    (P.S. this particular sample is merely an amalgamation of the code which was reproduced in the paper; it is not complete, and will therefore not execute).

  32. Re:In other news...BAN THE PARENT by hairyfeet · · Score: 2, Funny

    yeah no shit. You think he'd at least offer us Counterfeit CPUs or dodgy RAM or something. If you are gonna spam then spam correctly. It is as bad as showing nerds a bunch of ads for jock products and tampons. Total waste of spam if you ask me.

    --
    ACs don't waste your time replying, your posts are never seen by me.
  33. Re:In other news... by Anonymous Coward · · Score: 2, Insightful

    Dude, you're wrong. Let it go.

  34. Re:Confused by Ungrounded+Lightning · · Score: 4, Informative

    TFA uses the security community's special term "(a) shellcode", which means something other than what it sounds like to ordinary programmers.

    "A shellcode" is the infection head of an exploit - the thing you try to get to run on the target to make the rest of the exploit work. It's in the machine language of the target, not a shell language.

    It's called "a shellcode" because it typically (but not necessarily) tries to sucker the system into launching a shell to run the rest of the exploit. The rest of the exploit may be in a shell language (depending on the shell to interpret it), a machine language executable, etc. Or "the shellcode" may do something else than launch a shell.

    This is one of the latter cases. It's a chunk of self-modifying code (due to the limits of what instructions you can get out of English-looking text) that bootstraps its own internals into something that can act as an interpreter (or other executor) for the rest of the English-looking exploit code, then runs though that code and "makes it happen".

    You can think of it as a binary executable program that depends on self-modification to get away with consisting only of combinations of bytes that look enough like English to fool spam filters which are trying to recognize executable code.

    So it's a very goofy binary and there are no shells or shell languages involved. Instead (if I read this right) the researchers built a very screwy assembler that takes as input an assembler source program and produces as output some VERY screwy machine code that looks like English and ends up doing the same job in a roundabout way, rather than being the direct translation of the assembler code input.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  35. Re:In other news...BAN THE PARENT by Falconhell · · Score: 2, Interesting

    It hope none of you are thinking of subscribing coolforsale's email address zminring@gmail.com to a lot of spam lists.

    That would be very wrong.

    Very very wrong.

  36. Re:In other news... by rnturn · · Score: 2, Interesting

    "the compiled binary data that can be run raw on an x86 processor -- looks like English text."

    I had brought something like this up during an after-work, Friday night beer session back in the late '80s when a co-worker mentioned the odd snippets of text that one would see while examining programs using the debugger. (No... we weren't talking about strings of text defined in the source code.) I wondered whether it was possible to come up with a program whose machine code formed English text that actually performed a useful function; like some bizaare entry in an Obfuscated Assembly Language contest. Looks like it was possible though I still am not sure that malware actually meets my definition of "useful". Eye of the beholder, I guess.

    --
    CUR ALLOC 20195.....5804M
  37. Re:In other news... by TheLink · · Score: 2, Interesting

    There's a difference, an assembly language representative of a machine code program doesn't normally execute on the target machine. It has to be "assembled" to the object code before it can be executed.

    What these bunch have done is created a program that "massages" (which could include expanding and alteration) source machine code to a new arrangement of _machine_code_ that can execute on the target as is. That new arrangement happens to resemble English text (in a computer format).

    It's only an assembler if you're thinking of machine code as the "assembly language" and the "english looking" machine code as the assembled object code.

    But that's stretching things a lot. Like saying you've actually been right all along, that is if wrong is right. ;)

    --
  38. This is far more interesting! by Terje+Mathisen · · Score: 4, Interesting

    I for one is very impressed by what they've done, even if it is somewhat similar to what I did nearly 15 years ago:

    At that time I wrote what's probably the "best" executable text encoder for MsDos, it uses the absolute minimum possible amount of self-modification (a single 2-byte Jcc opcode) while staying entirely within the MIME text character set, and survives all the most usual forms of reformatting/reflowing of the text. (Replacing CRLF with a single CR (Mac) or LF (unix) or turning each paragraph into a single line.)

    The initial bootstrap looks like this:

    ZRYPQIQDYLRQRQRRAQX,2,NPPa,R0Gc,.0Gd,PPu.F2,QX=0+r+E=0=tG0-Ju E=
    EE(-(-GNEEEEEEEEEEEEEEEF 5BBEEYQEEEE=DU.COM=======(c)TMathisen95

    (The uppercase 'E's are my NOP fillers, they execute as INC BP, a register I don't use.)

    Terje

    PS. Unlike the current guys, I wrote the code above by hand, on paper, during the evenings of a ski vacation. I had brought with me a listing of the ascii encoding of all instructions that would use MIME characters only. :-)

    --
    "almost all programming can be viewed as an exercise in caching"
    1. Re:This is far more interesting! by coinreturn · · Score: 2, Informative

      Yeah, but yours doesn't look like English; theirs does.

    2. Re:This is far more interesting! by Terje+Mathisen · · Score: 3, Interesting

      I know, and that's exactly what's makes it so interesting:

      They have effectively defined a small subset of the entire instruction set while allowing all other instructions that doesn't produce a side effect which would crash their "real" code.

      Terje

      --
      "almost all programming can be viewed as an exercise in caching"
  39. Re:In other news...BAN THE PARENT by Hurricane78 · · Score: 2, Interesting

    Isn’t this why CAPTCHA was invented?

    I mean just add captchas an a place where is slows him down too much for spamming to still make sense.

    And freakin’ use reCAPTCHA, if you don’t want to get laughed at! ^^

    --
    Any sufficiently advanced intelligence is indistinguishable from stupidity.
  40. English Shell Code...? by kirill.s · · Score: 2, Funny

    unzip; strip; touch; finger; grep; mount; fsck; more; yes; fsck; fsck; fsck; umount; sleep;

  41. HP had it in 1986 by Anonymous Coward · · Score: 3, Interesting

    I think this is interesting, but hardly break-through.

    In the mid 80's, we did the same thing at a field Hewlett-Packard office, although not aimed at viruses. Our target was to enable users to key in x86 code in text form. In other words, sit down at a PC, open EDLIN (the DOS equivalent of Notepad), or some simple text editor, and key in human readable words (i.e. meaningful text that humans - HP Engineers - could easily transcribe from paper or a phone call). Then save the file as a .com file (which was a DOS executable), and then run it.

    Think back to the days of stand-alone PC's, no USB, etc. If the field engineer was at a customer site, and needed to run a small diagnostic program on the PC, but didn't have the tool, then they'd simply call the office, and have the secretary ("coordinator") read them the human-readable sentences to key in. The engineer keys it in, and launches a diagnostic program. Our version even had a check-sum built into the words, so as long as you got the first few sentences exactly right (which were the boot part), then the rest of the "code" (sentences) were examined for check-sums, and would generate a location-specific error (e.g. "Checksum error in the sentence 'Many frightened capsules trigger captain mole".)

    I remember this well, because I wrote the boot part, and the checksum algorithm. I made it fairly resilient to normal human typing habits (i.e. don't worry about capitalization, multiple spaces between words, apostrophes, etc). And I tried to choose some easy sentences (manually) for the boot part, since that had to be entered exactly right each time.

    The system was made up of a "compiler" which would take a simple .com file (that is, an executable file, not a dot-com website), and convert it to "sentences" (which made little sense). We used a spelling dictionary English words, removing homonyms, as we wanted the words to be "read aloud". We tried to compile into short sentences of specific noun-phrase / verb-phrase formats, but they rarely made any sense. Some were outright silly, like: "The crazed orange melts to school."

    It worked great! But it was only practical for very short utilities. Still, it was FAR easier to key in sentences of nonsense, rather than hex code. Our experience was that a typical engineer could key in nonsense sentences about 5 times faster than hex code (even considering that the words had to have extra boot code to analyze the text), although the results varied depending on the length of the overall program.

    Then networks came along and rendered it fairly useless.

  42. Thanks by turgid · · Score: 3, Informative

    What is "shell code" supposed to be? Bourne shell scripts?

    Someone had to ask it!

    From the wikipedia: In computer security, a shellcode is a small piece of code used as the payload in the exploitation of a software vulnerability. It is called "shellcode" because it typically starts a command shell from which the attacker can control the compromised machine. Shellcode is commonly written in machine code, but any piece of code that performs a similar task can be called shellcode. Because the function of a payload is not limited to merely spawning a shell, some have suggested that the name shellcode is insufficient.[1] However, attempts at replacing the term have not gained wide acceptance.

    So it's a poor piece of new terminology that has stuck, unfortunately.

  43. Interesting work by Stan+Vassilev · · Score: 2, Insightful

    But I'd venture a guess it's far easier to hide such code in the noise of an innocent looking image.

  44. Re:Why run the code? by Gleapsite · · Score: 2, Interesting

    Its a stenographic method. It requires some executing code (malware, software vunerability, w/e) to jump to the ASCII text and begin executing it. Its like camouflaging the battering ram to look like the countryside. You still need someone on the inside to lower the drawbridge.

    --
    face the world with eyes of fire.
  45. Too bad IBM went with the 8088 by Megane · · Score: 2, Interesting

    This sort of shellcode is probably a bit harder to write for the 68000, with its 16-bit instructions that have an "operand mode" field that spans between the two bytes. While a lot of useful instructions are in the 2xxx-7xxx range, and branches are in the 6xxx range, the instructions that do any sort of math are outside it.

    It would be interesting to see what can be done with other CPUs as well. In particular, I recall that OS X PPC missed a chance to resist shellcode by ignoring two of the four bytes of the OS trap instruction, rather than forcing them to be nulls.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }