Exploit the possiblities

Microsoft VBA Hidden Modules

Microsoft VBA Hidden Modules
Posted Mar 29, 2017
Authored by Maxim Tomashevich

Microsoft Visual Basic for Applications versions 6.5 through 7.1 suffer from a malicious hidden module issue.

tags | exploit
MD5 | 4011c4794004ffbae2aa1e2f8344edd9

Microsoft VBA Hidden Modules

Change Mirror Download

Maxim Tomashevich / Thegrideon Software










Visual Basic for Applications (VBA) 6.5 - 7.1 (x32 / x64)

Vulnerability Details:


VBA library loads modules for execution from all streams inside "VBA" OLE
folder (based on "dir" stream records), but only the modules present in
"PROJECT" stream are listed and shown in VBA Project Explorer.

"PROJECT" stream modification can be used to hide any module and this
creates easy to exploit security vulnerability:

1) Malicious code of any length and complexity can be hidden without any
security warnings or hints from VBA IDE whatsoever.

2) A single call to a hidden module is all that required to execute
malicious code. This call can be masked by number of tricks (name visually
similar to a standard function for example: latin letter 'O' (oh) replaced
with '0' (zero) or 'o' with Cyrillic or Greek 'o', function name misspelled,

Function StrCImp(a, b) -or- STRC0MP(a, b) -or simply- StrCmp(a, b)

Or Sub auto_open() can be used for self-containing and a bit more dangerous
malicious module if the host file is useful enough to be opened twice.

3) An absence of any notifications about hidden modules presence and an
ability to see all other listed modules together create a false sense of
security and provoke to enable the code that looks harmlessly.

Sub Function1() ...

LResult = StrCImp ("vba", "vba") -or- LResult = STRC0MP("vba", "vba") -or-
LResult = StrCmp("vba", "vba")

... End Sub

4) This approach can be used to "weaponize" popular VBA scripts in all
VBA-enabled applications: AutoCAD, Excel, CorelDRAW, PowerPoint, Word, some
PLC systems, etc...

Proof of Concept:


You can download MS Excel example files (with hidden and visible code
blocks) from:


or create one with the following basic procedure:

1) Create new VBA-enabled ".xslm" Spreadsheet and add 2 modules "Module1",

(at least one visible module [with or without code] is required to keep VBA
library from removing VBA Project on Save)

2) Change file extension from ".xslm" to ".zip", open the file and extract
vbaProject.bin from "xl" folder.

3) With any OLE editor remove line "Module=Module1" from "PROJECT" stream.

Hex editor can be used as well to replace "Module=Module1" with several
empty lines (0xD 0xA).

4) Put modified vbaProject.bin back into archive and change the extension
back to ".xslm".

5) Open the file in MS Excel to verify "Module1" disappearance.

Severity Level:





Permission is hereby granted for the redistribution of this text, provided
that it is not altered except by reformatting, and that due credit is given.
Permission is explicitly given for insertion in vulnerability databases and
similar, provided that due credit is given to the author.The author is not
responsible for any misuse of the information contained herein and prohibits
any malicious use of all security related information or exploits by the
author or elsewhere.


RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?

Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

January 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jan 1st
    2 Files
  • 2
    Jan 2nd
    13 Files
  • 3
    Jan 3rd
    16 Files
  • 4
    Jan 4th
    39 Files
  • 5
    Jan 5th
    26 Files
  • 6
    Jan 6th
    40 Files
  • 7
    Jan 7th
    2 Files
  • 8
    Jan 8th
    16 Files
  • 9
    Jan 9th
    25 Files
  • 10
    Jan 10th
    28 Files
  • 11
    Jan 11th
    44 Files
  • 12
    Jan 12th
    32 Files
  • 13
    Jan 13th
    2 Files
  • 14
    Jan 14th
    4 Files
  • 15
    Jan 15th
    31 Files
  • 16
    Jan 16th
    15 Files
  • 17
    Jan 17th
    16 Files
  • 18
    Jan 18th
    24 Files
  • 19
    Jan 19th
    15 Files
  • 20
    Jan 20th
    5 Files
  • 21
    Jan 21st
    0 Files
  • 22
    Jan 22nd
    0 Files
  • 23
    Jan 23rd
    0 Files
  • 24
    Jan 24th
    0 Files
  • 25
    Jan 25th
    0 Files
  • 26
    Jan 26th
    0 Files
  • 27
    Jan 27th
    0 Files
  • 28
    Jan 28th
    0 Files
  • 29
    Jan 29th
    0 Files
  • 30
    Jan 30th
    0 Files
  • 31
    Jan 31st
    0 Files

Top Authors In Last 30 Days

File Tags


packet storm

© 2018 Packet Storm. All rights reserved.

Security Services
Hosting By