Skip to content

Commit 8134a08

Browse files
authored
Merge pull request #795 from ziadhany/add_fireeye
Add fireeye vulnerabilities #487
2 parents 07985b0 + 839bb3c commit 8134a08

File tree

7 files changed

+426
-0
lines changed

7 files changed

+426
-0
lines changed

vulnerabilities/importers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from vulnerabilities.importers import debian
1515
from vulnerabilities.importers import debian_oval
1616
from vulnerabilities.importers import elixir_security
17+
from vulnerabilities.importers import fireeye
1718
from vulnerabilities.importers import gentoo
1819
from vulnerabilities.importers import github
1920
from vulnerabilities.importers import gitlab
@@ -61,6 +62,7 @@
6162
apache_tomcat.ApacheTomcatImporter,
6263
xen.XenImporter,
6364
ubuntu_usn.UbuntuUSNImporter,
65+
fireeye.FireyeImporter,
6466
]
6567

6668
IMPORTERS_REGISTRY = {x.qualified_name: x for x in IMPORTERS_REGISTRY}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
import logging
10+
import re
11+
from pathlib import Path
12+
from typing import Iterable
13+
from typing import List
14+
15+
from vulnerabilities.importer import AdvisoryData
16+
from vulnerabilities.importer import GitImporter
17+
from vulnerabilities.importer import Reference
18+
from vulnerabilities.utils import build_description
19+
from vulnerabilities.utils import dedupe
20+
21+
logger = logging.getLogger(__name__)
22+
23+
24+
class FireyeImporter(GitImporter):
25+
spdx_license_expression = "CC-BY-SA-4.0 AND MIT"
26+
license_url = "https://github.com/mandiant/Vulnerability-Disclosures/blob/master/README.md"
27+
notice = """
28+
Copyright (c) Mandiant
29+
The following licenses/licensing apply to this Mandiant repository:
30+
1. CC BY-SA 4.0 - For CVE related information not including source code (such as PoCs)
31+
2. MIT - For source code contained within provided CVE information
32+
"""
33+
34+
def __init__(self):
35+
super().__init__(repo_url="git+https://github.com/mandiant/Vulnerability-Disclosures")
36+
37+
def advisory_data(self) -> Iterable[AdvisoryData]:
38+
self.clone()
39+
files = filter(
40+
lambda p: p.suffix in [".md", ".MD"], Path(self.vcs_response.dest_dir).glob("**/*")
41+
)
42+
for file in files:
43+
if Path(file).stem == "README":
44+
continue
45+
try:
46+
with open(file) as f:
47+
yield parse_advisory_data(f.read())
48+
except UnicodeError:
49+
logger.error(f"Invalid file {file}")
50+
51+
52+
def parse_advisory_data(raw_data) -> AdvisoryData:
53+
"""
54+
Parse a fireeye advisory repo and return an AdvisoryData or None.
55+
These files are in Markdown format.
56+
"""
57+
raw_data = raw_data.replace("\n\n", "\n")
58+
md_list = raw_data.split("\n")
59+
md_dict = md_list_to_dict(md_list)
60+
61+
database_id = md_list[0][1::]
62+
summary = md_dict.get(database_id[1::]) or []
63+
description = md_dict.get("## Description") or []
64+
impact = md_dict.get("## Impact") # not used but can be used to get severity
65+
exploit_ability = md_dict.get("## Exploitability") # not used
66+
cve_ref = md_dict.get("## CVE Reference") or []
67+
tech_details = md_dict.get("## Technical Details") # not used
68+
resolution = md_dict.get("## Resolution") # not used
69+
disc_credits = md_dict.get("## Discovery Credits") # not used
70+
disc_timeline = md_dict.get("## Disclosure Timeline") # not used
71+
references = md_dict.get("## References") or []
72+
73+
return AdvisoryData(
74+
aliases=get_aliases(database_id, cve_ref),
75+
summary=build_description(" ".join(summary), " ".join(description)),
76+
references=get_references(references),
77+
)
78+
79+
80+
def get_references(references):
81+
"""
82+
Return a list of Reference from a list of URL reference in md format
83+
>>> get_references(["- http://1-4a.com/cgi-bin/alienform/af.cgi"])
84+
[Reference(reference_id='', url='http://1-4a.com/cgi-bin/alienform/af.cgi', severities=[])]
85+
>>> get_references(["- [Mitre CVE-2021-42712](https://www.cve.org/CVERecord?id=CVE-2021-42712)"])
86+
[Reference(reference_id='', url='https://www.cve.org/CVERecord?id=CVE-2021-42712', severities=[])]
87+
"""
88+
urls = []
89+
for ref in references:
90+
if ref.startswith("- "):
91+
urls.append(matcher_url(ref[2::]))
92+
else:
93+
urls.append(matcher_url(ref))
94+
95+
return [Reference(url=url) for url in urls if url]
96+
97+
98+
def matcher_url(ref) -> str:
99+
"""
100+
Returns URL of the reference markup from reference url in Markdown format
101+
"""
102+
markup_regex = "\[([^\[]+)]\(\s*(http[s]?://.+)\s*\)"
103+
matched_markup = re.findall(markup_regex, ref)
104+
if matched_markup:
105+
return matched_markup[0][1]
106+
else:
107+
return ref
108+
109+
110+
def get_aliases(database_id, cve_ref) -> List:
111+
"""
112+
Returns a List of Aliases from a database_id and a list of CVEs
113+
>>> get_aliases("MNDT-2021-0012",["CVE-2021-44207"])
114+
['CVE-2021-44207', 'MNDT-2021-0012']
115+
"""
116+
cve_ref.append(database_id)
117+
return dedupe(cve_ref)
118+
119+
120+
def md_list_to_dict(md_list):
121+
"""
122+
Returns a dictionary of md_list from a list of a md file splited by \n
123+
>>> md_list_to_dict(["# Header","hello" , "hello again" ,"# Header2"])
124+
{'# Header': ['hello', 'hello again'], '# Header2': []}
125+
"""
126+
md_dict = {}
127+
md_key = ""
128+
for md_line in md_list:
129+
if md_line.startswith("#"):
130+
md_dict[md_line] = []
131+
md_key = md_line
132+
else:
133+
md_dict[md_key].append(md_line)
134+
return md_dict
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# FEYE-2019-0002
2+
## Description
3+
GPU-Z.sys, part of the GPU-Z package from TechPowerUp, exposes the wrmsr instruction to user-mode callers without properly validating the target Model Specific Register (MSR). This can result in arbitrary unsigned code being executed in Ring 0.
4+
5+
## Impact
6+
High - Arbitrary Ring 0 code execution
7+
8+
## Exploitability
9+
Medium/Low - Driver must be loaded or attacker will require admin rights. Newer versions require admin callers.
10+
11+
## CVE Reference
12+
CVE-2019-7245
13+
14+
## Technical Details
15+
IOCTL 0x8000644C in the GPU-Z driver instructs the binary to modify a Model Specific Register (MSR) on the target system. These registers control a wide variety of system functionality and can be used to monitor CPU temperature, track branches in code, tweak voltages, etc. MSRs are also responsible for setting the kernel mode function responsible for handling system calls.
16+
17+
The driver does not appropriately filter access to MSRs, allowing an attacker to overwrite the system call handler and run unsigned code in Ring 0. Allowing access to any of the following MSRs can result in arbitrary Ring 0 code being executed:
18+
19+
* 0xC0000081
20+
* 0xC0000082
21+
* 0xC0000083
22+
* 0x174
23+
* 0x175
24+
* 0x176
25+
26+
For exploitation details see the INFILTRATE presentation in the references.
27+
28+
## Resolution
29+
This issue is fixed in v2.23.0: [https://www.techpowerup.com/257995/techpowerup-releases-gpu-z-v2-23-0](https://www.techpowerup.com/257995/techpowerup-releases-gpu-z-v2-23-0)
30+
31+
## Discovery Credits
32+
Ryan Warns
33+
34+
## Disclosure Timeline
35+
- 2 February 2019 - Contacted vendor
36+
- 2 February 2019 - Vendor response, confirmation of issue
37+
- 25 July 2019 - Vendor confirmed fix
38+
- 6 August 2019 - Fixed version released
39+
40+
## References
41+
[Exploitation Details](https://downloads.immunityinc.com/infiltrate2019-slidepacks/ryan-warns-timothy-harrison-device-driver-debauchery-msr-madness/MSR_Madness_v2.9_INFILTRATE.pptx)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"aliases": [
3+
"CVE-2019-7245 ",
4+
" FEYE-2019-0002"
5+
],
6+
"summary": "GPU-Z.sys, part of the GPU-Z package from TechPowerUp, exposes the wrmsr instruction to user-mode callers without properly validating the target Model Specific Register (MSR). This can result in arbitrary unsigned code being executed in Ring 0.",
7+
"affected_packages": [],
8+
"references": [],
9+
"date_published": null,
10+
"weaknesses": []
11+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# FEYE-2020-0020
2+
## Description
3+
4+
Digi International's ConnectPort X2e is susceptible to a local privilege escalation vulnerable to the privileged user `root`.
5+
6+
## Impact
7+
High - An attacker with remote network access to a X2e could remotely compromise the device. This could be used to install malware, modify system behavior, or stage a more serious attack.
8+
9+
## Exploitability
10+
Medium - An attacker would need to read and write files as the system user python. On production devices, this can be accomplished remotely by establishing an SSH connection or access via a TTY.
11+
12+
## CVE Reference
13+
CVE-2020-12878
14+
15+
## Technical Details
16+
The ConnectPort X2e performed filesystem actions as the privileged system user root on files controllable by the less-privileged user python. A malicious attacker could use this to escalate privileges from the local user `python` user to `root`.
17+
18+
Mandiant determined that the user `root` executed the file `/etc/init.d/S50dropbear.sh` during normal system boot. The shell script performed a `chown` on the directory `/WEB/python/.ssh/`, which was writable as the user `python`.
19+
20+
To exploit this, Mandiant used Linux symbolic links to force the system to set the ownership of the directory `/etc/init.d/` to `python:python`. Mandiant could then create a malicious `init` script in the `/etc/init.d/` directory that would be executed by `root` on future system boots.
21+
22+
## Resolution
23+
Digi International has fixed the reported vulnerability in [version 3.2.30.6](https://ftp1.digi.com/support/firmware/93001304_D.pdf) (May 2020) of the ConnectPort X2e software.
24+
25+
## Discovery Credits
26+
- Jake Valletta, FireEye Mandiant
27+
- Sam Sabetan, FireEye Mandiant
28+
29+
## Disclosure Timeline
30+
31+
- 13 February 2020 - Issue reported to vendor
32+
- 11 March 2020 - Issue confirmed by Digi International
33+
- 14 May 2020 - CVE reserved with MITRE
34+
- May 2020 - Digi Releases Patch
35+
- 17 February 2021 - FireEye Mandiant advisory published
36+
37+
## References
38+
39+
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12878
40+
- https://www.fireeye.com/blog/threat-research/2021/02/solarcity-exploitation-of-x2e-iot-device-part-one.html
41+
- https://www.fireeye.com/blog/threat-research/2021/02/solarcity-exploitation-of-x2e-iot-device-part-two.html
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"aliases": [
3+
"CVE-2020-12878",
4+
" FEYE-2020-0020"
5+
],
6+
"summary": "Digi International's ConnectPort X2e is susceptible to a local privilege escalation vulnerable to the privileged user `root`.",
7+
"affected_packages": [],
8+
"references": [
9+
{
10+
"reference_id": "",
11+
"url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12878",
12+
"severities": []
13+
},
14+
{
15+
"reference_id": "",
16+
"url": "https://www.fireeye.com/blog/threat-research/2021/02/solarcity-exploitation-of-x2e-iot-device-part-one.html",
17+
"severities": []
18+
},
19+
{
20+
"reference_id": "",
21+
"url": "https://www.fireeye.com/blog/threat-research/2021/02/solarcity-exploitation-of-x2e-iot-device-part-two.html",
22+
"severities": []
23+
}
24+
],
25+
"date_published": null,
26+
"weaknesses": []
27+
}

0 commit comments

Comments
 (0)