#4885·hashcat

nvrtc cannot open an include path holding a character outside ASCII on Windows

Author: jsteubeCreated Sep 19, 2026Updated Sep 19, 2026
Labelsbug

Title

nvrtc cannot open an include path holding a character outside ASCII on Windows


Describe the bug

Installed under a directory whose name holds a character outside ASCII, and started from any other directory, hashcat cannot build a CUDA kernel. nvrtc is handed the include directory and reports the path back with each byte of its UTF-8 name read as a separate character in a legacy code page.

The process code page is not the cause. The application manifest declares it as UTF-8 and that is in effect: one line above the failure, in the same run, hashcat prints the same directory correctly, which it can only do because GetModuleFileNameA() answered in UTF-8. nvrtc, inside that same process, converts the path it is given with something else.

The OpenCL backends compile from the same path without trouble, on AMD, Intel and NVIDIA alike, and so does nvrtc on Linux. hiprtc is untested, and its Windows include path is absolute for the same reason, so it is likely to behave the same way.

To Reproduce

The hash is md5 of password and any wordlist containing it will do. 测试用户长名称 is the name from #4180, and any name holding such a character reproduces it.

mkdir 测试用户长名称
tar -xf hashcat-7.1.2.7z -C 测试用户长名称
cd ..
测试用户长名称\hashcat.exe -m 0 -a 0 --backend-ignore-opencl --backend-ignore-hip ^
  5f4dcc3b5aa765d61d8327deb882cf99 wordlist.txt
* Device #1: Kernel C:/Users/hc/workspace/测试用户长名称/OpenCL/shared.cl build failed.

shared_kernel(7): catastrophic error: cannot open source file
  "C:/Users/hc/workspace/\u00e6\u00b5?\u00e8??\u00e7??.../OpenCL//inc_vendor.h"

1 catastrophic error detected in the compilation of "shared_kernel".

Both of these do work, and locate the fault:

--backend-ignore-cuda instead of --backend-ignore-opencl   cracks, OpenCL builds from the same path
the same binary started from inside that directory         cracks, the include path is then relative

Expected behavior

A kernel builds from an install directory whatever its name holds, as it does on Linux and as it does on the OpenCL backends on Windows.

Hardware/Compute device:

  • Compute device name: RTX 3090
  • OpenCL/CUDA driver name: NVIDIA DRIVER
  • OpenCL/CUDA driver version: 616.64
  • OpenCL/CUDA driver source: .exe installer

Hashcat version:

  • OS: Windows
  • Distribution: Windows 11, 10.0.26200.9457
  • Version: master, after #4654 landed. Before it, hashcat had to be started from its own folder, which is what kept the relative include path and hid this

Diagnostic output compute devices:

NVIDIA GeForce RTX 3090, driver 616.64
CUDA API (CUDA 13.4)
====================
* Device #01: NVIDIA GeForce RTX 3090, 23336/24575 MB, 82MCU

OpenCL API (OpenCL 2.1 AMD-APP (3652.0)) - Platform #1 [Advanced Micro Devices, Inc.]
=====================================================================================
* Device #01: AMD Radeon RX 6900 XT, 16279/16368 MB (13695 MB allocatable), 40MCU
OpenCL API (OpenCL 3.0 ) - Platform #2 [Intel(R) Corporation]
=============================================================
* Device #02: Intel(R) UHD Graphics 770, skipped
OpenCL API (OpenCL 3.0 CUDA 13.4.62) - Platform #3 [NVIDIA Corporation]
=======================================================================
* Device #03: NVIDIA GeForce RTX 3090, 24448/24575 MB (6143 MB allocatable), 82MCU

Additional context

This was hidden until now. Before #4654 hashcat had to be started from its own folder, so the include path was relative and never converted by anyone. #4654 reads the install directory and hands it to the compilers, so every directory works except this one, and only on CUDA.

It is also the half of #1233 that is still open. The manifest fixed hashcat's own paths, which is what that issue was reported for, and left the kernel compiler's.

nvrtc on Linux, checked against the same shape of include, opens such a path under a UTF-8 locale and under LC_ALL=C. A deliberately wrong path there reports the same "cannot open source file", so those passes mean the header really was found.

Ways out, the first 2 checked against the failing case above:

  • Give nvrtc its headers instead of a path. hc_nvrtcCreateProgram() already takes numHeaders, headers and includeNames and we pass 0, NULL, NULL. Setting INCLUDE_PATH to a fixed ASCII token and registering the 127 inc_* files under hc/<name> and <name> compiles with no path reaching the compiler at all. hiprtc takes the same arguments, so one mechanism covers both.
  • Hand nvrtc the 8.3 short name. GetShortPathNameA() on the include directory is 5 lines at one call site and also compiles. It depends on 8.3 name creation, which can be disabled per volume, and there is no signal when it is off.
  • A directory junction with an ASCII name reaches the same place as the short name for more cost and a filesystem write, so it is only a fallback where 8.3 is disabled.