One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
qemu-kvm
/
system
/
View File Name :
security.html
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Security — QEMU qemu-kvm-6.2.0-53.module+el8.10.0+2055+8eb7870b.4 documentation</title> <link rel="shortcut icon" href="../_static/qemu_32x32.png"/> <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="Multi-process QEMU" href="multi-process.html" /> <link rel="prev" title="Xtensa System emulator" href="target-xtensa.html" /> <script src="../_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="../index.html" class="icon icon-home"> QEMU <img src="../_static/qemu_128x128.png" class="logo" alt="Logo"/> </a> <div class="version"> 6.2.0 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <p class="caption"><span class="caption-text">Contents:</span></p> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../about/index.html">About QEMU</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">System Emulation</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="quickstart.html">Quick Start</a></li> <li class="toctree-l2"><a class="reference internal" href="invocation.html">Invocation</a></li> <li class="toctree-l2"><a class="reference internal" href="device-emulation.html">Device Emulation</a></li> <li class="toctree-l2"><a class="reference internal" href="keys.html">Keys in the graphical frontends</a></li> <li class="toctree-l2"><a class="reference internal" href="mux-chardev.html">Keys in the character backend multiplexer</a></li> <li class="toctree-l2"><a class="reference internal" href="monitor.html">QEMU Monitor</a></li> <li class="toctree-l2"><a class="reference internal" href="images.html">Disk Images</a></li> <li class="toctree-l2"><a class="reference internal" href="virtio-net-failover.html">QEMU virtio-net standby (net_failover)</a></li> <li class="toctree-l2"><a class="reference internal" href="linuxboot.html">Direct Linux Boot</a></li> <li class="toctree-l2"><a class="reference internal" href="generic-loader.html">Generic Loader</a></li> <li class="toctree-l2"><a class="reference internal" href="guest-loader.html">Guest Loader</a></li> <li class="toctree-l2"><a class="reference internal" href="barrier.html">QEMU Barrier Client</a></li> <li class="toctree-l2"><a class="reference internal" href="vnc-security.html">VNC security</a></li> <li class="toctree-l2"><a class="reference internal" href="tls.html">TLS setup for network services</a></li> <li class="toctree-l2"><a class="reference internal" href="secrets.html">Providing secret data to QEMU</a></li> <li class="toctree-l2"><a class="reference internal" href="authz.html">Client authorization</a></li> <li class="toctree-l2"><a class="reference internal" href="gdb.html">GDB usage</a></li> <li class="toctree-l2"><a class="reference internal" href="managed-startup.html">Managed start up options</a></li> <li class="toctree-l2"><a class="reference internal" href="bootindex.html">Managing device boot order with bootindex properties</a></li> <li class="toctree-l2"><a class="reference internal" href="cpu-hotplug.html">Virtual CPU hotplug</a></li> <li class="toctree-l2"><a class="reference internal" href="pr-manager.html">Persistent reservation managers</a></li> <li class="toctree-l2"><a class="reference internal" href="targets.html">QEMU System Emulator Targets</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">Security</a><ul> <li class="toctree-l3"><a class="reference internal" href="#overview">Overview</a></li> <li class="toctree-l3"><a class="reference internal" href="#security-requirements">Security Requirements</a><ul> <li class="toctree-l4"><a class="reference internal" href="#virtualization-use-case">Virtualization Use Case</a></li> <li class="toctree-l4"><a class="reference internal" href="#non-virtualization-use-case">Non-virtualization Use Case</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#architecture">Architecture</a><ul> <li class="toctree-l4"><a class="reference internal" href="#guest-isolation">Guest Isolation</a></li> <li class="toctree-l4"><a class="reference internal" href="#principle-of-least-privilege">Principle of Least Privilege</a></li> <li class="toctree-l4"><a class="reference internal" href="#isolation-mechanisms">Isolation mechanisms</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#sensitive-configurations">Sensitive configurations</a><ul> <li class="toctree-l4"><a class="reference internal" href="#monitor-console-qmp-and-hmp">Monitor console (QMP and HMP)</a></li> </ul> </li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="multi-process.html">Multi-process QEMU</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../user/index.html">User Mode Emulation</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../interop/index.html">System Emulation Management and Interoperability</a></li> <li class="toctree-l1"><a class="reference internal" href="../specs/index.html">System Emulation Guest Hardware Specifications</a></li> <li class="toctree-l1"><a class="reference internal" href="../devel/index.html">Developer Information</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">QEMU</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html">Docs</a> »</li> <li><a href="index.html">System Emulation</a> »</li> <li>Security</li> <li class="wy-breadcrumbs-aside"> <a href="https://gitlab.com/qemu-project/qemu/blob/master/docs/system/security.rst" class="fa fa-gitlab"> Edit on GitLab</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="security"> <h1>Security<a class="headerlink" href="#security" title="Permalink to this headline">¶</a></h1> <div class="section" id="overview"> <h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2> <p>This chapter explains the security requirements that QEMU is designed to meet and principles for securely deploying QEMU.</p> </div> <div class="section" id="security-requirements"> <h2>Security Requirements<a class="headerlink" href="#security-requirements" title="Permalink to this headline">¶</a></h2> <p>QEMU supports many different use cases, some of which have stricter security requirements than others. The community has agreed on the overall security requirements that users may depend on. These requirements define what is considered supported from a security perspective.</p> <div class="section" id="virtualization-use-case"> <h3>Virtualization Use Case<a class="headerlink" href="#virtualization-use-case" title="Permalink to this headline">¶</a></h3> <p>The virtualization use case covers cloud and virtual private server (VPS) hosting, as well as traditional data center and desktop virtualization. These use cases rely on hardware virtualization extensions to execute guest code safely on the physical CPU at close-to-native speed.</p> <p>The following entities are untrusted, meaning that they may be buggy or malicious:</p> <ul class="simple"> <li>Guest</li> <li>User-facing interfaces (e.g. VNC, SPICE, WebSocket)</li> <li>Network protocols (e.g. NBD, live migration)</li> <li>User-supplied files (e.g. disk images, kernels, device trees)</li> <li>Passthrough devices (e.g. PCI, USB)</li> </ul> <p>Bugs affecting these entities are evaluated on whether they can cause damage in real-world use cases and treated as security bugs if this is the case.</p> </div> <div class="section" id="non-virtualization-use-case"> <h3>Non-virtualization Use Case<a class="headerlink" href="#non-virtualization-use-case" title="Permalink to this headline">¶</a></h3> <p>The non-virtualization use case covers emulation using the Tiny Code Generator (TCG). In principle the TCG and device emulation code used in conjunction with the non-virtualization use case should meet the same security requirements as the virtualization use case. However, for historical reasons much of the non-virtualization use case code was not written with these security requirements in mind.</p> <p>Bugs affecting the non-virtualization use case are not considered security bugs at this time. Users with non-virtualization use cases must not rely on QEMU to provide guest isolation or any security guarantees.</p> </div> </div> <div class="section" id="architecture"> <h2>Architecture<a class="headerlink" href="#architecture" title="Permalink to this headline">¶</a></h2> <p>This section describes the design principles that ensure the security requirements are met.</p> <div class="section" id="guest-isolation"> <h3>Guest Isolation<a class="headerlink" href="#guest-isolation" title="Permalink to this headline">¶</a></h3> <p>Guest isolation is the confinement of guest code to the virtual machine. When guest code gains control of execution on the host this is called escaping the virtual machine. Isolation also includes resource limits such as throttling of CPU, memory, disk, or network. Guests must be unable to exceed their resource limits.</p> <p>QEMU presents an attack surface to the guest in the form of emulated devices. The guest must not be able to gain control of QEMU. Bugs in emulated devices could allow malicious guests to gain code execution in QEMU. At this point the guest has escaped the virtual machine and is able to act in the context of the QEMU process on the host.</p> <p>Guests often interact with other guests and share resources with them. A malicious guest must not gain control of other guests or access their data. Disk image files and network traffic must be protected from other guests unless explicitly shared between them by the user.</p> </div> <div class="section" id="principle-of-least-privilege"> <h3>Principle of Least Privilege<a class="headerlink" href="#principle-of-least-privilege" title="Permalink to this headline">¶</a></h3> <p>The principle of least privilege states that each component only has access to the privileges necessary for its function. In the case of QEMU this means that each process only has access to resources belonging to the guest.</p> <p>The QEMU process should not have access to any resources that are inaccessible to the guest. This way the guest does not gain anything by escaping into the QEMU process since it already has access to those same resources from within the guest.</p> <p>Following the principle of least privilege immediately fulfills guest isolation requirements. For example, guest A only has access to its own disk image file <code class="docutils literal notranslate"><span class="pre">a.img</span></code> and not guest B’s disk image file <code class="docutils literal notranslate"><span class="pre">b.img</span></code>.</p> <p>In reality certain resources are inaccessible to the guest but must be available to QEMU to perform its function. For example, host system calls are necessary for QEMU but are not exposed to guests. A guest that escapes into the QEMU process can then begin invoking host system calls.</p> <p>New features must be designed to follow the principle of least privilege. Should this not be possible for technical reasons, the security risk must be clearly documented so users are aware of the trade-off of enabling the feature.</p> </div> <div class="section" id="isolation-mechanisms"> <h3>Isolation mechanisms<a class="headerlink" href="#isolation-mechanisms" title="Permalink to this headline">¶</a></h3> <p>Several isolation mechanisms are available to realize this architecture of guest isolation and the principle of least privilege. With the exception of Linux seccomp, these mechanisms are all deployed by management tools that launch QEMU, such as libvirt. They are also platform-specific so they are only described briefly for Linux here.</p> <p>The fundamental isolation mechanism is that QEMU processes must run as unprivileged users. Sometimes it seems more convenient to launch QEMU as root to give it access to host devices (e.g. <code class="docutils literal notranslate"><span class="pre">/dev/net/tun</span></code>) but this poses a huge security risk. File descriptor passing can be used to give an otherwise unprivileged QEMU process access to host devices without running QEMU as root. It is also possible to launch QEMU as a non-root user and configure UNIX groups for access to <code class="docutils literal notranslate"><span class="pre">/dev/kvm</span></code>, <code class="docutils literal notranslate"><span class="pre">/dev/net/tun</span></code>, and other device nodes. Some Linux distros already ship with UNIX groups for these devices by default.</p> <ul class="simple"> <li>SELinux and AppArmor make it possible to confine processes beyond the traditional UNIX process and file permissions model. They restrict the QEMU process from accessing processes and files on the host system that are not needed by QEMU.</li> <li>Resource limits and cgroup controllers provide throughput and utilization limits on key resources such as CPU time, memory, and I/O bandwidth.</li> <li>Linux namespaces can be used to make process, file system, and other system resources unavailable to QEMU. A namespaced QEMU process is restricted to only those resources that were granted to it.</li> <li>Linux seccomp is available via the QEMU <code class="docutils literal notranslate"><span class="pre">--sandbox</span></code> option. It disables system calls that are not needed by QEMU, thereby reducing the host kernel attack surface.</li> </ul> </div> </div> <div class="section" id="sensitive-configurations"> <h2>Sensitive configurations<a class="headerlink" href="#sensitive-configurations" title="Permalink to this headline">¶</a></h2> <p>There are aspects of QEMU that can have security implications which users & management applications must be aware of.</p> <div class="section" id="monitor-console-qmp-and-hmp"> <h3>Monitor console (QMP and HMP)<a class="headerlink" href="#monitor-console-qmp-and-hmp" title="Permalink to this headline">¶</a></h3> <p>The monitor console (whether used with QMP or HMP) provides an interface to dynamically control many aspects of QEMU’s runtime operation. Many of the commands exposed will instruct QEMU to access content on the host file system and/or trigger spawning of external processes.</p> <p>For example, the <code class="docutils literal notranslate"><span class="pre">migrate</span></code> command allows for the spawning of arbitrary processes for the purpose of tunnelling the migration data stream. The <code class="docutils literal notranslate"><span class="pre">blockdev-add</span></code> command instructs QEMU to open arbitrary files, exposing their content to the guest as a virtual disk.</p> <p>Unless QEMU is otherwise confined using technologies such as SELinux, AppArmor, or Linux namespaces, the monitor console should be considered to have privileges equivalent to those of the user account QEMU is running under.</p> <p>It is further important to consider the security of the character device backend over which the monitor console is exposed. It needs to have protection against malicious third parties which might try to make unauthorized connections, or perform man-in-the-middle attacks. Many of the character device backends do not satisfy this requirement and so must not be used for the monitor console.</p> <p>The general recommendation is that the monitor console should be exposed over a UNIX domain socket backend to the local host only. Use of the TCP based character device backend is inappropriate unless configured to use both TLS encryption and authorization control policy on client connections.</p> <p>In summary, the monitor console is considered a privileged control interface to QEMU and as such should only be made accessible to a trusted management application or user.</p> </div> </div> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="multi-process.html" class="btn btn-neutral float-right" title="Multi-process QEMU" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="target-xtensa.html" class="btn btn-neutral" title="Xtensa System emulator" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2021, The QEMU Project Developers. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. <!-- Empty para to force a blank line after "Built with Sphinx ..." --> <p></p> <p>This documentation is for QEMU version 6.2.0.</p> <p><a href="../about/license.html">QEMU and this manual are released under the GNU General Public License, version 2.</a></p> </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'../', VERSION:'qemu-kvm-6.2.0-53.module+el8.10.0+2055+8eb7870b.4', LANGUAGE:'None', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: false, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>