RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1351389 - Segfault when PKCS11 token has non-extractable/sensitive objects
Summary: Segfault when PKCS11 token has non-extractable/sensitive objects
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gnutls
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Nikos Mavrogiannopoulos
QA Contact: Stanislav Zidek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-30 00:47 UTC by Richard Chan
Modified: 2016-11-04 00:58 UTC (History)
1 user (show)

Fixed In Version: gnutls-3.3.23-9.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 00:58:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2218 0 normal SHIPPED_LIVE gnutls bug fix and enhancement update 2016-11-03 13:25:10 UTC

Description Richard Chan 2016-06-30 00:47:44 UTC
Description of problem:
p11tool segmentation fault when token has unextractable objects (e.g. private keys)

(attempted memcpy of invalid memory)


Version-Release number of selected component (if applicable):
gnutls-utils-3.3.8-14.el7_2.x86_64

How reproducible:
Always


Steps to Reproduce:
1. Get an HSM/PKCS11 with non-extractable/sensitive keys
2.  p11tool --list-all-privkeys  --login 'pkcs11:model='AWSCloudHSM'

(Using AWS CloudHSM == SafeNet Network HSM)


Actual results:
Segmentation fault
[5004397.702750] p11tool[30063]: segfault at 102686fdf ip 00007fbddbf821a6 sp 00007ffd67008378 error 4 in libc-2.17.so[7fbddbe38000+1b7000]

Expected results:
Object 34:
        URL: pkcs11:model=AWSCloudHSM;manufacturer=Safenet%2c%20Inc.;serial=00000000;token=PARTITION;id=%00%00%01%54%3b%f8%f9%2b;object=privatekey;object-type=private
        Type: Private key
        Label: privatekey
        Flags: CKA_WRAP/UNWRAP; CKA_PRIVATE; CKA_SENSITIVE; 
        ID: 00:00:00:00


Additional info:

Root cause is

lib/pkcs11_int.c:pkcs11_get_attribute_avalue() on error does not set data pointer to NULL as expected by callers.

Fixed in upstream bug #108

Comment 1 Richard Chan 2016-06-30 00:50:05 UTC
Backtrace: the PKCS11 library returned a value of -1, interpreted as 2^32-1.
data->data is not NULL, so an attempted memcpy of 2^32-1 bytes...

#0  __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:1578
#1  0x00007ffff7ae6c7e in memcpy (__len=4294967295, __src=0x71fc90, __dest=<optimized out>) at /usr/include/bits/string3.h:51
#2  _gnutls_set_datum (dat=dat@entry=0x71def0, data=0x71fc90, data_size=4294967295) at gnutls_datum.c:47
#3  0x00007ffff7b07fae in pkcs11_obj_import (class=class@entry=3, obj=obj@entry=0x71def0, data=data@entry=0x7fffffffd7f0, 
    id=id@entry=0x7fffffffd7d0, label=label@entry=0x7fffffffd7e0, tinfo=tinfo@entry=0x7fffffffde50, 
    lib_info=lib_info@entry=0x7ffff7dda2e0 <providers+224>) at pkcs11.c:1244
#4  0x00007ffff7b0ae0f in pkcs11_import_object (obj=2000002, class=3, info=info@entry=0x7fffffffde50, 
    lib_info=lib_info@entry=0x7ffff7dda2e0 <providers+224>, fobj=0x71def0, sinfo=0x7fffffffdd60, sinfo=0x7fffffffdd60) at pkcs11.c:1624
#5  0x00007ffff7b0bc17 in find_objs_cb (sinfo=sinfo@entry=0x7fffffffdd60, info=info@entry=0x7fffffffde50, 
    lib_info=lib_info@entry=0x7ffff7dda2e0 <providers+224>, input=input@entry=0x7fffffffe170) at pkcs11.c:2632
#6  0x00007ffff7b0d4ee in _pkcs11_traverse_tokens (find_func=find_func@entry=0x7ffff7b0b680 <find_objs_cb>, input=input@entry=0x7fffffffe170, 
    info=0x71b740, pin_info=pin_info@entry=0x0, flags=2) at pkcs11.c:1162
#7  0x00007ffff7b0dc46 in gnutls_pkcs11_obj_list_import_url2 (p_list=p_list@entry=0x7fffffffe1f0, n_list=n_list@entry=0x7fffffffe1e4, 
    url=url@entry=0x7fffffffe778 "pkcs11:model=AWSCloudHSM", attrs=GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY, flags=flags@entry=1) at pkcs11.c:2792
#8  0x000000000040645b in pkcs11_list (outfile=0x7ffff68cf400 <_IO_2_1_stdout_>, url=url@entry=0x7fffffffe778 "pkcs11:model=AWSCloudHSM", 
    type=type@entry=5, flags=flags@entry=1, detailed=detailed@entry=0, info=info@entry=0x7fffffffe320) at pkcs11.c:128
#9  0x0000000000405cd7 in cmd_parser (argv=<optimized out>, argc=<optimized out>) at p11tool.c:271
#10 main (argc=<optimized out>, argv=<optimized out>) at p11tool.c:65

Comment 10 errata-xmlrpc 2016-11-04 00:58:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2218.html


Note You need to log in before you can comment on or make changes to this bug.