Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated cli.py file #326

Closed
wants to merge 12 commits into from
Closed

Updated cli.py file #326

wants to merge 12 commits into from

Conversation

SinghHrmn
Copy link
Contributor

@SinghHrmn SinghHrmn commented Feb 1, 2020

currently in the cli.py when we find that version is an empty string the result of get_version does not drop that result. This update will check and will only show those results which have a valid version and not an empty string.

cve_bin_tool.Scanner - INFO - Checkers: bluez, curl, expat, ffmpeg, gnutls, icu, kerberos, libcurl, libgcrypt, libjpeg, libnss, libtiff, node, openssh, openssl, png, sqlite, systemd, xerces, xml2, zlib
cve_bin_tool - INFO - None
cve_bin_tool.Scanner - INFO - /tmp/cve-bin-tool-sfqzwq_7/data.tar.xz.extracted/usr/bin/gnutls-cli is gnutls-cli 3.5.8
cve_bin_tool.Scanner - INFO - Known CVEs in version 3.5.8
cve_bin_tool.Scanner - INFO - CVE-2009-1390, CVE-2014-3467, CVE-2014-3468, CVE-2014-3469, CVE-2017-7507, CVE-2017-7869, CVE-2019-3829
cve_bin_tool.Scanner - ERROR - error: no version info for 'gnutls-cli'
cve_bin_tool.Scanner - ERROR - error: no version info for 'gnutls-serv'
cve_bin_tool.Scanner - INFO - /tmp/cve-bin-tool-sfqzwq_7/gnutls-bin_3.5.8-6ubuntu3_amd64.deb.extracted/usr/bin/gnutls-cli is gnutls-cli 3.5.8
cve_bin_tool.Scanner - INFO - Known CVEs in version 3.5.8
cve_bin_tool.Scanner - INFO - CVE-2009-1390, CVE-2014-3467, CVE-2014-3468, CVE-2014-3469, CVE-2017-7507, CVE-2017-7869, CVE-2019-3829
cve_bin_tool.Scanner - ERROR - error: no version info for 'gnutls-cli'
cve_bin_tool.Scanner - ERROR - error: no version info for 'gnutls-serv'
cve_bin_tool - INFO - 
cve_bin_tool - INFO - Overall CVE summary: 
cve_bin_tool - INFO - There are 2 files with known CVEs detected
cve_bin_tool - INFO - Known CVEs in ('gnutls-cli', '3.5.8'):
gnutls-cli,3.5.8,CVE-2009-1390,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3467,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3468,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3469,MEDIUM
gnutls-cli,3.5.8,CVE-2017-7507,HIGH
gnutls-cli,3.5.8,CVE-2017-7869,HIGH
gnutls-cli,3.5.8,CVE-2019-3829,HIGH

This is the output after updating the cli.py. You can see that from the below output where it also recognised some false positive with empty version string.

cve_bin_tool - INFO - There are 6 files with known CVEs detected
cve_bin_tool - INFO - Known CVEs in ('gnutls-cli', '3.5.8'), ('gnutls-cli', ''), ('gnutls-serv', ''):
gnutls-cli,3.5.8,CVE-2009-1390,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3467,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3468,MEDIUM
gnutls-cli,3.5.8,CVE-2014-3469,MEDIUM
gnutls-cli,3.5.8,CVE-2017-7507,HIGH
gnutls-cli,3.5.8,CVE-2017-7869,HIGH
gnutls-cli,3.5.8,CVE-2019-3829,HIGH
gnutls-cli,,CVE-2006-7239,MEDIUM
gnutls-cli,,CVE-2008-4989,MEDIUM
gnutls-cli,,CVE-2009-1390,MEDIUM
gnutls-cli,,CVE-2009-1415,MEDIUM
gnutls-cli,,CVE-2009-1417,MEDIUM
gnutls-cli,,CVE-2009-2409,MEDIUM
gnutls-cli,,CVE-2009-2730,HIGH
gnutls-cli,,CVE-2009-3555,MEDIUM
gnutls-cli,,CVE-2009-5138,MEDIUM
gnutls-cli,,CVE-2010-0731,HIGH
gnutls-cli,,CVE-2012-0390,MEDIUM
gnutls-cli,,CVE-2012-1569,MEDIUM
gnutls-cli,,CVE-2012-1573,MEDIUM
gnutls-cli,,CVE-2012-1663,HIGH
gnutls-cli,,CVE-2014-0092,MEDIUM
gnutls-cli,,CVE-2014-1959,MEDIUM
gnutls-cli,,CVE-2014-3466,MEDIUM
gnutls-cli,,CVE-2014-3467,MEDIUM
gnutls-cli,,CVE-2014-3468,MEDIUM
gnutls-cli,,CVE-2014-3469,MEDIUM
gnutls-cli,,CVE-2014-8155,MEDIUM
gnutls-cli,,CVE-2015-0282,MEDIUM
gnutls-cli,,CVE-2015-3308,HIGH
gnutls-cli,,CVE-2016-7444,HIGH
gnutls-cli,,CVE-2017-5334,CRITICAL
gnutls-cli,,CVE-2017-5335,HIGH
gnutls-cli,,CVE-2017-5336,CRITICAL
gnutls-cli,,CVE-2017-5337,CRITICAL
gnutls-cli,,CVE-2017-7507,HIGH
gnutls-cli,,CVE-2017-7869,HIGH
gnutls-serv,,CVE-2006-7239,MEDIUM
gnutls-serv,,CVE-2008-4989,MEDIUM
gnutls-serv,,CVE-2009-1390,MEDIUM
gnutls-serv,,CVE-2009-1415,MEDIUM
gnutls-serv,,CVE-2009-1417,MEDIUM
gnutls-serv,,CVE-2009-2409,MEDIUM
gnutls-serv,,CVE-2009-2730,HIGH
gnutls-serv,,CVE-2009-3555,MEDIUM
gnutls-serv,,CVE-2009-5138,MEDIUM
gnutls-serv,,CVE-2010-0731,HIGH
gnutls-serv,,CVE-2012-0390,MEDIUM
gnutls-serv,,CVE-2012-1569,MEDIUM
gnutls-serv,,CVE-2012-1573,MEDIUM
gnutls-serv,,CVE-2012-1663,HIGH
gnutls-serv,,CVE-2014-0092,MEDIUM
gnutls-serv,,CVE-2014-1959,MEDIUM
gnutls-serv,,CVE-2014-3466,MEDIUM
gnutls-serv,,CVE-2014-3467,MEDIUM
gnutls-serv,,CVE-2014-3468,MEDIUM
gnutls-serv,,CVE-2014-3469,MEDIUM
gnutls-serv,,CVE-2014-8155,MEDIUM
gnutls-serv,,CVE-2015-0282,MEDIUM
gnutls-serv,,CVE-2015-3308,HIGH
gnutls-serv,,CVE-2016-7444,HIGH
gnutls-serv,,CVE-2017-5334,CRITICAL
gnutls-serv,,CVE-2017-5335,HIGH
gnutls-serv,,CVE-2017-5336,CRITICAL
gnutls-serv,,CVE-2017-5337,CRITICAL
gnutls-serv,,CVE-2017-7507,HIGH
gnutls-serv,,CVE-2017-7869,HIGH

@SinghHrmn
Copy link
Contributor Author

SinghHrmn commented Feb 1, 2020

These are the following errors on long tests. I don't know why the list didn't contained that version.

======================================================================
FAIL: test_jpeg_rpm_2_0_0 (test.test_scanner.TestScanner)
Test detection of libjpeg-turbo 2.0.0 fedora rpm
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 315, in test_jpeg_rpm_2_0_0
    self._file_test(
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 117, in _file_test
    self.assertIn(version, cves[package])
AssertionError: '2.0.0' not found in {'2.0.1': {'CVE-2018-19664': 'MEDIUM', 'CVE-2018-20330': 'HIGH'}}

======================================================================
FAIL: test_libgcrypt_rpm_1_8_3 (test.test_scanner.TestScanner)
Test detection of libgcrypt 1.8.3 fedora rpm
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 378, in test_libgcrypt_rpm_1_8_3
    self._file_test(
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 117, in _file_test
    self.assertIn(version, cves[package])
AssertionError: '1.8.3' not found in {'1.7.6': {'CVE-2017-0379': 'HIGH', 'CVE-2017-7526': 'MEDIUM', 'CVE-2017-9526': 'MEDIUM', 'CVE-2018-0495': 'MEDIUM', 'CVE-2018-6829': 'HIGH'}}
======================================================================
FAIL: test_zlib_rpm_1_2_11 (test.test_scanner.TestScanner)
Test detection on zlib 1.2.11 fedora rpm
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 832, in test_zlib_rpm_1_2_11
    self._file_test(
  File "/home/runner/work/cve-bin-tool/cve-bin-tool/test/test_scanner.py", line 117, in _file_test
    self.assertIn(version, cves[package])
AssertionError: '1.2.11' not found in {'1.2.8': {'CVE-2016-9840': 'HIGH', 'CVE-2016-9841': 'CRITICAL', 'CVE-2016-9842': 'HIGH', 'CVE-2016-9843': 'CRITICAL'}}

----------------------------------------------------------------------
Ran 85 tests in 437.821s

FAILED (failures=3, skipped=2)
Test failed: <unittest.runner.TextTestResult run=85 errors=0 failures=3>
error: Test failed: <unittest.runner.TextTestResult run=85 errors=0 failures=3>
##[error]Process completed with exit code 1.

@terriko
Copy link
Contributor

terriko commented Feb 3, 2020

Hm. That is weird. It's definitely causing something to go wrong in the version detection, but I'm not sure why at a glance.

@SinghHrmn
Copy link
Contributor Author

@terriko I don't think so I've messed anything with the version detection. I'm only checking if the version is non-empty string then include that else discard that. But there might be something that I'm not able to see I'll definately look into that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants