You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2022/06/13 08:18:34 UTC

[Bug 66115] New: Some Password protected XLS files are not read

https://bz.apache.org/bugzilla/show_bug.cgi?id=66115

            Bug ID: 66115
           Summary: Some Password protected XLS files are not read
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: ansh.sahajpal@adeptia.com
  Target Milestone: ---

Created attachment 38314
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38314&action=edit
The file causing the issue, password is adeptia

I have found an issue with HSSF and BIFF8 component to read password protected
xls files. The issue is similar to the following issue id:
https://bz.apache.org/bugzilla/show_bug.cgi?id=51815

I have gone through the issue and can confirm that i have the exact same error.
However, I cannot see if the issue was fixed or not or any workaround.
I created a dummy xls file following some atypical steps mentioned below:

1. Right click anywhere on desktop.
2. Go to new-> XLSX document 
3. Open the XLSX document in WPS Office.
4. Add any data in the document.
5. Save the file in xls format via WPS Office
6. Add password protection to the file ( any password ).
7. Try to load the file in HSSFWorkBook after setting password in
BIFF8EncryptionKey


I have created many files by following above steps, and I am only able to
replicate the issue with few files. So, few of the files created with the exact
same steps works fine however, few of the files do not.
I have attached the file with which I am able to replicate the issue.

We are using POI version 4.1.1.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66115] Some Password protected XLS files are not read

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66115

ansh.sahajpal@adeptia.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ansh.sahajpal@adeptia.com

--- Comment #1 from ansh.sahajpal@adeptia.com ---
Code snippet used to read the file:

Biff8EncryptionKey.setCurrentUserPassword(null);
Biff8EncryptionKey.setCurrentUserPassword(password);
try {
        workbook = new HSSFWorkbook((InputStream) inputStream);
} catch (IOException e1) {
        throw e1;
} finally {
        Biff8EncryptionKey.setCurrentUserPassword(null);
}


Error Message:
Caused by: java.lang.IllegalArgumentException: Name is too long:
�J�mA��}-܏LR����M��2'n���0ՀC>�.}�2�O���$�LJ%�� �
ze\��������C9�Xko%i�]��d�rhd_���[�=�@|%�*�~�
        at
org.apache.poi.hssf.record.WriteAccessRecord.setUsername(WriteAccessRecord.java:102)
        at
org.apache.poi.hssf.record.WriteAccessRecord.<init>(WriteAccessRecord.java:70)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:84)
        ... 92 more

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66115] Some Password protected XLS files are not read

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66115

Andreas Beeker <ki...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Andreas Beeker <ki...@apache.org> ---
Fixed via r1901996

Added a workaround for invalid documents of WPS office, i.e. if the document is
resaved via Excel the WriteAccessRecord gets encrypted again ...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66115] Some Password protected XLS files are not read

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66115

--- Comment #2 from Andreas Beeker <ki...@apache.org> ---
if the WriteAccessRecord.sid is added to the non-encrypted records in
Biff8DecryptingStream::isNeverEncryptedRecord, the file can be read.

According to [1], the WriteAccess record is not exempted from being encrypted.
I'm therefore reluctant to simply add the sid to the above method.

I need to check further in the MS-XLS docs, if there's another flag I haven't
handled yet.

[1]: 2.2.10 Encryption (Password to Open) -
https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/0f2ea0a1-9fc8-468d-97aa-9d333b72d106

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org