File Extension Spoofing in Windows Defender Antivirus

Project Description

Using file extension spoofing, an attacker can counterfeit a harmless file extension of a file. This could be used to trick users into executing an executable without recognising.

Vendor description

“Keep your PC safe with trusted antivirus protection built-in to Windows 10. Windows Defender Antivirus delivers comprehensive, ongoing and real-time protection against software threats like viruses, malware and spyware across email, apps, the cloud and the web.


Business recommendation

Update to the latest version of the Windows Defender Antivirus definitions.

Vulnerability overview/description

The vulnerability is based on the file extension spoofing method using the RTL unicode character to display a spoofed file extension. This method uses the LTR unicode character, that instructs the following text to be shown in left-to-right order. Lets assume [LTR] is the LTR unicode character, an attacker can use this unicode character to fool a user into believing that a file has a different extension.

For example an attacker may name an executable file (.exe) spoofed-[LTR]gpj.exe, which would be displayed as spoofed-exe.jpg on an LTR-based system. The most important point here is to have the extension you want to be shown in reverse order, since it will be shown right-to-left. Combined with the right file icon, an attacker can imitate an arbitrary file extension.

Same goes for other extensions too, like xlsx for a Microsoft Excel Sheet. During testing it happened that xlsx was typed in the wrong order (xslx instead of xlsx since reverse order) and Windows Defender Antivirus removed the test file while we tried to execute it. As a result, two files were created, with the exact same executable but with different fake extensions:

  1. spoofed-[RTL]xslx.exe (displayed as spoofed-exe.xlsx)
  2. spoofed-[RTL]xlsx.exe (displayed as spoofed-exe.xslx)

The second one was deleted, while the first one could be executed without any problem.

Therefore, other extensions related to Microsoft Office were tested as well, but it seems only the xlsx extension had a detection for it.

While the security issue of spoofing the file extension by using the RTL unicode character (on RTL systems it is the same just with LTR) is widely known, it seems to be unknown that Microsoft already started to add detection mechanisms for this issue. But since it is not implemented for all extensions and it seems to be implemented in the wrong order, this feature is mostly unknown.

Proof of concept

For the proof of concept a file has to be renamed in Unicode mode using the Unicode character ‘202E’ (‘\u202E’ in C), which stands for RTL. The sample code is written in C/C++ and uses the unicode API of Windows. A Python PoC has been made as well.



int main(int argc, char** argv)
	wchar_t opath[] = L"test.exe";
	wchar_t npath_ok[] = L"spoofed-\u202Exslx.exe"; // String for filename 'spoofed-exe.xlsx'
	wchar_t npath_wrong[] = L"spoofed-\u202Exlsx.exe"; // String for filename 'spoofed-exe.xslx'
	// Copy 'test.exe' to file shown as 'spoofed-exe.xlsx'
	CopyFileW(opath, npath_ok, false);
	// Copy 'test.exe' to file shown as 'spoofed-exe.xslx'
	CopyFileW(opath, npath_wrong, false);


from shutil import copyfile

opath = "test.exe"
npath_ok = "spoofed-\u202Exslx.exe" # String for filename 'spoofed-exe.xlsx'
npath_wrong = "spoofed-\u202Exlsx.exe" # String for filename 'spoofed-exe.xslx'

# Copy 'test.exe' to file shown as 'spoofed-exe.xlsx'
copyfile(opath, npath_ok)
# Copy 'test.exe' to file shown as 'spoofed-exe.xslx'
copyfile(opath, npath_wrong)

There will be two new files after the execution (as long as ‘test.exe’ exists) and the file shown as ‘spoofed-exe.xslx’ will be deleted while trying to execute (or earlier) as shown
in figure 1.

Figure 1: File gets deleted by Windows Defender Antivirus.

Figure2: Test file is executed.


Vulnerable / tested versions

Windows Defender Antivirus has been tested in its latest version 4.18.1908.7-0, updated at 25th of September 2019.

Vendor contact timeline

2019-09-26Providing vendor the advisory through
2019-10-01Microsoft answered that this is no vulnerability, but the virus definition database will be updated
2019-12-11Public release of security advisory


The update of the virus definition database of the 30th of September provides a fix.


There is no workaround available.

Advisory URL

EOF David Haintz / @2019

Interested to work with the experts of SEC Consult? Send us your application
Want to improve your own cyber security with the experts of SEC Consult? Contact our local offices.

Project Details

  • TitleFile Extension Spoofing
  • ProductWindows Defender Antivirus
  • Vulnerable version4.18.1908.7-0
  • Fixed versionVirus Definition Update of 2019/09/30
  • CVE number-
  • ImpactHigh
  • Homepage
  • Found2019-09-25
  • ByDavid Haintz (Office Vienna) | SEC Consult Vulnerability Lab