Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Modules" as keyword for self-modification #823

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DecimalTurn
Copy link
Contributor

@DecimalTurn DecimalTurn commented Sep 18, 2023

I recently found this question on Stack Overflow, it shows how to import a new code module in VBA using the Modules object.

Here's a simplified snippet that illustrates how it works:

    Dim ThisModule As Module
    Set ThisModule = ThisWorkbook.Modules.Add
    ThisModule.InsertFile "C:\Users\(username)\Desktop\..."

I always thought you had to use VBComponents.Import, but turns out there is this undocumented method as well.

@DecimalTurn
Copy link
Contributor Author

For the record, the snippet of code above won't be flagged by olevba as malicious, but does manage to import a VBA module even if "trust access to the vba project object model" is disabled!

@decalage2 decalage2 self-requested a review June 10, 2024 10:48
@decalage2 decalage2 self-assigned this Jun 10, 2024
@decalage2 decalage2 added this to the oletools 0.60 milestone Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants