wolfSSL — Compilation Without Warnings-as-Errors in the CMake Build for Windows Targets
The top-level CMakeLists.txt passes -Wall -Wextra -Wno-unused -Werror on every platform except Windows, where it passes only -Wall. A Windows CMake build does not stop on compiler warnings. This is a build-hardening observation and not a vulnerability in the library code.
- Advisory
- BYTERAY-2026-0433
- CWE
- CWE-1127
- CVSS
- 2.5 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-28
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.2 through 5.9.4, CMake builds for Windows targets (MSVC and MinGW)
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
The wolfSSL CMake build chooses its warning flags in one block near the top of CMakeLists.txt. OpenWatcom gets -wx. Every other non-Windows toolchain gets -Wall -Wextra -Wno-unused -Werror. The Windows branch gets -Wall alone, and nothing else in the CMake files adds a warnings-as-errors switch for it.
The result is a difference between platforms. A source change that produces a compiler warning stops the CMake build on Linux or macOS and does not stop it on Windows. The branch is taken for every Windows target, so it covers MinGW as well as cl.exe, although the comment beside it only speaks of cl.exe.
This advisory records the difference for integrators who rely on the CMake build as a warning gate. It does not describe a flaw that an attacker can reach. No input to the library is involved, and the advisory does not identify a defect that the Windows build has let through.
Affected Products and Versions
- Component: CMake build, top-level
CMakeLists.txt. - Condition: CMake configured for a Windows target, where the CMake variable
WIN32is true. This includes MSVC and MinGW toolchains. The Visual Studio project files in the repository are a separate build path, covered in BYTERAY-2026-0434. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- The
v5.9.2-stableandv5.9.4-stabletags have the same block. - Not changed on master as of 2026-12-03.
- The autotools
./configurebuild does not use this file. Earlier releases were not checked.
Technical Details
The block at CMakeLists.txt:241-249:
if(CMAKE_C_COMPILER_ID STREQUAL "OpenWatcom")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wx -wcd=202")
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_HAVE_MIN -DWOLFSSL_HAVE_MAX -DNO_WRITEV")
elseif(WIN32)
# Windows cl.exe does not support the -Wextra, -Wno-unused and -Werror flags.
set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
else()
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Werror ${CMAKE_C_FLAGS}")
endif()
CMakeLists.txt:244selects the Windows branch for any Windows target that is not OpenWatcom.CMakeLists.txt:246prepends-Walland nothing else. Withcl.exethat option turns on every warning the compiler has. With MinGW GCC it is the ordinary-Wallset, without-Wextra.- No warnings-as-errors switch is added.
cl.exehas one,/WX, and MinGW GCC accepts-Werror; the comment atCMakeLists.txt:245explains why the GCC spellings were dropped forcl.exeand does not address either. CMakeLists.txt:248shows what the other platforms receive.
A search of CMakeLists.txt and the cmake/ directory at the tested commit finds no other place that sets -Werror, /WX or a warning level. WARNING_C_FLAGS at CMakeLists.txt:237-239 is an input for the person configuring the build; the project does not set it.
Reachability and Preconditions
- The library is built with CMake for a Windows target.
- The person running the build controls the flags. There is no attacker position, authentication state or user interaction to describe: nothing at run time depends on the setting.
- The gate can be added from the command line through
WARNING_C_FLAGSorCMAKE_C_FLAGSwithout editing the file.
Impact
Confirmed: a Windows CMake build of wolfSSL completes when the compiler emits warnings, where the same build on other platforms would fail. Warnings are still printed.
That is a loss of one automatic check on one platform. Whether it matters depends on a warning that appears only with a Windows toolchain and that marks a real defect. None is identified here, and no memory-safety or cryptographic weakness follows from the setting itself.
ByteRay did not build a proof of concept for this issue. The analysis is from source review.
Remediation and Mitigation
Not fixed on wolfSSL master as of commit e4b0841b32e7 (2026-12-03). The block there is the same.
A change, if upstream wants one, would split the Windows branch by compiler: /WX with a chosen warning level for cl.exe, and the same GCC flags as the other platforms for MinGW. The sources would first have to build clean at that level with each compiler, which was not tested for this advisory.
Integrators who want the gate can configure with -DWARNING_C_FLAGS=/WX for cl.exe, or with -Wextra -Werror in the same variable for MinGW. The cost is that a compiler update can stop the build until the new warning is handled.
Timeline
- 2026-09-28 — Reported to wolfSSL.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.