gpg --verify SHA256SUMS.asc
is easily bypassable for detached signatures.
The correct command requires the data file:
gpg --verify SHA256SUMS.asc SHA256SUMS
This appears to be a common mistake.
Without the second argument, gpg succeeds even if the .asc file contains an arbitrary embedded message rather than signing the actual SHA256SUMS file. It prints a warning, but it's easily missed in gpg's output.
The gpg manpage explicitly discourages the single-argument form, keeping it only for backward compatibility. I actually keep a list of gpg pitfalls. This is number 8.
Mehdi Kerimov reported this in nix-bitcoin's self-updater via
@nixbitcoinorg's bounty program. We had originally followed verification instructions, which had the same issue and have since been fixed. That this sat unnoticed on
@bitcoincoreorg since 2018 shows just how little-known this footgun is.
It's unlikely bad signatures were ever published at scale, as anyone noticing the warning or using the two-argument command would have caught it immediately.