Bug 1411327

Summary: [fix available] Password Protected (Encrypted) files opening as plain text after cancelling password dialog
Product: Red Hat Enterprise Linux 7 Reporter: jigar <jraising>
Component: libreofficeAssignee: Michael Stahl <mstahl>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 7.5-AltCC: alanm, bsanford, caolanm, jkoten, jreznik, mstahl
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libreoffice-5.0.6.2-5.el7 Doc Type: Bug Fix
Doc Text:
Previously, when an incorrect password was entered for a password protected document, the document has beenoperation considered as valid and a fallback attempt to open it as plain text has been made. As a consequence, it could appear that the document succesfully loaded, while just the encrypted unreadable content was shown. A fix has been made to terminate import attempts after entering incorrect password, and now nothing is loaded when a wrong password is entered.
Story Points: ---
Clone Of:
: 1426348 (view as bug list) Environment:
Last Closed: 2017-08-01 12:21:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1426348    

Description jigar 2017-01-09 13:43:29 UTC
Description of problem: When we save password protected files using .xlsx format, it can be reopened with libreoffice without entering password and can lead to data loss and data theft. 


Version-Release number of selected component (if applicable): libreoffice-5.0.6.2-3


How reproducible: Always


Steps to Reproduce:
1. Create a Calc/Writer doc with data
2. In the "Save as" dialog box, select "Save with Password" & Format as ".xlsx"
3. Save the sheet & try reopening it
4. When prompted for password, Press "Cancel"
5. The sheet still opens up with encrypted data and can be edited and saved again.

Actual results: The encrypted password protected files can be reopened without password and edited.


Expected results: Password protected files should not open without the password.


Additional info: This is a security issue for the customer and hence high priority.

Comment 1 Caolan McNamara 2017-01-10 10:33:20 UTC
To be very clear, and looking at what I get here with this version, the documents are encrypted correctly and are only decrypted successfully if the correct password is given, right ?

But, if cancel is selected at the password dialog the import as a docx/pptx fails and the encrypted file is opened as raw text by some fall back logic. i.e. gibberish is shown. Which is the same thing as you would get if you e.g. opened the encrypted file in gedit as raw text.

So, assuming I'm looking at the right problem, this is unsightly and we should just fail to open it, but its not a security issue because there is no data theft possibility. Such raw encrypted data can be opened and edited in any text editor.

caolanm->mstahl: this happens in 5.0 but not in 5.1, can you track down the commit which make it behave as expected

Comment 3 Michael Stahl 2017-01-10 14:56:43 UTC
this is fixed upstream in 5.2.0 by

commit 579c2de3a88483eff0664d3a303b19cbd386db47
Author:     Maxim Monastirsky <momonasmon>
AuthorDate: Wed Apr 27 16:19:13 2016 +0300

    tdf#80999 Canceling password prompt should abort detection
    
    ... instead of continuing the detection loop and being
    "detected" as plain text. The detection API will from now
    return a type based on the file extension only, which is
    far more useful than "plain text" anyway. Plus the media
    descriptor has a flag to indicate that the detection wasn't
    completed, which can be also used by the loading code to
    abort the loading process.


patch applies cleanly to libreoffice-5-0 my branch and passes "make check".

Comment 4 Michael Stahl 2017-02-09 14:19:22 UTC
fix committed

Comment 11 Bill Sanford 2017-04-10 18:01:46 UTC
Verified with RHEL-7.4-20170330.1 and libreoffice-5.0.6.2-7

Comment 12 errata-xmlrpc 2017-08-01 12:21:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1975