oletools icon indicating copy to clipboard operation
oletools copied to clipboard

XLS with Macro not detected

Open randubin opened this issue 2 years ago • 2 comments

Affected tool: olevba, mraptor, oleid

Describe the bug Oletools do not detect the existence of the macro inside these xls.

File/Malware sample to reproduce the bug

Link: https://labs.inquest.net/dfi/sha256/c3d288a9284810a199d41d9bed7d3bfe3daf478b2a5bbd7a96f20876997c429a

How To Reproduce the bug Reproducible in Py2/Py3

Expected behavior All Oletools will detect the malware (Please observe the link)

Console output / Screenshots If applicable, add screenshots to help explain your problem. Use the option "-l debug" to add debugging information, if possible. You can see from the debug that the macro is found but not shown: Regular run:

olevba 413e21b93cb3a7a4256ce411591d8164_black.xls      
XLMMacroDeobfuscator: pywin32 is not installed (only is required if you want to use MS Excel)
olevba 0.60.1.dev6 on Python 3.8.8 - http://decalage.info/python/oletools
===============================================================================
FILE: 413e21b93cb3a7a4256ce411591d8164_black.xls
Type: OLE
**No VBA or XLM macros found.**

OleId:
Filename: 413e21b93cb3a7a4256ce411591d8164_black.xls
--------------------+--------------------+----------+--------------------------
Indicator           |Value               |Risk      |Description               
--------------------+--------------------+----------+--------------------------
File format         |Generic OLE file /  |info      |Unrecognized OLE file.    
                    |Compound File       |          |Root CLSID: 00020832-0000-
                    |(unknown format)    |          |0000-C000-000000000046 -  
                    |                    |          |Microsoft Excel sheet with
                    |                    |          |macro enabled (Excel.Sheet
                    |                    |          |MacroEnabled.12)          
--------------------+--------------------+----------+--------------------------
Container format    |OLE                 |info      |Container type            
--------------------+--------------------+----------+--------------------------
Encrypted           |False               |none      |The file is not encrypted 
--------------------+--------------------+----------+--------------------------
VBA Macros          |No                  |none      |This file does not contain
                    |                    |          |VBA macros.               
--------------------+--------------------+----------+--------------------------
XLM Macros          |No                  |none      |This file does not contain
                    |                    |          |Excel 4/XLM macros.       
--------------------+--------------------+----------+--------------------------
External            |0                   |none      |External relationships    
Relationships       |                    |          |such as remote templates, 
                    |                    |          |remote OLE objects, etc   
--------------------+--------------------+----------+--------------------------

But from OleVBA debug:

olevba 0.60.1.dev6 on Python 3.8.8 - http://decalage.info/python/oletools
DEBUG    ftguess: file type=Generic OLE/CFB file - container=OLE
INFO     Opening OLE file 413e21b93cb3a7a4256ce411591d8164_black.xls
INFO     Check whether OLE file is PPT
DEBUG    using open OleFileIO
DEBUG    File appears not to be a ppt file (In stream "root" for field "listdir" found value "['\x01compobj', '\x01ole', '\x03eprint', '\x03objinfo', 'package']" but expected Current User!)
===============================================================================
FILE: 413e21b93cb3a7a4256ce411591d8164_black.xls
Type: OLE
**DEBUG    detect vba macros**
DEBUG    VBA_Parser.find_vba_projects
DEBUG    Checking DirEntry #0
DEBUG    Checking DirEntry #1
DEBUG    Reading data from stream '\x01Ole' - size: 20 bytes
DEBUG    Read 20 bytes
DEBUG    b'\x01\x00\x00\x02\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG    Checking DirEntry #2
DEBUG    Reading data from stream '\x03EPRINT' - size: 8968 bytes
DEBUG    Read 8968 bytes
DEBUG    b'\x01\x00\x00\x00l\x00\x00\x00\x14\x00\x00\x00\x08\x00\x00\x00C\x03\x00\x00u\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf7\r\x00\x00!\x02\x00\x00 EMF\x00\x00\x01\x00\x08#\x00\x00T\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xec\x13\x00\x00\xc8\x19\x00\x00\xd8\x00\x00\x00\x17\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'...[much more data]...b'\x00\x80F\x00\x00\x00\x1c\x00\x00\x00\x10\x00\x00\x00EMF+\x02@\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x14\x00\x00\x00'
DEBUG    Checking DirEntry #3
DEBUG    Reading data from stream 'Package' - size: 15298 bytes
DEBUG    Read 15298 bytes
DEBUG    b'PK\x03\x04\x14\x00\x06\x00\x08\x00\x00\x00!\x00c\x12\x02n\x9d\x01\x00\x00)\x05\x00\x00\x13\x00\x08\x02[Content_Types].xml \xa2\x04\x02(\xa0\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'...[much more data]...b'\x00\x00\x00\x00\x00\x00\x00\x00z5\x00\x00docProps/app.xmlPK\x05\x06\x00\x00\x00\x00\r\x00\r\x00g\x03\x00\x00E8\x00\x00\x00\x00'
DEBUG    Checking DirEntry #4
DEBUG    Reading data from stream '\x01CompObj' - size: 131 bytes
DEBUG    Read 131 bytes
DEBUG    b'\x01\x00\xfe\xff\x03\n\x00\x00\xff\xff\xff\xff2\x08\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00F&\x00\x00\x00Microsoft Excel \xc7alisma Sayfasi (kod)\x00\n\x00\x00\x00ExcelML12\x00\x1b\x00\x00\x00Excel.SheetMacroEnabled.12\x00\xf49\xb2q\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG    Checking DirEntry #5
DEBUG    Reading data from stream '\x03ObjInfo' - size: 6 bytes
DEBUG    Read 6 bytes
DEBUG    b'\x00\x00\x03\x00\r\x00'
DEBUG    Checking DirEntry #6
DEBUG    This DirEntry is an orphan or unused
DEBUG    Checking DirEntry #7
DEBUG    This DirEntry is an orphan or unused
DEBUG    detect xlm macros
No VBA or XLM macros found.

