Re:QEMU: user-to-root privesc inside VM via bad translation ...
by tyingq on Wednesday March 22, 2017 @01:53AM
(#13928750)
"However, while real X86 processors have a maximum instruction length of 15 bytes, QEMU's instruction decoder for X86 does not place any limit on the instruction and length or the number of instruction prefixes."
Interesting, and not your usual type of exploit. Guessing this isn't one that will have the Rust crowd doling out "told ya so" :). Logic error only. No buffer overflow, not much strong types do for you, etc.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by quotemstr on Wednesday March 22, 2017 @03:01AM
(#13928970)
Well, look on the bright side: once we eliminate the boring old memory safety bugs, and the XSS, and the SQL injection, the exploits that remain will at least be interesting.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by hueving on Wednesday March 22, 2017 @05:11AM
(#13929463)
If you really wanted to fish for a "told ya so", someone could just point out that by eliminating all of those other classes of bugs, developers could have spent more time looking for logic errors.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by simion314 on Wednesday March 22, 2017 @09:17AM
(#13930629)
If a developer finishes his task he will be given a new task, I don't think you will get a task "go and review our code again for weird logic errors" you will be sent to add a new feature or fix a bug, so you will work on that and create a few new bugs.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by nullc on Wednesday March 22, 2017 @07:23AM
(#13930039)
I got that while trolling Rust developers a bit on this point, and had to concede-- it's a fair point.
I do think that rust doesn't (yet) have enough affordances for formal verification of algorithmic correctness-- but if you're not chasing memory safety you have more time to deal with other issues.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by pjmlp on Wednesday March 22, 2017 @04:30AM
(#13929311)
If we remove memory corruption errors, that it already one less class of errors to worry about.
As for the <whatever type safe systems programming language> crowd, these complaints have been done in the past by fairly unknown people like C. A. R. Hoare, Niklaus Wirth, James G. Mitchell, Alan Kay, Luca Cardelli,.... so what do they know about computers.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by thesz on Wednesday March 22, 2017 @09:18AM
(#13930631)
Range checking is done deal with sufficiently strong types (read - dependent types). It was done in the Epigram LONG time ago, ten years ago if not more.
For example, when you fetching bytes for decode you can type-check that you are in the quota and act accordingly.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by thesz on Wednesday March 22, 2017 @06:04PM
(#13935425)
No.
Working with two page quota (as QEMU dev intended) at type level won't allow you to pass through three page (as QEMU code allows and what is exploited).
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by pm215 on Wednesday March 22, 2017 @08:03AM
(#13930208)
It's the bit where it says 'is it used in conjunction with a hypervisor?'. That's how we define the use cases that count as defendable against malicious guests.
This covers more than just the TCG cpu emulation because it also means that any device model that can only be used with an emulated CPU is also out of scope for CVEs and hasn't been audited to confirm it has no VM-escape bugs. So the internal documentation of TCG itself isn't really the right place to document this I think.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by i336_ on Wednesday March 22, 2017 @10:15AM
(#13931043)
Hi, wanted to quickly ask a slightly offtopic question about TCG that I've wondered about for a few years. I was never sure who to ask.
Rob Landley made some small noises about the possibility of leveraging TCG as a successor to tcc (I read about the tinycc/tcc debacle (http://www.landley.net/code/tinycc/) - really sad). I was just curious if such an idea - turning QEMU's code generator into a standalone compiler - is technically feasible in terms of architectural sanity and practical maintainability.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by pm215 on Wednesday March 22, 2017 @11:18AM
(#13931599)
Well, I guess technically you could do it -- the codegen started out as code from tcc, after all. However we've made enough changes over the years that right now it has some specializations to QEMU's needs. Also questions like "is this optimization pass worthwhile" have definitely different answers for QEMU's JIT purposes compared to an actual compiler -- we care a lot more about codegen speed so there are some optimizations that we prototyped but abandoned because they didn't improve the runtime performance enough to make up for codegen getting slower.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by i336_ on Thursday March 23, 2017 @01:05AM
(#13937516)
I didn't actually know that TCG was built from tcc, interesting.
Leveraging TCG in its current JIT-optimized state could actually be very compelling though: the only "C interpreters" I'm aware of are PicoC and Ch (and pedantically, tcc -run), all very different codebases. None offer a JIT-optimizing C interpreter though.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by bonzini on Wednesday March 22, 2017 @05:52PM
(#13935346)
TCG used to have no optimizations at all, so the current ones shouldn't be worse than what tcc used to have... That said I have never looked at tcc's code generator.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by Confiks on Wednesday March 22, 2017 @01:54AM
(#13928756)
As the bug seems to rely on a maximum instruction length that is present in hardware x86 but not in QEMU's x86, the reach of this particular bug seems to be just the software emulated mode.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by Confiks on Wednesday March 22, 2017 @02:05AM
(#13928794)
It might be used for special applications, but not for your typical server that is connected to the internet, simply because it's horribly slow compared to the virtualization support (VT-x / AMD-V) most modern CPUs offer since at least 2010.
Re:QEMU: user-to-root privesc inside VM via bad translation ...
by tomhoward on Wednesday March 22, 2017 @05:28AM
(#13929544)
Dang has addressed this matter several times in the past [1]. The dupe detector is 'deliberately porous' so good stories have multiple chances to get exposure.
Interesting, and not your usual type of exploit. Guessing this isn't one that will have the Rust crowd doling out "told ya so" :). Logic error only. No buffer overflow, not much strong types do for you, etc.
I do think that rust doesn't (yet) have enough affordances for formal verification of algorithmic correctness-- but if you're not chasing memory safety you have more time to deal with other issues.
As for the <whatever type safe systems programming language> crowd, these complaints have been done in the past by fairly unknown people like C. A. R. Hoare, Niklaus Wirth, James G. Mitchell, Alan Kay, Luca Cardelli,.... so what do they know about computers.
For example, when you fetching bytes for decode you can type-check that you are in the quota and act accordingly.
Working with two page quota (as QEMU dev intended) at type level won't allow you to pass through three page (as QEMU code allows and what is exploited).
I wonder what's the reach of that bug.
Is what you're saying here documented anywhere?
http://wiki.qemu-project.org/SecurityProcess#How_impact_and_...
It would be nice to warn about lack of security properties of TCG in some of these places: http://git.qemu-project.org/?p=qemu.git;a=blob_plain;f=tcg/R... http://wiki.qemu-project.org/Documentation/TCG
This covers more than just the TCG cpu emulation because it also means that any device model that can only be used with an emulated CPU is also out of scope for CVEs and hasn't been audited to confirm it has no VM-escape bugs. So the internal documentation of TCG itself isn't really the right place to document this I think.
Rob Landley made some small noises about the possibility of leveraging TCG as a successor to tcc (I read about the tinycc/tcc debacle (http://www.landley.net/code/tinycc/) - really sad). I was just curious if such an idea - turning QEMU's code generator into a standalone compiler - is technically feasible in terms of architectural sanity and practical maintainability.
Leveraging TCG in its current JIT-optimized state could actually be very compelling though: the only "C interpreters" I'm aware of are PicoC and Ch (and pedantically, tcc -run), all very different codebases. None offer a JIT-optimizing C interpreter though.
I take it that all that would be necessary would be ripping out the disassembler frontend and wiring in something like http://www.quut.com/c/ANSI-C-grammar-y.html + http://www.quut.com/c/ANSI-C-grammar-l-2011.html (or an equivalent), or maybe even a (heavily) forward-ported copy of tcc's C parser?
For example, I remember using qemu to emulate RPi with ARM software emulation on my x86 machine.
[1] https://hn.algolia.com/?query=dang%20porous&sort=byPopularit...