Skip to content

Commit 3cddddc

Browse files
authored
Merge pull request #183 from martindg/cvss-module
CVSS Module contribution
2 parents 50d1d5e + cff8fb4 commit 3cddddc

23 files changed

Lines changed: 872 additions & 21 deletions

trainingportal/qna.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,34 @@ let analysisEnc = (mes) => {
231231
return getRes(goldenKey, cipher);
232232
}
233233

234+
let cvss_3_score_1 = () => {
235+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N")};
236+
}
237+
238+
let cvss_4_score_2 = () => {
239+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N")};
240+
}
241+
242+
let cvss_5_chain = () => {
243+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N")};
244+
}
245+
246+
let cvss_6_score_3 = () => {
247+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N")};
248+
}
249+
250+
let cvss_7_score_4 = () => {
251+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N")};
252+
}
253+
254+
let cvss_8_score_5 = () => {
255+
return {"digest": getDigest("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N")};
256+
}
257+
258+
let cvss_9_score_6 = () => {
259+
return {"digest": getDigest("CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N")};
260+
}
261+
234262
const DEFS = {
235263
"crypto_caesar": caesarEnc,
236264
"crypto_vigenere": vigenereEnc,
@@ -239,7 +267,14 @@ const DEFS = {
239267
"crypto_hash": hashEnc,
240268
"crypto_xor": xorEnc,
241269
"crypto_pbk": pbkEnc,
242-
"crypto_analysis": analysisEnc
270+
"crypto_analysis": analysisEnc,
271+
"cvss_3_score_1": cvss_3_score_1,
272+
"cvss_4_score_2": cvss_4_score_2,
273+
"cvss_5_chain": cvss_5_chain,
274+
"cvss_6_score_3": cvss_6_score_3,
275+
"cvss_7_score_4": cvss_7_score_4,
276+
"cvss_8_score_5": cvss_8_score_5,
277+
"cvss_9_score_6": cvss_9_score_6
243278
}
244279

245280
module.exports = {
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
## The Common Vulnerability Scoring System (CVSS)
2+
3+
<br>
4+
5+
The Common Vulnerability Scoring System (CVSS) is an *open framework for communicating the characteristics and severity of software vulnerabilities*. You can find the most complete and up-to-date information on CVSS at [https://www.first.org/cvss/](https://www.first.org/cvss/). The current version of the CVSS specification is CVSS v4 with CVSS v3 still being widely used. CVSS provides a standardized vendor agnostic and platform agnostic methodology and produces a CVSS Score value between 0 and 10 and a CVSS rating:
6+
7+
- 9.0 - 10.0 Critical
8+
- 7.0 - 8.9 High
9+
- 4.0 - 6.9 Medium
10+
- 0.1 - 3.9 Low
11+
- 0.0 None
12+
13+
14+
15+
The CVSS score is produced by choosing the corresponding values for each CVSS metric (metrics will be covered in detail later in this chapter). The final set of all metrics is represented in the so called CVSS Vector e.g. `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N`. This example is decoded as:
16+
17+
- `AV:N` -> Attack Vector (AV): Network (N)
18+
- `AC:L` -> Attack Complexity (AC): Low (L)
19+
- `AT:N` -> Attack Requirements (AT): None (N)
20+
- `PR:N` -> Privileges Required (PR): None (N)
21+
- `UI:N` -> User Interaction (UI): None (N)
22+
- `VC:H` -> Vulnerable System Confidentiality (VC): High (H)
23+
- `VI:H` -> Vulnerable System Integrity (VI): High (H)
24+
- `VA:N` -> Vulnerable System Availability (VA): None (N)
25+
- `SC:N` -> Subsequent System Confidentiality (SC): None (N)
26+
- `SI:N` -> Subsequent System Integrity (SI): None (N)
27+
- `SA:N` -> Subsequent System Availability (SA): None (N)
28+
29+
Just by looking at the CVSS Vector, we can understand the (high-level) story behind the vulnerability. In this example we can see that: An unauthenticated attacker (`AV:N/AC:L/AT:N/PR:N/UI:N`) can read and write sensitive data (`VC:H/VI:H/VA:N`).
30+
31+
<br><br><br>
32+
33+
---
34+
35+
### It is important to note that CVSS `is not a` *Risk Score*.
36+
37+
<br><br>
38+
39+
CVSS gives us a **technical score** of a vulnerability. It does **NOT** deal with any business, financial, health or any other form of risk. To better understand this, consider the following example:
40+
41+
- 2 different vulnerabilities
42+
- The same CVSS score of 9.0 Critical
43+
- One of those is in a music player / sound device
44+
- The other is in a medical software responsible for delivering health-critical medical services to patients
45+
46+
The CVSS specification explicitly covers that vulnerability management should consider factors that are outside of CVSS:
47+
48+
Consumers may use CVSS information as input to an organizational vulnerability management
49+
process that also considers factors that are not part of CVSS in order to rank the threats
50+
to their technology infrastructure and make informed remediation decisions. Such factors may
51+
include, but are not limited to: regulatory requirements, number of customers impacted,
52+
monetary losses due to a breach, life or property threatened, or reputational impacts of a
53+
potential exploited vulnerability. These factors are outside the scope of CVSS.
54+
55+
---
56+
57+
<br><br><br>
58+
59+
## CVSS Metric Groups
60+
61+
<br>
62+
63+
CVSS v4 has 4 metric groups:
64+
65+
- Base.
66+
- Intrinsic characteristics
67+
- Constant over time
68+
- Assumes reasonable worst-case impact
69+
- Threat.
70+
- The current state of exploitability and remediation
71+
- Can only go lower than the Base score
72+
- Environmental.
73+
- Adjusted to specific environment
74+
- Considers mitigating factors
75+
- Considers adverse effects
76+
- Can go higher or lower than the Base score
77+
- Supplemental.
78+
- Context and additional extrinsic attributes
79+
- No impact on the CVSS score
80+
81+
For the remainder of this chapter, we will be focusing only on the Base metric group as it provides the most robust measure of a vulnerability's characteristics. The Environmental group is also very effective for adjusting the exploitability and impact metrics for a particular environment and can be viewed as a modification to the Base metric.
82+
83+
84+
## CVSS Base Score
85+
86+
CVSS Base metrics go into 2 broad categories:
87+
88+
- **Exploitability**. How easy/hard it is to exploit the vulnerability and what the prerequisites are.
89+
- `Attack Vector (AV)`
90+
- `Attack Complexity (AC)`
91+
- `Attack Requirements (AT)`
92+
- `Privileges Required (PR)`
93+
- `User Interaction (UI)`
94+
- **Impact**. The security properties being violated.
95+
- *Vulnerable System*. The system that has the vulnerability.
96+
- `Confidentialiy (VC)`
97+
- `Integrity (VI)`
98+
- `Availability (VA)`
99+
- *Subsequent System*. Other dependent system(s) being impacted.
100+
- `Confidentiality (SC)`
101+
- `Integrity (SI)`
102+
- `Availability (SA)`
103+
104+
<br><br><br>
105+
106+
### Exploitability Metrics
107+
108+
#### [Attack Vector (AV)](https://www.first.org/cvss/v4-0/specification-document#Attack-Vector-AV)
109+
- **Question**: From where can an attacker execute the attack?
110+
- **Values**:
111+
- Network (`N`)
112+
- Remotely over the network
113+
- **Examples**:
114+
- Web-based attacks
115+
- Adjacent (`A`)
116+
- Local/Adjacent network (physical or logical)
117+
- **Examples**:
118+
- Physical proximity
119+
- Bluetooth
120+
- WiFi
121+
- Logical proximity
122+
- ARP
123+
- DHCP
124+
- Local (`L`)
125+
- Not bound to the network stack
126+
- **Examples**:
127+
- Vulnerable lock screen
128+
- Malware infected document
129+
- Local Privilege Escalation (LPE)
130+
- Physical (`P`)
131+
- Physical access to the device
132+
- **Examples**:
133+
- Malicious USB device
134+
- Evil Maid attacks
135+
136+
#### [Attack Complexity (AC)](https://www.first.org/cvss/v4-0/specification-document#Attack-Complexity-AC)
137+
138+
- **Question**: What are the requirements for bypassing security-enhancing conditions/controls?
139+
- **Values**:
140+
- Low (`L`)
141+
- The attack requires no target-specific defense circumvention
142+
- **Examples**:
143+
- Most web attacks
144+
- High (`H`)
145+
- The attack requires evasion or circumvention of security-enhancing techniques in place that would otherwise hinder the attack:
146+
- address space layout randomization (ASLR)
147+
- data execution prevention (DEP)
148+
- Obtaining target-specific secrets
149+
- **Examples**:
150+
- [regreSSHion CVE-2024-6387](https://www.first.org/cvss/v4-0/examples#regreSSHion-CVE-2024-6387)
151+
- Attackers must defeat memory safety defenses in order to achieve code execution
152+
153+
**NOTE**: It is important to note that Attack Complexity is **not** related to exploit complexity. A proof-of-concept for exploiting a vulnerability may be a sophisticated piece of code itself, but that does not necessarily have effect on the Attack Complexity metric. You should ask not "How hard would it be for someone to design the exploit code?", but instead ask "How hard would it be for someone having access to the exploit code to overcome the security conditions in order for this attack to work?"
154+
155+
#### [Attack Requirements (AT)](https://www.first.org/cvss/v4-0/specification-document#Attack-Requirements-AT)
156+
157+
- **Question**: Are there any non-security-specific conditions that need to be overcome?
158+
- **Values**:
159+
- None (`N`)
160+
- No special requirements or conditions
161+
- **Examples**:
162+
- Most web attacks
163+
- Present (`P`)
164+
- The attack requires the presence of a specific condition that is not always present
165+
- **Examples**:
166+
- Race condition requiring a very specific timing window
167+
- Man-in-the-Middle (MitM) attacks
168+
169+
#### [Privileges Required (PR)](https://www.first.org/cvss/v4-0/specification-document#Privileges-Required-PR)
170+
171+
- **Question**: What privileges does an attacker need (themselves, not the victim)?
172+
- **Values**:
173+
- None (`N`)
174+
- No need for authentication
175+
- **Examples**:
176+
- SQL injection on the login page
177+
- Low (`L`)
178+
- Authentication required, but only low privileges
179+
- **Examples**:
180+
- Low-privileged user can access the admin panel
181+
- Logged in attacker is able to change other users’ data
182+
- High (`H`)
183+
- Attacker needs significant privileges (e.g. admin)
184+
- **NOTE**: In CVSS we only measure the impact of a vulnerability in terms of what is gained by exploiting it. It wouldn't make sense to score legitimate administrative capabilities as impact.
185+
- **Examples**:
186+
- Exploit only possible through the admin panel of a Web app
187+
- Change of scope vulnerabilities such as a privileged user on a VM/container can escape into the host and execute commands there
188+
189+
#### [User Interaction (UI)](https://www.first.org/cvss/v4-0/specification-document#User-Interaction-UI)
190+
191+
- **Question**: What are the requirements on the user/victim for the attack to succeed?
192+
- **Values**:
193+
- None (`N`)
194+
- Attacker can exploit without any interaction from any user/victim
195+
- **Examples**:
196+
- SQL injection on the login page
197+
- Passive (`P`)
198+
- Requires only limited interaction or normal/ordinary user behaviour
199+
- **Examples**:
200+
- A user will be compromised if they simply open a malicious message/email/sms within the application (not having to further follow any links)
201+
- A malicious user can change their user info so that an account takeover occurs whenever the admin user generates reports (assuming report generation is a normal/expected activity)
202+
- A stored cross-site scripting (XSS) in the default dashboard that loads after user log-in
203+
- Active (`A`)
204+
- Requires a behaviour that is out of the ordinary, against recommended guidance, or subverting security controls
205+
- **Examples**:
206+
- An email with malicious attachment that the victim needs to explicitly download and execute
207+
- The user must explicitly accept/override a security warning such as certificate/TLS issues reported by the browser
208+
- Reflected cross-site scripting (XSS) where the victim needs to follow a malicious link
209+
210+
### Impact Metrics
211+
212+
#### CIA
213+
214+
In CVSS impact is measured against the security properties:
215+
216+
- **Confidentiality (C)**. Attackers can't read data.
217+
- **Integrity (I)**. Attackers can't modify data.
218+
- **Availability (A)**. Attackers can't disrupt the service.
219+
220+
Impact is only measured in terms of what is gained by exploiting a vulnerability. For example, a vulnerability that allows a read-only user to modify some data should only be scored with Integrity impact. The impact should be contained to what can be proven or reasonably expected.
221+
222+
**NOTES**:
223+
224+
- Brute-forcing cryptographically secure algorithms with sufficient key size and entropy should be considered neither reasonable nor practical
225+
- Finding a collision in a hashing function known to be broken (such as SHA-1) has to be considered reasonable (as proven in the shattered attack), even if not computationally/financially feasible for non-financially capable attackers.
226+
227+
#### Scope (Vulnerable System Impact vs Subsequent System Impact)
228+
229+
CVSS v4 introduces separate impact scores for the Vulnerable (`V`) system and Subsequent (`S`) systems (previously in CVSS v3 this used to be marked by a Scope (`S`) metric).
230+
231+
The CVSS documentation includes a [CVSS User Guide](https://www.first.org/cvss/v4-0/user-guide#Vulnerable-System-and-Subsequent-System) with some examples on scope scoring.
232+
233+
Examples of change of scope (vulnerable to subsequent) for impact:
234+
235+
- vulnerability in a virtualization hypervisor that allows a virtual machine "escape" from the VM onto the host (similarly, container escape)
236+
- cross-site scripting (XSS) vulnerabilities. The vulnerable system is the web server, but the impacted system (i.e. subsequent) is the victim's web browser.
237+
238+
#### [Confidentiality (VC/SC)](https://www.first.org/cvss/v4-0/specification-document#Confidentiality-VC-SC)
239+
240+
- **Security Property**. Attackers can't read data.
241+
- **Values**:
242+
- None (`N`)
243+
- No impact
244+
- Low (`L`)
245+
- Read access to some restricted data:
246+
- No control over which data
247+
- Amount/kind is limited
248+
- **Examples**:
249+
- Attacker can read internal debug messages and see some internal details (e.g. IP addresses), but no secrets or critical information
250+
- Attacker can see user statistics
251+
- High (`H`)
252+
- Read all data or critical data
253+
- **Examples**:
254+
- SQL injection allowing database dump of the whole database
255+
- Attacker can read another user's access tokens
256+
257+
#### [Integrity (VI/SI)](https://www.first.org/cvss/v4-0/specification-document#Integrity-VI-SI)
258+
259+
- **Security Property**. Attackers can't modify data.
260+
- **Values**:
261+
- None (`N`)
262+
- No impact
263+
- Low (`L`)
264+
- Read access to some restricted data:
265+
- No control over which data
266+
- Amount/kind is limited
267+
- **Examples**:
268+
- Attacker can change another user's avatar image
269+
- High (`H`)
270+
- Modify all data or critical data
271+
- **Examples**:
272+
- SQL injection allowing database modifications
273+
- Attacker can set another user's authentication details (e.g. password, tokens)
274+
275+
276+
#### [Availability (VA/SA)](https://www.first.org/cvss/v4-0/specification-document#Availability-VA-SA)
277+
278+
- **Security Property**. Attackers can't disrupt the service.
279+
- **Values**:
280+
- None (`N`)
281+
- No impact
282+
- Low (`L`)
283+
- Some impact (performance) or partial impact
284+
- **Examples**:
285+
- Computationally intensive cryptographic operation can be abused to partially overload the CPU and cause slower server responses, but cannot completely deny the service
286+
- Attacker can deny some non-critical functionality e.g. report generation
287+
- High (`H`)
288+
- Full service denial or critical parts being denied
289+
- Fully deny access
290+
- Sustained (for the duration of the attack)
291+
- Persistent (even after the attack)
292+
- Deny only access to some critical resources
293+
- User login sessions
294+
- **Examples**:
295+
- Attacker can abuse a particular operation that would overload the server and prevent it from serving clients for the next 10 seconds. The attacker can sustain the attack with 1 request every 9-10 seconds.
296+
- Attacker can send a malformed request the would crash the server. The service will no longer be available until it is manually restarted.
297+
- Attacker can break the login functionality. Existing sessions remain intact, but users cannot sign in anymore (sustained or persistent).
298+
299+
300+
---
301+
302+
**Resources**:
303+
304+
- CVSS Documentation: [https://www.first.org/cvss/](https://www.first.org/cvss/)
305+
- CVSS 4.0 Calculator: [https://www.first.org/cvss/calculator/4-0](https://www.first.org/cvss/calculator/4-0)
306+
- CVSS Examples: [https://www.first.org/cvss/v4-0/examples](https://www.first.org/cvss/v4-0/examples)
307+
- CVSS User Guide: [https://www.first.org/cvss/v4-0/user-guide](https://www.first.org/cvss/v4-0/user-guide)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The CVSS specification is available at [https://www.first.org/cvss/](https://www.first.org/cvss/).

0 commit comments

Comments
 (0)