File tree Expand file tree Collapse file tree 3 files changed +56
-25
lines changed Expand file tree Collapse file tree 3 files changed +56
-25
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python3
2
+ import os
2
3
3
4
"""
4
5
CVE checker for openssh
@@ -17,7 +18,7 @@ def get_version(lines, filename):
17
18
18
19
VPkg: openbsd, openssh
19
20
"""
20
- regex = re .compile ("OpenSSH_([0-9]+\.[0-9]+[0-9a-z\s]*)" )
21
+ regex = re .compile (r "OpenSSH_([0-9]+\.[0-9]+[0-9a-z\s]*)" )
21
22
version_info = dict ()
22
23
23
24
# determine version
@@ -27,27 +28,27 @@ def get_version(lines, filename):
27
28
break # The binary seems to contain many version strings and the
28
29
# first one matches the binary in question
29
30
30
- if filename in [
31
- "scp" ,
32
- "sftp" ,
33
- "ssh " ,
34
- "ssh-add " ,
35
- "ssh-agent " ,
36
- "ssh-argv0 " ,
37
- "ssh-copy-id " ,
38
- "ssh-keygen " ,
39
- "ssh-keyscan " ,
40
- "slogin " ,
41
- ]:
42
- version_info [ "is_or_contains" ] = "is"
43
- version_info [ "modulename" ] = "openssh-client"
44
- elif filename in ["sshd" ]:
45
- version_info [ "is_or_contains" ] = "is"
46
- version_info [ "modulename" ] = "openssh-server"
47
-
48
- if "is_or_contains" in version_info :
49
- version_info ["modulename " ] = "openssl "
50
- else :
51
- return dict ()
52
-
53
- return version_info
31
+ for modulename , binary_names in (
32
+ {
33
+ "openssh-client" : [
34
+ "scp " ,
35
+ "sftp " ,
36
+ "ssh" ,
37
+ "ssh-add " ,
38
+ "ssh-agent " ,
39
+ "ssh-argv0 " ,
40
+ "ssh-copy-id " ,
41
+ "ssh-keygen " ,
42
+ "ssh-keyscan" ,
43
+ "slogin" ,
44
+ ],
45
+ "openssh-server" : ["sshd" ],
46
+ }
47
+ ). items ():
48
+ for check in binary_names :
49
+ if check in os . path . split ( filename )[ - 1 ] :
50
+ version_info ["is_or_contains " ] = "is "
51
+ version_info [ "modulename" ] = modulename
52
+ return version_info
53
+
54
+ return {}
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main () {
4
+ printf ("This program is designed to test the cve-bin-tool checker." );
5
+ printf ("It outputs a few strings normally associated with OpenSSH 7.9" );
6
+ printf ("They appear below this line." );
7
+ printf ("------------------" );
8
+ printf ("OpenSSH_7.9" );
9
+
10
+ return 0 ;
11
+ }
Original file line number Diff line number Diff line change @@ -412,6 +412,25 @@ def test_nss_rpm_3_26_2(self):
412
412
"3.26.2" ,
413
413
)
414
414
415
+ def test_openssh_7_9 (self ):
416
+ """Scanning test-openssh-7.9.out"""
417
+ self ._binary_test (
418
+ "test-openssh-7.9.out" ,
419
+ "openssh-client" ,
420
+ "7.9" ,
421
+ [
422
+ # known CVEs in this version
423
+ "CVE-2019-6111" ,
424
+ "CVE-2019-6110" ,
425
+ "CVE-2019-6109" ,
426
+ "CVE-2018-20685" ,
427
+ ],
428
+ [
429
+ # older CVEs that should not be detected
430
+ "CVE-2018-15919" ,
431
+ "CVE-2018-15473" ,
432
+ ],
433
+ )
415
434
def test_openssl_1_0_2g (self ):
416
435
"""Scanning test-openssl-1.0.2g.out"""
417
436
self ._binary_test (
You can’t perform that action at this time.
0 commit comments