wolfSSL — Compilation Without Warnings-as-Errors in Autotools Builds Outside a VCS Checkout
The wolfSSL configure script adds -Werror to CFLAGS only when it finds version-control metadata in the build directory. A build from a release tarball keeps the warning flags but a compiler warning does not stop the build. This is a build-hardening observation and not a vulnerability in the library code.
- Advisory
- BYTERAY-2026-0431
- 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, autotools builds configured in a directory that is not a version-control checkout (release tarballs)
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
The autotools build takes its warning flags from the macro AX_HARDEN_CC_COMPILER_FLAGS. The macro adds -Werror to CFLAGS when the configure script detects a .git, .svn, .hg or .bzr entry. When it finds none, it keeps -Werror in a helper variable that is used only while probing which other flags the compiler accepts.
A release tarball has no version-control metadata. A default ./configure && make from a tarball therefore compiles with the full warning set, -Wall, -Wextra and up to 29 further warning options that are each added if the compiler accepts them. Warnings are printed, but the build succeeds regardless. A comment in the macro file states this as the design.
This advisory records the behaviour for integrators who assume the release build is gated on warnings. 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 missing gate has let through.
Affected Products and Versions
- Component: autotools build,
m4/ax_harden_compiler_flags.m4andm4/ax_vcs_checkout.m4, invoked fromconfigure.ac. - Condition:
./configureis run in a directory with no version-control metadata. That is the case for every release tarball. At the tested commit the test looks in the build directory, so an out-of-tree build of a git checkout is treated the same way. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- The
v5.9.2-stableandv5.9.4-stabletags carry identical copies of both macro files and the same invocation. - Not changed on master as of 2026-12-03.
- A default
./configurebuild from a tarball is affected. The CMake build is separate: on non-Windows platforms it passes-Werrorwhatever the source of the tree (CMakeLists.txt:248). Earlier releases were not checked.
Technical Details
The decision is at m4/ax_harden_compiler_flags.m4:104-111:
ac_cv_warnings_as_errors=no
ax_append_compile_cflags_extra=
AS_IF([test "$ac_cv_vcs_checkout" = "yes"],[
AX_APPEND_COMPILE_FLAGS([-Werror])
ac_cv_warnings_as_errors=yes
],[
AX_APPEND_COMPILE_FLAGS([-Werror],[ax_append_compile_cflags_extra])
])
The second argument of AX_APPEND_COMPILE_FLAGS names the variable that receives the flag (m4/ax_append_compile_flags.m4:7-16). With no second argument the flag goes to CFLAGS. In the other branch it goes to ax_append_compile_cflags_extra. Every later call in the macro passes that variable as the third argument, for example m4/ax_harden_compiler_flags.m4:121-122, and the third argument is only added to the command line of the probe compile (m4/ax_append_compile_flags.m4:18-21). It makes the compiler reject unknown flags during the probe. It is never written to CFLAGS or AM_CFLAGS.
The data flow for a tarball build:
AX_VCS_SYSTEMtests for.bzr,.svn,.hgand.gitin the current directory and finds none (m4/ax_vcs_checkout.m4:55-61).AX_VCS_CHECKOUTsetsac_cv_vcs_checkout=no(m4/ax_vcs_checkout.m4:68-72).configure.ac:13585runsAX_HARDEN_CC_COMPILER_FLAGS, which takes the second branch atm4/ax_harden_compiler_flags.m4:110.- The warning flags at
m4/ax_harden_compiler_flags.m4:119-161are appended toCFLAGS.-Werroris not. - The configure summary prints the result as "Warnings as failure" (
configure.ac:14250).
The linker half of the macro has the same branch (m4/ax_harden_compiler_flags.m4:74-85). The comment on its first line states the design: inside a checkout -Werror is appended, otherwise it is only used to test other flags.
Reachability and Preconditions
- The library is built with autotools from a tree without version-control metadata.
- The person running the build controls this. There is no attacker position, authentication state or user interaction to describe: nothing at run time depends on the setting.
- The gate can be restored without editing the build.
EXTRA_CFLAGSis a documented configure and make variable (configure.ac:48) thatMakefile.am:42appends toAM_CFLAGS.
Impact
Confirmed: a tarball build does not fail on compiler warnings. Warnings are still enabled and still printed.
The practical consequence is narrow. Upstream builds the same sources with -Werror in its git checkouts and in its CI smoke test (.github/workflows/smoke-test.yml:152). What a tarball build can show and then ignore is a warning that only appears with the integrator's compiler, target or option set. Whether any such warning marks a real defect depends on that warning. 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 macro file there is identical. Master commit 19e71c8f4be4e62b2d11a93dffcdf3796bafc750 changed the detection to look in the source directory, so out-of-tree builds of a checkout now get -Werror. Tarball builds are unchanged.
A change, if upstream wants one, would be an explicit configure switch for warnings-as-errors in place of the version-control test, so that the choice is visible and the same for every source of the tree. Many projects leave -Werror off in releases on purpose, because a newer compiler can add warnings that break an otherwise correct build.
Integrators who want the gate can pass EXTRA_CFLAGS=-Werror to make, or build from a git checkout. The cost is that a new compiler release can stop the build until the warning is handled.
Timeline
- 2026-09-28 — Reported to wolfSSL.
- 2026-10-24 — Commit 19e71c8f4be4, which moves the version-control test to the source directory, reached wolfSSL master.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.