Skip to content

Commit b4ba06d

Browse files
authored
Merge branch 'main' into cvss-v-display
2 parents 184ecc0 + 398ca99 commit b4ba06d

19 files changed

Lines changed: 477 additions & 75 deletions

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ executing==0.8.3
3535
freezegun==1.2.1
3636
frozenlist==1.3.0
3737
gitdb==4.0.9
38-
GitPython==3.1.37
38+
GitPython==3.1.41
3939
gunicorn==20.1.0
4040
idna==3.3
4141
imagesize==1.3.0
@@ -44,7 +44,7 @@ iniconfig==1.1.1
4444
ipython==8.10.0
4545
isort==5.10.1
4646
jedi==0.18.1
47-
Jinja2==3.1.1
47+
Jinja2==3.1.3
4848
jsonschema==3.2.0
4949
license-expression==21.6.14
5050
lxml==4.9.1
@@ -106,7 +106,7 @@ toml==0.10.2
106106
tomli==2.0.1
107107
traitlets==5.1.1
108108
typing_extensions==4.1.1
109-
univers==30.10.0
109+
univers==30.11.0
110110
urllib3==1.26.18
111111
wcwidth==0.2.5
112112
websocket-client==0.59.0

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ install_requires =
7171

7272
#essentials
7373
packageurl-python>=0.10.5rc1
74-
univers>=30.10.0
74+
univers>=30.11.0
7575
license-expression>=21.6.14
7676

7777
# file and data formats

vulnerabilities/importers/fireeye.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def advisory_data(self) -> Iterable[AdvisoryData]:
4444
if Path(file).stem == "README":
4545
continue
4646
try:
47-
with open(file) as f:
47+
with open(file, encoding="utf-8-sig") as f:
4848
yield parse_advisory_data(raw_data=f.read(), file=file, base_path=base_path)
4949
except UnicodeError:
5050
logger.error(f"Invalid file {file}")

vulnerabilities/importers/github.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
class GitHubAPIImporter(Importer):
9393
spdx_license_expression = "CC-BY-4.0"
9494
importer_name = "GHSA Importer"
95+
license_url = "https://github.com/github/advisory-database/blob/main/LICENSE.md"
9596

9697
def advisory_data(self) -> Iterable[AdvisoryData]:
9798
for ecosystem, package_type in PACKAGE_TYPE_BY_GITHUB_ECOSYSTEM.items():
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
10+
from django.db import migrations
11+
from django.db import models
12+
13+
14+
class Migration(migrations.Migration):
15+
16+
def remove_duped_changelogs(apps, schema_editor):
17+
PackageChangeLog = apps.get_model("vulnerabilities", "PackageChangeLog")
18+
VulnerabilityChangeLog = apps.get_model("vulnerabilities", "VulnerabilityChangeLog")
19+
20+
models_list = [PackageChangeLog, VulnerabilityChangeLog]
21+
22+
for model in models_list:
23+
# Identify duplicate records based on actor_name, action_type, and source_url
24+
duplicate_records = model.objects.values('actor_name', 'action_type', 'source_url').annotate(count=models.Count('id')).filter(count__gt=1)
25+
26+
to_be_deleted = list()
27+
28+
for duplicate_set in duplicate_records:
29+
# Get the records for the current duplicate set
30+
records_to_delete = model.objects.filter(
31+
actor_name=duplicate_set['actor_name'],
32+
action_type=duplicate_set['action_type'],
33+
source_url=duplicate_set['source_url']
34+
).order_by('-software_version')
35+
36+
# Keep the record with the older software version
37+
record_to_keep = records_to_delete.last()
38+
39+
# Delete the records with the newer software version
40+
to_be_deleted.extend(records_to_delete.exclude(id=record_to_keep.id))
41+
42+
to_be_deleted = list(set(to_be_deleted))
43+
to_be_deleted = [rec.id for rec in to_be_deleted]
44+
model.objects.filter(id__in = to_be_deleted).delete()
45+
46+
dependencies = [
47+
("vulnerabilities", "0054_alter_packagechangelog_software_version_and_more"),
48+
]
49+
50+
operations = [
51+
migrations.RunPython(remove_duped_changelogs, reverse_code=migrations.RunPython.noop),
52+
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 4.1.13 on 2024-01-22 09:42
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("vulnerabilities", "0055_remove_changelogs_with_same_data_different_software_version"),
10+
]
11+
12+
operations = [
13+
migrations.AlterUniqueTogether(
14+
name="packagechangelog",
15+
unique_together={("action_time", "actor_name", "action_type", "source_url")},
16+
),
17+
migrations.AlterUniqueTogether(
18+
name="vulnerabilitychangelog",
19+
unique_together={("action_time", "actor_name", "action_type", "source_url")},
20+
),
21+
]

vulnerabilities/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ def get_iso_time(self):
11451145
class Meta:
11461146
abstract = True
11471147
ordering = ("-action_time",)
1148+
unique_together = ("action_time", "actor_name", "action_type", "source_url")
11481149

11491150

11501151
class VulnerabilityHistoryManager(models.Manager):
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MNDT-2023-0017
2+
3+
The IBM Personal Communications (PCOMM) application 13.0.0 and earlier caused a user's plaintext password to be written to the `C:\Temp\pcsnp_init.log` file when re-connection was made through a remote desktop protocol.
4+
5+
## Common Weakness Enumeration
6+
CWE-312: Cleartext Storage of Sensitive Information
7+
8+
## Impact
9+
High - An attacker with low-privilege access to a host with IBM PCOMM could recover the plaintext password of another user.
10+
11+
## Exploitability
12+
Low - Exploitability varies depending on the environment in which IBM PCOMM is installed. Mandiant identified this vulnerability when conducting independent security research for a client that used Citrix to connect to shared Windows Server instances. In certain environments where remote desktop is used to connect to shared hosts with IBM PCOMM installed, the exploitability is greatly increased.
13+
14+
## CVE Reference
15+
CVE-2016-0321 - scope expanded
16+
17+
## Technical Details
18+
While conducting independent security research, Mandiant identified a plaintext Active Directory password stored within the `C:\Temp\pcsnp_init.log` file. The affected host had IBM PCOMM version 13.0.0 installed and was used by multiple users who connected with Citrix. Upon a user connecting, disconnecting, and connecting again, the user's plaintext password was stored in the `C:\Temp\pcsnp_init.log` file.
19+
20+
## Discovery Credits
21+
- Adin Drabkin, Mandiant
22+
- Matthew Rotlevi, Mandiant
23+
24+
## Disclosure Timeline
25+
- 2023-09-26 - Issue reported to the vendor.
26+
- 2023-11-03 - The vendor updated the security bulletin for CVE-2016-0321 to include all known affected and fixed versions.
27+
28+
## References
29+
- [IBM Security Bulletin](https://www.ibm.com/support/pages/security-bulletin-ibm-personal-communications-could-allow-remote-user-obtain-sensitive-information-including-user-passwords-allowing-unauthorized-access-cve-2016-0321)
30+
- [IBM Personal Communications](https://www.ibm.com/support/pages/ibm-personal-communications)
31+
- [Mitre CVE-2016-0321](https://www.cve.org/CVERecord?id=CVE-2016-0321)

vulnerabilities/tests/test_data_migrations.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,3 +610,53 @@ def setUpBeforeMigration(self, apps):
610610
def test_removal_of_duped_purls(self):
611611
Package = apps.get_model("vulnerabilities", "Package")
612612
assert Package.objects.count() == 1
613+
614+
615+
class TestRemoveDupedChangeLogWithSameData(TestMigrations):
616+
app_name = "vulnerabilities"
617+
migrate_from = "0054_alter_packagechangelog_software_version_and_more"
618+
migrate_to = "0055_remove_changelogs_with_same_data_different_software_version"
619+
620+
def setUpBeforeMigration(self, apps):
621+
PackageChangeLog = apps.get_model("vulnerabilities", "PackageChangeLog")
622+
VulnerabilityChangeLog = apps.get_model("vulnerabilities", "VulnerabilityChangeLog")
623+
Package = apps.get_model("vulnerabilities", "Package")
624+
Vulnerability = apps.get_model("vulnerabilities", "Vulnerability")
625+
pkg1 = Package.objects.create(type="nginx", name="nginx", qualifiers={"os": "windows"})
626+
vuln = Vulnerability.objects.create(summary="NEW")
627+
PackageChangeLog.objects.create(
628+
actor_name="Nginx",
629+
action_type=1,
630+
source_url="test",
631+
software_version="1",
632+
package=pkg1,
633+
related_vulnerability=vuln,
634+
)
635+
PackageChangeLog.objects.create(
636+
actor_name="Nginx",
637+
action_type=1,
638+
source_url="test",
639+
software_version="2",
640+
package=pkg1,
641+
related_vulnerability=vuln,
642+
)
643+
VulnerabilityChangeLog.objects.create(
644+
actor_name="Nginx",
645+
action_type=1,
646+
source_url="test",
647+
software_version="2",
648+
vulnerability=vuln,
649+
)
650+
VulnerabilityChangeLog.objects.create(
651+
actor_name="Nginx",
652+
action_type=1,
653+
source_url="test",
654+
software_version="1",
655+
vulnerability=vuln,
656+
)
657+
658+
def test_removal_of_changelog(self):
659+
PackageChangeLog = apps.get_model("vulnerabilities", "PackageChangeLog")
660+
VulnerabilityChangeLog = apps.get_model("vulnerabilities", "VulnerabilityChangeLog")
661+
assert PackageChangeLog.objects.all().count() == 1
662+
assert VulnerabilityChangeLog.objects.all().count() == 1

vulnerabilities/tests/test_fireeye.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,48 @@ def test_parse_advisory_data_2(self):
172172
result = imported_data.to_dict()
173173

174174
util_tests.check_results_against_json(result, expected_file)
175+
176+
def test_md_list_to_dict_2(self):
177+
expected_output = {
178+
"# MNDT-2023-0017\n": [
179+
"\n",
180+
"The IBM Personal Communications (PCOMM) application 13.0.0 and earlier caused a user's plaintext password to be written to the `C:\\Temp\\pcsnp_init.log` file when re-connection was made through a remote desktop protocol.\n",
181+
"\n",
182+
],
183+
"## Common Weakness Enumeration\n": [
184+
"CWE-312: Cleartext Storage of Sensitive Information\n",
185+
"\n",
186+
],
187+
"## Impact\n": [
188+
"High - An attacker with low-privilege access to a host with IBM PCOMM could recover the plaintext password of another user.\n",
189+
"\n",
190+
],
191+
"## Exploitability\n": [
192+
"Low - Exploitability varies depending on the environment in which IBM PCOMM is installed. Mandiant identified this vulnerability when conducting independent security research for a client that used Citrix to connect to shared Windows Server instances. In certain environments where remote desktop is used to connect to shared hosts with IBM PCOMM installed, the exploitability is greatly increased.\n",
193+
"\n",
194+
],
195+
"## CVE Reference\n": ["CVE-2016-0321 - scope expanded\n", "\n"],
196+
"## Technical Details\n": [
197+
"While conducting independent security research, Mandiant identified a plaintext Active Directory password stored within the `C:\\Temp\\pcsnp_init.log` file. The affected host had IBM PCOMM version 13.0.0 installed and was used by multiple users who connected with Citrix. Upon a user connecting, disconnecting, and connecting again, the user's plaintext password was stored in the `C:\\Temp\\pcsnp_init.log` file.\n",
198+
"\n",
199+
],
200+
"## Discovery Credits\n": [
201+
"- Adin Drabkin, Mandiant\n",
202+
"- Matthew Rotlevi, Mandiant\n",
203+
"\n",
204+
],
205+
"## Disclosure Timeline\n": [
206+
"- 2023-09-26 - Issue reported to the vendor.\n",
207+
"- 2023-11-03 - The vendor updated the security bulletin for CVE-2016-0321 to include all known affected and fixed versions.\n",
208+
"\n",
209+
],
210+
"## References\n": [
211+
"- [IBM Security Bulletin](https://www.ibm.com/support/pages/security-bulletin-ibm-personal-communications-could-allow-remote-user-obtain-sensitive-information-including-user-passwords-allowing-unauthorized-access-cve-2016-0321)\n",
212+
"- [IBM Personal Communications](https://www.ibm.com/support/pages/ibm-personal-communications)\n",
213+
"- [Mitre CVE-2016-0321](https://www.cve.org/CVERecord?id=CVE-2016-0321)\n",
214+
],
215+
}
216+
with open(os.path.join(TEST_DATA, "fireeye_test3.md"), encoding="utf-8-sig") as f:
217+
md_list = f.readlines()
218+
md_dict = md_list_to_dict(md_list)
219+
assert md_dict == expected_output

0 commit comments

Comments
 (0)