Python In Excel - Potential Abuse By Attackers
Incident Report for Rapid Response Status Page
Resolved
This incident has been resolved.
Posted Aug 24, 2023 - 14:41 UTC
Update
Based on further research of the new Python In Excel feature, a hunting query was created to detect modifications of the mentioned registry key to the value 0. This will allow Python code to be executed by Excel without any warning or permission from the user. We suggest using the following query to monitor such cases and mitigate potential risks in the future.

Check the hunting query Axon Rapid Response Git repository - https://github.com/axon-git/rapid-response/blob/main/Python%20In%20Excel/python_security_warning_reg_modification.sql

Please reach out to the team if there are any further questions.

Thanks,
Team Axon
Posted Aug 24, 2023 - 14:40 UTC
Investigating
Yesterday, Microsoft introduced “Python in Excel” (https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439), a built-in integration in Excel with Python to allow data analysis and visualization based on Python packages with Excel’s capabilities. Currently, Python in Excel is available only for Microsoft 365 Insider Program beta users and is expected to be available to all users in the future .

While this feature has great potential, we expect that threat actors will utilize the capability to execute malicious Python code in order to deploy malware or steal sensitive data from the impacted device. To mitigate this threat we highly suggest modifying the relevant registry keys as suggested by Microsoft using one of the following commands (https://support.microsoft.com/en-us/office/data-security-and-python-in-excel-33cc88a4-4a87-485e-9ff9-f35958278327):

1. Warning - Enable a warning prompt when opening an Excel file that contains Python code:
reg add HKCU\software\policies\microsoft\office\16.0\excel\security /v PythonFunctionWarnings /t REG_DWORD /d 1 /f 
2. Block - Block Python code from being executed in Excel files:
reg add HKCU\software\policies\microsoft\office\16.0\excel\security /v PythonFunctionWarnings /t REG_DWORD /d 2 /f

The team will conduct a more in-depth exploration and will update with relevant information.

Thanks,
Team Axon
Posted Aug 23, 2023 - 14:41 UTC
This incident affected: Rapid Response.