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 1545976 - Coverity uncovered several issues in pam_pkcs11 that should be addressed.
Summary: Coverity uncovered several issues in pam_pkcs11 that should be addressed.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pam_pkcs11
Version: 7.0
Hardware: All
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Bob Relyea
QA Contact: Asha Akkiangady
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-16 00:33 UTC by Bob Relyea
Modified: 2018-10-30 11:35 UTC (History)
1 user (show)

Fixed In Version: pam_pkcs11-0.6.2-29.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-30 11:35:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3258 0 None None None 2018-10-30 11:35:47 UTC

Description Bob Relyea 2018-02-16 00:33:05 UTC
Buffer overflow:

pam_pkcs11-0.6.2/src/common/strings.c:173: alloc_strlen: Allocating insufficient memory for the terminating null of the string. 
pam_pkcs11-0.6.2/src/common/cert_info.c:238: overrun-local: Overrunning array "results" of 16 8-byte elements at element index 16 (byte offset 128) using index "i" (which evaluates to 16). 
------------------------------------------------
Invalid Dereference:

pam_pkcs11-0.6.2/src/tools/pkcs11_setup.c:88: var_deref_op: Dereferencing null pointer "item". 
pam_pkcs11-0.6.2/src/tools/pkcs11_setup.c:58: var_deref_op: Dereferencing null pointer "item". 
pam_pkcs11-0.6.2/src/common/cert_info.c:238: overrun-local: Overrunning array "results" of 16 8-byte elements at element index 16 (byte offset 128) using index "i" (which evaluates to 16). 

-----------------------------
Use after free:

pam_pkcs11-0.6.2/src/common/uri.c:392: deref_after_free: Dereferencing freed pointer "info". 
return is missing in the error path.
-----------------------------------

Dead code:
 Defect type: UNREACHABLE
1. pam_pkcs11-0.6.2/src/pam_pkcs11/pam_pkcs11.c:682: unreachable: This code cannot be reached: "memset(password, 0, strlen(...".
#   680|   
#   681|       /* quick and dirty fail exit point */
#   682|->     memset(password, 0, strlen(password));
#   683|       free(password); /* erase and free in-memory password data */
#   684|   
Expand
   * Code block just needs to be removed.
-------------------------------------------------


Compiler warnings:

1. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/tools/pklogin_finder.c:129:18: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
Expand
2. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/tools/pkcs11_listcerts.c:125:16: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
Expand
3. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/tools/pkcs11_inspect.c:130:18: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
Expand

1. pam_pkcs11-0.6.2/src/pam_pkcs11/pam_pkcs11.c:651:5: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
Expand
11. Defect type: COMPILER_WARNING
1. pam_pkcs11-0.6.2/src/pam_pkcs11/pam_pkcs11.c:631:5: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
Expand
12. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/pam_pkcs11/pam_pkcs11.c:615:5: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
Expand
16. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/mappers/ldap_mapper.c:845:3: warning: pointer targets in passing argument 1 of 'ldap_encode_escapes' differ in signedness [-Wpointer-sign]
Expand
20. Defect type: COMPILER_WARNING
1. pam_pkcs11-0.6.2/src/common/cert_info.c:236:20: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
Expand
21. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/common/cert_info.c:234:28: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
Expand
22. Defect type: COMPILER_WARNING
2. pam_pkcs11-0.6.2/src/common/algorithm.c:56:5: warning: return discards 'const' qualifier from pointer target type [enabled by default]

Comment 3 Bob Relyea 2018-06-21 17:45:02 UTC
fixed in pam_pkcs11-0.6.2-29.el7

Comment 5 Roshni 2018-08-01 15:18:31 UTC
[root@dhcp129-188 ~]# rpm -qi pam_pkcs11
Name        : pam_pkcs11
Version     : 0.6.2
Release     : 30.el7
Architecture: x86_64
Install Date: Tue 31 Jul 2018 10:10:59 AM EDT
Group       : System Environment/Base
Size        : 1101020
License     : LGPLv2+
Signature   : RSA/SHA256, Fri 22 Jun 2018 12:41:17 PM EDT, Key ID 199e2f91fd431d51
Source RPM  : pam_pkcs11-0.6.2-30.el7.src.rpm
Build Date  : Thu 21 Jun 2018 07:47:56 PM EDT
Build Host  : x86-017.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://www.opensc-project.org/pam_pkcs11
Summary     : PKCS #11/NSS PAM login module

Coverity scan passed on the errata for this build.

Comment 7 errata-xmlrpc 2018-10-30 11:35:40 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://access.redhat.com/errata/RHBA-2018:3258


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