openssl has catastrophic issues when locale set to TR_UTF8

Bug #1968997 reported by Ilgaz
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
openssl (Ubuntu)
Fix Released
Critical
Graham Inggs
Jammy
Fix Released
Critical
Graham Inggs
Kinetic
Fix Released
Critical
Graham Inggs

Bug Description

[Impact]

Due to the case comparison differences in the Turkish locale, some routines in
OpenSSL fail to recognize some algorithm names as valid, unexpectedly breaking
crypto.

[Test Plan]

This bug is really easy to trigger:

sudo locale-gen tr_TR.UTF-8
LANG=C curl https://ubuntu.com/ > /dev/null # This work
LANG=tr_TF.UTF-8 curl https://ubuntu.com/ > /dev/null # This fails

The error is curl: (35) error:03000072:digital envelope routines::decode error

[Where problems could occur]

This patch set is relatively massive, and can cause regressions, as illustrated
by the patch #5 which fixes one such regression. Those regressions would likely
show up as either libssl crashes, in case of uninitialized objects, or as
algorithm selection failures if somehow the case comparison is buggy.

[Other Info]

The fix has already been released upstream as part of their 3.0.3 release.

[Original report]
I noticed this when I checked "ua status". It alerted me that I should check my openssl configuration.

"ua status
Failed to access URL: https://contracts.canonical.com/v1/resources?architecture=amd64&kernel=5.15.0-25-generic&series=jammy
Cannot verify certificate of server
Please check your openssl configuration."

I also figured wget&curl doesn't work with https:// URLs at all.

On web I found:
https://github.com/openssl/openssl/issues/18039

So I changed locale to C_UTF-8

#locale
LANG=tr_TR.UTF-8
LANGUAGE=
LC_CTYPE="tr_TR.UTF-8"
LC_NUMERIC=tr_TR.UTF-8
LC_TIME=tr_TR.UTF-8
LC_COLLATE="tr_TR.UTF-8"
LC_MONETARY=tr_TR.UTF-8
LC_MESSAGES="tr_TR.UTF-8"
LC_PAPER=tr_TR.UTF-8
LC_NAME=tr_TR.UTF-8
LC_ADDRESS=tr_TR.UTF-8
LC_TELEPHONE=tr_TR.UTF-8
LC_MEASUREMENT=tr_TR.UTF-8
LC_IDENTIFICATION=tr_TR.UTF-8
LC_ALL=
casaba@ship-macbook:/backups$ sudo locale-gen c
ca_AD ca_ES.UTF-8 ca_IT ckb_IQ cs_CZ cy_GB.UTF-8
ca_AD.UTF-8 ca_ES@valencia ca_IT.UTF-8 cmn_TW cs_CZ.UTF-8
ca_ES ca_FR ce_RU crh_UA cv_RU
ca_ES@euro ca_FR.UTF-8 chr_US csb_PL cy_GB
casaba@ship-macbook:/backups$ sudo locale-gen C.UTF-8
Generating locales (this might take a while)...
  C.UTF-8... done
Generation complete.
casaba@ship-macbook:/backups$ update-locale LANG=C.UTF8
casaba@ship-macbook:/backups$ sudo update-locale LANG=C.UTF8

Now the result is (after logout/login)

ua status
SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes n/a Security compliance and audit tools
esm-infra yes n/a UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified core packages
fips-updates yes n/a NIST-certified core packages with priority security updates
livepatch yes n/a Canonical Livepatch service

Enable services with: ua enable <service>

     Account: <email address hidden>
Subscription: <email address hidden>

If Ubuntu 22 ships with current configuration, entire TR will suffer considering you can't find http:// downloads anymore.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: openssl 3.0.2-0ubuntu1
ProcVersionSignature: Ubuntu 5.15.0-25.25-generic 5.15.30
Uname: Linux 5.15.0-25-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Thu Apr 14 10:21:09 2022
InstallationDate: Installed on 2021-12-29 (105 days ago)
InstallationMedia: Lubuntu 20.04.3 LTS "Focal Fossa" - Release amd64 (20210819)
SourcePackage: openssl
UpgradeStatus: Upgraded to jammy on 2022-04-09 (4 days ago)
mtime.conffile..etc.ssl.openssl.cnf: 2022-04-10T13:11:20.222505

