Skip to content

Commit cb2aca7

Browse files
committed
CLOUDSTACK-8613, CLOUDSTACK-6301: Dump KVM domain XML with secure flag
When dumping XML use appropriate flags: 1, VIR_DOMAIN_XML_SECURE (dump security sensitive information too) 8, VIR_DOMAIN_XML_MIGRATABLE (dump XML suitable for migration) Source: https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags This fixes CVE 2015-3252: VNC password lost during VM migration across KVM hosts. The issue is also seen when a VM is rebooted. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 3a48171 commit cb2aca7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,8 +3094,13 @@ private Answer execute(MigrateCommand cmd) {
30943094
description for the instance to be used on the target host.
30953095
30963096
This is supported by libvirt-java from version 0.50.0
3097+
3098+
CVE-2015-3252: Get XML with sensitive information suitable for migration by using
3099+
VIR_DOMAIN_XML_MIGRATABLE flag (value = 8)
3100+
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags
3101+
30973102
*/
3098-
xmlDesc = dm.getXMLDesc(0).replace(_privateIp, cmd.getDestinationIp());
3103+
xmlDesc = dm.getXMLDesc(8).replace(_privateIp, cmd.getDestinationIp());
30993104

31003105
dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp() + "/system");
31013106

@@ -4510,7 +4515,10 @@ protected String rebootVM(Connect conn, String vmName) {
45104515
String msg = null;
45114516
try {
45124517
dm = conn.domainLookupByName(vmName);
4513-
String vmDef = dm.getXMLDesc(0);
4518+
// Get XML Dump including the secure information such as VNC password
4519+
// By passing 1, or VIR_DOMAIN_XML_SECURE flag
4520+
// https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags
4521+
String vmDef = dm.getXMLDesc(1);
45144522
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
45154523
parser.parseDomainXML(vmDef);
45164524
for (InterfaceDef nic : parser.getInterfaces()) {

0 commit comments

Comments
 (0)