SSVC/Deployer.pm

filter: Statementstmt 80.9% 51 / 63 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 6 / 18 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 65.0% 13 / 20 Podpod 100% 9 / 9 totaltotal 64.8% 83 / 128 CC 11 SCAR 21.7
CC
11
Cov
69%
new
21.6
exploitation
2.0
system_exposure
2.0
CRAP 8.8
« SSVC/Supplier.pm ↑ Summary SSVC/CISA.pm »
1 package SSVC::Deployer;
2  
3 2 ▶use feature ':5.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use parent 'SSVC::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use constant METADATA => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
13 key => 'deployer',
14 name => 'Deployer',
15 description =>
16 'Decision about the priority with which a deployer should apply a patch or other remediation for a deployed system.',
17 url => 'https://certcc.github.io/SSVC/',
18 2 };
19  
20 #<<<
21 2 ▶use constant DECISION_POINTS => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
22 exploitation => {
23 vector_name => 'E',
24 label => 'Exploitation',
25 definition => 'The present state of exploitation of the vulnerability.',
26 values => [N => 'none', P => 'public_poc', A => 'active'],
27 },
28  
29 system_exposure => {
30 vector_name => 'EXP',
31 label => 'System Exposure',
32 definition => 'The accessible attack surface of the affected system or service.',
33 values => [S => 'small', C => 'controlled', O => 'open'],
34 },
35  
36 automatable => {
37 vector_name => 'A',
38 label => 'Automatable',
39 definition => 'Can an attacker reliably automate creating exploitation events for this vulnerability?',
40 values => [N => 'no', Y => 'yes'],
41 },
42  
43 safety_impact => {
44 vector_name => 'SI',
45 label => 'Safety Impact',
46 definition => 'The safety impact of the vulnerability.',
47 values => [N => 'negligible', M => 'marginal', R => 'critical', C => 'catastrophic'],
48 },
49  
50 mission_impact => {
51 vector_name => 'MI',
52 label => 'Mission Impact',
53 definition => 'Impact on Mission Essential Functions of the organization.',
54 values => [D => 'degraded', MSC => 'mef_support_crippled', MEF => 'mef_failure', MF => 'mission_failure'],
55 },
56  
57 human_impact => {
58 vector_name => 'HI',
59 label => 'Human Impact',
60 definition => 'Human Impact is a combination of Safety Impact and Mission Impact.',
61 values => [L => 'low', M => 'medium', H => 'high', VH => 'very_high'],
62 },
63  
64 decision => {
65 vector_name => 'DSOI',
66 label => 'Defer, Scheduled, Out-of-Cycle, Immediate',
67 definition => 'The priority with which a deployer should apply a patch or other remediation.',
68 values => [D => 'defer', S => 'scheduled', O => 'out_of_cycle', I => 'immediate'],
69 },
70 2 };
71 #>>>
72  
73 2 ▶use constant DECISION_PATH => [qw(E EXP A HI)];
Subroutine BEGIN: called CC=1 SCAR=0.0
74 2 ▶use constant VECTOR => [qw(E EXP A SI MI HI DSOI)];
Subroutine BEGIN: called CC=1 SCAR=0.0
75  
76 # https://certcc.github.io/SSVC/reference/decision_points/human_impact/ (Safety Impact x Mission Impact -> Human Impact)
77 # SI MI => HI
78 2 my %SI_MI_to_HI = (
79 N => {D => 'L', MSC => 'L', MEF => 'M', MF => 'VH'},
80 M => {D => 'L', MSC => 'L', MEF => 'M', MF => 'VH'},
81 R => {D => 'M', MSC => 'H', MEF => 'H', MF => 'VH'},
82 C => {D => 'VH', MSC => 'VH', MEF => 'VH', MF => 'VH'},
83 );
84  
85 # https://certcc.github.io/SSVC/howto/deployer_tree/ (Exploitation x System Exposure x Automatable x Human Impact -> Decision)
86 # E EXP A HI => DSOI
87 #<<<
88 2 ▶use constant DECISION_TREE => +{
Subroutine BEGIN: called CC=1 SCAR=0.0
89 'A:C:N:H' => 'O', 'A:C:N:L' => 'S', 'A:C:N:M' => 'S', 'A:C:N:VH' => 'O',
90 'A:C:Y:H' => 'O', 'A:C:Y:L' => 'O', 'A:C:Y:M' => 'O', 'A:C:Y:VH' => 'O',
91 'A:O:N:H' => 'O', 'A:O:N:L' => 'S', 'A:O:N:M' => 'O', 'A:O:N:VH' => 'I',
92 'A:O:Y:H' => 'I', 'A:O:Y:L' => 'O', 'A:O:Y:M' => 'O', 'A:O:Y:VH' => 'I',
93 'A:S:N:H' => 'O', 'A:S:N:L' => 'S', 'A:S:N:M' => 'S', 'A:S:N:VH' => 'O',
94 'A:S:Y:H' => 'O', 'A:S:Y:L' => 'S', 'A:S:Y:M' => 'O', 'A:S:Y:VH' => 'O',
95 'N:C:N:H' => 'S', 'N:C:N:L' => 'D', 'N:C:N:M' => 'S', 'N:C:N:VH' => 'S',
96 'N:C:Y:H' => 'S', 'N:C:Y:L' => 'S', 'N:C:Y:M' => 'S', 'N:C:Y:VH' => 'S',
97 'N:O:N:H' => 'S', 'N:O:N:L' => 'D', 'N:O:N:M' => 'S', 'N:O:N:VH' => 'S',
98 'N:O:Y:H' => 'S', 'N:O:Y:L' => 'S', 'N:O:Y:M' => 'S', 'N:O:Y:VH' => 'O',
99 'N:S:N:H' => 'S', 'N:S:N:L' => 'D', 'N:S:N:M' => 'D', 'N:S:N:VH' => 'S',
100 'N:S:Y:H' => 'S', 'N:S:Y:L' => 'D', 'N:S:Y:M' => 'S', 'N:S:Y:VH' => 'S',
101 'P:C:N:H' => 'S', 'P:C:N:L' => 'D', 'P:C:N:M' => 'S', 'P:C:N:VH' => 'S',
102 'P:C:Y:H' => 'S', 'P:C:Y:L' => 'S', 'P:C:Y:M' => 'S', 'P:C:Y:VH' => 'O',
103 'P:O:N:H' => 'S', 'P:O:N:L' => 'S', 'P:O:N:M' => 'S', 'P:O:N:VH' => 'O',
104 'P:O:Y:H' => 'O', 'P:O:Y:L' => 'S', 'P:O:Y:M' => 'S', 'P:O:Y:VH' => 'O',
105 'P:S:N:H' => 'S', 'P:S:N:L' => 'D', 'P:S:N:M' => 'S', 'P:S:N:VH' => 'S',
106 'P:S:Y:H' => 'S', 'P:S:Y:L' => 'S', 'P:S:Y:M' => 'S', 'P:S:Y:VH' => 'S',
107 2 };
108 #>>>
109  
110 72 ▶sub new {
Subroutine new: called CC=11 SCAR=30.7
Pod documented
111  
112 72 my ($class, %params) = @_;
113  
114 72 my $self = $class->SUPER::new(%params);
115  
116 72 ▶ unless ($self->vector_value('SI') && $self->vector_value('MI')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->vector_value("SI") and $self->vector_value("MI")) 0 72 72
Condition33%1/3
$self->vector_value("SI") and $self->vector_value("MI")
!ll&&!rl&&r
0072
MC/DC0%0/2
$self->vector_value("SI") and $self->vector_value("MI")
$self->vector_value("SI") $self->vector_value("MI")
Truth table33%1/3
A and B
A= $self->vector_value("SI")B= $self->vector_value("MI")
ABresult
0X0
100
111
117 0 Carp::croak "Cannot compute 'human_impact': need 'safety_impact' and 'mission_impact'";
118 }
119  
120 72 my $computed_HI = $SI_MI_to_HI{$self->vector_value('SI')}->{$self->vector_value('MI')};
121  
122 72 ▶ if ($self->vector_value('HI') && $self->vector_value('HI') ne $computed_HI) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->vector_value("HI") and $self->vector_value("HI") ne $computed_HI) 0 72 72
Condition33%1/3
$self->vector_value("HI") and $self->vector_value("HI") ne $computed_HI
!ll&&!rl&&r
7200
MC/DC0%0/2
$self->vector_value("HI") and $self->vector_value("HI") ne $computed_HI
$self->vector_value("HI") $self->vector_value("HI") ne $computed_HI
Truth table33%1/3
A and B
A= $self->vector_value("HI")B= $self->vector_value("HI") ne $computed_HI
ABresult
0X0
100
111
123 0 Carp::croak sprintf "Inconsistent 'human_impact' (got: %s, expected: %s)", $self->vector_value('HI'),
124 $computed_HI;
125 }
126  
127 72 $self->{vector}->{HI} = $computed_HI;
128 72 $self->{decision_points}->{human_impact} = $class->decision_point_labels('human_impact')->{$computed_HI};
129  
130 72 ▶ unless ($self->vector_value('E')
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->vector_value("E") and $self->vector_value("EXP") and $self->vector_value("A") and $self->vector_value("HI")) 0 72 72
Condition33%3/9
$self->vector_value("E") and $self->vector_value("EXP") and $self->vector_value("A") and $self->vector_value("HI")
!ll&&!rl&&r
0072
$self->vector_value("E") and $self->vector_value("EXP") and $self->vector_value("A")
!ll&&!rl&&r
0072
$self->vector_value("E") and $self->vector_value("EXP")
!ll&&!rl&&r
0072
MC/DC0%0/4
$self->vector_value("E") and $self->vector_value("EXP") and $self->vector_value("A") and $self->vector_value("HI")
$self->vector_value("E") $self->vector_value("EXP") $self->vector_value("A") $self->vector_value("HI")
Truth table20%1/5
A and B and C and D
A= $self->vector_value("E")B= $self->vector_value("EXP")C= $self->vector_value("A")D= $self->vector_value("HI")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
131 && $self->vector_value('EXP')
132 && $self->vector_value('A')
133 && $self->vector_value('HI'))
134 {
135 0 Carp::croak "Cannot compute 'decision'"
136 . ": need 'exploitation', 'system_exposure', 'automatable' and 'human_impact'";
137 }
138  
139 72 my $computed_D = $class->DECISION_TREE->{join ':', map { $self->vector_value($_) } @{$class->DECISION_PATH}};
140  
141 72 ▶ if ($self->vector_value('DSOI') && $self->vector_value('DSOI') ne $computed_D) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D) 0 72 72
Condition33%1/3
$self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D
!ll&&!rl&&r
7200
MC/DC0%0/2
$self->vector_value("DSOI") and $self->vector_value("DSOI") ne $computed_D
$self->vector_value("DSOI") $self->vector_value("DSOI") ne $computed_D
Truth table33%1/3
A and B
A= $self->vector_value("DSOI")B= $self->vector_value("DSOI") ne $computed_D
ABresult
0X0
100
111
142 0 Carp::croak sprintf "Inconsistent 'decision' (got: %s, expected: %s)", $self->vector_value('DSOI'), $computed_D;
143 }
144  
145 72 $self->{vector}->{DSOI} = $computed_D;
146 72 $self->{decision} = $class->decision_point_labels('decision')->{$computed_D};
147  
148 72 return $self;
149  
150 }
151  
152 0 ▶sub exploitation { shift->{decision_points}->{exploitation} }
Subroutine exploitation: not called CC=1 SCAR=6.9
Pod documented
153 0 ▶sub system_exposure { shift->{decision_points}->{system_exposure} }
Subroutine system_exposure: not called CC=1 SCAR=6.9
Pod documented
154 0 ▶sub automatable { shift->{decision_points}->{automatable} }
Subroutine automatable: not called CC=1 SCAR=6.9
Pod documented
155 0 ▶sub safety_impact { shift->{decision_points}->{safety_impact} }
Subroutine safety_impact: not called CC=1 SCAR=6.9
Pod documented
156 0 ▶sub mission_impact { shift->{decision_points}->{mission_impact} }
Subroutine mission_impact: not called CC=1 SCAR=6.9
Pod documented
157 0 ▶sub human_impact { shift->{decision_points}->{human_impact} }
Subroutine human_impact: not called CC=1 SCAR=6.9
Pod documented
158 72 ▶sub decision { shift->{decision} }
Subroutine decision: called CC=1 SCAR=0.0
Pod documented
159  
160 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=1 SCAR=6.9
Pod documented
161  
162 0 my $self = shift;
163  
164 return {
165 0 exploitation => $self->exploitation,
166 system_exposure => $self->system_exposure,
167 automatable => $self->automatable,
168 safety_impact => $self->safety_impact,
169 mission_impact => $self->mission_impact,
170 human_impact => $self->human_impact,
171 decision => $self->decision,
172 };
173  
174 }
175  
176 2 1;
177  
178  
179 __END__
« SSVC/Supplier.pm ↑ Summary SSVC/CISA.pm »