Revision history for this message
Ilgaz (ilgaz) wrote :
Jeremy Bícha (jbicha)
tags: added: rls-jj-incoming
Changed in openssl (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Simon Chopin (schopin)
tags: added: fr-2255
Steve Langasek (vorlon)
Changed in openssl (Ubuntu):
importance: High → Critical
status: Confirmed → In Progress
assignee: nobody → Steve Langasek (vorlon)
Revision history for this message
Steve Langasek (vorlon) wrote :

I've uploaded a fix to the jammy unapproved queue, but it's a rather large patch and I think it should be reviewed by another member of the release team.

Changed in openssl (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Upstream did a review of these changes and I think they have some valid points:
https://github.com/openssl/openssl/pull/18115#issuecomment-1099784064

I'm also worried that the newlocale() calls have no corresponding freelocale() counterparts. I think this needs a bit more tinkering before we proceed - in lieu of these uncertainties, I'll reject if from the queue.

Revision history for this message
Steve Langasek (vorlon) wrote :

Note that because these locale objects are declared 'static', they don't go out of scope until the library is unloaded. So the only way this results in a memory leak is if a process is opening libssl via dlopen, then unloading it, then loading it again.

Revision history for this message
Simon Chopin (schopin) wrote :

Moving back to In Progress and assigning to me, as there is now an upstream fix that has been merged in their 3.0 branch: https://github.com/openssl/openssl/pull/18103 (patches applied manually, hence the wrong status of the PR)

(note that the patch caused a regression on their master branch, but apparently *not* on the 3.0 branch)

I'll prepare an SRU for it ASAP.

Changed in openssl (Ubuntu):
status: Fix Committed → In Progress
assignee: Steve Langasek (vorlon) → Simon Chopin (schopin)
tags: removed: rls-jj-incoming
Simon Chopin (schopin)
Changed in openssl (Ubuntu Jammy):
status: New → Confirmed
status: Confirmed → In Progress
description: updated
Revision history for this message
Simon Chopin (schopin) wrote (last edit ):

Attached is the patch for the Jammy SRU.

You can find a build of it in this PPA: https://launchpad.net/~schopin/+archive/ubuntu/test-ppa/+sourcepub/13495859/+listing-archive-extra
(just pop the extra changelog entry)

Revision history for this message
Simon Chopin (schopin) wrote (last edit ):

Here's the debdiff for kinetic, which is the whole 3.0.3 upstream release.

You'll find a build for it in my PPA: https://launchpad.net/~schopin/+archive/ubuntu/test-ppa/+sourcepub/13495897/+listing-archive-extra

(just pop the extra changelog entry)

Revision history for this message
Simon Chopin (schopin) wrote :
Simon Chopin (schopin)
Changed in openssl (Ubuntu Jammy):
importance: Undecided → Critical
status: In Progress → Confirmed
Changed in openssl (Ubuntu Kinetic):
status: In Progress → Confirmed
Graham Inggs (ginggs)
Changed in openssl (Ubuntu Jammy):
assignee: nobody → Graham Inggs (ginggs)
Changed in openssl (Ubuntu Kinetic):
assignee: Simon Chopin (schopin) → Graham Inggs (ginggs)
Changed in openssl (Ubuntu Jammy):
status: Confirmed → In Progress
Changed in openssl (Ubuntu Kinetic):
status: Confirmed → In Progress
Graham Inggs (ginggs)
Changed in openssl (Ubuntu Kinetic):
status: In Progress → Fix Committed
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Ilgaz, or anyone else affected,

Accepted openssl into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/openssl/3.0.2-0ubuntu1.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-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. 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 openssl (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Ilgaz (ilgaz) wrote :

Good news, proposed patch fixed the issue.

Fresh Kubuntu (Turkish) on a VM with proposed patches enabled. Original symptom isn't there

# sudo ua status
[sudo] ilgaz için parola:
SERVICE AVAILABLE DESCRIPTION
cc-eal no Common Criteria EAL2 Provisioning Packages
cis no Security compliance and audit tools
esm-infra yes UA Infra: Extended Security Maintenance (ESM)
fips no NIST-certified core packages
fips-updates no NIST-certified core packages with priority security updates
livepatch yes Canonical Livepatch service

This machine is not attached to a UA subscription.

Additionally this works (another symptom, wget)

# wget https://cdimage.ubuntu.com/kubuntu/releases/22.04/release/kubuntu-22.04-desktop-amd64.iso.torrent
--2022-05-06 14:33:48-- https://cdimage.ubuntu.com/kubuntu/releases/22.04/release/kubuntu-22.04-desktop-amd64.iso.torrent
cdimage.ubuntu.com (cdimage.ubuntu.com) çözümleniyor... 91.189.91.124, 91.189.91.123, 185.125.190.37, ...
cdimage.ubuntu.com (cdimage.ubuntu.com)|91.189.91.124|:443 bağlanılıyor... bağlantı kuruldu.
HTTP isteği gönderildi, cevap bekleniyor... 200 OK
Uzunluk: 280634 (274K) [application/x-bittorrent]
Kayıt yeri: ‘kubuntu-22.04-desktop-amd64.iso.torrent’

kubuntu-22.04-desktop-a 100%[===============================>] 274,06K 505KB/s süre 0,5s

2022-05-06 14:33:49 (505 KB/s) - ‘kubuntu-22.04-desktop-amd64.iso.torrent’ kaydedildi [280634/280634]

# apt info openssl
Package: openssl
Version: 3.0.2-0ubuntu1.2
Priority: important
Section: utils
Origin: Ubuntu

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (openssl/3.0.2-0ubuntu1.2)

All autopkgtests for the newly accepted openssl (3.0.2-0ubuntu1.2) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

mysql-8.0/8.0.29-0ubuntu0.22.04.2 (i386)
resource-agents/1:4.7.0-1ubuntu7 (armhf)
seqkit/2.1.0+ds-1 (arm64)
ngircd/26.1-1 (s390x)
linux-lowlatency/5.15.0-30.31 (arm64)
python-bonsai/1.3.0+ds-3build1 (armhf)

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/jammy/update_excuses.html#openssl

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

Thank you!

Revision history for this message
Simon Chopin (schopin) wrote :

I've been using 3.0.2-0ubuntu1.2 on jammy for a couple of days without any noticeable regression, and have confirmed that the bug has been fixed using the curl method outlined above.

Marking as verified on jammy.

tags: added: verification-done-jammy
removed: verification-needed-jammy
Simon Chopin (schopin)
tags: removed: verification-needed
Graham Inggs (ginggs)
tags: added: verification-done
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for openssl has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openssl - 3.0.2-0ubuntu1.2

---------------
openssl (3.0.2-0ubuntu1.2) jammy; urgency=medium

  * d/p/lp1968997/*: cherry-pick a patchset to fix issues with the Turkish
    locale (LP: #1968997)

 -- Simon Chopin <email address hidden> Thu, 05 May 2022 10:04:52 +0200

Changed in openssl (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openssl - 3.0.3-0ubuntu1

---------------
openssl (3.0.3-0ubuntu1) kinetic; urgency=medium

  * New upstream release (LP: #1968997):
    - d/p/CVE-2022-*: dropped, present upstream
    - d/p/c_rehash-compat.patch: refreshed

 -- Simon Chopin <email address hidden> Thu, 05 May 2022 10:56:04 +0200

Changed in openssl (Ubuntu Kinetic):
status: Fix Committed → Fix Released
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.