rufus/Makefile.am
Pete Batard 622e60659c
[dev] fix a side-loading vulnerability with cfgmgr32.dll
* Current Rufus and earlier versions (when compiled with MinGW) suffer from a side-loading vulnerability
  due to cfgmgr32.dll being attempted to be loaded from the same directory as the executable. This may
  result in someone being able to execute elevated malicious code if they already have gained user-level
  access to the platform and were able to drop an arbitrary cfgmgr32.dll in the same directory as rufus.
* While we were able to address similar vulnerabilities using delay-loading, this method does not appear
  to work for MinGW with this specific DLL, so we remove all the implicit CM_ function calls, that result
  in automated DLL loading that cannot be mitigated, to replace them with direct DLL hooks, which are
  not subject to Windows' default (vulnerable) DLL lookup behaviour. We still add the def for the delay
  loading in case we manage to find how to delay load cfgmgr32 with MinGW in the future...
* Fixes CVE-2025-26624 (https://github.com/pbatard/rufus/security/advisories/GHSA-p8p5-r296-g2jv).
* This vulnerability was discovered by @EmperialX working with @Shauryae1337 and reported by @EmperialX.
2025-02-19 11:58:10 +00:00

17 lines
684 B
Makefile

SUBDIRS = src
TARGET = rufus
TAGVER = $(shell git log --oneline | wc -l)
SEDCMD = s/^\([ \t]*\)Version="\([0-9]*\)\.\([0-9]*\)\.[0-9]*\.\([0-9]*\)"\(.*\)/\1Version="\2.\3.@@TAGVER@@.\4"\5/
upx: all
@upx --lzma --best src/$(TARGET)$(EXEEXT)
# This step produces the UPX compressed and signed releases that are made available for public download
# NB: UPX v3.09 or later is needed for LZMA compression (http://upx.sourceforge.net/)
release: all
@mv src/$(TARGET)$(EXEEXT) .
@sleep 1
@$(STRIP) $(TARGET)$(EXEEXT)
@upx --lzma --best $(TARGET)$(EXEEXT)
@mv $(TARGET)$(EXEEXT) $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT)
@cmd.exe //c _sign.cmd $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT)