Beyond good ol’ Run key, Part 137

This is a neat persistence trick you can use… if you got access to TrustedInstaller…

The wininet.dll library in Windows 10+ extends the functionality of InternetErrorDlg function to reach out to a configurable Registry location that supports handling of unknown error messages. The function takes the error code as an argument and reaches out to the following location:

HKLM\SOFTWARE\Microsoft\Windows\
CurrentVersion\Internet Settings\LUI\<error>

It then reads the value in a form of an expandable string and extracts library name from it by splitting it from the exported API name using an exclamation mark as a separator. And if a given error code doesn’t have an entry the function defaults to value ‘0’ which by default points to:

%SystemRoot%\system32\wininetlui.dll!InternetErrorDlgEx

I was curious if I could force the loading of my own payload and after launching Process Monitor with a filter on \Lui path I was able to quickly trigger error 12040 (ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR). I then added an entry for my own test library and was able to load my DLL 🙂

There are at least two caveats:

  • You need TrustedInstaller rights to add/modify the registry entry
  • User needs to use Internet Explorer (I couldn’t trigger it in Edge)

Yara Carpet Bomber, Part 2

Steve asked about the use cases for Yara Carpet Bomber approach and in this twitter convo I provided 2 examples of quick & dirty Yara rules:

that help to find all references to API names (including API names spelled backward) within a given binary e.g. in this case Notepad executable. It may come handy if you want to quickly check for API references that are inside any place of the files including import tables and strings used to resolve APIs dynamically:

The list includes APIs from the following libraries:

  • advapi32.dll
  • avicap32.dll
  • cabinet.dll
  • combase.dll
  • crypt32.dll
  • dbghelp.dll
  • dbnetlib.dll
  • gdi32.dll
  • icmp.dll
  • IPHLPAPI.DLL
  • kernel32.dll
  • mfc140.dll
  • MFCaptureEngine.dll
  • mpr.dll
  • mscoree.dll
  • mstask.dll
  • ntdll.dll

You can download the set here.