Bug 1642283

Summary: NULL pointer dereference in cvrf_priv.c:cvrf_model_filter_by_cpe() with `oscap cvrf eval`
Product: Red Hat Enterprise Linux 7 Reporter: Sam Fowler <sfowler>
Component: openscapAssignee: Jan Černý <jcerny>
Status: CLOSED ERRATA QA Contact: Matus Marhefka <mmarhefk>
Severity: low Docs Contact:
Priority: low    
Version: 7.5CC: jcerny, matyc, mhaicman, openscap-maint, sfowler
Target Milestone: rcFlags: lcervako: mirror+
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: openscap-1.2.17-10.el7 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:53:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sam Fowler 2018-10-24 06:33:12 UTC
Description of problem:
Found by testing with cvrf.xml on portal, e.g.
https://access.redhat.com/labs/securitydataapi/cvrf.xml

But seems to be the same result with an empty xml file too.


Version-Release number of selected component (if applicable):
openscap-scanner-1.2.16-8.el7_5.x86_64

How reproducible:
Every time.

Steps to Reproduce:
1. $ yum install -y openscap-scanner
2. $ touch foo.xml
3. $ oscap cvrf eval foo.xml

Actual results:
Segmentation Fault

Expected results:
No segfault

Additional info:
Backtrace:

#0  0x00007ffff4b486e9 in cvrf_model_filter_by_cpe (model=0x0, 
    cpe=0x600c0000bde0 "Red Hat Enterprise Linux Desktop Supplementary (v. 6)")
    at cvrf_priv.c:1293
#1  0x00007ffff4b4d35e in find_all_cvrf_product_ids_from_cpe (
    session=session@entry=0x60080000a4d0) at cvrf_eval.c:172
#2  0x00007ffff4b4debe in cvrf_model_get_results_source (import_source=<optimized out>, 
    os_name=os_name@entry=0x555555584660 "Red Hat Enterprise Linux Desktop Supplementary (v. 6)") at cvrf_eval.c:230
#3  0x0000555555574c58 in app_cvrf_evaluate (action=0x7fffffffe2c0) at oscap-cvrf.c:102
#4  0x0000555555566e16 in oscap_module_call (action=0x7fffffffe2c0) at oscap-tool.c:261
#5  oscap_module_process (module=0x55555578ffc0 <CVRF_EVALUATE_MODULE>, 
    module@entry=0x55555578a120 <OSCAP_ROOT_MODULE>, argc=argc@entry=4, 
    argv=argv@entry=0x7fffffffe5b8) at oscap-tool.c:346
#6  0x0000555555564c32 in main (argc=4, argv=0x7fffffffe5b8) at oscap.c:83

Comment 2 Jan Černý 2018-10-24 07:28:02 UTC
It is important to say that CVRF module in OpenSCAP doesn't work at all.

I can reproduce the segmentation fault. I could do a quick patch for the segfault, but result would be it will print out some error message instead.

I also noticed that the CVRF document you linked has root element "Cvrfs", but according to CVRF v1.1 XML schema it should be "cvrfdoc". Is that document following a different standard?

Do you have an intention to use CVRF? Is there any possible use-case for it?

Comment 3 Sam Fowler 2018-10-24 07:40:31 UTC
(In reply to Jan Černý from comment #2)
> It is important to say that CVRF module in OpenSCAP doesn't work at all.
> 
> I can reproduce the segmentation fault. I could do a quick patch for the
> segfault, but result would be it will print out some error message instead.

I suspected the CVRF module was not supported, but it was not clear to me. I would definitely prefer a meaningful error message to a segfault.

> I also noticed that the CVRF document you linked has root element "Cvrfs",
> but according to CVRF v1.1 XML schema it should be "cvrfdoc". Is that
> document following a different standard?

I'm not familiar enough with the standards to say.

> Do you have an intention to use CVRF? Is there any possible use-case for it?

I don't have any specific use-case for CVRF. I was just exploring different uses of Red Hat's security data with oscap when I stumbled across the crash.

Comment 4 Jan Černý 2018-11-13 13:35:48 UTC
The segmentation fault has been fixed in upstream in https://github.com/OpenSCAP/openscap/pull/1252

Comment 10 errata-xmlrpc 2020-09-29 19:53:30 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 (openscap bug fix and enhancement update), 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-2020:3914