You are browsing the archive for Anti-Forensics.

Beyond good ol’ Run key, Part 30

April 26, 2015 in Anti-Forensics, Autostart (Persistence), Compromise Detection, Forensic Analysis, Malware Analysis

Many laptops come with preinstalled packages that enhance user experience by responding to gestures and shortcuts available via a touchpad. One of the most popular packages offering such functionality comes from Synaptics. My old laptop has it preinstalled as well and… that’s how this post was born.

While exploring the options of the program I discovered that you can associate a lot of various actions with buttons and areas/zones of the touchpad. Turns out that one such interesting action is… running an arbitrary program :)

synaptics1Clicking the Configure button allows us to choose the path to the program:

synaptics2Same goes for the right button (and also zones shown at the bottom of the left pane):

synaptics3Once I configured these I was able to launch the program of my choice by just playing with the touchpad.

I must mention that it is not a vulnerability – it is just a flexibility offered by the program allowing user to define what they want to do with their computer. But of course it could be abused as a persistence mechanism.

The place in the Registry where these paths are stored is shown below:

  • HKCU\Software\Synaptics\SynTPEnh\PlugInConfig\TouchPadPS2

synaptics4The information about what action should be triggered is stored here:

  • HKCU\Software\Synaptics\SynTP\TouchPadPS2
    • LeftButtonAction = if equal 0 the default touchpad action is overridden with the action of the plugin defined by the next 2 entries below (LeftButtonPlugInID & LeftButtonPlugInActionID)
    • LeftButtonPlugInID = changed to ‘SynTP’
    • LeftButtonPlugInActionID = if this ActionID is equal to 5 then it is program execution

synaptics5Right button (and other buttons, if present)  as well as zones all have similar set of settings (again, their actual availability depends on a touchpad model/hardware/); the respective registry entries are:

  • TopLeftCornerPlugInID=
  • TopRightCornerPlugInID=
  • BottomLeftCornerPlugInID=
  • BottomRightCornerPlugInID=
  • LeftButtonPlugInID=
  • MiddleButtonPlugInID=
  • RightButtonPlugInID=
  • UpButtonPlugInID=
  • DownButtonPlugInID=
  • 2FingerTapPlugInID=
  • 3FingerTapPlugInID=
  • ExButton1PlugInID=
  • ExButton2PlugInID=
  • ExButton3PlugInID=
  • ExButton4PlugInID=
  • ExButton5PlugInID=
  • ExButton6PlugInID=
  • ExButton7PlugInID=
  • ExButton8PlugInID=
  • PressToSelectPlugInID=
  • Button5PlugInID=
  • ButtonModePlugInID=
  • 3FingerPressPlugInID=
  • PalmOnPadPlugInID=
  • 2FingerDoubleTapPlugInID=

and each of them have the respective ‘ActionID’ settings e.g.:

  • TopRightCornerPlugInID -> TopRightCornerPlugInActionID

The chance we will come across it on real cases are pretty low, but just adding it here for completeness.

Beyond good ol’ Run key, Part 29

March 13, 2015 in Anti-Forensics, Autostart (Persistence), Compromise Detection, Forensic Analysis, Malware Analysis

LNK files are used by malware for many years so there is not much new about it that can be said with regards to persistence.

Examples include:

  • Placing shortcut files in popular locations (Desktop, Start Menu)
  • Replacing an .exe path inside the .lnk files with one pointing to a malicious executable (‘man-in-the-middle’, or a variant of a companion virus)
  • Exploits (as used by Stuxnet)
  • Etc.

The following examples explore 2 more (but less popular) methods of leveraging LNK files as a persistence mechanism.

Hot Keys

The first one relies on Hot Keys. LNK files placed on a Desktop or in a Start Menu have an interesting property – they can register hot keys that may activate the respective lnk file i.e. launch them.

This was handy back in a day when icons on a desktop were hidden most of the time and using shortcuts allowed accessing the most popular applications w/o a need to minimize all windows, or browsing through the Start Menu. Today, the new Taskbar in Win7/8/10 + Windows+<number> combinations make this functionality pretty much obsolete. But it’s still there. And one can modify an existing Desktop/Start Menu shortcut, or create a new one that will point to a malware.

It will be activated anytime a specific combination of keys is hit.

Of course, which key combination to choose is a tricky part – a wrong choice could affect running applications. One can always explore possibilities by checking the Shortcut Key section on the Shortcut Properties Window. Interestingly, manually setting the keys will almost always include a CTRL+ALT prefix (added by the OS). It limits a range of popular keys that can be entered via Shortcut Properties Window (note: some keys f.ex. F1-F12 are not prefixed):


One could bypass this restriction by setting the keys directly via COM object responsible for creation of shortcuts (IShellLink interface), or even manually modifying the .lnk file (on a binary level).

To demonstrate this trivial trick we can look at the following snippet of code.

set w = CreateObject("")
d = w.SpecialFolders("Desktop")
set l = w.CreateShortcut(d + "\foo.lnk")
l.WindowStyle = 4
l.TargetPath = "c:\test\malware.exe"
l.Hotkey = "Captial"

It leverages a COM IShellLink interface accessed via Visual Basic Script to create a shortcut to a c:\test\malware.exe file. The ‘malware’ will be activated anytime someone presses a CAPS LOCK. A trivia fact: ‘Captial’ is actually how VBS refers to a CAPS LOCK key.

This choice of key(s) is actually not that bad – people don’t use CAPS LOCK at all and at the same time – they often press it accidentally every once in a while. After some more tests it also looks that it does NOT affect running programs, so f.ex. if you type something, then press CAPS LOCK (malware runs), applications will still interpret CAPS LOCK and switch to capital letters. Pressing it again brings the small letters back (while malware executes again).

A kinda similar concept applies to F1 which could be used as an alternative (people don’t use a built-in Help that often either).

This is how the generated shortcut looks like in the Shortcuts Properties Window:


And this is what happens when you hit Caps Lock:

lnk3aThe c:\test\malware.exe is a simple program showing a message box.

Command line modification

The other way one can exploit the .LNK files is by modifying not the path to the executable itself, but by changing the command line arguments. This is in fact a technique that is actively used by malicious plugins. They use this trick to patch .LNK files pointing the Google Chrome browser to load a malicious plugin via a modified command line. The command line switch that is added is ‘–load-extension’.

Chrome uses a lot of command line arguments that could be potentially abused the same way.