QPDF tries to use MD5 in FIPS mode
| Affects | Status | Importance | Assigned to | Milestone | ||
|---|---|---|---|---|---|---|
| Qpdf |
Fix Released
|
Unknown
|
||||
| qpdf (Ubuntu) | Status tracked in Resolute | |||||
| Jammy |
New
|
High
|
Dariusz Gadomski | |||
| Noble |
New
|
High
|
Dariusz Gadomski | |||
| Plucky |
Won't Fix
|
Medium
|
Dariusz Gadomski | |||
| Questing |
New
|
Medium
|
Dariusz Gadomski | |||
| Resolute |
Fix Released
|
Medium
|
Unassigned | |||
Bug Description
[ Impact ]
* After enabling fips (or fips-updates) libqpdf will fail to calculate MD5 for decoding the PDFs (which are used by cups-filters during the printing process).
* Printing may become impossible after enabling FIPS.
* For such situations gnutls provides LAX mode [1]:
GNUTLS_FIPS140_LAX
The library still uses the FIPS140-2 relevant algorithms but all forbidden by FIPS140-2 operations are allowed; this is useful when the application is aware of the followed security policy, and needs to utilize disallowed operations for other reasons (e.g., compatibility).
[1] https:/
[ Test Plan ]
* Enable FIPS:
pro attach # to be able to enable FIPS mode
pro enable fips-updates
reboot # to boot the fips kernel
* Try to run the filter directly:
/usr/lib/
* With affected qpdf version it aborts with the following messages:
ERROR: cfFilterPDFToPDF: Exception: gnutls: MD5 error: An algorithm that is not enabled was negotiated.
ERROR: pdftopdf filter function failed.
[ Where problems could occur ]
* The patch relaxes gnutls restrictions on algorithms in non-security related,
limited contexts (GNUTLS_FIPS140_LAX mode). If there is an automated tooling or auditting software they may detect that not only FIPS-approved algorithms are
being used.
However, in context of decoding PDFs it is not possible to get rid of MD5 entirely. It's usage however is limited to only non-security related taks.
[ Other Info ]
Original bug description:
After enabling fips/fips-updates it is impossible to print anymore.
Requesting a print results in the following message in the cups logs:
`ERROR: cfFilterPDFToPDF: Exception: gnutls: MD5 error: An algorithm that is not enabled was negotiated.`
I have came up with a small reproducer:
```
pro attach # to be able to enable FIPS mode
pro enable fips-updates
reboot # to boot the fips kernel
# with FIPS mode enabled
/usr/lib/
```
The output ends with:
ERROR: cfFilterPDFToPDF: Exception: gnutls: MD5 error: An algorithm that is not enabled was negotiated.
ERROR: pdftopdf filter function failed.
I have tracked the problematic code to:
QPDF::compute_
It unconditionally uses MD5 (that in turn asks gnutls for MD5) and in FIPS mode it fails as MD5 is not fips-approved.
The bottomline is: it is not possible to print with fips-mode enabled.
| Changed in qpdf (Ubuntu Noble): | |
| importance: | Undecided → High |
| Changed in qpdf (Ubuntu Jammy): | |
| importance: | Undecided → High |
| Changed in qpdf (Ubuntu Resolute): | |
| importance: | High → Medium |
| Changed in qpdf (Ubuntu Questing): | |
| importance: | Undecided → Medium |
| Changed in qpdf (Ubuntu Plucky): | |
| importance: | Undecided → Medium |
| Changed in qpdf: | |
| status: | Unknown → New |
| description: | updated |
| description: | updated |
| description: | updated |
| Changed in qpdf: | |
| status: | New → Fix Released |

gdb backtrace of where the issue occurs: d818, algorithm= GNUTLS_ DIG_MD5) at ../../lib/ crypto- api.c:839 gnutls: :MD5_init (this=0x5555555 ad810) at /usr/src/ qpdf-11. 9.0-1.1build1/ libqpdf/ QPDFCrypto_ gnutls. cc:46 fb8e0) at /usr/src/ qpdf-11. 9.0-1.1build1/ libqpdf/ MD5.cc: 11 data_key (encryption_ key=... , objid=<optimized out>, generation=0, use_aes=<optimized out>, encryption_ V=<optimized out>, qpdf-11. 9.0-1.1build1/ libqpdf/ QPDF_encryption .cc:352 :setDataKey (this=0x7ffffff fbdb0, objid=<optimized out>) qpdf-11. 9.0-1.1build1/ libqpdf/ QPDFWriter. cc:845 :writeObject (this=this@ entry=0x7ffffff fbdb0, object=..., object_ stream_ index=object_ stream_ index@entry= -1) qpdf-11. 9.0-1.1build1/ libqpdf/ QPDFWriter. cc:1790 :writeStandard (this=0x7ffffff fbdb0) at /usr/src/ qpdf-11. 9.0-1.1build1/ libqpdf/ QPDFWriter. cc:3013 fbdb0) at /usr/src/ qpdf-11. 9.0-1.1build1/ libqpdf/ QPDFWriter. cc:2200 Processor: :emit_file (this=0x5555555 9b320, f=<optimized out>, doc=0x7fffffffbea0, take=<optimized out>) pdftopdf/ qpdf-pdftopdf- processor. cxx:876 <optimized out>, data=<optimized out>, <optimized out>) at cupsfilters/ pdftopdf/ pdftopdf. cxx:985 apper (argc=argc@entry=7, argv=argv@ entry=0x7ffffff fe398, 0x7ffff7f4fce0 <ppdFilterPDFTo PDF(int, int, int, cf_filter_data_t*, void*)>, parameters= parameters@ entry=0x0, =JobCanceled@ entry=0x5555555 58014 <JobCanceled>) at ppd/ppd- filter. c:178 e398) at filter/ pdftopdf. c:66
```
#0 gnutls_hash_init (dig=0x5555555a
#1 0x00007ffff75b0e83 in QPDFCrypto_
#2 0x00007ffff756f309 in MD5::MD5 (this=0x7ffffff
#3 QPDF::compute_
encryption_R=0) at /usr/src/
#4 0x00007ffff7553509 in QPDFWriter:
at /usr/src/
#5 0x00007ffff755e683 in QPDFWriter:
at /usr/src/
#6 0x00007ffff75603f2 in QPDFWriter:
#7 QPDFWriter::write (this=0x7ffffff
#8 0x00007ffff7e8e12d in _cfPDFToPDFQPDF
at cupsfilters/
#9 0x00007ffff7e822a8 in cfFilterPDFToPDF (inputfd=<optimized out>, outputfd=<optimized out>, inputseekable=
parameters=
#10 0x00007ffff7f519bf in ppdFilterCUPSWr
filter=
JobCanceled
#11 0x00005555555550db in main (argc=7, argv=0x7fffffff
```