8 ms·
Undocumented x86 instructions to control the CPU at the microarchitecture level [pdf]
- Chilinot 5y agoInteresting, the conclusion only speculates that this can have security consequences. Anyone with better understanding that could provide an example of what would be possible to do using these instructions?
- dmitrygr 5y agoanything! if you can get them to execute. the authors found one way to enable them, but others may exist (we do not know). maybe another secret instruction enables these also. we do not know.
- d3k 5y agoIt should be possible to see if a given "secure" binary makes use of a given microcode instruction. If that is the case, it could be possible to use udbgrd/udbgwr to modify the microcode instruction to do something else, e.g. to store some register data in the URAM or the SRAM. By doing this you should be able to "spy" the data the "secure" binary is processing.
- TeeMassive 5y agohttps://www.youtube.com/watch?v=_eSAF_qT_FY https://www.youtube.com/watch?v=_eSAF_qT_FY
- babesh 5y agoShould we be able to scan binaries for these instructions? I guess an exploit should be able to call these instructions.
- duskwuff 5y agoThese instructions only work if the CPU is in a particular, unusual state ("Red Unlocked"); even then, they require a value to be written to a MSR, which is a privileged operation. It's highly unlikely that there is any way to activate this functionality from userspace. Indeed, it's not clear that it's possible to activate without physical intervention (e.g. JTAG access).
- ipython 5y agoBut in the paper they explicitly test the possibility that the undocumented instructions could be speculatively executed and have visible side effects. They found that the instructions are actually executed, but they couldn’t jump to arbitrary microcode (a side effect of one of the undocumented instructions) because of a single lfence ucode op. They proved that at least on the atom processor they could unlock, the speculative execution of the undocumented instruction calculated an offset and placed it in internal registers even though the instruction was executed from the “green” (normal) operating mode.
- dmitrygr 5y agono way - x86 has no instruction alignment requirements, so the same bytes could be an immediate in some innocuous instruction. Also the same bytes can be run two ways in x86 and this is sometimes used. Plus, code can be created dynamically on almost all platforms except iOS. so in short: no
- CalChris 5y agoThat would help but self modifying code after a stack smash could still JIT them.
- ori_b 5y agoKeep in mind: in a variable length instruction set like x86, you can jump into the middle of an instruction, and have it interpreted as another instruction. If you have mov $0x123, %r16 you can think of it as a sequence of bytes, which (oversimplified) encodes to something like: 0: $0xb8 # opcode for mov 1: $0x10 # destination register 2: $0x23 0x01 0x00 0x00 # constant if you jump to address 2, you're in the middle of your constant. If that constant happens to be a malicious opcode, you're screwed. So you can't just decode instructions starting from the program entry to find out if an opcode is trying to execute malicious code. You need to find all possible paths, including all computed jumps, to make that decision.
- im3w1l 5y agoI know that in the past legitimate programs did obfuscations like this for anti-piracy reasons. But do they still? Or can it nowadays be considered a red flag?
- nostrademons 5y agoThat's sounds like one of those tasks that's isomorphic to the halting problem. Replace the malicious opcode sequence with "HALT" and your static analyzer can determine whether an arbitrary program can halt, something known to be impossible.
- bqmjjx0kac 5y agoThe halting problem concerns deciding whether any program will halt. It's definitely possible to decide whether some programs will halt.
- justinjlynn 5y agoThis is a really good distinction to make - people use the halting problem as an excuse to avoid doing any sort of analysis because it can't work in general and give a fully definitive answer - but most analysis solutions don't need to be fully general or fully definitive in order to be valuable.
- sivizius 5y agoVery interesting, but irrelevant for most of us.
- thricegr8 5y agoIn case anybody doesn't feel comfortable downloading a PDF within the context of the title :) https://github.com/chip-red-pill/udbgInstr/blob/main/paper/undocumented_x86_insts_for_uarch_control.pdf https://github.com/chip-red-pill/udbgInstr/blob/main/paper/u...
- tinktank 5y agoHow do people find these instructions?
- 1-6 5y agoPerhaps someone accidentally left the doors open on the Atom CPU which allowed them to run a disassembler. "In mid-2020, our team managed to extract microcode for modern Atom processors that are based on the Goldmont microarchitecture. It became possible to do this on Atom Goldmont systems-on-chip (SoCs) due to an arbitrary code execution vulnerability in Intel CSME (Intel-SA-00086)."
- x0re4x 5y agoProbably using something like that: https://github.com/xoreaxeaxeax/sandsifter https://github.com/xoreaxeaxeax/sandsifter
- vsareto 5y agoyeah, it's cited in the paper: [4] C. Domas. Breaking the x86 ISA.https://www.blackhat.com/docs/us-17/thursday/us-17-Domas-Breaking-The-x86-Instruction-Set-wp.pdf https://www.blackhat.com/docs/us-17/thursday/us-17-Domas-Bre..., Jul. 2017.
- fart32 5y agoReminded me his cool setup: https://youtu.be/_eSAF_qT_FY?t=1972 https://youtu.be/_eSAF_qT_FY?t=1972
- sabas123 5y agoThey have been reverse engineering Atom for over half a decade (possibly longer) now.
- garaetjjte 5y agoSee also (2018, for old VIA cpu): https://i.blackhat.com/us-18/Thu-August-9/us-18-Domas-God-Mode-Unlocked-Hardware-Backdoors-In-x86-CPUs-wp.pdf https://i.blackhat.com/us-18/Thu-August-9/us-18-Domas-God-Mo...
- sabas123 5y agoExcept that these latest findings are actually undocumented instead of known debug instructions (albeit still technically impressive)
- dang 5y agoUndocumented x86 instructions to control the CPU at the microarchitecture level [pdf] - https://news.ycombinator.com/item?id=27764806 https://news.ycombinator.com/item?id=27764806 - July 2021 (27 comments)
- userbinator 5y ago(Intel maintains a database with passwords of all manufactured chips.) I find this... somewhat hard to believe, both because Intel's volumes are huge and it would mean something like the original Pentium III Processor Serial Number came back to haunt us. There was recently a leak of Intel internal information, but based on the contents of this article, it seems that was really mundane (schematics, etc. --- which any companies buying and using their chips would easily have access to) in relation to the true depth of the secrets that lie within these processors... part of me really wishes there was far more that got leaked, because besides the security aspect, and the despicable practice of companies hiding information on devices from their actual owners and locking them out, this stuff is just intensely curiosity-satiating. however, the existence of such instructions poses a security threat since there is publicly available PoC code [9] that can activate the Red Unlock mode on one of the modern Intel platforms. Security threat, or maybe path to freedom...? As an aside, the VAX microcode (and hardware schematics) can be easily found, for those interested in this stuff and looking for something less secretive.
- deleted 5y ago[deleted]
- hyperman1 5y agoEvery security threat is a path to freedom: Security means you have a treasure, an attacker and a defender. In this case, the treasure is data inside the processor, the attacker is the current owner, the defender is a vague group of hollywood, previous owners, intel, governements, etc... Freedom means the owner (laptop thief) can steal the data from the previous owner (victim). Freedom means the owner can steal movies from hollywood. Freedom means Linus could create an OS without the blessing of Microsoft, etc... The problem is it is everything or nothing. So if you're a victim of theft, you want security. If you're pirating, you want freedom. If you want to clone the DVD your toddler keeps watching and destroying, you also want freedom. If you want to fully use all capabilities of your device, you want freedom.
- necheffa 5y agoThis is an incredibly one dimensional view. There is "owner" in the sense of "who currently physically possesses it" and "owner" as in "rightfully, legally belonging to regardless of current physical location". Freedom in the OP context means we actually own the things we buy rather than existing in a total corporate oligarchy were we only ever lease the temporary right to use a product but never actually own it in the legal sense.