Malicious Intent using Adobe Acrobat's OCG setIntentMay 29, 2018 | Abdul-Aziz Hariri
Throughout this blog post, I will discuss a vulnerability that we received through the program (ZDI-18-173) that affected the
For example, we can create a simple OCG through the
We can retrieve the OCGs through the
OCG objects expose various properties and methods that allow us to control the layers to a certain extent. One method of interest is the
setIntent method. This method is used to set the OCG
setIntent is implemented inside
Escript.api, which is located inside the plug-ins folder in Acrobat. I won’t dig into how to locate
Escript in this blog -- we’ll cover that in a future MindshaRE blog.
For now, let’s assume that we located
I’ve removed portions of the decompiled code of the
sub_238B9F62 function and only kept the portions that are relevant:
At  in Figure 2 above, the length property of the array is retrieved and is fully controlled by the attacker. Then at  in the figure above, memory is allocated based on the size computed at . Finally, at , the length is used in a loop that overflows the allocated buffer:
Logically, any value that causes the wrap ( > 0x7FFFFFFF) takes the vulnerable code path. Hence, this fact should be taken into consideration when fixing the bug. Nevertheless, Adobe’s developers decided to take a shortcut with the patch:
They wanted to make sure that the size is not exactly 0x7FFFFFFF. Obviously, this was an inadequate response because that’s not the only value that triggers the bugs.
Once the patch was out, the researcher did not waste any time. He literally sent us the patch bypass a couple of hours later. The POC looks exactly the same as the original POC with a minor change: setting the array length with 0xFFFFFFFF instead of 0x7FFFFFFF. Again, any value greater than 0x7FFFFFFF would work. Here’s the bypass:
This time, the developers at Adobe realized that simple value checks won’t cut it and came up with the following solution to avoid the integer wrap:
It’s amazing how huge the attack surface is for Adobe Acrobat. It’s also amazing to think how many systems have Acrobat installed. What makes it even more interesting is the lack of advanced mitigations, which makes it relatively easier to target than other applications. Add to that some less than proper patching, and it’s easy to see why it remains a popular target for researchers.
When compared to some other vendors, there’s still a long way for Acrobat to catch up with the modern mitigation game, and we’ll be watching their improvements closely. Until then, Acrobat will likely remain an attractive target for bug hunters.