Bug 73328 - FILEOPEN: Can't open encrypted Excel template
Summary: FILEOPEN: Can't open encrypted Excel template
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-01-06 17:34 UTC by Alexander Nolting
Modified: 2016-04-24 16:58 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
password protected rar with the two sample files (80.16 KB, application/x-rar-compressed)
2014-01-06 17:34 UTC, Alexander Nolting
Details
Excel Template with Macros (44.50 KB, application/vnd.ms-excel.template.macroEnabled.12)
2014-01-08 10:38 UTC, Alexander Nolting
Details
.xlsx versin after saving (40.62 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2014-01-08 10:39 UTC, Alexander Nolting
Details
Excel with Sample Data (40.81 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2014-01-09 06:05 UTC, Alexander Nolting
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nolting 2014-01-06 17:34:59 UTC
Created attachment 91546 [details]
password protected rar with the two sample files

Hello to the Team,

I have an Excel 2010 Macro Template file (.xltm) which is being used for doing weekly worktime reports. This Excel will saved as normal xlsx. The file makes heavy use of the functions cell grouping and cell protection.

Both files are cannot be opened by the latest LO version 4.2.0.1. While opening the template LO stops working with an error "Wrong file version." And when it opens the xslx the cells cannot be edited. So further testing is impossible.

This Excel might be a good example for testing complaince to MSOXML files.

Best regards
Alex
Comment 1 Julien Nabet 2014-01-07 21:21:33 UTC
Could you please attach a zip file instead of rar?
On pc Debian x86-64, testing, I can't open the rar file.
Comment 2 Maxim Monastirsky 2014-01-08 08:08:50 UTC
(In reply to comment #0)
> Created attachment 91546 [details]
> password protected rar with the two sample files
@Alex: How should we open that file it it's password protected? If the file contains confidential information, please replace it with some junk and re-upload. Thanks.
Comment 3 Alexander Nolting 2014-01-08 10:38:13 UTC
Created attachment 91657 [details]
Excel Template with Macros

Hi,

I attached the file without zipping or rar them.

Bets regards
Alex
Comment 4 Alexander Nolting 2014-01-08 10:39:08 UTC
Created attachment 91658 [details]
.xlsx versin after saving
Comment 5 Maxim Monastirsky 2014-01-08 19:00:16 UTC
I can confirm that the template doesn't open using a recent master (Build ID: 3df9adb1b0031e77977431c90edee651b2aaa195), and also using an older build from 2013-10-21 (Build ID: 051731bbcaa79b6428c8ebee6c114c9b28220cc8). But it opens fine using 4.1.4. So it's a regression.

The error is indeed 'Version Incompatibility. Incorrect file version.', but only when not choosing the exact format from the drop-down box (probably thrown by one of the type detectors). When choosing the right format, the error is 'General Error. General input/output error.'.

Examining the file with 7zip shows an encrypted Compound file (= MS Office binary). But strange that it opens with Excel 2010 SP2 without asking any password. So I'm not sure how to reproduce such file. I tried to create password protected file with Excel, and it looks the same internally (using 7zip), but it doesn't open even with 4.1.4 (with the same error).

@Julien: Do you know anything about support of encrypted files? Does it a known limitation?
Comment 6 Julien Nabet 2014-01-08 19:39:39 UTC
On pc Debian x86-64 with master sources updated today, I can't open the file too (version incompatibility, Incorrect file version)
I noticed these in console logs:
warn:oox.storage:29578:1:oox/source/helper/zipstorage.cxx:70: ZipStorage::ZipStorage exception opening input storage: 
warn:oox.storage:29578:1:oox/source/helper/zipstorage.cxx:70: ZipStorage::ZipStorage exception opening input storage: 
:1: parser error : Document is empty
ࡱ
^

I must do more tests.
Comment 7 Julien Nabet 2014-01-08 19:58:14 UTC
When selecting template Excel 2007/2010
I've got a message general input/output error
I've got this on console:
warn:oox.storage:29578:1:oox/source/helper/zipstorage.cxx:70: ZipStorage::ZipStorage exception opening input storage: 
warn:legacy.osl:29578:1:oox/source/core/filterbase.cxx:530: FilterBase::setMediaDescriptor - missing input stream

About the xlsx file, I can open it but can't change the cells because password given via private email by Alexander doesn't unlock.
Either a problem with password or with the algo used by LO.

Maxim: I know that there are function related to encryption in LO but I don't know much more about this.

Anyway, I put it at NEW since there's indeed a problem here and put on cc main Calc devs for any suggestion.
Comment 8 Maxim Monastirsky 2014-01-08 20:40:13 UTC
(In reply to comment #6)
> :1: parser error : Document is empty
> ࡱ
> ^
This output if from KeynoteImportFilter detector.

At end it's detected by draw.FormatDetector as 'impress_MS_PowerPoint_97_Vorlage'.
Comment 9 Julien Nabet 2014-01-08 21:32:55 UTC
About the template, it seems there's a problem here:
package/source/xstor/xfactory.cxx
     49         // TODO/LATER: should the disk spanned files be supported?
     50         // 0x50, 0x4b, 0x07, 0x08
     51         return ( nRead == 4 && aData[0] == 0x50 && aData[1] == 0x4b && aData[2] == 0x03 && aData[3] == 0x04 );

and here's what I got:
(gdb) p aData
$16 = uno::Sequence of length 4 = {-48 '\320', -49 '\317', 17 '\021', -32 '\340'}

I don't know if it explains the whole thing but it doesn't seem right.
Comment 10 Alexander Nolting 2014-01-09 05:56:07 UTC
(In reply to comment #7)
> When selecting template Excel 2007/2010
> I've got a message general input/output error
> I've got this on console:
> warn:oox.storage:29578:1:oox/source/helper/zipstorage.cxx:70:
> ZipStorage::ZipStorage exception opening input storage: 
> warn:legacy.osl:29578:1:oox/source/core/filterbase.cxx:530:
> FilterBase::setMediaDescriptor - missing input stream
> 
> About the xlsx file, I can open it but can't change the cells because
> password given via private email by Alexander doesn't unlock.
> Either a problem with password or with the algo used by LO.
> 
> Maxim: I know that there are function related to encryption in LO but I
> don't know much more about this.
> 
> Anyway, I put it at NEW since there's indeed a problem here and put on cc
> main Calc devs for any suggestion.

Hi Julien,

the password for unlocking the sheet protection was already send to you and Maxim. My assumption was that due to an issue with the parser cells which shouldn't be protected are protected in LO. The parser issue shown on cli seems to be a different one.

I'll attach a sample xlsx with data in it to show how the file is used.

Best regards
Alex
Comment 11 Alexander Nolting 2014-01-09 06:05:32 UTC
Created attachment 91734 [details]
Excel with Sample Data
Comment 12 Maxim Monastirsky 2014-01-09 06:45:17 UTC
(In reply to comment #9)
> About the template, it seems there's a problem here:
> package/source/xstor/xfactory.cxx
>      49         // TODO/LATER: should the disk spanned files be supported?
>      50         // 0x50, 0x4b, 0x07, 0x08
>      51         return ( nRead == 4 && aData[0] == 0x50 && aData[1] == 0x4b
> && aData[2] == 0x03 && aData[3] == 0x04 );

@Julien: Those values are for zip based files, but encrypted office files are of different format called 'Compound', and shouldn't be treated as zip.
Comment 13 Maxim Monastirsky 2014-08-03 14:12:37 UTC
Not reproducible anymore as of 4.2.6.2/4.3.0.4/master, so closing as WORKSFORME. Feel free to reopen if it still doesn't work for you.
Comment 14 Jean-Baptiste Faure 2016-04-24 16:58:45 UTC
Version set from description.

Best regards. JBF