cisagov / cyhy-core

Core code for Cyber Hygiene (CyHy)
Other
8 stars 10 forks source link

Ingest "known ransomware" data in KEV feed #80

Closed dav3r closed 1 year ago

dav3r commented 1 year ago

๐Ÿ—ฃ Description

This PR updates cyhy-kevsync to read the recently-added knownRansomwareCampaignUse field from the CISA JSON known_exploited_vulnerabilities_schema and store it in the CyHy KEVDoc database collection.

Additionally, this PR updates the ticket manager to be aware of the new known_ransomware flag in the ticket details (see https://github.com/cisagov/cyhy-core/pull/80/commits/d166237ae7a367b7198b36cbdaa9a4a0eda58fb6). This is in support of the work needed for https://github.com/cisagov/cyhy-system/issues/101 and https://github.com/cisagov/cyhy-system/issues/102.

๐Ÿ’ญ Motivation and context

In support of the "Ransomware Vulnerability Warning Pilot", this data needs to pulled into the CyHy database so that it can be reported to CyHy stakeholders.

Resolves https://github.com/cisagov/cyhy-system/issues/100.

๐Ÿงช Testing

I deployed these changes to a development environment, ran cyhy-kevsync, and confirmed that it ran successfully:

$ sudo grep kevsync /var/log/syslog
Oct 19 14:57:03 database1 CRON[28154]: (cyhy) CMD (/usr/local/bin/cyhy-kevsync 2>&1 | /usr/bin/logger -t cyhy-kevsync)
Oct 19 14:57:04 database1 cyhy-kevsync: Imported 1022 KEV entries, 184 are known ransomware.

I also checked the database and verified that the new field was being ingested as expected:

> db.kevs.findOne()
{ "_id" : "CVE-2019-0841", "known_ransomware" : true }
> db.kevs.count()
1022
> db.kevs.count({"known_ransomware": true})
184
> db.kevs.count({"known_ransomware": false})
838

โœ… Pre-approval checklist

โœ… Post-merge checklist

dav3r commented 1 year ago

Thanks @mcdonnnj for the solid suggestions. ๐Ÿ‘ I'm clearly a little rusty with my Python. ๐Ÿ˜ณ

dav3r commented 1 year ago

Re-requesting review after the addition of https://github.com/cisagov/cyhy-core/pull/80/commits/d166237ae7a367b7198b36cbdaa9a4a0eda58fb6, which is needed in order to support https://github.com/cisagov/cyhy-system/issues/101 and https://github.com/cisagov/cyhy-system/issues/102.

I also updated this PR's description to mention this additional change.

dav3r commented 1 year ago

These changes have been deployed to Production. I manually ran cyhy-kevsync to pull in the new known_ransomware data and verified that it worked as expected. I will also check the database today to ensure that tickets are getting updated appropriately with the new known_ransomware flag.