Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooling for generating Tim's shadedetector run scripts #27

Merged
merged 12 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CVE-2013-2186/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2013-5960/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2014-0050/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2015-6420/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2015-6748/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2015-7501/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2016-0779/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2016-2510/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2016-5394/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2016-6798/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2016-6802/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2016-7051/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2017-15717/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2017-18349/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2018-1002201/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2018-10237/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2018-11771/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2018-1324/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2018-8017/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2019-0225/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2019-12402/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2020-1953/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2021-29425/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions CVE-2021-44228/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2022-25845/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2022-38749/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2022-38751/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2022-42889/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions CVE-2022-45688/mvn_clean_test.exitstatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
12 changes: 11 additions & 1 deletion tools/create-pov-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,22 @@ if (json.affected.length > 1) {
const nvdUrl = 'https://nvd.nist.gov/vuln/detail/'
const ghsaUrl = 'https://github.com/advisories/'

let testSignalWhenVulnerable = "success|failure"; // User needs to figure out which
try {
const mvnTestExitStatus = fs.readFileSync('mvn_clean_test.exitstatus');
testSignalWhenVulnerable = mvnTestExitStatus === '1' ? 'failure' : 'success';
console.error(`Auto-determined testSignalWhenVulnerable=${testSignalWhenVulnerable}`);
} catch (e) {
// Ignore; most likely the file did not exist
console.error('Could not auto-determine testSignalWhenVulnerable');
}

const xshady = {
id: cve,
artifact: affected.package.name,
vulnerableVersions: affected.versions,
fixVersion: null,
testSignalWhenVulnerable: "success|failure",
testSignalWhenVulnerable,
references: [nvdUrl + cve, ghsaUrl + ghsa]
}

Expand Down
13 changes: 13 additions & 0 deletions tools/guess_gav.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/perl

my ($g, $a, $v);

while (<>) {
if ((/<dependency>/ .. m|</dependency>|) && !defined($v)) {
m|<groupId>(.*?)</groupId>| and $g = $1;
m|<artifactId>(.*?)</artifactId>| and $a = $1;
m|<version>(.*?)</version>| and $v = $1;
}
}

print "$g:$a:$v\n";
29 changes: 29 additions & 0 deletions tools/run_shadedetector_on_all.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/perl

use strict;
use warnings;

my $n = 100;

my $localScratchCacheDir = '/local/scratch/whitewa/shadedetector/.cache';
my $cacheDir = (-d $localScratchCacheDir ? $localScratchCacheDir : "$ENV{HOME}/code/shadedetector/.cache");
my $jarPath = "../target/shadedetector.jar";
my $xshadyPath = "$ENV{HOME}/code/xshady";

foreach my $d (<CVE-*>) {
my $gav = `tools/guess_gav.pl < $d/pom.xml`;
chomp $gav;
my $exitStatus = `cat $d/mvn_clean_test.exitstatus`;
chomp $exitStatus;
my $sig = ($exitStatus eq '0' ? 'success' : 'failure');

#print "$d: $gav\n";
my ($g, $a, $v) = split /:/, $gav;

# For now just assume exit status 1 means failures, not errors (it's actually the case for now).
my $cmd = "/usr/bin/time java -jar $jarPath -g $g -a $a -v $v -vul $xshadyPath/$d -sig $sig -l log$n-$d.log -vos vuln_staging -vov vuln_final --stats stats$n-$d.log -o1 csv.details?dir=details$n-$d -o2 csv.summary?file=summary$n-$d.csv -cache $cacheDir";

print "$cmd\n";

++$n;
}