News for hackers. Stuff that matters.
Re:Pwn2Own results for Wednesday (Day One) by SiVal on Friday March 14, 2014 @03:56PM (#7401383)
It appears that most of these attacks relied on exploiting the unfortunate design of C, which makes manual memory management the default and safe, managed memory the special case. It should be the reverse. Speed will always matter, but you don't have to use risky, manual memory mgt everywhere to get speed; you just need it in the few spots where it makes a difference.

In the majority of places in your code, manual memory management gives you no benefit but does expose you to a possible vulnerability if you make a mistake. If the default, lazy option were to let the well-tested runtime do the job for you, yet you could do a little extra work and get manual override wherever you wanted, and manual override everywhere brought you essentially back to C, I think we would have much safer code without a noticeable loss of performance.

Edit: I just realized in the shower that I was saying "memory management" when I meant direct "memory manipulation" more generally. I'm including arrays accessed by memory address rather than by bounds-checked index, pointer arithmetic, etc., not just malloc and free.

Re:Pwn2Own results for Wednesday (Day One) by pcwalton on Friday March 14, 2014 @04:12PM (#7401500)
> It appears that most of these attacks relied on exploiting the unfortunate design of C, which makes manual memory management the default and safe, managed memory the special case. It should be the reverse. Speed will always matter, but you don't have to use risky, manual memory mgt everywhere to get speed; you just need it in the few spots where it makes a difference.

That's true, but I would claim something even stronger. Getting safety doesn't mean giving up manual memory management, as Rust shows (disclaimer: I work on Rust). You just have to need to have a language or system that enforces that you use safe manually-managed idioms. The idea that safety requires giving up performance (e.g. opting into a garbage collector, or even a runtime) is not true in most cases. In a properly designed system, safety doesn't even require opting into a runtime.

Re:Pwn2Own results for Wednesday (Day One) by SiVal on Friday March 14, 2014 @04:29PM (#7401612)
Would Firefox be better (more secure and with no performance handicap) if written in Rust? I realize that there is an enormous amount of existing code that shouldn't be thrown away, but if Mozilla wanted to create a browser from scratch today (or in a couple of years, when Rust has been debugged and polished), would they write it in Rust?
Re:Pwn2Own results for Wednesday (Day One) by letney on Friday March 14, 2014 @04:48PM (#7401760)
Re:Pwn2Own results for Wednesday (Day One) by hershel on Friday March 14, 2014 @04:53PM (#7401792)
Pcwalton, do you guys at mozilla think servo could be foolproof against sandbox escapes, or that this is a bit unrealistic ?
Re:Pwn2Own results for Wednesday (Day One) by pcwalton on Friday March 14, 2014 @04:55PM (#7401806)
There's no such thing as "foolproof against sandbox escape" without proving a sandbox, as well as all it depends on, correct. But I believe that memory safety is a security advance.
Re:Pwn2Own results for Wednesday (Day One) by Someone on Saturday March 15, 2014 @04:17AM (#7404012)
Your edit almost made me eat my comment, but I will go further: there's nothing risky about manual memory management, as long as the compiler and/or runtime prohibit you from accessing memory you didn't allocate, adding null pointer and boundary checks (which may need runtime support to get the size of an allocated memory block) where the compiler cannot guarantee that you only access memory you allocated.

The reverse situation, garbage-collecting systems that do nothing to prevent you from dereferencing null pointers or going out of bounds, is just as dangerous as C.

Re:Pwn2Own results for Wednesday (Day One) by gioi on Friday March 14, 2014 @03:59PM (#7401418)
Mozilla's Rust & Servo go exactly in this direction, thankfully.
Re:Pwn2Own results for Wednesday (Day One) by conorh on Friday March 14, 2014 @03:50PM (#7401325)
Looks like day 2 happened already and had some pretty good exploits:

http://www.pwn2own.com/2014/03/pwn2own-results-thursday-day-...

Re:Pwn2Own results for Wednesday (Day One) by gioi on Friday March 14, 2014 @03:59PM (#7401411)
Re:Pwn2Own results for Wednesday (Day One) by rwg on Friday March 14, 2014 @02:43PM (#7400910)
At Pwn4Fun, Google delivered a very impressive exploit against Apple Safari launching Calculator as root on Mac OS X.

I'll bet it was ocspd they exploited. The CRL handling code in libsecurity is awful, and ocspd runs as root without a sandbox profile.

Re:Pwn2Own results for Wednesday (Day One) by bfish510 on Friday March 14, 2014 @03:29PM (#7401191)
How can you tell if a process runs as root or is run within a sandbox?
Re:Pwn2Own results for Wednesday (Day One) by rwg on Friday March 14, 2014 @04:21PM (#7401555)
"ps" will show the effective uid ocspd is running as:

    % ps aux|grep ocspd
    root              534   0.0  0.0  2442712   2036   ??  Ss    3:53PM   0:00.04 /usr/sbin/ocspd
I don't know how to show the sandbox a running process is contained in, but it's easy enough to show that launchd runs ocspd directly, without sandbox-exec:

    % grep -A3 ProgramArguments /System/Library/LaunchDaemons/com.apple.ocspd.plist
            <key>ProgramArguments</key>
            <array>
                    <string>/usr/sbin/ocspd</string>
            </array>
It's possible for a process to programmatically place itself in a sandbox (see /usr/include/sandbox.h), but a quick look at the source to ocspd and a quick disassembly of what actually ships with OS X 10.9.2 shows ocspd does not do that.
Re:Pwn2Own results for Wednesday (Day One) by yukichan on Friday March 14, 2014 @04:00PM (#7401426)
On a mac Activity Monitor will show you that, also there are also things like top, ps aux and pgrep. These would work:

pgrep -lf -U root | grep processname

or:

ps aux | grep root | grep processname

Re:Pwn2Own results for Wednesday (Day One) by sitkack on Friday March 14, 2014 @05:09PM (#7401896)
What this shows is that if you are using a machine connected to the internet, assume you have been rooted. If you are paranoid, do all of your surfing in a VM over Tor and reset that VM state after every launch.
Re:Pwn2Own results for Wednesday (Day One) by Ellipsis753 on Friday March 14, 2014 @06:31PM (#7402442)
Good idea but there's quite a lot of exploits in virtual machines that let them infect the host machine too. :P So it's really pretty hard to stay safe. You could always run your OS from a read-only CD? At least you'd be none-infected on each reboot.
Re:Pwn2Own results for Wednesday (Day One) by ChuckMcM on Friday March 14, 2014 @07:18PM (#7402664)
My favorite is you run the browser on a different machine and you place a webcam near it that you can visit on your primary machine. Sending keystrokes and mouse moves to the browser machine using an infrared laser to create a unidirectional serial link to the machine.

Air gap AND lasers, how cool is that?

Re:Pwn2Own results for Wednesday (Day One) by sitkack on Saturday March 15, 2014 @02:24PM (#7405582)
I have a more doable sketch of this, running in a guest account on a raspberry pi over xvnc. Laptop is firewalled from net, raspberry pi is booted from read only media. Would need hardware ethernet firewall between laptop and raspberry pi to only allow VNC traffic.
Re:Pwn2Own results for Wednesday (Day One) by Ellipsis753 on Saturday March 15, 2014 @10:03AM (#7404654)
I like this idea.

I guess you might get away with just sshing to a machine if you could secure that.

Re:Pwn2Own results for Wednesday (Day One) by M2Ys4U on Saturday March 15, 2014 @04:47AM (#7404066)
Tails[0] would be a good candidate for this.

[0] https://tails.boum.org/

Re:Pwn2Own results for Wednesday (Day One) by mikeash on Friday March 14, 2014 @06:59PM (#7402581)
Until someone infects your BIOS, anyway.