Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ab4c073
Initial commit
ptdropper Jul 24, 2017
f22bcad
Merge branch 'master' of https://github.com/ptdropper/scan-for-cve-is…
ptdropper Jul 24, 2017
afec344
Removed local status files for local projects
ptdropper Jul 24, 2017
853b3e3
documented the virtual environment for python
ptdropper Nov 20, 2018
d0f5834
Dynamic files must not be in version control
ptdropper Nov 21, 2018
11dcfe4
Merge https://github.com/ptdropper/CVE-Scanner-for-your-SW-BOM
ptdropper Nov 21, 2018
f135b34
Input files for spacecom
ptdropper Nov 21, 2018
17cd06c
Dosetrack input file
ptdropper Nov 21, 2018
325a54f
Add files via upload
ptdropper Feb 28, 2019
1617781
Update json_cve_parser.py
ptdropper Feb 28, 2019
30e38b6
Update json_cve_parser.py
ptdropper Feb 28, 2019
7416f29
Update json_cve_parser.py
ptdropper Mar 21, 2019
b225898
Use python set mechanism
ptdropper Mar 21, 2019
3020a3f
Reads input list of packages
ptdropper Mar 22, 2019
a2cdbee
Produce output of intersection
ptdropper Mar 25, 2019
1d3f4b6
Formatted output
ptdropper Mar 26, 2019
e643c85
Output format clean up
ptdropper Mar 26, 2019
5f16ef1
Output format
ptdropper Mar 26, 2019
bba2184
Implement the ignore list
ptdropper Mar 26, 2019
92ea1cc
clean up
ptdropper Mar 26, 2019
00a3d17
Exact package version match
ptdropper Mar 26, 2019
ee77186
Output format corrections
ptdropper Mar 27, 2019
2a043cd
Sort the output
ptdropper Mar 27, 2019
e3c7b24
character encoding corrected for Jenkins
Mar 28, 2019
32cde4c
automatic NVD database download
Apr 1, 2019
8aaa75c
automatic download failure corrected
Apr 1, 2019
777e016
Merge pull request #1 from ptdropper/json-format
ptdropper Apr 2, 2019
d114a7c
remove xml support
Apr 5, 2019
8f2971d
Merge branch 'master' of https://github.com/ptdropper/CVE-Scanner-for…
Apr 5, 2019
fec68f6
XML support deprecated by NIST
Apr 5, 2019
d333c64
Python error in ascii encoding
May 28, 2019
887be3a
Create google50af3e76283d37df.html
May 31, 2019
3fd3af4
google identity
May 31, 2019
ccd88a0
Clarify how to
ptdropper May 31, 2019
401f28a
make site search engine searchable
ptdropper May 31, 2019
fac51d2
Update README.md
ptdropper Jun 4, 2019
80dffed
examples and clarify how to use
ptdropper Aug 1, 2019
8a2f99d
examples
ptdropper Aug 1, 2019
b64f415
format clean up
ptdropper Aug 1, 2019
fa1c1f7
Content on how to use the scripts
ptdropper Aug 1, 2019
358e4e7
create example of an input file
ptdropper Aug 1, 2019
88642b8
example input file
ptdropper Aug 1, 2019
1769d17
SQLite interface for wildcard support
ptdropper Oct 15, 2019
24bb62b
Merge branch 'master' of https://github.com/ptdropper/CVE-Scanner-for…
Nov 12, 2019
e94107d
Automate the build and analysis
ptdropper Jan 14, 2020
2d7e1a1
Add files via upload
ptdropper Feb 5, 2020
368480d
Merge branch 'master' of https://github.com/ptdropper/CVE-Scanner-for…
Feb 21, 2020
d19869f
Merge
Feb 21, 2020
22a37d6
Corrected a strange error related to encoding.
Feb 21, 2020
eeab3bc
Sort output of a single file
Feb 24, 2020
e3f627c
Beautify readme
ptdropper Feb 24, 2020
3baa1ae
Support NIST JSON 1.1
ptdropper Apr 17, 2020
b59e901
Merge pull request #3 from ptdropper/nist_json_1_1
ptdropper Apr 17, 2020
175c48f
Merge remote-tracking branch 'origin/master'
Apr 17, 2020
0ef34c7
clean up
Apr 17, 2020
8277f0d
Support for WB45 SBOM
ptdropper Jul 8, 2020
0968e9d
error handling
ptdropper Jul 8, 2020
3fe07aa
Create codeql-analysis.yml
ptdropper Oct 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 0 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['python']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
8 changes: 0 additions & 8 deletions .gitignore

This file was deleted.

71 changes: 51 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
NIST CVE library search engine.
Provide your project's list of software packages, libraries, and any module used to create your product.
This tool will use your list to search tousands of NIST CVE entries to find any known issues.
Knowledge is half the battle, so use this to automate the search for software items that could have outstanding
issues needed a patch.