DEBUG    Checking for encryption (normal)
DEBUG    Checking for encryption using msoffcrypto
INFO     msoffcrypto failed to parse file or determine whether it is encrypted: Unrecognized file format
DEBUG    Checking for encryption in zip file
DEBUG    no encryption detected
DEBUG    will exit now with code 0

Version information:

  • OS: Mac
  • OS version: 64 bits
  • Python version: 2.7/3.8.8 - 64 bits
  • oletools version: 0.60.1.dev6

Additional context Add any other context about the problem here.

randubin avatar Mar 20 '22 06:03 randubin

Similar: https://labs.inquest.net/dfi/sha256/3f5fe222b37dc82beeef36881b02216bf07d80c8e9a534cc816ebe2fff7cc335

randubin avatar Mar 20 '22 11:03 randubin

This is similar but seems to be a different type: https://labs.inquest.net/dfi/sha256/29ce7b65dd79e7dea0f39ad6291eb8caf8e5a8e57741ab11696aa35c86f4a462

olevba 0.60.1.dev6 on Python 2.7.18 - http://decalage.info/python/oletools
DEBUG    ftguess: file type=MS Excel 97 Workbook - container=OLE
INFO     Opening OLE file a94b862a3e9067af960b1ee8df594975_black_reverse.xls
INFO     Check whether OLE file is PPT
DEBUG    using open OleFileIO
DEBUG    File appears not to be a ppt file (In stream "root" for field "listdir" found value "[u'\x05documentsummaryinformation', u'\x05summaryinformation', u'workbook']" but expected Current User!)
===============================================================================
FILE: a94b862a3e9067af960b1ee8df594975.xls
Type: OLE
DEBUG    detect vba macros
DEBUG    VBA_Parser.find_vba_projects
DEBUG    Checking DirEntry #0
DEBUG    Checking DirEntry #1
DEBUG    Reading data from stream u'Workbook' - size: 15995 bytes
DEBUG    Read 15995 bytes
DEBUG    '\t\x08\x10\x00\x00\x06\x05\x00\xc1H\xcd\x07\xc1\x00\x02\x00\x06\x08\x00\x00\xe1\x00\x02\x00\xb0\x04\xc1\x00\x02\x00\x00\x00\xe2\x00\x00\x00\\\x00p\x00\x06\x00\x00Avihai                                                   '...[much more data]...'\x1d\x00\x0f\x00\x03\x01\x00\x00\x00\x00\x00\x01\x00\x01\x00\x01\x00\x00\x00g\x08\x17\x00g\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\xff\xff\xff\xff\x03D\x00\x00\n\x00\x00\x00'
DEBUG    Checking DirEntry #2
DEBUG    Reading data from stream u'\x05SummaryInformation' - size: 4096 bytes
DEBUG    Read 4096 bytes
DEBUG    "\xfe\xff\x00\x00\n\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\xe0\x85\x9f\xf2\xf9Oh\x10\xab\x91\x08\x00+'\xb3\xd90\x00\x00\x00\xa0\x00\x00\x00\x07\x00\x00\x00\x01\x00\x00\x00@\x00\x00\x00\x04\x00\x00\x00H\x00\x00\x00\x08\x00\x00\x00X\x00\x00\x00\x12\x00\x00\x00h\x00\x00\x00\x0c\x00\x00\x00\x80\x00\x00\x00\r\x00\x00\x00"...[much more data]...'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DEBUG    Checking DirEntry #3
DEBUG    Reading data from stream u'\x05DocumentSummaryInformation' - size: 4096 bytes
DEBUG    Read 4096 bytes
DEBUG    '\xfe\xff\x00\x00\n\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\xd5\xcd\xd5\x9c.\x1b\x10\x93\x97\x08\x00+,\xf9\xae0\x00\x00\x00\xc4\x00\x00\x00\t\x00\x00\x00\x01\x00\x00\x00P\x00\x00\x00\x0f\x00\x00\x00X\x00\x00\x00\x17\x00\x00\x00d\x00\x00\x00\x0b\x00\x00\x00l\x00\x00\x00\x10\x00\x00\x00t\x00\x00\x00\x13\x00\x00\x00'...[much more data]...'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
**DEBUG    detect xlm macros**
DEBUG    _extract_xlm_plugin_biff
DEBUG    Found Excel stream 'Workbook'
DEBUG    Running BIFF plugin from oledump
No VBA or XLM macros found.

DEBUG    Checking for encryption (normal)
DEBUG    Checking for encryption using msoffcrypto
/opt/anaconda3/envs/python2/lib/python2.7/site-packages/msoffcrypto/method/rc4.py:5: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
DEBUG    no encryption detected
DEBUG    will exit now with code 0

randubin avatar Mar 20 '22 12:03 randubin