Dissecting QNX

Dissecting QNX

Dissecting QNX Jos Wetzels1,2,3, Ali Abbasi3,4 1Midnight Blue 2Eindhoven University of Technology (TU/e) 3University of Twente (UT) 4Ruhr-University Bochum (RUB) his work concerns a dissection of QNX: a pro- addition, it is deployed in highly sensitive embedded prietary, real-time operating system aimed systems such as industrial automation PLCs, medical T at the embedded market. QNX is used in devices, building management systems, railway many sensitive and critical devices in different in- safety equipment, Unmanned Aerial Vehicles (UAVs), dustry verticals and while some prior security re- anti-tank weapons guidance systems, the Harris search has discussed QNX, mainly as a byproduct Falcon III military radios, Caterpillar mining control of BlackBerry mobile research, there is no prior systems, General Electric turbine control systems and work on QNX exploit mitigations and secure ran- Westinghouse and AECL nuclear powerplants. dom number generators. In this work, carried out as part of the master’s thesis of the first author, we The interest of high-profile actors in QNX-based present the first reverse-engineering and analysis systems is evidenced by a series of documents from of the exploit mitigations, secure random number the United States Central Intelligence Agency (CIA) generators and memory management internals of obtained and released by WikiLeaks under the name QNX versions up to and including QNX 6.6 and the ’Vault 7’. These documents show an interest on part brand new 64-bit QNX 7.0 released in March 2017. of the CIA’s Embedded Development Branch (EDB) of We uncover a variety of design issues and vulnera- the Engineering Development Group (EDG) (which bilities which have significant implications for the develops and tests exploits and malware used in covert exploitability of memory corruption vulnerabilities operations) in targeting QNX [65]. on QNX as well as the strength of its cryptographic ecosystem. In this work, we focus primarily on QNX’s ’binary security’ ie. its hardening against memory corruption exploitation, as well as the quality of its secure random 1 Introduction number generators. More precisely, this work makes the following novel QNX [17] is a proprietary, closed-source, Unix-like contributions: real-time operating system with POSIX support aimed primarily at the embedded market. Initially released in 1982 for the Intel 8088 and later acquired by • It presents the first reverse-engineering of the BlackBerry, it forms the basis of BlackBerry OS, proprietary, closed-source QNX OS to document BlackBerry Tablet OS and BlackBerry 10 used in the internals of its memory manager, exploit mobile devices as well as forming the basis of Cisco’s mitigations (eg. NX memory, ASLR, stack canaries, IOS-XR used in carrier-grade routers such as the RELRO) and secure random number generators CRS, the 12000 and the ASR9000 series. QNX also (both the kernel PRNG and /dev/random), dominates the automotive market [61] (particularly covering all QNX versions as of writing (ie. ≤ 6.6 telematics, infotainment and navigation systems) and and the newly released QNX 7.0). is found in millions of cars from Audi, Toyota, BMW, Porsche, Honda and Ford to Jaguar and Lincoln. In • It presents the first analysis of the exploit Dissecting QNX mitigations and secure RNGs on QNX ≤ 6.6 and for hundreds of POSIX utilities, common networking 7.0 and uncovers a variety of design issues and technologies (IPv4/IPv6, IPSec, FTP, HTTP, SSH, vulnerabilities which have significant implications etc.) and dynamic libraries. As opposed to the for the exploitability of memory corruption monolithic kernel architecture of most general-purpose vulnerabilities on QNX as well as the strength of OSes, QNX features a microkernel which provides its cryptographic ecosystem. minimal services (eg. system call and interrupt handling, task scheduling, IPC message-passing, etc.) • As a result of this work, we disclosed the un- to the rest of the operating system which runs as covered issues to the vendor and cooperated in a team of cooperating processes as illustrated in drafting patches to help protect system end-users. Figure 1. As a result, only the microkernel resides in kernelspace with the rest of the operating system and other typical kernel-level functionality (drivers, Given that there is, as discussed in Section 2.1, protocol stacks, etc.) residing in userspace next to no prior work on QNX’s mitigations, secure ran- regular user applications albeit separated by privilege dom number generators or memory management boundaries. In QNX the microkernel is combined with internals, we consider this work a significant con- the process manager in a single executable module tribution to the state of the art in understanding called procnto. QNX libc converts POSIX function QNX security as well as QNX OS internals more broadly. calls into message handling functions which pass messages through the microkernel to the relevant pro- In Section 2 we present an brief overview of QNX’s cess. As of writing, the latest QNX release is version 7.0. OS architecture, its security architecture and its mem- ory management internals. We discuss the result of our reverse-engineering and analysis of the exploit mitiga- PS File U DF File N FS File tions of QNX versions up to and including 6.6 in Section Process M anager M anager M anager Flash File M anager H FS File M anager M anager 3 and those of QNX version 7.0 in Section 4. In Section QN X N eutrino 5 we present the results of our reverse-engineering and M icrokernel analysis of the secure random number generators of Software Bus QNX versions ≤ 6.6 and 7.0. Finally, in Section 6 we Character N etwork present our concluding remarks. GU I M anager M queue CIFS File M anager M anager M anager Application M anager Application 2 QNX Overview Figure 1: QNX Microkernel Architecture [60] 2.1 Security History Most elements of the QNX system architecture (such Most of the relatively scarce public research available as the messaging layer, process & resource manage- on QNX security has been the byproduct of research ment, filesystem and networking functionality, etc.) into BlackBerry’s QNX-based mobile operating systems are well described in prior work [42] and since this such as Tablet OS, BlackBerry OS and BlackBerry work focuses on memory corruption we will only dis- 10 [3, 13–15, 66] most of which has not focussed on cuss QNX memory management and the security ar- QNX itself. Recent work by Plaskett et al. [1, 42] has chitecture in ’broad strokes’. focussed on QNX itself, particularly security of the Inter- Process Communication (IPC), message passing and Persistent Publish Subscribe (PPS) interfaces as well 2.3 Security Architecture as kernel security through system call fuzzing. When As a Unix-like operating system QNX inherits a large it comes to specific vulnerabilities the work done by part of the Unix security model, primarily in the Julio Cesar Fort [27] and Tim Brown [19] stands out in form of user groups and associated permission-based particular and the MITRE CVE database [25] reports, access controls. QNX is certified to Common Criteria as of writing, 34 vulnerabilities most of which are setuid ISO/IEC 15408 Evaluation Assurance Level (EAL) 4+. logic bugs or memory corruption vulnerabilities. The certification report [21] indicates that the Target of Evaluation (TOE) boundary encompasses only the 2.2 OS Architecture procnto system process (ie. the microkernel and process manager) and libc. QNX supports a wide range of CPU architectures and features a pre-emptible microkernel architec- QNX features a strong separation between kernel- ture with multi-core support ensuring virtually any and userspace running everything except for the component (even core OS components and drivers) microkernel and process manager in kernelspace can fail without bringing down the kernel. QNX by assigning it to the procnto process which runs itself has a small footprint but support is available as root with PID 1. Other OS components run as Page 2 of 22 Dissecting QNX their own root processes in userspace next to non-OS User Process 1 User Process 2 User Process 3 System Process processes. Separation between OS processes and non-OS processes comes down to a combination procnto of enforcement of user permissions and additional sandboxing capabilities [54]. If a non-OS process is run as root, the only way to wall it off from the 0 3.5G 0 3.5G 0 3.5G 3.5G 4G wider OS is by restricting its capabilities. On the other hand, capabilities can be assigned on a granular level Figure 2: QNX Private Virtual Memory [53] allowing or disallowing access to system actions and resources meaning for many processes there is no need to run as root to perform their functionality. Security separation between userspace and kernelspace is also mediated in this fashion which does mean, Architecture Start End however, that there is no ’absolute isolation’ of the Userspace microkernel and a root user without significant x86 0x00000000 0xBFFFFFFF capability restrictions (as is the default for most OS AArch32 0x00000000 0x7FFFFFFF processes) can easily pivot into the microkernel by MIPS 0x00000000 0x7FFFFFFF means of common kernel calls, access to sensitive PPC 0x40000000 0xFFFB0000 devices (eg. /dev/mem) or installation of Interrupt SuperH 0x00000000 0x7BFF0000 Service Routines (ISRs). Kernelspace x86 0xC0000000 0xFFFFFFFF As such one should not confuse the safety guarantee AArch32 0x80000000 0xFFFFFFFF that the crashing of one component does not lead to MIPS 0x80000000 0xFFFFFFFF a crash of the entire system with a security guarantee PPC 0x00000000 0x3FFFFFFF that the compromise of one component could not lead SuperH 0x80000000 0xCFFFFFFF to the compromise of the entire system. If no explicit capability restrictions are put in place by system inte- Table 1: QNX ≤ 6.6 Address Boundaries grators, nothing prevents a compromise of a process with the right privileges or capabilities from leading to arbitrary kernelspace code execution.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    22 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us