How does it wor? It is a simple python script used to parse your provided list of software modules (packages, libraries and so on)
against a database of known software vulnerabilities.
The vulnerabilities are the NIST provided CVE issues. The script download.xml gathers an updated database from NIST
and stores it locally.
Then run the cli.py script with your software to parse through the entire database.
The output is an XML file showing the matching CVE's.

Fair warning it uses some specific python libraries so your are BEST served by creating a local directory with
a virtual python envionrment to protect your machine. Trust me.

To get this working you will need to download a copy of the NVD here: https://nvd.nist.gov/download.cfm#CVE_FEED
and put the xml files in the dbs folder.

run package-cve-lookup -h for more information on using the command line interface.
Welcome to the [CVE Scanner](https://github.com/ptdropper/CVE-Scanner-for-your-SW-BOM) wiki!

What is CVE-scanner?
====================
This project provides a way that you can manage the risk inherited by using open source and third party source projects. This provides you with intelligent Software Composition Analysis to identify and reduce risk.

Inputs from your project
========================
The project is a python based NIST-CVE library search engine for use with your own custom Software Bill of Materials (SBOM) input file. This is ideal for projects where you can create a text file of your SBOM as input to the tool. The output will be all CVE identifiers of potential risks. The library from NIST is tens of thousands of entries, and this tool does the work of searching for your specific packages of interest.

HOW TO:
=======
- Create an ascii text input file holding package names and versions of interest.
- Input data file contains the triplet "vendor-product-version" with dashes.
- Must match on all 3 to decide to report the CVE.
- Lines with a leading hash/pound symbol are ignored.

Example for typical open source packages where there is no vendor so set the vendor value to match the product name.
```sh
libssh-libssh-1.0
linux_kernel-linux_kernel-4.9
microsoft-home_server-2003
php-php-5.4.3
```
Whitelist to ignore specific CVEs
=================================
Next is an optional whitelist file you can create. The whitelist is referred to as the "ignore list" in the python sources.
The ignore list content is based on your analysis of the reported CVE's affecting your project. As you review CVE descriptions and details you may find that some of the CVEs do not apply in your product. Then copy those entries into the ignore list file and optionally provide some message to yourself to explain why the CVE does not apply. These ignored CVE's will show up with the marking < skipped > in the report so you are aware they have been analyzed.

Example ignore list file content
================================
```sh
##CVE-2015-7697 does not apply because the product does not use feature foo which is the trigger for this issue.
CVE-2015-7697
```

Usage: ./json_cve_parser.py ./my_input_input -i ./my_ignore_list
Example: the shell script "check_spacecom_json.sh" calls

./json_cve_parser.py ./spacecom_input -i ./spacecom_ignore_list

The parser is json_cve_parser.py, accepts input file, reads each line, searches the database for that triplet, and if that product tripet is related to a CVE number write the CVE number and summary text to the output file. If that CVE is in the ignore list, then indicate that the CVE is marked with the prefix < skipped >.

So there is more to the process as is captured in the script scan_for_vulnerabilities_json.sh. This script is the real entry point for the process which can be run on the command line, in a cron job, or hooked into Jenkins. THe file performs the required database download from NIST, starts a local python environment using the "activate" command, creates a new directory that has a unique incremental build number, and finally calls the shell script "check_spacecom_json.sh" to execute the process.

Jenkins
=======
For a daily build process use the script scan_for_vulnerabilities_json.bat as the hook into your Jenkins build machine. It will call the "scan_for_vulnerablities_json.sh" script in a bash session.

Finally the output directories will continue to grow in number and daily changes to the NIST database will be reflected in the output files in those output directories. One tool to use to verify you can observe changes is to use the Git SCM tool to track every one of the output files. Each day copy the latest over the top of the previous iteration and let the Git diff feature show you what changed. Managing vulnerabilities then means managing these changes.

Binary file added __pycache__/cve_lookup.cpython-37.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

32 changes: 0 additions & 32 deletions application.py

This file was deleted.

1 change: 1 addition & 0 deletions check_com_3_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./json_cve_parser.py space_com_3_input -i space_com_3_ignore_list
2 changes: 0 additions & 2 deletions check_dosetrack.sh

This file was deleted.

2 changes: 2 additions & 0 deletions check_dosetrack_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./json_cve_parser.py dosetracklink.input -i ignorecvelist

2 changes: 0 additions & 2 deletions check_spacecom.sh

This file was deleted.

2 changes: 2 additions & 0 deletions check_spacecom2_wb45_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
./json_cve_parser.py ./spacecom2_wb45_input -i ./spacecom2_wb45_ignore_list
2 changes: 2 additions & 0 deletions check_spacecom_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
./json_cve_parser.py ./spacecom_input -i ./spacecom_ignore_list
82 changes: 0 additions & 82 deletions cli.py

This file was deleted.

Loading