Bug 10308

Summary: rpm installs bad signature package with option --nodigest --nosignature failed
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Unassigned <unassigned>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium CC: ccasciato, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, paul, randy.macleod
Version: 2.4   
Target Milestone: 6.2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Package with bad signature none

Description Hongxu Jia 2016-09-20 07:59:49 UTC
Created attachment 3428 [details]
Package with bad signature

1. Problem
Boot a target environment with rpm:

1). With option '--nodigest --nosignature', installing package
with bad signature failed
====== 
root@localhost:~# rpm -ivh --nodigest --nosignature  hello-bogus.rpm
error: hello-bogus.rpm: Header V4 DSA signature: BAD, key ID 09753bc
======

2). Without option '--nodigest --nosignature', installing package
with bad signature is successful
======
root@localhost:~# rpm -ivh hello-bogus.rpm
Preparing...                ########################################### [100%]
   1:hello                  ########################################### [100%]
root@localhost:~# rpm -q hello 
hello-1.0-r1.1.x86_64
======

2. Expected:
======
root@localhost:~# rpm -ivh hello-bogus.rpm
error: hello-bogus.rpm: Header V4 DSA signature: BAD, key ID 09753bca


root@localhost:~# rpm -ivh --nodigest --nosignature  hello-bogus.rpm
Preparing...                ########################################### [100%]
   1:hello                  ########################################### [100%]
======
Comment 1 Robert Yang 2016-09-20 08:05:16 UTC
I've fixed --query, I think that we also need fix --install/--upgrade:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=51b08835b64421669e018481e344effe4727183b
Comment 2 Hongxu Jia 2016-09-20 09:06:12 UTC
(In reply to comment #1)
> I've fixed --query, I think that we also need fix --install/--upgrade:
> 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/
> ?id=51b08835b64421669e018481e344effe4727183b

We should make sure rpm upgrade should work:

Preprae two version hello with bad signature

1. Install hello with version 1.0-r1.0

root@localhost:~# rpm -ivh --nodigest --nosignature hello-1.0-r1.0.corei7_64.rpm
Preparing... ########################################### [100%]
   1:hello ########################################### [100%]

root@localhost:~# rpm -F --verbose hello-1.0-r2.0.corei7_64.rpm
error: hello-1.0-r2.0.corei7_64.rpm: Header V4 DSA signature: BAD, key ID 8a0274fa

2. Upgrade hello with version 1.0-r2.0

root@localhost:~# rpm -F --verbose --nodigest --nosignature hello-1.0-r2.0.corei7_64.rpm
Preparing packages for installation...
hello-1.0-r2.0.corei7_64

root@localhost:~# rpm -q hello
hello-1.0-r2.0.corei7_64

//Hongxu
Comment 3 Hongxu Jia 2016-09-20 09:08:42 UTC
BTW: How to prepare rpm package with bad singnature

vim rpm pacakge(such as hello-1.0-r1.0.corei7_64.rpm)
Tweak any single character before -----END PGP PUBLIC KEY BLOCK-----

//Hongxu
Comment 4 Mark Hatle 2016-09-22 14:50:54 UTC
As noted in the mailing list.

The problem is that apparently a previous change activated some normally deactivated code to allow signature by-pass.

The previous code was implemented in reverse, i.e. signature/digest validation was always deactivated instead of always activated.

This permits a corrupted package to avoid validation and install.


As noted on the mailing list by Hongxu, the fix for this issue would be to correct the validation arguments, so the default is enabled, and the --no* options disable the default.


Alternatively we disable the previous patch and go back to the community setting avoiding this chunk of code.
Comment 5 Randy MacLeod 2021-09-23 15:21:51 UTC
Hongxu, Does WR care about this bug?
Comment 6 Randy MacLeod 2023-10-30 15:37:30 UTC
Build move to 5.0 -- ../Randy
Comment 7 Randy MacLeod 2024-04-25 01:13:51 UTC
Bulk move of 5.0 medium importance issues to 5.99.
Move to 5.1 if you want to actively work on an issue.
Comment 8 Randy MacLeod 2024-04-25 01:23:53 UTC
Build move to 5.1
Comment 9 Randy MacLeod 2025-05-01 14:07:09 UTC
Bulk move of all unassigned 5.2 medium importance bugs to 5.3.
Comment 10 Randy MacLeod 2026-02-26 19:54:18 UTC
Robert,
Is this still a problem with rpm6 ?
Comment 11 Randy MacLeod 2026-05-28 13:16:29 UTC
Bulk move of 6.0 Medium bugs to 6.1.