Bug 1312573 - virt-aa-helper allows read access to the VNC socket
Summary: virt-aa-helper allows read access to the VNC socket
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-27 13:37 UTC by Simon Arlott
Modified: 2020-05-28 08:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-20 14:01:01 UTC
Embargoed:
bugzilla.redhat.simon: needinfo-


Attachments (Terms of Use)
Patch to remove read permission on VNC sockets (646 bytes, patch)
2016-02-27 13:37 UTC, Simon Arlott
no flags Details | Diff

Description Simon Arlott 2016-02-27 13:37:42 UTC
Created attachment 1131085 [details]
Patch to remove read permission on VNC sockets

Description of problem: virt-aa-helper allows read access to the VNC socket

Version-Release number of selected component (if applicable): 1.2.16

How reproducible: Connect to the VNC socket using the VM's apparmor profile

Steps to Reproduce:
1. Identify the apparmor profile (libvirt-<uuid>) used by a running VM (<name>) that has a VNC socket enabled
2. As root, run and then ^C: socat UNIX-CLIENT:/var/lib/libvirt/qemu/<name>.vnc STDIO
3. As root, run and then ^C: aa-exec -p libvirt-<uuid> socat UNIX-CLIENT:/var/lib/libvirt/qemu/<name>.vnc STDIO

Actual results:
2. RFB 003.008
3. RFB 003.008

Expected results:
2. RFB 003.008
3. 2016/02/27 13:33:08 socat[1065] E connect(5, AF=1 "/var/lib/libvirt/qemu/<name>.vnc", 35): Permission denied

Additional info: The VM does not need read permission for its own VNC socket to create(), bind(), accept() connections or to receive(), send(), etc. on connections.

Comment 1 Cole Robinson 2016-03-21 22:25:31 UTC
Thanks for the patch. I don't think anyone who works on virt-aa-helper watches this tracker... please send the patch to libvir-list and CC cbosdonnat and agx , they can review and commit

Comment 2 Cole Robinson 2016-03-21 23:32:55 UTC
Also if you do send the patch upstream, and these patches have landed:

http://www.redhat.com/archives/libvir-list/2016-March/msg00979.html

Please adjust the spice socket permissions as well

Comment 3 Cole Robinson 2016-04-07 20:02:57 UTC
CCing guido and cedric who patch virt-aa-helper on occasion

Comment 4 Guido Günther 2016-04-08 07:30:44 UTC
Looks good to me.

Comment 5 Cole Robinson 2016-04-08 13:02:36 UTC
I sent the patch upstream, Guido if you ACK I'll push it

http://www.redhat.com/archives/libvir-list/2016-April/msg00363.html

Comment 6 Cole Robinson 2016-04-20 14:01:01 UTC
Pushed upstream now. Thanks for the patch!

commit ab9569e5460d1e4737fe8b625c67687dc2204665
Author: Simon Arlott <bugzilla.redhat.simon>
Date:   Fri Apr 8 09:01:33 2016 -0400

    virt-aa-helper: disallow VNC socket read permissions
    
    The VM does not need read permission for its own VNC socket to create(),
    bind(), accept() connections or to receive(), send(), etc. on connections.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1312573

Comment 7 Simon Arlott 2020-05-28 08:56:22 UTC
This got reverted upstream a few weeks later by someone who didn't consider why the permissions omitted reading, which is really frustrating:
2016-04-20: fix committed (ab9569e5460d1e4737fe8b625c67687dc2204665)
2016-06-08: changes to graphics socket handling (6465e1aa49397367a9cd0f27110b9c2280a7385)
2016-06-09: fix reverted (acc83afe333bfadd3f7f79091d38ca3d7da1eeb2)


Note You need to log in before you can comment on or make changes to this bug.