19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

556 Chapter 13 n Attacking Users: O<strong>the</strong>r Techniques<br />

have been identified within <strong>the</strong> ActiveX controls issued by popular <strong>web</strong><br />

<strong>application</strong>s, such as online gaming sites. These vulnerabilities normally<br />

can be exploited to cause arbitrary code execution on <strong>the</strong> computer of<br />

<strong>the</strong> victim user.<br />

n Many ActiveX controls contain methods that are inherently dangerous<br />

and vulnerable to misuse:<br />

n LaunchExe(BSTR ExeName)<br />

n SaveFile(BSTR FileName, BSTR Url)<br />

n LoadLibrary(BSTR LibraryPath)<br />

n ExecuteCommand(BSTR Command)<br />

Methods like <strong>the</strong>se usually are implemented by developers to build some<br />

flexibility into <strong>the</strong>ir control, enabling <strong>the</strong>m to extend its functionality in <strong>the</strong><br />

future without needing to deploy a fresh control. However, after <strong>the</strong> control<br />

is installed, it can, of course, be “extended” in <strong>the</strong> same way by any malicious<br />

<strong>web</strong>site to carry out undesirable actions against <strong>the</strong> user.<br />

Finding ActiveX Vulnerabilities<br />

When an <strong>application</strong> installs an ActiveX control, in addition to <strong>the</strong> browser<br />

alert that asks your permission to install it, you should see code similar to <strong>the</strong><br />

following within <strong>the</strong> HTML source of an <strong>application</strong> page:<br />

<br />

<br />

This code tells <strong>the</strong> browser to instantiate an ActiveX control with <strong>the</strong> specified<br />

name and classid and to download <strong>the</strong> control from <strong>the</strong> specified URL. If<br />

a control is already installed, <strong>the</strong> codebase parameter is not required, and <strong>the</strong><br />

browser locates <strong>the</strong> control from <strong>the</strong> local computer, based on its unique classid.<br />

If a user gives permission to install <strong>the</strong> control, <strong>the</strong> browser registers it as “safe<br />

for scripting.” This means that it can be instantiated, and its methods invoked,<br />

by any <strong>web</strong>site in <strong>the</strong> future. To verify for sure that this has been done, you can<br />

check <strong>the</strong> registry key HKEY_CLASSES_ROOT\CLSID\classid of control taken<br />

from above HTML\Implemented Categories. If <strong>the</strong> subkey 7DD95801-9882-<br />

11CF-9FA9-00AA006C42C4 is present, <strong>the</strong> control has been registered as “safe for<br />

scripting,” as shown in Figure 13-6.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!