Skip to content

Repository files navigation

Pentest-Risk-API (PRA)

Simple Python Flask API server that returns risk scores for CVSS and OWASP Risk Rating vector strings.

🐳 Usage

You can use the provided docker-compose.yml or just run:

docker run -it -rm -p 5000:5000 ghcr.io/pentestfactory/pentest-risk-api:latest

CVSS Risk Rating

# query CVSS 2.0 vector
curl "http://127.0.0.1:5000/cvss?vector=CVSS:2.0/AV:N/AC:L/Au:N/C:C/I:C/A:C"
# query CVSS 3.1 vector
curl "http://127.0.0.1:5000/cvss?vector=CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
# query CVSS 4.0 vector
curl "http://127.0.0.1:5000/cvss?vector=CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"

Example response:

{
"api_version": "0.1.0",
"cvss_score": 9.8,
"cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"risk_severity": "CRITICAL"
}

Tip

For CVSS 4.0, the API server defines Subsequent System Impact Metrics as optional.

Therefore, you can neglect SC, SI and SA from your provided vector string. The backend will automatically set those to N (None).

OWASP Risk Rating

Implements the OWASP Risk Rating Methodology based on 16 factors split across Likelihood and Impact.

# with optional parentheses
curl "http://127.0.0.1:5000/owasp?vector=(SL:5/M:5/O:5/S:5/ED:5/EE:5/A:5/ID:5/LC:5/LI:5/LAV:5/LAC:5/FD:5/RD:5/NC:5/PV:5)"
# without parentheses
curl "http://127.0.0.1:5000/owasp?vector=SL:5/M:5/O:5/S:5/ED:5/EE:5/A:5/ID:5/LC:5/LI:5/LAV:5/LAC:5/FD:5/RD:5/NC:5/PV:5"

Example response:

{
"api_version": "0.1.0",
"impact_label": "MEDIUM",
"impact_score": 5.0,
"likelihood_label": "MEDIUM",
"likelihood_score": 5.0,
"owasp_vector": "(SL:5/M:5/O:5/S:5/ED:5/EE:5/A:5/ID:5/LC:5/LI:5/LAV:5/LAC:5/FD:5/RD:5/NC:5/PV:5)",
"risk_severity": "MEDIUM"
}

Vector factors

All factor values must be numeric in the range 0–9.

GroupKeyFactor
LikelihoodSLSkill Level
LikelihoodMMotive
LikelihoodOOpportunity
LikelihoodSPopulation Size
LikelihoodEDEase of Discovery
LikelihoodEEEase of Exploit
LikelihoodAAwareness
LikelihoodIDIntrusion Detection
ImpactLCLoss of Confidentiality
ImpactLILoss of Integrity
ImpactLAVLoss of Availability
ImpactLACLoss of Accountability
ImpactFDFinancial Damage
ImpactRDReputation Damage
ImpactNCNon-Compliance
ImpactPVPrivacy Violation

Risk severity matrix

Likelihood \ ImpactNOTELOWMEDIUMHIGH
NOTENOTENOTELOWMEDIUM
LOWNOTENOTELOWMEDIUM
MEDIUMLOWLOWMEDIUMHIGH
HIGHMEDIUMMEDIUMHIGHCRITICAL

Combine with a TLS reverse proxy. CORS is already allowed on the Flask application.

About

Simple Python Flask API server that returns OWASP/CVSS scores for vector strings

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages