Just strip the signature before comparing the rebuilt artifacts?
Just strip the signature before comparing the rebuilt artifacts?
Posted Mar 7, 2025 16:06 UTC (Fri) by bluca (subscriber, #118303)Parent article: Hash-based module integrity checking
Why not just improve the tools that do the diffing to strip the signatures from the modules before comparing them? If they are bit-by-bit identical, the same signature could even be just reattached and the result should be identical.
It seems the binutils strip is able to remove the signature from a signed kernel module, from a quick local test.
      Posted Mar 7, 2025 17:25 UTC (Fri)
                               by josh (subscriber, #17465)
                              [Link] (16 responses)
       
     
    
      Posted Mar 7, 2025 18:41 UTC (Fri)
                               by bluca (subscriber, #118303)
                              [Link] (1 responses)
       
Considering inline signatures as part of the reproducible envelope doesn't provide any useful information about the state of the builds. It's not interesting data - it's just RSA. Given the same input, and the same key, you get the same output, so it's reproducible by definition. 
     
    
      Posted Mar 13, 2025 14:24 UTC (Thu)
                               by pjones (subscriber, #31722)
                              [Link] 
       
Which means you're right that this is primarily a tooling problem in our comparisons. 
     
      Posted Mar 7, 2025 18:58 UTC (Fri)
                               by bluca (subscriber, #118303)
                              [Link] (13 responses)
       
     
    
      Posted Mar 7, 2025 20:01 UTC (Fri)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] (9 responses)
       
For PE binaries, they can be generated on package installation, with a signature shipped in a _different_ package. 
     
    
      Posted Mar 7, 2025 22:59 UTC (Fri)
                               by bluca (subscriber, #118303)
                              [Link] (6 responses)
       
     
    
      Posted Mar 8, 2025 0:33 UTC (Sat)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] (5 responses)
       
A small subset of packages with signature files won't be reproducible (by design). These packages can be audited to not have anything but signature data, while large packages like the kernel can be completely bit-for-bit reproducible. 
And yes, it's strictly better than the status quo. 
It can even be done in a flexible way, something like `/usr/lib/share/signtab` directory with files containing hash-to-signature mappings. 
     
    
      Posted Mar 8, 2025 0:44 UTC (Sat)
                               by bluca (subscriber, #118303)
                              [Link] (4 responses)
       
No, it really is not - it's made-up nonsense that fails to solve a problem that doesn't exist while at the same time making everything worse on all aspects. But nice try. 
     
    
      Posted Mar 8, 2025 0:48 UTC (Sat)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] (3 responses)
       
First, not _everyone_ needs or wants the kernel signatures. I don't need them, I have enrolled my own keys into the Secure Boot. But I for sure want to have a guarantee that my kernel was indeed built from the supplied sources. Ideally integrated into the package management system. 
In my scenario, I just won't bother installing the non-reproducible signature packages. They can even be put into a separate package repository, actually (like it's done with non-free right now). 
     
    
      Posted Mar 9, 2025 20:03 UTC (Sun)
                               by k3ninho (subscriber, #50375)
                              [Link] (2 responses)
       
K3n. 
     
    
      Posted Mar 10, 2025 8:28 UTC (Mon)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] (1 responses)
       
     
    
      Posted Mar 12, 2025 13:45 UTC (Wed)
                               by surajm (subscriber, #135863)
                              [Link] 
       
     
      Posted Mar 13, 2025 14:27 UTC (Thu)
                               by pjones (subscriber, #31722)
                              [Link] (1 responses)
       
     
    
      Posted Mar 13, 2025 18:38 UTC (Thu)
                               by Cyberax (✭ supporter ✭, #52523)
                              [Link] 
       
This is fine for two reasons: 
     
      Posted Mar 10, 2025 13:28 UTC (Mon)
                               by Foxboron (subscriber, #108330)
                              [Link] (2 responses)
       
If RPM insists on embedded signatures then I suspect RPM needs to change. 
     
    
      Posted Mar 12, 2025 3:37 UTC (Wed)
                               by dbnichol (subscriber, #39622)
                              [Link] (1 responses)
       
     
    
      Posted Mar 12, 2025 10:44 UTC (Wed)
                               by bluca (subscriber, #118303)
                              [Link] 
       
Tools like diffoscope already deep dive into binaries being inspected, it shouldn't be hard to make them ignore difference in signatures. There is no point whatsoever in comparing signature data when comparing binaries anyway, it's completely pointless and doesn't provide any useful information or data. In fact, being forced to do so downgrades security of the target systems, as you are no longer able to, for example, use ephemeral keys for kernel modules, which is much better and safer (generate key at beginning of the build, throw it away at the end, no way for attackers to use it). 
     
      Posted Mar 7, 2025 17:44 UTC (Fri)
                               by t-8ch (subscriber, #90907)
                              [Link] (1 responses)
       
One-off exceptions would have to be maintained in all comparison tools. 
Also in addition to the appended signatures the keyring embedded into vmlinux (but only the one used for modules!) would need to be ignored, which is not as straight-forward. 
(disclaimer: I'm the author of the patchset under discussion) 
     
    
      Posted Mar 7, 2025 18:39 UTC (Fri)
                               by bluca (subscriber, #118303)
                              [Link] 
       
     
    Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
1. The PE binaries need to be placed on a separate EFI partition anyway.
2. You still need to handle custom signing keys for people using their own secure boot keys.
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
Just strip the signature before comparing the rebuilt artifacts?
      
And it gets much more complicated with derived build artifacts.
For example a package index of an archive containing a package repository with a kernel package.
Suddenly the tool would need to know which checksum in that package index are valid to be non-reproducible.
Or a built-from-source root filesystem.
Just strip the signature before comparing the rebuilt artifacts?
      
 
           