There is an approach similar to harrymc's excellent answer that I think is a faster, easier way IF, IF, you have at least rudimentary Visual Studio and C# skills. Also, harrymc's answer did not cover the part at the end where you need to place an EXE header file at the front of your CAB to make it self extracting. I've included that here.
PART 1: Create your CAB file with your modified binary file substituted in for the original one. See my answer to this question:
Roughly, the steps are:
* Extract your current CAB file into a folder, say, C:\MyOriginal\CabfileExtractDir\, using 7Zip or the Expand command.
* Replace the original binary file in this folder with your modified binary file with proper serial number.
* Run the CabMaker program (FREE, on GitHub) as detailed in my answer, to get a resulting CAB file with your changed file. CabMaker uses the "MakeCab" program internally. Note that CabMaker handles the DDF file creation task for you.
* In CabMaker, you'd supply C:\MyOriginal\CabfileExtractDir as the Source folder, and C:\MyEditedCabFile as the Target folder, and something like "MyModifiedFirmwareInstaller.cab" as the Target file name, and then click "Make CAB".
PART 2: Make your CAB file a self-extracting executable.
* Review the docs here. https://docs.microsoft.com/en-us/previous-versions/bb417343(v=msdn.10)?redirectedfrom=MSDN#microsoftmakecabusersguide The relevant part, adapted to your situation would be...
C:\> copy /b "%windir%\system32\extrac32.exe"+"C:\MyEditedCabFile\MyModifiedFirmwareInstaller.cab" "C:\MyEditedCabFile\MyModifiedFirmwareInstaller.exe"
C:\> del /q /f "MyModifiedFirmwareInstaller.cab"
ADDENDUM - Towards a more fully automated process
After seeing the process and getting the DDF file, you could probably automate the whole process to NOT need to use CabMaker, use the underlying MakeCab command line and DDF, and adapt it all into a batch file script, where you parameterize the serial number and the editing of the binary file. That's beyond the scope here, but quite possible.