Describe flaws in qcow/qcow2 encryption in the docs
PATCH v2 1/1 Describe flaws in qcow/qcow2 encryption in the docs
The qemu-img.texi / qemu-doc.texi files currently describe the qcow2/qcow2 encryption thus
"Encryption uses the AES format which is very secure (128 bit
keys). Use a long password (16 characters) to get maximum protection."
While AES is indeed a strong encryption system, the way that QCow/QCow2 use it results in a poor/weak encryption system. Due to the use of predictable IVs it is vulnerable to chosen plaintext attacks which can reveal the existance of encrypted data.
The direct use of the user passphrase as the encryption key also leads to an inability to change the passphrase of an image. If passphrase is ever compromised the image data will all be vulnerable, since it cannot be re-encrypted. The admin has to clone the image files with a new passphrase and then use a program like shred to secure erase all the old files.
Recommend against any use of QCow/QCow2 encryption, directing users to dm-crypt / LUKS which can meet modern cryptography best practices.
--- qemu-doc.texi | 23 ++++++++++++++++++++--- qemu-img.texi | 23 ++++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-)
In v2:
- Addressed typos reported by Peter
Still welcome info about any other flaws qcow2 has in this area that should be documented.
qemu-doc.texi +20 -3
@@ -547,10 +547,27 @@ File name of a base image (see @option{create} subcommand) @item backing_fmt Image format of the base image @item encryption -If this option is set to @code{on}, the image is encrypted. +If this option is set to @code{on}, the image is encrypted with 128-bit AES-CBC. + +The use of encryption in QCow and QCow2 images is considered to be flawed by +modern cryptography standards, suffering from a number of design problems: + +@itemize @minus +@item The AES-CBC cipher is used with predictable initialization vectors based +on the sector number. This makes it vulnerable to chosen plaintext attacks +which can reveal the existence of encrypted data. +@item The user passphrase is directly used as the encryption key. A poorly +choosen or short passphrase will compromise the security of the encryption. +In the event of the passphrase being compromised there is no way to change +the passphrase to protect data in any QCow images. The files must be cloned, +using a different encryption passphrase in the new file. The original file +must then be securely erased using a program like shred, though even this +is ineffective with many modern storage technologies. +@end itemize -Encryption uses the AES format which is very secure (128 bit keys). Use -a long password (16 characters) to get maximum protection. +Use of QCow / QCow2 encryption is thus strongly discouraged. Users are +recommended to use an alternative encryption technology such as the +Linux dm-crypt / LUKS system. @item cluster_size Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
qemu-img.texi +20 -3
@@ -402,10 +402,27 @@ File name of a base image (see @option{create} subcommand) @item backing_fmt Image format of the base image @item encryption -If this option is set to @code{on}, the image is encrypted. +If this option is set to @code{on}, the image is encrypted with 128-bit AES-CBC. -Encryption uses the AES format which is very secure (128 bit keys). Use -a long password (16 characters) to get maximum protection. +The use of encryption in QCow and QCow2 images is considered to be flawed by +modern cryptography standards, suffering from a number of design problems: + +@itemize @minus +@item The AES-CBC cipher is used with predictable initialization vectors based +on the sector number. This makes it vulnerable to chosen plaintext attacks +which can reveal the existence of encrypted data. +@item The user passphrase is directly used as the encryption key. A poorly +choosen or short passphrase will compromise the security of the encryption. +In the event of the passphrase being compromised there is no way to change +the passphrase to protect data in any QCow images. The files must be cloned, +using a different encryption passphrase in the new file. The original file +must then be securely erased using a program like shred, though even this +is ineffective with many modern storage technologies. +@end itemize + +Use of QCow / QCow2 encryption is thus strongly discouraged. Users are +recommended to use an alternative encryption technology such as the +Linux dm-crypt / LUKS system. @item cluster_size Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
Signature · 1 line
1.8.4.2
Quoted 11 lines · Daniel P. Berrange
Recommend against any use of QCow/QCow2 encryption, directing users to dm-crypt / LUKS which can meet modern cryptography best practices.
Signed-off-by Daniel P. Berrange <[email protected]>--- qemu-doc.texi | 23 ++++++++++++++++++++--- qemu-img.texi | 23 ++++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-)
qemu-doc.texi File name of a base image (see @option{create} subcommand) · line 560
Quoted 7 lines
qemu-doc.texi +7
-0+ +@itemize @minus +@item The AES-CBC cipher is used with predictable initialization vectors based +on the sector number. This makes it vulnerable to chosen plaintext attacks +which can reveal the existence of encrypted data. +@item The user passphrase is directly used as the encryption key. A poorly +choosen or short passphrase will compromise the security of the encryption.
s/choosen/chosen/ (both files)
Quoted 1 line
+In the event of the passphrase being compromised there is no way to change
and still my question whether this deserves a third @item.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 10 lines · Daniel P. Berrange
The qemu-img.texi / qemu-doc.texi files currently describe the qcow2/qcow2 encryption thus
"Encryption uses the AES format which is very secure (128 bit
keys). Use a long password (16 characters) to get maximum protection."While AES is indeed a strong encryption system, the way that QCow/QCow2 use it results in a poor/weak encryption system. Due to the use of predictable IVs
Sector number zero-extended to 128 bits.
Quoted 11 lines
it is vulnerable to chosen
plaintext attacks which can reveal the existance of encrypted data.The direct use of the user passphrase as the encryption key also leads to an inability to change the passphrase of an image. If passphrase is ever compromised the image data will all be vulnerable, since it cannot be re-encrypted. The admin has to clone the image files with a new passphrase and then use a program like shred to secure erase all the old files.
Quoted 5 lines
Recommend against any use of QCow/QCow2 encryption, directing users to dm-crypt / LUKS which can meet modern cryptography best practices.
Signed-off-by Daniel P. Berrange <[email protected]>
Amateur crypto.
Quoted 23 lines · Eric Blake
Quoted 11 lines · Daniel P. Berrange
Recommend against any use of QCow/QCow2 encryption, directing users to dm-crypt / LUKS which can meet modern cryptography best practices.
Signed-off-by Daniel P. Berrange <[email protected]>--- qemu-doc.texi | 23 ++++++++++++++++++++--- qemu-img.texi | 23 ++++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-)qemu-doc.texi File name of a base image (see @option{create} subcommand) · line 560
Quoted 7 lines
qemu-doc.texi +7
-0+ +@itemize @minus +@item The AES-CBC cipher is used with predictable initialization vectors based +on the sector number. This makes it vulnerable to chosen plaintext attacks +which can reveal the existence of encrypted data. +@item The user passphrase is directly used as the encryption key. A poorly +choosen or short passphrase will compromise the security of the encryption.s/choosen/chosen/ (both files)
Quoted 3 lines
Quoted 1 line
+In the event of the passphrase being compromised there is no way to change
and still my question whether this deserves a third @item.
I was considering this to be a result of using the passphrase as the key. It does however read better if split out, so I've made that change.
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|