mirror of
https://github.com/adulau/git-vuln-finder.git
synced 2024-11-22 10:07:11 +00:00
new: [cve] automatic extraction of CVE id from commit message
If one of more CVE id(s) are found in a commit message, those are added in the finding output. Example: "8c6f86c7c5350fadf22d32d6cd4712e2ad4447ba": { "message": "Fix an overflow bug in rsaz_512_sqr\n\nThere is an overflow bug in the x64_64 Montgomery squaring procedure used in\nexponentiation with 512-bit moduli. No EC algorithms are affected. Analysis\nsuggests that attacks against 2-prime RSA1024, 3-prime RSA1536, and DSA1024 as a\nresult of this defect would be very difficult to perform and are not believed\nlikely. Attacks against DH512 are considered just feasible. However, for an\nattack the target would have to re-use the DH512 private key, which is not\nrecommended anyway. Also applications directly using the low level API\nBN_mod_exp may be affected if they use BN_FLG_CONSTTIME.\n\nCVE-2019-1551\n\nReviewed-by: Paul Dale <paul.dale@oracle.com>\nReviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>\n(Merged from https://github.com/openssl/openssl/pull/10574)\n", "commit-id": "8c6f86c7c5350fadf22d32d6cd4712e2ad4447ba", "summary": "Fix an overflow bug in rsaz_512_sqr", "stats": { "insertions": 197, "deletions": 184, "lines": 381, "files": 1 }, "author": "Andy Polyakov", "author-email": "appro@openssl.org", "authored_date": 1575460101, "committed_date": 1575635491, "branches": [ "master" ], "pattern-selected": "(?i)(denial of service |\bXXE\b|remote code execution|\bopen redirect|OSVDB|\bvuln|\bCVE\b |\bXSS\b|\bReDoS\b|\bNVD\b|malicious|x−frame−options|attack|cross site |exploit|malicious|directory traversal |\bRCE\b|\bdos\b|\bXSRF \b|\bXSS\b|clickjack|session.fixation|hijack|\badvisory|\binsecure |security |\bcross−origin\b|unauthori[z|s]ed |infinite loop)", "pattern-matches": [ "attack" ], "cve": [ "CVE-2019-1551" ], "state": "cve-assigned" } The state is also updated to cve-assigned if one or more CVE are present in the commit message.
This commit is contained in:
parent
cb850efd6a
commit
846ee3a965
1 changed files with 15 additions and 2 deletions
|
@ -73,7 +73,7 @@ def find_vuln(commit, pattern=vulnpatterns):
|
||||||
|
|
||||||
def summary(commit, branch, pattern):
|
def summary(commit, branch, pattern):
|
||||||
rcommit = commit
|
rcommit = commit
|
||||||
|
cve = extract_cve(rcommit.message)
|
||||||
if rcommit.hexsha in potential_vulnerabilities:
|
if rcommit.hexsha in potential_vulnerabilities:
|
||||||
potential_vulnerabilities[rcommit.hexsha]['branches'].append(branch)
|
potential_vulnerabilities[rcommit.hexsha]['branches'].append(branch)
|
||||||
else:
|
else:
|
||||||
|
@ -90,9 +90,22 @@ def summary(commit, branch, pattern):
|
||||||
potential_vulnerabilities[rcommit.hexsha]['branches'].append(branch)
|
potential_vulnerabilities[rcommit.hexsha]['branches'].append(branch)
|
||||||
potential_vulnerabilities[rcommit.hexsha]['pattern-selected'] = pattern.pattern
|
potential_vulnerabilities[rcommit.hexsha]['pattern-selected'] = pattern.pattern
|
||||||
potential_vulnerabilities[rcommit.hexsha]['pattern-matches'] = ret['match']
|
potential_vulnerabilities[rcommit.hexsha]['pattern-matches'] = ret['match']
|
||||||
|
if cve: potential_vulnerabilities[rcommit.hexsha]['cve'] = cve
|
||||||
|
if cve:
|
||||||
|
potential_vulnerabilities[rcommit.hexsha]['state'] = "cve-assigned"
|
||||||
|
else:
|
||||||
potential_vulnerabilities[rcommit.hexsha]['state'] = args.s
|
potential_vulnerabilities[rcommit.hexsha]['state'] = args.s
|
||||||
|
|
||||||
return rcommit.hexsha
|
return rcommit.hexsha
|
||||||
|
|
||||||
|
def extract_cve(commit):
|
||||||
|
cve_find = re.compile(r'CVE-[1-2]\d{1,4}-\d{1,7}', re.IGNORECASE)
|
||||||
|
m = cve_find.findall(commit)
|
||||||
|
if m:
|
||||||
|
return m
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
repo_heads = repo.heads
|
repo_heads = repo.heads
|
||||||
repo_heads_names = [h.name for h in repo_heads]
|
repo_heads_names = [h.name for h in repo_heads]
|
||||||
print(repo_heads_names, file=sys.stderr)
|
print(repo_heads_names, file=sys.stderr)
|
||||||
|
|
Loading…
Reference in a new issue