A Look at the Open Type Font Manager Vulnerability from the Hacking Team Leak
Earlier this week, the Italian company known as Hacking Team experienced a breach, with more than 400GB of confidential company data made available to the public. The company was known for selling what it described as tools used to lawfully intercept communications that could be used by governments and law enforcement agencies. The company has stated they do not do business with oppressive countries.
Much of the leaked information covered Hacking Team’s business practices, which seemingly contradict their official statements on who they sell their products to. However, the leak also included the tools provided by the company to carry out attacks, including several exploits targeting Adobe Flash Player and Windows Kernel.
Since we have already discussed one of the Adobe Flash Player vulnerabilities, I decided to look into the Windows Kernel vulnerability. The vulnerability exists in the open font type manager module (ATMFD.dll), which is provided by Adobe. The DLL is run in the kernel mode. An attacker can exploit the vulnerability to perform privilege escalation which can bypass the sandbox mitigation mechanism.
Looking into the vulnerability
The vulnerability‘s root cause is simple. When the application calls for some GDI API (e.g., GDI32!NamedEscape), it can specify which font driver can be used in the font processing. ATMFD.dll is one of the font drivers. While the module processes the font data, there exists a buffer underflow, which is caused by a signed number extending.
I have simplified the vulnerability below:
Figure 1. Simplified vulnerability code
In line 5, the code is signed extending. If i is 0x8000, then index will be 0xffff8000. The check in line 6 will be successful, because index has a very small value (negative value) from the signed number view. In line 8, index*2+6 will become a negative value, so buffer_base[index*2+6] will point to a position which is in front of the buffer_base.
The font buffer’s content can be prepared by an attacker, so that the vulnerability can be used to write controlled content to the position which is front of the input buffer.
Additional information about this leak and the other exploits can also be found in our entry, Unpatched Flash Player Flaw, More POCs Found in Hacking Team Leak. We will update this entry should any information be made available.