Skip to content

Uncontrolled Search Path Element vulnerability On AHK installer v2.0.2  #9

@marucrypt

Description

@marucrypt

Hello, @Lexikos. I'm opening this issue as advised by the AHK Discord mods.

AutoHotKey installer was found to have an untrusted search path vulnerability, since the installer is relying on the Windows default search order to load libraries. This could potentially allow an attacker to execute arbitrary code on a user's machine.

How to Reproduce (Proof of Concept)
Proof of concept worked on a Microsoft Windows 10 Home VM running version 10.0.19045 Build 19045 (with latest patches)

  1. Download AutoHotKey v2.0 installer from AutoHotKey's website.
  2. Create a custom DLL and name it TextShaping.dll
  3. On the same folder where the installer was downloaded (i.e. C:\Users\<username>\Downloads), drop the custom DLL
  4. Run the installer executable. The installer will fail due to calling the fake dll (since the required functions do not exist), but the custom DLL code will execute. Please note that you don't have to be an admin to have the installer execute the DLL, since the TextShaping.dll DLL is loaded before you would get the UAC (User Account Control) prompt.

Remediation Steps
To fix this, Microsoft has multiple guidelines to perform safe DLL search order, such removing the current directory from the standard search path by calling SetDllDirectory
Please see below Microsoft's guidelines:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions