More nuanced public key algorithm revocation

Bug #2073126 reported by Julian Andres Klode
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Fix Released
Undecided
Julian Andres Klode
Noble
Fix Committed
Undecided
Unassigned
Oracular
Fix Released
Undecided
Julian Andres Klode

Bug Description

(Please see https://wiki.ubuntu.com/AptUpdates for the versioning)

[Impact]
We have received feedback from users that use NIST-P256 keys for their repositories that are upset about receiving a warning. We also revoked additional ECC curves, which may still be considered trusted, so we should not bump them to errors.

Also existing users may have third-party repositories that use 1024-bit RSA keys and we have not adequately informed them yet perhaps. We tried to revoke them in the 2.8.0, 2.8.1, and 2.8.2 updates (see bug 2060721). This has been deferred to a later update than 2.8.3 such that we can solve the warnings and other bugs.

[Solution]
Hence we will restore all elliptic curve keys of 256 or more bit to trusted:

    ">=rsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1";

Note that we still keep rsa1024 as allowed.

At the same time we will also introduce a more nuanced approach to revocations by introducing a 'next' level that issues a warning if the key is not allowed in it and a 'future' level that will issue an audit message with the --audit option.

For the next level, we will set it to:

    ">=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512"

This means we restrict warnings to Brainpool curves and the secp256k1 key, which we have not received any feedback about them being used yet.

For the future level, we will take a strong approach to best practices as it is only seen when explictly running with --audit and the intention is to highlight best practices. It will be set to

    ">=rsa3072,ed25519,ed448";

Which corresponds to the NIST recommendations for 2031 (and as little curves as possible). This level is unused in the 24.04 upload as the corresponding "audit" log level has not been backported to it.

[Test plan]
Tests are included in the library unit tests for parsing the specification strings; we have also included a test for the gpgv method to ensure that it produces the correct outcome for both 'next' and 'future' revoked keys.

Some smoke tests:

- Observe one a system with a 1024R signed repository that it keeps working and produces a warning (ensures a key listed in "next" but not in "current" warns)
- Sign a repository with a NIST P-256 key and ensure it does not produce warnings (ensures that a key listed in "current" and "next" does not warn)

[Where problems could occur]
There could of course be bugs in the implementation of the new feature; this could result in verification of files failing. This also happens if you specify an invalid `next` or `future` string.

There cannot be any false positives: The new levels are only *additional* checks, anything not in the `Assert-Pubkey-Algo` list is still revoked.

The change in behavior of APT::Key::Assert-Pubkey-Algo _may_ cause a regression if you purposefully override `APT::Key::Assert-Pubkey-Algo` to *NOT* include algorithms that you actually use; which seems highly unlikely given that you'd be introducing warnings to your system. If you don't have a custom value set (or no warnings with your custom value), you have no regression there.

tags: added: foundations-todo
Changed in apt (Ubuntu):
assignee: nobody → Julian Andres Klode (juliank)
Revision history for this message
Julian Andres Klode (juliank) wrote :
summary: - Only revoke RSA explicitly
+ More nuanced public key algorithm revocation
Changed in apt (Ubuntu Noble):
milestone: none → ubuntu-24.04.1
description: updated
description: updated
description: updated
description: updated
description: updated
Changed in apt (Ubuntu Oracular):
status: New → Fix Committed
tags: added: regression-proposed
description: updated
description: updated
description: updated
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Julian, or anyone else affected,

Accepted apt into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apt/2.8.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in apt (Ubuntu Noble):
status: New → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Timo Aaltonen (tjaalton) wrote (last edit ):

this upload is not to be accepted to -updates before the discussion on ubuntu-release@ is concluded

tags: added: block-proposed
tags: added: block-proposed-noble
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (apt/2.8.1)

All autopkgtests for the newly accepted apt (2.8.1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

apport/2.28.1-0ubuntu3 (s390x)
auto-apt-proxy/14.1 (armhf, s390x)
cron/3.0pl1-184ubuntu2 (arm64)
dgit/11.8 (arm64)
gcc-10/10.5.0-4ubuntu2 (arm64)
gcc-11/11.4.0-9ubuntu1 (armhf)
gcc-13/13.2.0-23ubuntu4 (arm64, armhf)
gcc-13/unknown (s390x)
gcc-14/14-20240412-0ubuntu1 (armhf)
gcc-snapshot/1:20240117-1ubuntu1 (arm64, armhf)
ubiquity/24.04.5 (armhf)
update-notifier/unknown (s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#apt

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Timo Aaltonen (tjaalton)
tags: removed: block-proposed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 2.9.7

---------------
apt (2.9.7) unstable; urgency=medium

  [ sid ]
  * Show installed version (not candidate version) while removing a package

  [ David Kalnischkies ]
  * Parse snapshot option for apt show/list (Closes: #1075819)

  [ Frans Spiesschaert ]
  * Dutch program translation update (Closes: #1075874)
  * Dutch manpages translation update (Closes: #1075875)

  [ Michał Kułach ]
  * Polish program translation update (Closes: #1075975)

  [ Julian Andres Klode ]
  * worker: Add an audit level to log audit messages
  * gpgv: Add a LaterWorthless level, a SoonWorthless but at 'audit' level
  * gpgv: Add IsAssertedPubKeyAlgo() function
  * Only revoke weak RSA keys for now, add 'next' and 'future' levels
    (LP: #2073126)
  * solver3: Refactor Reason.Pkg()/Reason.Ver() use with iterator
  * Add note that redundant 'CLI interface' is intentional

 -- Julian Andres Klode <email address hidden> Tue, 30 Jul 2024 13:19:24 +0900

Changed in apt (Ubuntu Oracular):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Julian, or anyone else affected,

Accepted apt into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apt/2.8.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (apt/2.8.2)

All autopkgtests for the newly accepted apt (2.8.2) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

apport/2.28.1-0ubuntu3.1 (armhf)
apt/2.8.2 (armhf, s390x)
auto-apt-proxy/14.1 (ppc64el, s390x)
cron/3.0pl1-184ubuntu2 (arm64, s390x)
dgit/11.8 (arm64, s390x)
gcc-11/11.4.0-9ubuntu1 (arm64)
gcc-12/12.3.0-17ubuntu1 (amd64, s390x)
gcc-13/13.2.0-23ubuntu4 (arm64, armhf)
gcc-14/unknown (armhf, s390x)
gcc-snapshot/1:20240117-1ubuntu1 (amd64, arm64, s390x)
open-build-service/unknown (armhf, s390x)
postgresql-debversion/unknown (s390x)
python-apt/unknown (s390x)
reportbug/unknown (s390x)
reprotest/unknown (s390x)
ubuntu-advantage-tools/unknown (s390x)
unattended-upgrades/unknown (s390x)
update-notifier/unknown (s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#apt

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

description: updated
description: updated
description: updated
Changed in apt (Ubuntu Noble):
milestone: ubuntu-24.04.1 → none
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote :

All autopkgtests for the newly accepted apt (2.8.2) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

autopkgtest/5.34ubuntu2 (amd64, arm64, armhf)
update-manager/1:24.04.9 (amd64, arm64, armhf, i386, ppc64el, s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#apt

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Andreas Hasenack (ahasenack) wrote (last edit ):

So to summarize, and please confirm or deny my understanding below, comparing to 2.7.14build2 which is current noble release+updates:

- Assert-Pubkey-Algo reintroduces >= rsa1024 (was rsa2048), and allows more nist curves[1]. It's downgrading the RSA key size to 1024.
- there is no error whatsoever if an algorithm is not in the Pubkey-Algo list, correct? Just warnings
- new levels are introduced: next, and future[2]. How can the user switch between them? I see after installing 2.8.3 that I have the default, next, and future levels, but it's not clear how "next" and "future" are to be used.

1. diff:
- Cnf.CndSet("APT::Key::Assert-Pubkey-Algo", ">=rsa2048,ed25519,ed448");
+ Cnf.CndSet("APT::Key::Assert-Pubkey-Algo", ">=rsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1");

2. diff
+ Cnf.CndSet("APT::Key::Assert-Pubkey-Algo::Next", ">=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512");
+ Cnf.CndSet("APT::Key::Assert-Pubkey-Algo::Future", ">=rsa3072,ed25519,ed448");

Revision history for this message
Julian Andres Klode (juliank) wrote :

The level has changed:

Algorithms missing in "APT::Key::Assert-Pubkey-Algo" cause errors now, whereas algorithms in "APT::Key::Assert-Pubkey-Algo::Next" cause warnings.

Accordingly, the values were moved around such that "APT::Key::Assert-Pubkey-Algo::Next" matches the old
APT::Key::Assert-Pubkey-Algo (with NIST curves added); and "APT::Key::Assert-Pubkey-Algo" also allows 2048-bit (and brainpool, nist, secp256)

The result is that rsa<2048, brainpool curves, secp256k1 do not change behavior vs the old version (they now cause warnings), but NIST curves no longer cause warnings per popular request.

Which coincidentally is why we need two levels.

This matches the behavior in oracular and plucky.

This _may_ cause a regression if you purposefully override `APT::Key::Assert-Pubkey-Algo` to *NOT* include algorithms that you actually use; which seems highly unlikely given that you'd be introducing warnings to your system.

description: updated
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> Algorithms missing in "APT::Key::Assert-Pubkey-Algo" cause errors now, whereas algorithms in
> "APT::Key::Assert-Pubkey-Algo::Next" cause warnings.

The word "missing" is, er, missing, in the second part of that sentence, right? The full correct sentence is (diff capitalized by me):

  Algorithms missing in "APT::Key::Assert-Pubkey-Algo" cause errors now, whereas algorithms MISSING in
  "APT::Key::Assert-Pubkey-Algo::Next" cause warnings.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I tested with (only changed rsa from the defaults):
APT::Key::Assert-Pubkey-Algo ">=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1";
APT::Key::Assert-Pubkey-Algo::Next ">=rsa5120,ed25519,ed448,nistp256,nistp384,nistp512";
APT::Key::Assert-Pubkey-Algo::Future ">=rsa6144,ed25519,ed448";

And got:
$ sudo apt update
Hit:1 http://br.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://br.archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://br.archive.ubuntu.com/ubuntu noble-backports InRelease
Hit:4 http://br.archive.ubuntu.com/ubuntu noble-security InRelease
Hit:5 https://ppa.launchpadcontent.net/ahasenack/apt-sru/ubuntu noble InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: http://br.archive.ubuntu.com/ubuntu/dists/noble/InRelease: Signature by key F6ECB3762474EDA9D21B7022871920D1991BC93C uses weak algorithm (rsa4096)
W: http://br.archive.ubuntu.com/ubuntu/dists/noble-updates/InRelease: Signature by key F6ECB3762474EDA9D21B7022871920D1991BC93C uses weak algorithm (rsa4096)
W: http://br.archive.ubuntu.com/ubuntu/dists/noble-backports/InRelease: Signature by key F6ECB3762474EDA9D21B7022871920D1991BC93C uses weak algorithm (rsa4096)
W: http://br.archive.ubuntu.com/ubuntu/dists/noble-security/InRelease: Signature by key F6ECB3762474EDA9D21B7022871920D1991BC93C uses weak algorithm (rsa4096)
W: https://ppa.launchpadcontent.net/ahasenack/apt-sru/ubuntu/dists/noble/InRelease: Signature by key 6BD1A790B3211D9CE0A04D073DA665FECBA631A9 uses weak algorithm (rsa4096)

Meaning, rsa4096 is MISSING from ::Next, and I got a warning.

Revision history for this message
Andreas Hasenack (ahasenack) wrote (last edit ):

So from my understanding, these are the big changes in this SRU, regarding the crypto config.

a) Algorithms MISSING from Assert-Pubkey-Algo are now treated as an ERROR, whereas before (noble release) they were WARNINGS;

b) The list of algorithms in Assert-Pubkey-Algo changed:

FROM: ">=rsa2048,ed25519,ed448");
TO: ">=rsa1024,ed25519,ed448,
          nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1");

  b1) rsa2048 was replaced by rsa1024
  b2) nist*, brainpool*, and secp256k1 were added to the list

c) Two more algorithms lists were added:

  c1) Next: algorithms MISSING from this list will trigger a WARNING
  c2) Future: algorithms MISSING from this list will trigger an AUDIT event (not fully supported in this noble SRU yet, so this "Future" list can be ignored for now)

  Next", ">=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512");
  Future", ">=rsa3072,ed25519,ed448");

These lists, and how they apply, can be confusing. Here is another way to read these that I came up with:

- Assert-Pubkey-Algo: list of PERMITTED algorithms. If a repository was signed with an algorithm/key NOT listed here, it will trigger an ERROR, regardless of the other lists.
- Assert-Pubkey_Algo::Next: list of NO WARNING algorithms. If a repository was signed with an algorithm/key NOT listed here, it will trigger a WARNING. Should be a subset of the above.

Revision history for this message
Andreas Hasenack (ahasenack) wrote (last edit ):

@ubuntu-security, could I please get your take on the changes introduced by this SRU? I believe I summarized them in comment #16 (unless @juliank chimes in with a correction!).

It's basically the list of crypto algorithms that need checking.

RSA1024 still triggers a "weak key" warning.

https://discourse.ubuntu.com/t/new-requirements-for-apt-repository-signing-in-24-04/42854/15 might help with some history, and with the choices of algorithms, but it's a long read.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Thanks for your summary, Andreas, I found it very helpful.

This guide appeared to be the newest from NIST that I could find on the topic of key lengths https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar3.ipd.pdf -- page 21 (marked 11 on the page) appears to say n=1024 is still fine for "legacy use": "The algorithm or key length may only be used to process already protected information (e.g., decrypt ciphertext data or verify a digital signature)". A very literal reading would probably suggest that *old* InRelease files would be fine but *new* InRelease files wouldn't be. There'd be no reliable way to tell the age without actually validating the signature, so maybe it's academic, but I don't imagine they intended to allow installing software protected solely by rsa1024.

I would prefer if we asked users to make this change themselves if they still have rsa1024 repositories somewhere. Noble has been out for almost a year. Ubuntu 24.04.1 was released over six months ago. If the >=rsa2048 restrictions were brand new, and we saw a deluge of complaints, maybe relaxing it would make sense. But what we've seen is a decade of people asking us how to prevent rsa1024 from being used.

I don't understand why today is the right day to allow weaker RSA keys.

All the other changes seem fine to me.

Thanks

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> I don't understand why today is the right day to allow weaker RSA keys.

I don't think that changed. To recap (and these changes are confusing, yes, but this is my understanding of the final result):

# Noble release
- there is only one list of crypto algorithms: Assert-Pubkey-Algo
- anything NOT in that list will trigger a WARNING
- RSA 1024 is NOT in that list, therefore we have a WARNING

# This SRU
- there are two new lists: Assert-Pubkey-Algo::Next and Assert-Pubkey-Algo::Future
- the behavior of Assert-Pubkey-Algo CHANGED: now, algorithms not in this list will trigger an ERROR instead of a WARNING
- algorithms NOT PRESENT in Assert-Pubkey-Algo::Next will issue a WARNING
- RSA1024 was ADDED to Assert-Pubkey-Algo, so it's allowed
- RSA1024 is NOT PRESENT in Assert-Pubkey-Algo::Next, so a WARNING is triggered

In summary, RSA1024 triggers a WARNING in both noble release, and with this SRU.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Put the security levels (noble release vs unapproved vs oracular) into a table in

https://docs.google.com/document/d/1rIREl1ebAoJXyqjig5MlV1-Jae9EREcApuVMlKT1whQ/edit?tab=t.0

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Ah, thank you both Andreas and Julian for working with me to understand these changes better.

If we're already supporting rsa1024 in noble, that would explain why we haven't seen a deluge of support requests around it. Fair. Tightening it in an update a year later, absent impressive news, would be too much.

I think I'm happy with this update now.

Thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.