Skip to content

Twitter icon Follow me?

16 Jul Oh, meant MAX_PATH, not PATH_MAX.

16 Jul PathCanonicalize is great, but what if my path is longer than PATH_MAX characters? Any suggestions? #win32

14 Jul GetFileVersionInfoSize("c:Program FilesAux") blocks forever on Windows XP. Is that an OS bug?

13 Jul srvklw32.exe - new Bredolab worm variant. Discovered a few days ago. 15% detection rate: http://www.freefixer.com/library/file/59990/

08 Jul bill114.exe - another update of the Koobface download. http://www.freefixer.com/library/file/59929/

06 Jul npi.dll nad npi.sys comes with the Koobface worm. Only Mcafee detects it at the moment: http://www.freefixer.com/library/file/59802/

06 Jul Added rel="canonical" to some of the file info pages on the FreeFixer.com web site.

05 Jul sisytj32.exe is a Bredolab variant. A typical sign of infection is svchost.exe using 100% CPU. http://www.freefixer.com/library/file/59777/

04 Jul Playing around with the C++ tr1 binders.

29 Jun bill113.exe, yet another Koobface variant: http://www.freefixer.com/library/file/59577/

19 Jun uClassify back-end server now available for download: http://blog.uclassify.com/download-evaluation-server/

14 Jun Uploads to VirusTotal up and running again. Disabled cURLs "Expect: 100-continue" HTTP header and that solved the problem.

13 Jun "Ping.fm have temporarily suspended the use of twitterfeed with their service" That's why my feeds are not posted anymore :(

13 Jun xiaosos.exe, xiaodll0.dll, xiaodll1.dll and xiaodll2.dll comes with a password stealer: http://www.freefixer.com/library/file/58980/

09 Jun bill112.exe removal instructions: http://www.freefixer.com/library/file/58829/

09 Jun TR/Buzus.dhxv blocks access to freefixer.com: http://www.avira.com/en/threats/section/fulldetails/id_vir/5193/tr_buzus.dhxv.html

09 Jun netbhl32.exe comes with the Bredolab worm. I've posted removal instructions here: http://www.freefixer.com/library/file/58794/

08 Jun ping.fm + twitterfeed does not work for me anymore. Anyone else also having the same problem?

06 Jun Virustotal.com up and running again :) The 28 files in the queue at FreeFixer.com should be scanned shortly.

06 Jun FreeFixer.com now running on 64-bit Linux. Please let me know if you see any problems.

07 June 2010

Crash in CDHtmlDialog's OnInitDialog method

Recently I implemented a crash report system for FreeFixer which allows the user to upload the FreeFixer memory dump for analysis. A memory dump is generated if an unhandled exception occur, such as an access violation exception, or if the application triggers an ASSERT. With the help of the memory dump, FreeFixer's executable file, and the symbols, I can see exactly where in the code the problem occur. This have been quite useful to track down some bugs.

Today I downloaded the 10 dumps generated from FreeFixer v0.58 for analysis. There has been approximately 20.000 downloads since the release of FreeFixer v0.58 three weeks ago. There are two bugs that has been around for some time where I've not found any fix.

Five of the dumps highlights a problem that appears during initialization. FreeFixer's user interface is built with a CDHtmlDialog. When the application starts, I call the dialog's DoModal() method, which later on calls my OnInitDialog() method, which immediately calls CDHtmlDialog::OnInitDialog.


BOOL CDHtmlDialog::OnInitDialog()
{
	AfxEnableControlContainer();

	CDialog::OnInitDialog();

	RECT rectClient;
	GetClientRect(&rectClient);

	// if we've been created from the dynamic template
	// set the caption
	if (!m_lpszTemplateName)
		SetWindowText(m_strDlgCaption);

	// check if there is a browser control on the dialog
	// already
	CWnd *pCtrl = GetDlgItem(AFX_IDC_BROWSER);
	LPUNKNOWN lpUnk;
	if (pCtrl)
	{
		lpUnk = pCtrl->GetControlUnknown();
		if (lpUnk && SUCCEEDED(lpUnk->QueryInterface(IID_IWebBrowser2, (void **) &m_pBrowserApp)))
		{
			m_wndBrowser.Attach(pCtrl->m_hWnd);
			m_bAttachedControl = TRUE;
		}
	}
	if (m_pBrowserApp == NULL)
	{
		// create the control window
		m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL,
					WS_VISIBLE | WS_CHILD, rectClient, this, AFX_IDC_BROWSER);
		lpUnk = m_wndBrowser.GetControlUnknown();
boom->		if (FAILED(lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp)))
		{
			m_wndBrowser.DestroyWindow();
			DestroyWindow();
			return TRUE;
		}

