DLL secure loading (using Strict Mode)

Overview

On the Windows platform, if an application does not explicitly restrict DLL loading paths or verify the trustworthiness of loaded DLLs, it may be vulnerable to DLL Search Order Hijacking attacks, which can lead to arbitrary code execution or privilege escalation.

PowerBuilder applications follow the standard Windows loader behavior and therefore share the same potential risks under default configurations.

This section explains the DLL loading mechanisms of Windows and PowerBuilder, and describes how the DLL secure loading solution introduced in PowerBuilder 2025 R2 reduces security risks through a combination of controlled DLL loading paths and DLL digital signature verification.

This section provides practical configuration and validation instructions for enabling DLL Strict Mode in PowerBuilder applications. It is intended to help customers securely configure DLL loading behavior, reduce the risk of DLL hijacking attacks, and safely deploy PowerBuilder applications in production environments.

The focus is on when to use DLL Strict Mode, how to configure it, and how to verify the results, rather than on internal implementation details.

When to use DLL Strict Mode

Enable DLL Strict Mode if your application meets one or more of the following conditions:

  • The application loads PowerBuilder Runtime DLLs or third-party DLLs at runtime

  • The application is deployed to end-user machines or shared environments

  • The application directory, working directory, or PATH may be user-writable

  • You must comply with security policies or internal audit requirements

What DLL Strict Mode does

DLL Strict Mode can significantly reduce the risk of loading malicious or unexpected DLLs.

When DLL Strict Mode is enabled:

  • The Windows default DLL search order is restricted

  • DLLs are loaded only from the allowed paths

  • Uncontrolled locations such as the current working directory and PATH are excluded

When Strict Mode is disabled When Strict Mode is enabled

Without DLL Strict Mode, PowerBuilder follows the default Windows DLL search behavior for loading DLLs.

By default, the PowerBuilder application searches for DLLs in directories in the following order:

  1. The application directory where the application executable is located

  2. The system directory (C:\Windows\System32 for 64-bit or C:\Windows\SysWOW64 for 32-bit)

  3. The Windows directory (C:\Windows)

  4. The current working directory from which the application is started

  5. The PowerBuilder runtime directory specified in <exename>.xml

  6. The directories listed in the PATH environment variable

These locations may be writable by non-administrative users, which introduces security risks.

The native client/server application searches for DLLs in directories in the following order:

  1. The system directory (C:\Windows\System32 for 64-bit or C:\Windows\SysWOW64 for 32-bit)

  2. Paths listed under Strict Mode

The PowerClient/PowerServer application searches for DLLs in directories in the following order:

  1. The system directory (C:\Windows\System32 for 64-bit or C:\Windows\SysWOW64 for 32-bit)

  2. The PowerBuilder runtime directory

  3. Paths listed under Strict Mode

Application directory, working directory, XML runtime directory, and PATH directories are ignored unless explicitly added under Strict Mode.


Limitations

DLL Strict Mode does not apply to:

  • DLLs loaded using explicit absolute paths

    DLLs loaded by specifying an absolute file path in the application code.

  • Indirect DLL dependencies

    DLLs loaded as dependencies of another DLL and resolved by the Windows or .NET loader.

  • Internal DLL loading by third-party components

    DLLs loaded internally by third-party libraries or components, outside the application's direct control.

  • .NET Runtime assembly probing

    Assemblies resolved through .NET runtime probing paths, the Global Assembly Cache (GAC), or assembly binding rules.

  • System-level loading mechanisms such as KnownDLLs

DLL Strict Mode complements, but does not replace, OS-level security controls.

Configuring DLL Strict Mode

All required DLL directories must be added to the allowed path list under Strict Mode.

What to configure How to configure

PowerBuilder Runtime DLLs

For native client/server application projects, it is highly recommended to control the PowerBuilder Runtime loading path and verify the digital signature:

  1. Enable DLL Strict Mode and add the runtime DLL directory to the path list

    For 64-bit applications, the PowerBuilder Runtime path must point to the x64 directory.

    C:\Program Files\Appeon\PowerBuilder\Runtime\x64

    Note: For PowerClient/PowerServer projects, there is no need to add the runtime path, because the runtime DLLs will be automatically loaded from the directory according to the runtime version, for example, %localappdata%\PBApps\Applications\Runtime\25.0.0.3599. PowerBuilder will search this directory automatically.

  2. Enable DLL digital signature verification to ensure runtime DLLs come from trusted publishers

    Only Appeon-signed DLLs will be verified.

Database Client DLLs

If your application uses externally installed database clients such as Oracle, SYC ASE, Informix etc., add the database client bin directory to the allowed path.

For example, to connect with the Oracle client, add the "bin" directory to the path list:

C:\oracle\client\bin

For example, to connect with the SAP ASE client, add the "bin" directory to the path list:

C:\SAP\ASE-16_0\bin

External Function Calls

If your application uses DECLARE ... LIBRARY or dynamically loads DLLs via Windows LoadLibrary function:

  1. Identify all referenced DLLs in the source code

  2. Add their directories to the path list under Strict Mode

For example, to load a DLL using relative path "dll\test.dll",

Function long gef_add(long a,long b)  Library "dll\test.dll" alias for "add"

Add the application directory to the path list:

.

.NET Assemblies

If any DLLs are loaded via LoadWithDotNet function, add their directories to the path list under Strict Mode.

For example,

String is_assemblypath = "dll\test.dll"

To allow DLLs to be loaded from the "dll" folder under application directory, Add "." to the path list:

.

Note that some .NET runtime directories are loaded automatically by the .NET runtime and are not controlled by DLL Strict Mode and DLLs loaded indirectly by the .NET assembly follow Windows or .NET loader rules and are not controlled by DLL Strict Mode.

DLLs deployed as "External files"

In PowerClient and PowerServer projects, DLLs configured in the project painter > Application tab > External files are deployed to (and later loaded from) the application directory.

To allow DLLs to be loaded from the application directory, add "." to the path list:

.

WebBrowser (WebView2)

The WebBrowser control loads WebView2 Runtime, however the underlying EmbeddedBrowserWebView.dll is not controlled by DLL Strict Mode.

Please ensure WebView2 Runtime is installed and maintained using the official Microsoft distribution and update mechanism.


Step 1: Enable DLL Strict Mode.

Enable Strict Mode in the Security tab of your project painter (including native C/S application project painter, PowerClient project painter, and PowerServer project painter).

Step 2: Configure the allowed paths.

Add all trusted DLL directories to the path list, including runtime DLLs, third-party DLLs, database client DLLs directories etc. as listed in the above table.

For example, for a native client/server application project, you can add the runtime DLL path, database client DLL path, and third-party DLL path, like below.


If the third-party DLLs are located under the application directory, you can add the application directory (.) like below.


For a PowerClient or PowerServer project, there is no need to add the runtime path, because the runtime DLLs will be automatically loaded from the directory according to the runtime version.

If the third-party DLLs are located under the application directory (for example, if there are DLLs deployed as "External files"), you can add the application directory (.) like below.


Step 3: Enable DLL digital signature verification.

Enabling digital signature verification prevents tampered or unsigned DLLs from being loaded.

Note: only Appeon-signed DLLs will be verified.

pbvm.dll must be in the same directory as the DLLs being verified.

These options are also supported in PBAutoBuild and ORCA.

  • PBAutoBuild (applicable to native client/server, PowerClient, and PowerServer projects)

                    "DllLoadOptions": {
                        "StrictMode": true,
                        "AllowedPaths": "F:\\;",
                        "VerifySignature": true
                    }
    
  • ORCA (applicable to native client/server projects)

    set exeinfo property strictmode <true|false>
    set exeinfo property allowedpaths propertyString
    set exeinfo property dllsignatureverification <true|false>

Verification

Using Process Monitor (Recommended)

Use Process Monitor to verify the actual DLL loading order and ensure that DLL Strict Mode is working as expected.

  1. Launch Process Monitor with Administrator privileges.

  2. Configure the following filters:

    • Process Name is <YourPowerBuilderApp.exe> -> Include

    • Operation is Load Image -> Include

      (This filter shows DLLs that are actually loaded into memory. If you want to observe the full search and probing process, you can disable this filter.)

    • Path contains .dll -> Include

  3. Start the application and trigger functionality that loads DLLs.

  4. Review the Load Image events and check the Path and Result columns:

    • SUCCESS indicates the actual path from which the DLL was loaded.

    • NAME NOT FOUND indicates search paths that were attempted but rejected.

If only DLLs from System32, SysWOW64, and the allowed paths are successfully loaded, the DLL Strict Mode configuration is effective.

Additional Tools

You can use the following tools to perform additional verification:

  • Process Explorer / ListDLLs

    View all DLLs currently loaded by the process along with their full paths.

  • signtool / sigcheck

    Verify whether critical DLLs are digitally signed and whether the signatures are issued by trusted publishers.

  • Dependencies

    Analyze indirect DLL dependencies to avoid scenarios where the main DLL is trusted, but its dependent DLLs are loaded from uncontrolled locations.