From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: dlaor@redhat.com
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] guest agent: add RPC blacklist command-line option
Date: Thu, 08 Dec 2011 17:38:10 -0600 [thread overview]
Message-ID: <4EE14A62.6000107@linux.vnet.ibm.com> (raw)
In-Reply-To: <4EE13FD0.2060304@redhat.com>
On 12/08/2011 04:53 PM, Dor Laor wrote:
> On 12/07/2011 06:45 PM, Michael Roth wrote:
>> On 12/07/2011 06:12 AM, Dor Laor wrote:
>>> On 12/07/2011 12:52 PM, Daniel P. Berrange wrote:
>>>> On Wed, Dec 07, 2011 at 12:34:01PM +0200, Dor Laor wrote:
>>>>> On 12/07/2011 06:03 AM, Michael Roth wrote:
>>>>>> This adds a command-line option, -b/--blacklist, that accepts a
>>>>>> comma-seperated list of RPCs to disable, or prints a list of
>>>>>> available RPCs if passed "?".
>>>>>>
>>>>>> In consequence this also adds general blacklisting and RPC listing
>>>>>> facilities to the new QMP dispatch/registry facilities, should the
>>>>>> QMP monitor ever have a need for such a thing.
>>>>>
>>>>> Beyond run time disablement, how easy it is to compile out some of
>>>>> the general commands such as exec/file-handling?
>>>>>
>>>>> Security certifications like common criteria usually ask to compile
>>>>> out anything that might tamper security.
>>>>
>>>> I don't think that's really relevant/needed. As discussed on the
>>>> call yesterday, this is security theatre, because nothing can prevent
>>>> the host admin from accessing guest RAM or disk data. AFAIK the
>>>> virtualization related security certifications acknowledge this
>>>> already& don't make any claims about security of guests against
>>>> a malicious host admin. In any case, a suitable SELinux policy for
>>>> the guest agent could prevent arbitrary file/binary access via
>>>> generic 'exec' / 'file-read' commands, in a manner that is sufficient
>>>> to satisfy security certications.
>>>
>>> I absolutely agree that the hypervisor can tweak the guest in multiple
>>> ways. Nevertheless there are two reasons I asked it:
>>>
>>> 1. Reduce code and noise from security reviewers eyes.
>>> We were asked to do exactly that for other qemu functionality that
>>> is included but does not run at all. It's just makes the review
>>> faster.
>>
>> Actually removing the code, or compiling it out?
>>
>> If it's a matter of compiling it out, the best solution I can think of
>> is having the QAPI code generators create a #define <rpc> for each RPC,
>> then wrapping the implementations inside an #ifdef <rpc>. That way you
>> could compile out the code by simply modifying the schema.
>>
>> That said, I'd really like to avoid having distros get into the habit of
>> extensively modifying their guest agent source outside of bug fixes and
>> whatnot, I think it'll cause too many problems down the road. From a
>> management perspective, if you're running a cloud with multiple distros,
>> it'll be really difficult to account for agents that have been modified
>> or crippled in various ways.
>
> I don't mind ignoring the guest side for security issues, but since
> we're discussing it, isn't the mechanism for capability exchange will
> take of command existence? We'll need it anyway to handle various agent
> versions.
Agreed, and with the capabilities reporting introduced in patch 2 we'd
be able to determine whether a guest command was simply disabled, or if
it was compiled out. So that's not too much a concern.
The issue is that the latter case is much easier to rectify if the
disabled command becomes a requirement on the host side, since it's a
guest config change, rather than a re-spin of a guest agent package. For
a homogenous environment, re-spinning the agent package isn't too
difficult to deal with, but in a mixed environment there would be a lot
of inertia in needing to coordinate requirements with multiple distro
package maintainers to support new agent features and provide updated
packages.
The only way to get around this, for mixed environments, is if our
primary deployment model is to support the agent for a number of distros
(RHEL/SLES/etc) and have the host push new versions as needed (via ISO,
or unattended via guest distro-packaged agent with remote update support).
That way, each host/distro can push an agent that suites their specific
requirements, while an upstream/community-supported guest tools ISO
focuses on broader functionality. Kind of like the virtio-win drivers,
where non-RHEL users can consume via community-supported unsigned drivers.
But that still requires certain agent functionality to remain
"off-limits", such as remote update (which is currently possible via
guest-file-write and guest-shutdown, or eventually without shutdown via
guest-exec, though a specific update interface would probably be
warranted for this scenario).
>
>>
>> Perhaps we only need, say, shutdown, for ovirt, and compile out the
>> rest, but maybe a customer wants to run their RHEL guest in home-brewed
>> environment where they use qemu-ga file read/write to handle a specific
>> set of guest activation procedures. Now they need a new agent package.
>>
>> It's a whole lot of hassle for host/guest admins for the sake of saving
>> a security reviewer a bit of investigating that'll lead right back to
>> the general operating premise that you have to trust your host
>> administrators before any chain of trust can be established.
>>
>> At least with this interface we can provide some semblance of relief to
>> users with specific security concerns, but don't have to work with
>> distros to re-package agents when those concerns collide with
>> requirements on the host side. We can just check to see if they disabled
>> the functionality and request they re-enable due to <reason> by updating
>> their configs.
>>
>>>
>>> 2. Every piece of code is a risk for exploit
>>> Imagine that a bug/leak/use-after-free in the blacklist command or
>>> the exec command on qemu exists and allows attacked to gain control
>>> of qemu.
>>
>> A host can never assume that a guest [agent] can be trusted. qemu-ga
>> might've been replaced completely by a malicious guest admin, thus
>> circumventing any steps a distro has taken to harden it. Fortunately a
>> guest can only affect memory outside it's address space by going through
>> the virtio-serial/QMP layer. So we can focus our efforts on hardening
>> the transport and json parser layers, and a lot of work has gone into
>> that already (placing limits on token size, recursion depth, etc). So
>> that's more an issue that needs to be addressed on the qemu side, and is
>> independent of any particular RPC implementation on the guest side.
>
> I agree that the host side is relevant and this guest side is negligible
> here since a malicious guest will create its own agent.
>
>>
>>>
>>>>
>>>> Regards,
>>>> Daniel
>>>
>>
>
next prev parent reply other threads:[~2011-12-08 23:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 4:03 [Qemu-devel] [PATCH 1/2] guest agent: add RPC blacklist command-line option Michael Roth
2011-12-07 4:03 ` [Qemu-devel] [PATCH 2/2] guest agent: add supported command list to guest-info RPC Michael Roth
2011-12-07 10:34 ` [Qemu-devel] [PATCH 1/2] guest agent: add RPC blacklist command-line option Dor Laor
2011-12-07 10:52 ` Daniel P. Berrange
2011-12-07 12:12 ` Dor Laor
2011-12-07 16:45 ` Michael Roth
2011-12-08 22:53 ` Dor Laor
2011-12-08 23:38 ` Michael Roth [this message]
2011-12-12 23:34 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE14A62.6000107@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=dlaor@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).