8 ms·
An introduction to reverse-engineering x86 microcode and writing it
- userbinator 9y agoThe paper itself is here, if you'd rather not sit through an hour-long video: http://syssec.rub.de/media/emma/veroeffentlichungen/2017/08/16/usenix17-microcode.pdf http://syssec.rub.de/media/emma/veroeffentlichungen/2017/08/... AMD microarchitecture exploration seems to have progressed quite a lot farther than Intel in general -- Google "9C5A203A" for some more interesting reading...
- white-flame 9y agoIt's just a 30 minute video at 2x play speed. :)
- quotemstr 9y agoI've always thought that it's a shame that CPU vendors haven't opened up microcode programming to the public. To extend a silly graphics metaphor: it's as if, right now, CPUs ran Vulkan, but we could only program them with Unity. As the speakers in this talk point out, open microcode would allow extending the CPU with brand-new capabilities, including not only high-performance instrumentation frameworks, but also, I think, nearly-free ASAN-like and CFG-like runtime safety checks. Is security a reason not to open the microcode architecture? I don't think so. I know this talk happened at CCC, but I don't see the security consequences of open microcode being severe: if you're in a position to install a microcode update, you've already won.* Backward compatibility? Sure. Microcode can change generation-to-generation, or even stepping-to-stepping. Public microcode programs would have to be written with the understanding that no stability is guaranteed. But you can still get a lot of useful work done that way --- for example, people write Linux kernel drivers all the time. Trade secrets? Eh. Does it really matter whether a processor has 32 or 64 internal temporary registers? I'm not sure what secrets proprietary microcode might protect against an adversary that has a dedicated chip design team and electron microscopes. So, yeah, this talk represents impressive work, but none of this work should be necessary. Then again, if wishes were horses, beggars would ride. We can't even get Intel to ship a processor without the damn management engine. * Granted, microcode backdoors have the virtue of being subtle and easy to hide. This paragraph doesn't apply if microcode updates let you break the processor's internal security model, but it sounds like, from the talk, that microcode obeys security invariants.
- jws 9y agoI wonder about robustness. Can the microcode physically destroy the CPU? Consider driving a bus line both high and low simultaneously from two sources. That puts transistors which ordinarily spurt out a little current to overcome capacitance into a continuous maximum current situation. Compared to maximum toggle rate in normal operation, (50% duty cycle for a transistor, exponentially decaying current when on), I’ll estimate this will easily average four times the current. The development cycle could be littered with dead processors, but worse for Intel, if a widely used microcode has a very infrequent chip stressing flaw it will manifest as “Intel chips aren’t reliable.”
- sannee 9y agoI don't think that tri-state logic is used in ICs anymore (?). EDIT: http://vswww.kaist.ac.kr/ENGLISH/old_lecture/ee878-2002/lecture/SoC_22-OCNetwork-1113.pdf http://vswww.kaist.ac.kr/ENGLISH/old_lecture/ee878-2002/lect... It probably does not imply that the chip is indestructible through microcode though.
- DavidBuchanan 9y agoHow do busses work without tri-state logic?
- vanjoe 9y agoArbitration and multiplexing
- marcosdumay 9y agoThat paper is about a different concept only loosely related to what DavidBuchanan seems to be talking about. Selecting a register through a tri-state based bus demands a circuit with a O(1) critical path. Selecting a register through a logical selector demands a circuit with O(log n) critical path, and a large constant factor.
- convolvatron 9y ago
- white-flame 9y agoGiven that the microscope inspection saw the individual bits in the microcode tables, I wonder how possible it would be to visually extract crypto keys baked into the processor for newer models. I doubt they'd be in a nice orderly addressed ROM area like this, but they still have to be hardcoded somewhere.
- madez 9y agoThere are techniques to prevent reading stored data in chips. Smartcards often have some of those protections.
- marcosdumay 9y agoGood luck protecting against offline reading with a microscope. The only defense is that this thing is expensive.
- userbinator 9y agoI wonder how possible it would be to visually extract crypto keys baked into the processor for newer models AFAIK the Intel ones use public-key encryption[1], so you would not really gain anything. They obviously thought of this. [1] http://inertiawar.com/microcode/ http://inertiawar.com/microcode/ - 2048-bit RSA too, so not really breakable in the near future either.
- solotronics 9y agoI wonder if there will be a point that machine learning algorithms can hack better than humans? Already they can play certain games and find solutions that seem alien to us. Perhaps this is already occuring?
- rft 9y agoAs was already pointed out, any protection scheme would most likely use asymetric crypto, so you can only dump the public key anyway. However there is a more pressing problem, that you would even have if symetric crypto was used: In order to extract the key you would need to know how it is encoded, which you only know once you know the plaintext of the microcode (which requires the encryption key to read the microcode updates). You run into a chicken-egg problem. Without the processor oracle, it would have been hard to impossible to start guessing the semantics of bitstrings. Also the physical ROM bits are not in the same order as the bits the CPU actually excutes during runtime. The mapping function is non trivial and we do not fully understand it yet. Finding this function required knowing what valid, plaintext microcode looks like so we could match the bitstrings from the ROM to it.
- madez 9y agoRecently here on Hacker News I had a short discussion with Steve Klabnik about JavaScript and WebAssembly among other things.[0] My point is that to execute randomly downloaded code is realistically impossible to secure, practically used to deliver malware and usually used against the interests of the user of the computer. If I can infer from Steve's stance the opinion of Mozilla, then it's sad to see that the only big browser developer organization I had hopes in simply waves these problems away and keeps on making JavaScript and WebAssembly more usable and widespread. It's disheartening to see that. The connection to this talk is that they demo triggering a backdoor hidden in microcode by executing some WebAssembly code in an up-to-date FireFox. [0] https://news.ycombinator.com/item?id=15981178 https://news.ycombinator.com/item?id=15981178
- legulere 9y ago> My point is that to execute randomly downloaded code is realistically impossible to secure This is absolutely not true if you have a MMU and something like a protection ring. In such an environment code by default can do nothing malicious. The only thing making it insecure in any way are the syscalls offered by the operating system.
- jcranmer 9y agoOn a von Neumann architecture, there is no actual distinction between code and data. Every CPU architecture in widespread use is a von Neumann architecture (GPUs, it should be noted generally aren't von Neumann). What this means is that loading data from unsecure, untrusted sources is potentially the same as executing code. In practice, this is actually very often the case--a buffer overflow trivially turns data into code. With that in mind, what realistically is possible to do, over than to declare that everything can only be read as plain text (and hope there's no exploitable bugs in font rendering of system fonts)?
- quotemstr 9y agoWhat is "code" anyway except instructions? The Harvard-Von-Neumann distinction is really a continuum. Even today's computers draw important distinctions between data and code: for example, we have separate data and instruction caches, and Linux has special caching behavior for PROT_EXEC pages. (The latter is an annoyance, BTW: there's no reason to treat Java bytecode, say, differently from PROT_EXEC pages. Executable protection should have nothing to do with active or inactive list membership.)
- rft 9y agoAuthor here, in case you have any questions.
- pfalcon 9y agoIf you can influence that, please make the PDF slides available on the CCC page. Thanks.
- stmw 9y agoThis is really excellent, thanks for sharing. So much remains hidden in today's x86 systems.