-
Notifications
You must be signed in to change notification settings - Fork 532
Add bluez test(s) #237
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
Comments
There's two types of tests that should be added. Here's instructions for each: Both of these are beginner-suitable tasks. This is a new checker and not very well-tested, so it's possible you will discover an issue with the checker itself during testing. If you do, please mention it here! |
I tried adding a file test to bluez package(version 5.50)
I checked cvedetails website and found that 5.50 is listed under CVE-2018-10910. Is there a way to update the dictionary? Could someone guide me through this. |
Okay, let's debug. You want to see if 5.50 exists, so let's make a little file that checks only that (and skips the binary scanning).
If you run that against csv2cve, what do you get? The command looks like this
(where blueztest.csv is whatever you called that little file) You can also look directly into the database with sqlite3 and see what the records look like to see if there's anything under 5.50. then call Spoiler: when I run equivalent tests on my dev branch #285 I get a different result than if I run it on master, so there's going to be an issue there. BUT! That error message isn't telling you that 5.50 doesn't exist in the database, it's telling you that the binary it scanned didn't appear to be bluetoothctl 5.50. So you might want to also try running the command line against it to see what you're getting:
Take a look at the line "Known CVES in ..." and I think you'll see why it's not finding the right bugs! |
So next steps: why is it not finding 5.50? Take a look at |
Thanks for the explanation!
For the following code,
I have single doubt though, I have kept empty string for the version number. Does that mean it will return all the versions containing vulnerabilites for the given package? |
I'd say it's a bug in the bluez checker if it's returning an empty string |
And, bug aside, I'm not entirely sure what it does with the empty string. it depends on whether the function we're using for version comparison thinks that "" is greater than, less than, or equal to stuff in the database. You can check that on the command line if you're curious! |
oh, and we could also make that behaviour more intentional if we want to, so that the tool throws an error or something. There's a bit of a thought about that in #263 that we haven't quite fleshed out. |
Hi @terriko, I tried adding some CVE mapping test for bluez. But I guess there is some error can you help me ? def test_bluez_5_42(self):
"""Scanning test-bluez-5.42.out"""
self._binary_test(
"test-bluez-5.42.out",
"bluez",
"5.42",
[
#for known CVE
"CVE-2016-9797",
"CVE-2016-9798",
"CVE-2016-9799",
"CVE-2016-9800",
"CVE-2016-9801",
"CVE-2016-9802",
"CVE-2016-9803",
"CVE-2016-9804",
"CVE-2016-9917",
"CVE-2016-9918",
],
[
#for older version
"CVE-2016-7837",
],
) When I tried running this code I got the following error
Can you tell me why it is unable to find bluez. |
I've got the list of CVE from cached CVE data base.
|
A result of [] likely means no checkers matched There's not much in the way of signature in bluez.py, so the thing it's looking for will match this regex:
At a guess, it's not finding it because |
@terriko thanks for the great explanation. I'll try updating regex and see if I can find solution to the above problem |
@terriko I tried to fix the previous issue. Updated the regex and also the name of the binary file. regex = [r"bluetoothctl: ([5]+\.[0-9]+)"] According to the checker it was finding libbluetooth.so in the filename or bluetoothctl as the last filename. So adding libbluetooth.so in the filename worked perfectly. (venvgsoc) mastervulcan@DESKTOP-DMEM457:~/gsoc-cve-bin-tool/cve-bin-tool$ python -m unittest test.test_scanner.TestScanner.test_bluez_5_42
rm *.out
gcc -o test-bluetoothctl-5.42libbluetooth.so.out test-bluetoothctl-5.42libbluetooth.so.c
gcc -o test-curl-7.59.0.out test-curl-7.59.0.c
gcc -o test-expat-2.0.1.out test-expat-2.0.1.c
gcc -o test-nss-3.35.out test-nss-3.35.c
gcc -o test-png-1.6.26.out test-png-1.6.26.c
gcc -o test-png-1.6.36.out test-png-1.6.36.c
gcc -o test-libgcrypt-1.7.6.out test-libgcrypt-1.7.6.c
gcc -o test-gnutls-cli-2.3.11.out test-gnutls-cli-2.3.11.c
gcc -o test-ffmpeg-4.1.4.out test-ffmpeg-4.1.4.c
gcc -o test-libjpeg-turbo-2.0.1.out test-libjpeg-turbo-2.0.1.c
gcc -o test-openssl-1.0.2g.out test-openssl-1.0.2g.c
gcc -o test-zlib-1.2.8.out test-zlib-1.2.8.c
gcc -o test-gnutls-serv-2.3.11.out test-gnutls-serv-2.3.11.c
gcc -o test-png-1.4.11.out test-png-1.4.11.c
gcc -o test-sqlite-3.12.2.out test-sqlite-3.12.2.c
gcc -o test-xml2-2.9.2.out test-xml2-2.9.2.c
gcc -o test-xml2-2.9.0.out test-xml2-2.9.0.c
gcc -o test-xerces-3_1_1.out test-xerces-3_1_1.c
gcc -o test-node-9.3.0.out test-node-9.3.0.c
gcc -o test-tiff-4.0.9.out test-tiff-4.0.9.c
gcc -o test-curl-7.57.0.out test-curl-7.57.0.c
gcc -o test-openssh-7.9.out test-openssh-7.9.c
gcc -o test-icu-3.8.1.out test-icu-3.8.1.c
gcc -o test-nss-3.45.out test-nss-3.45.c
gcc -o test-curl-7.34.0.out test-curl-7.34.0.c
gcc -o test-ffmpeg-4.1.3.out test-ffmpeg-4.1.3.c
gcc -o test-openssl-1.1.0g.out test-openssl-1.1.0g.c
gcc -o test-kerberos-5-1.15.1.out test-kerberos-5-1.15.1.c
gcc -o test-systemd-239.out test-systemd-239.c
Skip NVD database updates.
cve_bin_tool.Scanner - INFO - /home/mastervulcan/gsoc-cve-bin-tool/cve-bin-tool/test/binaries/test-bluetoothctl-5.42libbluetooth.so.out is bluetoothctl 5.42
cve_bin_tool.Scanner - INFO - Known CVEs in version 5.42
cve_bin_tool.Scanner - INFO - CVE-2016-9797, CVE-2016-9798, CVE-2016-9799, CVE-2016-9800, CVE-2016-9801, CVE-2016-9802, CVE-2016-9803, CVE-2016-9804, CVE-2016-9917, CVE-2017-1000250, CVE-2018-10910
.
----------------------------------------------------------------------
Ran 1 test in 5.109s
OK But when I tried running on a deb file the checker failed to recognise the version of bluez package
I guess we might have to replace the regex with the correct one anyway. |
In some cases, you won't replace the regex so much as add to it -- you can have as many regexes as you want to support different distros if they're different. (and experience says yes, sometimes they are.) |
Still looking for a good test here. Feel free to work on this even if someone else is already working on it -- there is no harm in havnig more than one file test for bluez and unless people happen to choose absolutely identical files, we can merge multiple solutions here. |
#232 added a checker for bluez that currently has no tests. It could use a "fake" file test as well as a test against a known bluez package.
You can read more about adding tests in the test directory README.md here: https://github.com/intel/cve-bin-tool/blob/master/test/README.md
The text was updated successfully, but these errors were encountered: