Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2025, 11:19 PM
syl3786 syl3786 is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2019
Advanced Beginner
Is Customizing Word's Ribbon UI Safe?
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Unhappy Is Customizing Word's Ribbon UI Safe?

I recently tried customizing Word's Ribbon UI:

My procedure:
  1. Created a .dotm file
  1. Added custom XML for Ribbon modifications using Office RibbonX Editor
  1. Placed file in Word's STARTUP folder:
    C:\Users[USER]\AppData\Roaming\Microsoft\Word\STARTUP

🚨 RED FLAG:
My antivirus immediately flagged the .dotm file as potentially harmful. It detected security vulnerabilities that could be exploited by malicious code. The warning suggested immediate removal of the file.

It is worth noting that my .dotm file contains only one simple module, which displays a message box.

My Questions:
  1. What's the current best practice for safe Ribbon customization?
  1. Are there modern alternatives to RibbonX Editor?
  1. Is there any way to edit the XML other than using RibbonX Editor? For example, can I change the .dotm file to a .zip, edit its XML code, repackage it as a .zip, and then change it back to a .dotm file? I tried this, but it didn’t work.
  1. How can we verify template security?



For now, I've removed the custom template for safety. I would love to hear from security experts on how to achieve this safely in 2025. The old methods seem too risky in today's threat landscape.
Reply With Quote
  #2  
Old 01-18-2025, 01:00 AM
Italophile Italophile is offline Is Customizing Word's Ribbon UI Safe? Windows 11 Is Customizing Word's Ribbon UI Safe? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Your antivirus was not objecting to your ribbon modification. It is objecting to the presence of the VBA code. Macros have been used for malicious code for a very long time.

Antivirus software can't tell the difference between malicious code and safe code.

There is no secure way of writing or distributing VBA code. The best you can do is sign your code with a code signing certificate.
Reply With Quote
  #3  
Old 01-18-2025, 01:21 AM
syl3786 syl3786 is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2019
Advanced Beginner
Is Customizing Word's Ribbon UI Safe?
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
Your antivirus was not objecting to your ribbon modification. It is objecting to the presence of the VBA code. Macros have been used for malicious code for a very long time.

Antivirus software can't tell the difference between malicious code and safe code.

There is no secure way of writing or distributing VBA code. The best you can do is sign your code with a code signing certificate.
Thank you for highlighting the VBA security aspect. However, this raises an even more concerning architectural security question:

If Microsoft Office applications weren't originally designed for end-user ribbon modifications, aren't we potentially creating security vulnerabilities by manipulating the UI architecture? Several security considerations come to mind:

Architectural Concerns:
  • The ribbon represents the primary interface layer with Office applications
  • Modifications could potentially create unexpected entry points
  • Custom XML parsing might be vulnerable to injection attacks
  • System integrity could be compromised through UI manipulation

Security Model Questions:
  • Does Microsoft officially support/secure custom ribbon modifications?
  • What validation exists for custom UI definitions?
  • How are ribbon customizations isolated from core application functions?
  • What prevents malicious code from hijacking custom UI elements?

Enterprise Security Implications:
  • Custom ribbons could bypass security policies
  • UI modifications might interfere with security controls
  • Potential for social engineering through modified interfaces
  • Risk of unauthorized system access through custom UI handlers
  • Would security experts recommend against any ribbon modifications in sensitive enterprise environments? How can organizations validate that ribbon customizations don't create security vulnerabilities?
Reply With Quote
  #4  
Old 01-18-2025, 03:56 AM
Italophile Italophile is offline Is Customizing Word's Ribbon UI Safe? Windows 11 Is Customizing Word's Ribbon UI Safe? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

The Microsoft Office applications were originally designed for end-user ribbon modifications.

As I originally stated, it is NOT modifying the ribbon that is the issue, it is the use of VBA that is the security issue. VBA is only a security issue because Office is used by lots of people who are routinely careless about security.

There are other methods of customizing Office:
  • VSTO - not cross-platform as it can only be used with Windows.
  • Office JS Apps - cross platform but the API doesn't have the depth that the COM object model does.

Microsoft has wanted to kill off VBA for a long time, but every time it tries to replace VBA with a modern technology it has only limited success. However, use of, and interest in, VBA has dwindled in recent years so perhaps they'll finally get their wish.

Customizing the Ribbon is only a security risk if it requires code to be executed, and it is the code that is executed that is the security risk not the Ribbon XML. I doubt that any bad actor would bother to modify the ribbon when code can be executed automatically simply by opening a document.
Reply With Quote
  #5  
Old 01-18-2025, 04:01 AM
Guessed's Avatar
Guessed Guessed is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You've asked a bunch of questions and some are relatively painless to answer.
Quote:
Are there modern alternatives to RibbonX Editor?
Yes, there are relatively inexpensive tools that you can buy to edit ribbons with.
Quote:
Is there any way to edit the XML other than using RibbonX Editor? For example, can I change the .dotm file to a .zip, edit its XML code, repackage it as a .zip, and then change it back to a .dotm file? I tried this, but it didn’t work.
Absolutely, you can edit the zip file's xml components but as you discovered, it won't work if you make a mistake with the code. Editing the zip file is easy but it is also easy to make a mistake which prevents the ribbon code from loading.

Quote:
How can we verify template security?
It is possible to create ribbon customisations that don't require vba code. So in that case your dotx/docx file is already safe and therefore trusted. However most customised ribbons do make use of code and the authoring of vba code is easier than the authoring of ribbons. Assuming your customisation requires code then (as recommended by Italophile) you would sign the code in the file and install the public key certificate on your user's machines so they can see the file is trusted.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old 01-18-2025, 05:01 AM
syl3786 syl3786 is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2019
Advanced Beginner
Is Customizing Word's Ribbon UI Safe?
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
The Microsoft Office applications were originally designed for end-user ribbon modifications.

As I originally stated, it is NOT modifying the ribbon that is the issue, it is the use of VBA that is the security issue. VBA is only a security issue because Office is used by lots of people who are routinely careless about security.

There are other methods of customizing Office:
  • VSTO - not cross-platform as it can only be used with Windows.
  • Office JS Apps - cross platform but the API doesn't have the depth that the COM object model does.

Microsoft has wanted to kill off VBA for a long time, but every time it tries to replace VBA with a modern technology it has only limited success. However, use of, and interest in, VBA has dwindled in recent years so perhaps they'll finally get their wish.

Customizing the Ribbon is only a security risk if it requires code to be executed, and it is the code that is executed that is the security risk not the Ribbon XML. I doubt that any bad actor would bother to modify the ribbon when code can be executed automatically simply by opening a document.
Thanks for the detailed explanation—I really appreciate it! You’ve brought up some great points, and it’s given me a lot to think about.

I didn’t realize that Microsoft Office was originally designed with end-user ribbon modifications in mind. If you happen to have any documentation or references about that, I’d love to check it out. It’s always interesting to learn more about the design decisions behind these tools.

I completely agree that VBA is the bigger security concern, especially given how widely Office is used and how easily users can overlook security risks. That said, I’ve also heard that XML-based customizations (like ribbon modifications) could potentially be exploited if not handled carefully. I’m not an expert on this, but it seems like both VBA and XML could have their own vulnerabilities depending on how they’re used.

It’s cool to hear about the alternatives like VSTO and Office JS Apps. Office JS Apps sound promising, especially since they’re cross-platform, but I can see how the lack of depth in the API compared to COM might be a drawback.

And yeah, it’s no surprise that Microsoft has been trying to move away from VBA for a while now. It’s interesting how it’s stuck around for so long, but it does seem like its usage is finally declining. Maybe this time they’ll succeed in phasing it out.

You’re absolutely right that the ribbon itself isn’t the security risk—it’s the code that gets executed. I doubt most bad actors would bother with ribbon modifications when they can just embed malicious code directly in a document. Still, I wonder if there’s any risk in how XML customizations are handled, especially if they’re not properly secured.

Anyway, thanks again for sharing your thoughts—this has been really helpful! If you have any more insights or resources, I’d love to hear them.
Reply With Quote
  #7  
Old 01-18-2025, 05:24 AM
syl3786 syl3786 is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2019
Advanced Beginner
Is Customizing Word's Ribbon UI Safe?
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You've asked a bunch of questions and some are relatively painless to answer.

Yes, there are relatively inexpensive tools that you can buy to edit ribbons with.

Absolutely, you can edit the zip file's xml components but as you discovered, it won't work if you make a mistake with the code. Editing the zip file is easy but it is also easy to make a mistake which prevents the ribbon code from loading.


It is possible to create ribbon customisations that don't require vba code. So in that case your dotx/docx file is already safe and therefore trusted. However most customised ribbons do make use of code and the authoring of vba code is easier than the authoring of ribbons. Assuming your customisation requires code then (as recommended by Italophile) you would sign the code in the file and install the public key certificate on your user's machines so they can see the file is trusted.
Thanks for the detailed explanation!

I’ve been thinking about how to handle deploying macros in an organization, especially with the rise of AI-generated code. Do you have any suggested workflows for rolling out new macros to multiple users?

I ask because I’ve seen cases where users rely on AI to generate VBA code, and while it’s great for quick solutions, it can also lead to security issues. For example, I once came across a Word macro that someone created using AI—it automatically searched selected text on Google. At first glance, it seemed harmless, but it ended up triggering antivirus alerts because it was flagged for potentially malicious behavior (turned out there was a trojan in the code).

So, I’m curious:

How do you balance the convenience of AI tools with the need for secure, reliable macros?

Do you have any tips for ensuring macros are safe before deploying them across an organization?

Looking forward to hearing your thoughts!
Reply With Quote
  #8  
Old 01-18-2025, 07:21 AM
Italophile Italophile is offline Is Customizing Word's Ribbon UI Safe? Windows 11 Is Customizing Word's Ribbon UI Safe? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by syl3786 View Post
I didn’t realize that Microsoft Office was originally designed with end-user ribbon modifications in mind. If you happen to have any documentation or references about that, I’d love to check it out. It’s always interesting to learn more about the design decisions behind these tools.
Design documentation was published on MSDN when Office 2007 was released. It's probably only available via the Wayback Machine now.

Quote:
Originally Posted by syl3786 View Post
That said, I’ve also heard that XML-based customizations (like ribbon modifications) could potentially be exploited if not handled carefully. I’m not an expert on this, but it seems like both VBA and XML could have their own vulnerabilities depending on how they’re used.
There is no scope for malicious XML in the RibbonUI because if the XML doesn't correspond to the schema it is rejected, silently unless the option to show UI errors has been checked.
Reply With Quote
  #9  
Old 01-18-2025, 07:29 AM
Italophile Italophile is offline Is Customizing Word's Ribbon UI Safe? Windows 11 Is Customizing Word's Ribbon UI Safe? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by syl3786 View Post
How do you balance the convenience of AI tools with the need for secure, reliable macros?
Ban the use of code generated by Artificial Idiocy.

Quote:
Originally Posted by syl3786 View Post
Do you have any tips for ensuring macros are safe before deploying them across an organization?
  • Always write the code yourself.
  • Never use code from the internet unless you fully understand what each line does.
  • Get a code signing certificate and sign your code.
  • Set macro security to "Disable all macros except digitally signed macros"
  • Accept that there is no such thing as "safe", there are only managed risks.
  • Accept that it will be necessary to educate the organization's IT staff as they will be risk averse by default.
Reply With Quote
  #10  
Old 01-19-2025, 07:02 AM
syl3786 syl3786 is offline Is Customizing Word's Ribbon UI Safe? Windows 10 Is Customizing Word's Ribbon UI Safe? Office 2019
Advanced Beginner
Is Customizing Word's Ribbon UI Safe?
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
Ban the use of code generated by Artificial Idiocy.


  • Always write the code yourself.
  • Never use code from the internet unless you fully understand what each line does.
  • Get a code signing certificate and sign your code.
  • Set macro security to "Disable all macros except digitally signed macros"
  • Accept that there is no such thing as "safe", there are only managed risks.
  • Accept that it will be necessary to educate the organization's IT staff as they will be risk averse by default.

Thank you for sharing your insights and advice on balancing the convenience of AI tools with the need for secure and reliable macros.

Your emphasis on understanding code, using code signing certificates, and managing risks is invaluable. I also appreciate your practical tips, such as setting macro security to disable unsigned macros and the importance of educating IT staff.

Your perspective on managed risks and the proactive steps you outlined are incredibly helpful for anyone navigating this space. Thanks again for your thoughtful contribution!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customizing Ribbon to load Templates Paralegal101 Word 1 12-10-2020 06:13 AM
Customizing the ribbon: Message tab on reply oleander Outlook 0 10-15-2018 10:17 AM
How to import the customized ribbon to Word without overwriting the existing Ribbon? SharonSh Word VBA 0 09-26-2013 11:47 PM
Is Customizing Word's Ribbon UI Safe? Customizing Ribbon in Excel Mixer Excel 3 03-19-2013 01:52 AM
Is Customizing Word's Ribbon UI Safe? Word won't open except safe mode netmouse Word 2 02-25-2009 06:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft