Password protection in vba project

D

Daniel

Hi,

I'm working on a project utilizing excel vba. The problem we have now is
that it seems to be quite easy to crack the vba password with 3rd party
tools. Is there any batter way to protect our code?

Thanks.

Daniel
 
J

Jialiang Ge [MSFT]

Hello Daniel,

From your post, my understanding on this issue is: you want to know how to
protect the Office solution's VBA code securely. If I'm off base, please
feel free to let me know.

According to the MSDN article:
http://msdn2.microsoft.com/en-us/library/aa189867(office.10).aspx, there
are four ways to control access to the VBA code:

1. Set a password that is required before the VBA code can be viewed.
(http://support.microsoft.com/kb/159748). You mentioned that this method is
not secure enough because some 3rd party tools may crack the password.
Based on my research, these tools seem to use "brute force" methods and
rely on dictionaries of common passwords. Because we are *locking* VBA, not
protecting the document content, and because VBA does not expose the
VBProject passwords in its object model, the usual approach to crack the
password is to use SendKeys to simulate the keystrokes that would be used
to enter the password for the project. Therefore, you can improve the
security of your file by using a long string of secure password:
http://www.microsoft.com/smallbusiness/support/articles/select_sec_passwords
..mspx

2. Though a secure password can improve the security of the vba codes, the
password can still be cracked some day in theory. To provide the highest
level of security for your VBA code, use Microsoft Visual Basic to create a
Component Object Model (COM) add-in. Because the VBA code in a COM add-in
is compiled as a dynamic-link library (DLL), it can't be modified without
access to the source code used to originally create it.
Application-specific add-ins are not compiled; you must use the same
protections as templates and documents. For information about how to create
COM add-ins, see
http://msdn2.microsoft.com/en-us/library/aa189019(office.10).aspx

3. In Access, you can save an .mdb or .adp file as a file type that
contains only compiled VBA code without the source code. For .mdb files,
this file type is called an .mde file; for .adp files, this file type is
called an .ade file. VBA code in these file types still runs, but there is
no way to view or modify the code.
http://msdn2.microsoft.com/en-us/library/aa141451(office.10).aspx

4. You can use file-system access-control features to control what users
can do with documents and templates. See:
http://msdn2.microsoft.com/en-us/library/aa190075(office.10).aspx

Please let me know if you have any other concerns, or need anything else.

Sincerely,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Daniel

Thanks for your help Jialiang. I'll investigate into it and see how I could
utilize these approaches.

Daniel
 
K

Karl E. Peterson

Daniel said:
I'm working on a project utilizing excel vba. The problem we have now is
that it seems to be quite easy to crack the vba password with 3rd party
tools. Is there any batter way to protect our code?

The *only* method that protects your code is to remove it from Excel/VBA and compile
it using VB5/6. That's it. Microsoft left a *gaping* security hole in their Office
product line, and is now spouting nonsense (method #1) in their response to you
here.
 
K

Karl E. Peterson

Jialiang Ge said:
Based on my research, these tools seem to use "brute force" methods and
rely on dictionaries of common passwords. Because we are *locking* VBA, not
protecting the document content, and because VBA does not expose the
VBProject passwords in its object model, the usual approach to crack the
password is to use SendKeys to simulate the keystrokes that would be used
to enter the password for the project. Therefore, you can improve the
security of your file by using a long string of secure password:
http://www.microsoft.com/smallbusiness/support/articles/select_sec_passwords.mspx

You should be ashamed, as should the company that employs you, for offering this
advice. While Office documents do use passwords to "protect" VBA code, a simple
25-line subroutine can strip it out of any XLS (or other Office document) in a few
milliseconds. Suggesting a stronger password is like using duct-tape and sheets of
plastic to seal up your home from terrorists. Recognize the problem. Ignorant and
meaningless gestures don't help anyone.
 
J

Jialiang Ge [MSFT]

Hi Daniel,

If you need further assistance, feel free to let me know. I will be more
than happy to be of assistance.

Have a great day!

Sincerely,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Karl E. Peterson

Jialiang Ge said:
If you need further assistance, feel free to let me know. I will be more
than happy to be of assistance.

Do you feel that's what you were? Honestly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top