In the code listed above, m_wndBrowser.GetControlUnknown() returns NULL and is assigned to the lpUnk variable, and later on a call to lpUnk->QueryInterface is done. There we have an access violation exception. Unfortunately I've not been able to figure out why does problem appear, and why it only appears in 1 out of 4000 downloads. Do you know of a solution to this problem? Please let me know.

There are a few suggestions available to fix this problem, such as calling CoInitialize(NULL) or AfxEnableControlContainer() in the application's InitInstance() method. However, none of these fixes has solved the problem:

The 5 remaining dumps is related to FreeFixer's code that extracts icons from executable files which are displayed in the scan result. The code goes something like this:


HMODULE module = LoadLibraryEx(filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (!module) return;

[..do some work on the module..]

const BOOL result = FreeLibrary(module);
ASSERT(result);

The result from FreeLibrary is passed to the ASSERT macro since I assume it is programming error if FreeLibrary fails when passed a valid HMODULE. However, the assertion is triggered, approximately once every 4000 downloads. Unfortunately I don't have the file name of the module that the code loads which probably would give some hints why the problem occur. Another interesting observation is that all five dumps shows that the machines where running the BitDefender anti-virus. Anyone else noticed this problem?

Permalink | Comments

23 April 2009

Porting Native API calls to Windows 7

I'm currently porting FreeFixer for the Windows 7 platform. Luckily the different flavors of Windows does not differ that much from one release to another, so most of the unit tests worked without any changes to the existing code.

There's one piece of code that needed an update though, and it's the rootkit detection plugin, which in its current state detects hidden processes. This plugin uses the Windows Native API. The Native API is incompletely documented and used internally by the Windows NT operating systems (NT, XP, 2000, Vista, Win7, etc). FreeFixer calls the Native API by putting the system calls index in the eax register, and then using sysenter or int 2Eh depending on the platform. By using this procedure, FreeFixer can bypass some of the rootkit hooking techniques that hide running processes.

There is one problem though, the system call index numbers have changed from release to release, and Windows 7 was not exception, so the code needed an update. The following lists some of the index numbers for the Windows 7 platform:

NtQuerySystemInformation  = 0x106
NtQueryInformationProcess = 0xe4
NtReadVirtualMemory       = 0x105
NtOpenProcess             = 0xbf

Hope this helps if you are porting your Native API calls to Windows 7.

Permalink | Comments

20 February 2009

OpenProcess and Audiodg.exe

I'm currently working on getting my malware removal tool FreeFixer up and running on the Windows Vista platform. FreeFixer woks by scanning the registry and the file system to find unwanted software. It is also enumerating processes, their file names and their modules. This is were I ran into some minor problem. On Windows XP I had previously obtained the SeDebugPrivilege privilege (defined as SE_DEBUG_NAME) and then opened all processes with the OpenProcess system call and passing PROCESS_QUERY_INFORMATION | PROCESS_VM_READ as the requested access. However, on Windows Vista OpenProcess failed on Audiodg.exe, with the ERROR_ACCESS_DENIED error code.

Audiodg.exe - a protected process

Windows Vista introduced a new type of process, the protected process. Protected processes are there to enhance support for digital rights management functionality in Windows Vista. [1]

A typical protected process does not allow injecting a thread into the process, accessing virtual memory of process, debugging the process, duplicate handles of the process, changing the quota or working set of a process.
You cannot open a typical protected process with PROCESS_QUERY_INFORMATION nor PROCESS_VM_READ. Luckily Vista introduced the PROCESS_QUERY_LIMITED_INFORMATION, which is a limited version of the PROCESS_QUERY_INFORMATION access right. This will allow you to open the process with OpenProcess and at least get the full path of the protected process. I think - please correct me if I'm wrong - that it's not possible to enumerate the modules of audiodg.exe from without the help of a kernel-mode component?

Permalink | Comments

How to toggle tab size in Visual Studio using a macro

Here's a code snippet that toggles the C/C++ editor's tab size between 2, 4 and 8:

' Author: Roger Karlsson
' http://rogerkarlsson.com/blogs/programming/toggle-tab-size/
Public Module ToggleTabSize

    ' Toggle the C/C++ editor's tab size between 2, 4 and 8.
    Sub Toggle()
        Dim props As EnvDTE.Properties = DTE.Properties("TextEditor", "C/C++")
        Dim ts As EnvDTE.Property
        Dim ins As EnvDTE.Property

        ts = props.Item("TabSize")
        ins = props.Item("IndentSize")

        If ts.Value = 2 Then
            ts.Value = 4
            ins.Value = 4
        ElseIf ts.Value = 4 Then
            ts.Value = 8
            ins.Value = 8
        Else
            ts.Value = 2
            ins.Value = 2
        End If
    End Sub

End Module

Permalink | Comments