NULL Pointer Exploit Excites Researchers
Da Massive writes "Mark Dowd's paper "Application-Specific Attacks: Leveraging the ActionScript Virtual Machine" has alarmed researchers. It points out techniques that promise to open up a class of exploits and vulnerability research previously thought to be prohibitively difficult. Already, the small but growing group of Information Security experts who have had the chance to read and digest the contents of the paper are expressing an excited concern depending on how they are interpreting it. While the Flash vulnerability described in the paper[PDF] has been patched by Adobe, the presentation of a reliable exploit for NULL pointer dereferencing has the researchers who have read the paper fascinated. Thomas Ptacek has an explanation of Dowd's work, and Nathan McFeters at ZDNet is 'stunned by the technical details.'"
Memory corruption vulnerabilities can easily be exploited using application-specific attacks, ActionScript Virtual Machine is just the current opening.
So you CAN get something from nothing!
Summation 2
"...Not this time. Flash forgets to check that allocation failed, a ludicrously common error. It then uses that pointer with an offset controlled by the attacker. NULL isn't valid. NULL plus 1024 isn't valud. But NULL + 0x8f71ba90 is, as is NULL + N for any N that addresses valid memory.
...The net result of this silliness is that it's hard to do what attackers normally do with a write32 vulnerability, which is to clobber a function's address with a pointer back to their buffer, so that their shellcode is called when the clobbered function is called. So Dowd's exploit takes things in a different direction, and manipulates the ActionScript bytecode state.
To this address, controlled by attackers via wild offset, Flash writes a value that is also controlled by the attacker. This is the write32 pattern: a vulnerability that gives the attacker the means to set any one value in memory to a value of their choosing. Game over.
The exploit doesn't actually get to offset an arbitrary number of bytes from 0. A complicated set of conditions constrains the address it writes to and the value it gives it.
The the actual write occurs via a structure offset. Flash is hardcoded to translate your offset into another number. Working offsets, as it turns out, will be greater than 0x80000000, and will be evenly divisible by 12 after 4 is added to them. Note: I thought I was hardcore when I wrote shellcode with no lowercase letters for the IMAP vulnerability in the '90s.
That's not all. The value that Flash will write to the wild pointer isn't totally controlled by the attacker either. It's cast up from a 16 bit integer to a 32 bit integer, and has another variable subtracted to it. This is the point in the report that I started giggling uncontrollably, embarassing myself at the coffee shop...
To wit: his exploit must (because he's messing with us) corrupt the Flash runtime, rewrite it to execute his trojan, and leave it running steady as if nothing had happened. Meaning:
--His modification to the verifier can't break existing instructions. --His bytecode has to swap values into the stack instead of clobbering them directly. --Portions of his shellcode have to run as both Flash bytecode and an X86 first-stage shellcode boot.
Two fun details:
First, even though IE and Firefox use different Flash builds, the addressing inside them is compatible. The exploit works in both places.
Second, Flash isn't compiled with ASLR. So the attack works on Vista.
Mass casualty. Go Flash!"
Some years ago I had many binary proprietary blobs on my computer: SUN Java browser plugin (now OSS), Adobe Acrobat (don't need it any more, OSS alternatives are equal now), nVidia driver (still needed but solution is on the way -> looking forward to switch to ATI as soon as GPL drivers get there), MS media codecs (don't need it any more, Flash ate MS' streaming video pie). Now, only Flash player remains that I don't see replacement in OSS world in foreseeable future. Add to it security concerns, 64-bit version and it clearly becomes major PITA of Linux desktop users. Doesn't look it will change any time soon.
839*929
NULL to see here, move along to 0x80000001 please...
(book by Dowd, McDonald, Schuh) is well worth a look: http://taossa.com/index.php/author/mark/
"It doesn't cost enough, and it makes too much sense."
The exploit is cool as hell from any perspective. As for the flash VM with it's inconsistencies between the bytecode verifier and interpreter -- what the fuck is that about?
Web executables (flash, java, activex, silverlight) are a bad idea, we've all known this since the beginning. If the security industry didn't place self-interest above security, they'd have shot these dancing pigs long ago.
I'm pretty sure that this is the kind of exploit that David Levinson used back in 1996.
Any fool can talk, but it takes a wise man to listen.
FTA: "is not far off being cross platform "
Err , I'm sorry but how exactly do they expect x86 code to run on Sparc, or PA-RISC or PPC? etc etc. Even on the same architecture but a different OS all the interrupt vectors and API address calls will be different. Sounds like they're got a bit over excited to me. Or maybe I've missed some complex details of the exploit.
"Flash builds, the addressing inside them is compatible. The exploit works in both places."
So it can mess around with the browser. Unless it can successfully exploit system specific API calls as opposed to browser APIs (you know , stuff like fork(), rmdir() etc etc) then its only ever going to be platform specific. And I think we can guess which one that'll be. I don't think I'll be updating adobe on my linux box just yet.
The moral of the story is a point that many of us have already been making for years: check the return value of malloc. I've had lots of arguments over whether or not it's okay to omit that and let your program crash for the poor sap who hasn't got any heap left. Unfortuantely a common attitude is, "the program is screwed anyway at that point, so who cares?"
The fact that Flash is doing all of these bytecode things also of course makes it more interesting. The first article linked seems to suggest that that makes the exploit really difficult (probably true), but it sounds like it also made it... well... possible.
"NULL Pointer Exploit Excites Researchers". Wow, an error in a program. This seems akin to ground-breaking front-page news: a cat stuck in a tree rescued by firemen.
The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.
null pointer's are very common errors in software, but are extremely hard to exploit. It almost never happens. This is why it's interesting.
finally a decent opportunity to ask...
"does it run Linux?"
or in other words from TFA Win32 Firefox/IE prone to this technique, I'm assuming the code injection would only work on the target OS, no? I mean the CPU is specific, but also to work seamlessly you need to script it to to the target app. So it does not work on another processor (PPC etc) but also it would not work on any other application - so as the Linux binary is different then you are safe (until that one is attacked, but part of the security of Linux relies on the smaller audience is not so attractive a target). But what if it worked on a Win32 DLL that was being emulated under Linux such as some of the codecs? Any thoughts? correct me!
And, just out of curiosity, I'm kinda wondering how long it took Mark to work this one out.
The stuff we geeks get excited about... *sigh* We're hopeless, aren't we?
Insert witty comment here
...you'll need a little Viagra first.
Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
Thankfully the flashblock addon was just updated to support firefox 3 beta 5. Since I only allow flash to run from a few sites, I'm not worried about any such exploit.
I've been a big fan of flashblock, ever since realizing that most flash developers assume 100% volume is mid range, and I assume 50%, and every flash website without volume controls rips through my ears like a buzzsaw.
First of all, this isn't just a null pointer exploit. Sure, it's a complicated and quite impressive exploit, but it isn't going to open the floodgate to new exploits. This may lead to some deeper analysis of potential flaws by researchers, but in all likelihood, any exploit will be too complex for much practical use.
Also, this is in no small part due to questionable code in Flash. Reading the article, it seems there are at least FOUR places in the code that have mistakes, and each one of them should jump out at the developer and scream I AM A POTENTIAL VULNERABILITY! The fact that they got exploited just means that crappy software is exploitable, but hey, we already knew that, right?
Null derefs still are not exploitable and will continue to be not exploitable.
null pointers exploiting excited researchers? it all sounds a little goatse to me...
You might need to dumb this down a shade for me, but from what I (think I) understand of it, it sounds like 0x8000000 is used as a kind of internal salt during bytecode compilation/execution for structure offsets so that the unchecked user code can't arbitrarily access structures?
If so... why would they do that? Why not simply ensure that offsets can't go above, say, 0xffff, and then make sure program code/data is well above that?
That's all
The paper specifically talks about the ActionScript virtual machine, i.e. the Flash player VM. There is nothing in there about Java. Why the Java icon? Why the Java tag?
When it comes a day after this flamebait article you have to start to wonder if the Slashdot editors are busy with some massive FUD campaign against Sun or if they are just really ignorant.
Being bitter is drinking poison and hoping someone else will die
How on Earth this is Java related and tagged with 'java' keyword?
Comment removed based on user account deletion
Wake me when something new happens.
Seriously, who in this day and age doesn't check the return codes of library routines when writing software that will be deployed on millions of computers?
...you'll need a pointer first.
Comment removed based on user account deletion
explain this event in terms that a person with a sex life not involving the Internet could understand?
"And now, Frank N. Furter, your time has come. Say 'goodbye' to all of this, and 'hello'... to oblivion!"
NULL is the name of a macro in C. Null is the name of the value which it (and the integral constant 0) put into a pointer; it's a regular noun with no capital letters (except when at the beginning of a sentence, of course).
Null is a four letter void.
"My country, right or wrong; if right, to be kept right; and if wrong, to be set right." --Senator Carl Schurz (1872)
Plugins Tab
:)
Switch on Forbid Macromedia Flash
Switch on Apply these restrictions to trusted sites too
Click OK.
Say goodbye to YouTube
I read this two days ago at the source that broke the news. I have two things to say:
- Dowd's a freaking genius.
- Slashdot's a slowpoke.
Rudd-O - http://rudd-o.com/
Is it just a coincidence that the daily Dilbert cartoon has gone Flash-only today?
I have never liked Flash, mainly because it was used as a distracting and irritating advertisement medium, but also because of the arrogant assumption that the Flash page author should be in control of what my machine does. I don't want my browsing experience reduced to some funereal pace at the whim of a marketing drone who thinks his tedious animation should occupy my time.
I was reconsidering my decision to give up reading Dilbert because of the switch to Flash, but now that I have read about this exploit I think I will stick to my No-Flash policy.
Yes I know, this exploit has been fixed in some version of Flash to which I may have upgraded but what about the next one?
One thing that is overlooked. They include the arbitrary code in the flash file and then use this exploit to run it. If you've got no-execute enabled for data and stack, this will crash and not do anything.
Anything involving misbehaving NULLs excites old LISP programmers.
Isn't this a very easily patchable problem? So malloc's that exceed physical memory should just be blocked, readdresssed or return something other than NULL. No?
What's ironic is that this exploit DOESN'T crash the browser! That's the whole ever-fuckin point.
...oh, hell...nevermind
A browser crash is what's SUPPOSED to happen here to prevent the exploit from deploying its payload. I mean, in this case, a crash is the DESIRED behavior. An uncaught exception should be thrown.
So... just walk with me here... maybe Windows isn't just unreliable and unstable. MAYBE it's the most secure application stack ever devised.
Segmentation Fault (core dumped)
Comment removed based on user account deletion
Attitudes like yours are the reason people keep getting owned. There tons of ways to get around NX. You could do the pwn to own thing and use something like Java to allocate an executable range. Or you can use a return to libc style attack. There's so much crap running in a browser that you have nothing but options.
The original article already has Russian trackbacks on it.
In Soviet Russia, trackback adds article to you.
promoting silverlight with security stuf... confirm/deny?
Cute. Read the actual paper from IBM, not the blogodreck. The same attack works on IE and Firefox, on XP and Vista. An attack for Firefox on Linux is probably possible.
This is easy to fix; it's a one line bug in Flash. But it will take years to replace all the bad versions of Flash out there.
What kind of title is that?
Swedish?
This is a Flash plugin problem, not java problem.
Why on earth is it under Java section and with Java tag?
--Coder
A program (flash player) allows to write to an uncheked addres, that's all. Add a simple check, and the problem is gone. It's the end of the world as we know-it?
What's in a sig?
In a "different" world, the default behavior for a failed system API call would cause the operating system to terminate the application. To override this behavior, the application author would have to explicitly tell the system API that it would handle the error condition.
The current method rewards the programmer for not adding the additional required code to handle an error. The reward is a simple, runnable, program, but one that contains a hidden time bomb just waiting for the right error condition.
The exception (catch/try) model is another way to handle these types of errors, if the system APIs would throw the exceptions.
The problem however that the cat is out of the bag so to speak. The major systems out there (Windows, Unix, Linux) have been built with a basic assumption that coders are performing due diligence by programming defensively.
Most of the patches I see popping up in Ubuntu's update notifier seem to involve buffer overflows. Now there is this exploit because someone didn't check a pointer (failed malloc()/new/etc?).
When I taught CS, back when dinosaurs ruled the earth, I would have given a homework assignment with anything like that a D or an F.
I mean WTF, fast forward a few eons and people are still writing code like this??? What do we have to do - shoot them???
A programmer not checking for a null pointer return or a buffer overflow is the equivalent of... geez, I don't know... a surgeon forgetting to wash his hands before operating?
The tyrant will always find a pretext for his tyranny - Aesop
First, I don't think anyone seriously considers that Silverlight is *probably* more secure than flash - just people have had less time to analyze it for exploits. Though, it is possible, I suppose, that it might be more secure.
Second, *even* if we allowed the hypothesis, for argument's sake, that Microsoft is acting to promote public awareness of this problem to promote it's own agenda, so what? Either this bug/exploit exists, or it doesn't exist, and it doesn't make it any more true or false just because Microsoft happens to be helping the problem to get attention (not that I am agreeing that is the case). If Microsoft *is* publicizing this, great - the more people that are aware of this, the more that will, hopefully, upgrade to a patched version of Flash and avoid getting Pwned.
"A programmer not checking for a null pointer return or a buffer overflow is the equivalent of... geez, I don't know... a surgeon forgetting to wash his hands before operating?"
Sorry but that conjures up a picture of Dilbert's PHB: "I'm giving you an under-performer rating on your last project Dilbert. I shouldn't have to hire someone to test your work.".
The biggest overflow culprit is probably strcpy() or a similar library function. Most proprietary and open source application code I have seen over the last couple of decades do not explicitly check buffer lengths before calling strcpy, etc. What most applications do (if anything) is focus on input validation and then blindly throw the validated data at library calls or lower level parts of the application code. What you were asking the students to do is act like every bit of code is paranoid interface or library code but the vast bulk of code out there is not written that way, nor should it be.
Writing and to a lesser extent using library code is always a trade off between saftey, speed, and the number of hours in a day. This is why writing a general purpose library/interface that adds something usefull to the art or science is difficult for vetrans let alone students.
I also taught programming to 1st and 2nd year CS students in the early 90's, in my experience many students found it difficult to fully grasp the concept of pointers even after two years with several different explainations from different presenters using different programming languages. Asking them to write bullet proof (sloth like) code is a waste of time. Sure, make them aware of defensive programing techniques, work it into assignments and award points it. However in an educational setting, well commeted and readable code that makes a decent attempt at the assigned problem and it's constraints is far more important than passing the keyboard bashing test and grades should reflect that.
And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
Using Opera, disable plugins and flash will not run at all. Then you can edit site preferences and add only plugins for specific sites, such as youtube and google video.
:-)
PS. I'm biased. I work at Opera, but what I said is still true
Sorry but you are not part of the solution, you are part of the problem.
Having code testers is no excuse for the original programmer being sloppy.
What most applications do (if anything) is focus on input validation and then blindly throw the validated data at library calls or lower level parts of the application code.
Which you appear to endorse. And which is also the cause of the many buffer overflow bugs, exploits and fixes thereof.
What you were asking the students to do is...
What I was asking the students, and any programmer, to do is this: do not copy a block of memory to another block of memory unless you know the destination block is large enough to contain the data you are copying.
Anyone who does not get why that is necessary should not be allowed near a computer.
Asking them to write bullet proof (sloth like) code is a waste of time.
Claiming that code that doesn't make unsustainable assumptions is "sloth like" is just a straw man, and a rather tired one at that. It doesn't deserve to be taken seriously, and so I won't.
"well commeted and readable code that makes a decent attempt at the assigned problem and it's constraints is far more important than passing..."
Ummmm no. There is your problem right there - looking pretty is not more important than working properly.
and grades should reflect that.
What makes you think their grades didn't reflect "commenting and readable" as well as correctness? Sorry but in software, just as in horseshoes, "close" doesn't count. And one programmer spending one extra hour to make sure that 1,000 users don't each spend an hour dealing with a bug is a good investment by any sane standard.
"two years with several different explanations from different presenters using different programming languagesIf after all that students didn't fully understand pointers then I suspect there is a more serious problem at the institution. The only thing necessary to get students to understand pointers is to teach them assembler for an architecture with indirect addressing, i.e. almost any modern cpu. Period. End of story.
Here's an exercise for you:
Until understood;Repeat
The tyrant will always find a pretext for his tyranny - Aesop
To emphasis my point you orinally wrote "A programmer not checking for a null pointer return or a buffer overflow is the equivalent of... geez, I don't know... a surgeon forgetting to wash his hands before operating?" To which I basically relpied that checking usually only needs to occur when talking input from outside your app and that a common and trivial mistake made by proffesionals is no justification for failing a student.
Not that someone like you would have made a mistike in your original statement but now you are telling me it means something different to what it actually says (ie: it now means "Do not copy a block of memory to another block of memory unless you know the destination block is large enough to contain the data you are copying.")
"Having code testers is no excuse for the original programmer being sloppy."
Never said it was, but in the real world as compared to your ivory tower only an idiot trusts a team of programmers to get everything right the first time. Take a look at the bug list for any major application, crappy apps don't have such lists (Hint: Absense of a bug list does not imply the programmer 'got it right').
Now here's a looping exercise for you:
Say: "In the real world people are expected to make mistakes despite their best efforts, teachers are not employed to act as a lint program." - until it bores through your ridgid ideology and the contorted logic you use to keep it alive.
And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.