id
string
language
string
framework
string
title
string
description
string
owasp
string
owasp_api
string
owasp_llm
string
cwe
string
mitre_attack
string
severity
string
difficulty
string
vulnerable_code
string
secure_code
string
patch
string
root_cause
string
attack
string
impact
string
fix
string
guideline
string
tags
list
metadata
dict
cvss_vector
string
SCP-000029
C#
ASP.NET Core
Missing authorization on API controller
An ASP.NET Core controller exposes patient records with no [Authorize] attribute.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-862
T1190 - Exploit Public-Facing Application
Critical
Beginner
[ApiController] [Route("api/patients")] public class PatientsController : ControllerBase { [HttpGet("{id}")] public Patient Get(int id) => _repo.Get(id); // Vulnerable: no auth }
[ApiController] [Route("api/patients")] [Authorize(Policy = "Clinician")] public class PatientsController : ControllerBase { [HttpGet("{id}")] public ActionResult<Patient> Get(int id) { var p = _repo.GetForUser(id, User.GetUserId()); return p is null ? NotFound() : p; } }
--- a/PatientsController.cs +++ b/PatientsController.cs @@ -3,6 +3,7 @@ +[Authorize(Policy = "Clinician")] public class PatientsController : ControllerBase { + var p = _repo.GetForUser(id, User.GetUserId()); + return p is null ? NotFound() : p;
No authorization policy is attached, so any anonymous caller reads patient data.
Caller enumerates /api/patients/1..N to scrape PHI.
Mass disclosure of protected health information (HIPAA violation).
Apply [Authorize] with a policy and scope queries to the authenticated principal.
Require authorization policies on every sensitive controller; scope by user.
[ "authorization", "aspnet", "csharp", "healthcare" ]
{ "domain": "Healthcare", "input_source": "path_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000167
Kotlin
Android
Insecure broadcast receiver exported
An Android receiver is exported without permission, allowing arbitrary commands.
A01:2021 - Broken Access Control
CWE-925
T1398 - Mobile Application Exploitation
High
Intermediate
<receiver android:name=".CmdReceiver" android:exported="true" /> <!-- Vulnerable -->
<receiver android:name=".CmdReceiver" android:exported="false" // Secure: not exported android:permission="com.app.PRIV" />
--- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,2 +1,3 @@ -<receiver android:name=".CmdReceiver" android:exported="true" /> +<receiver android:name=".CmdReceiver" android:exported="false" + android:permission="com.app.PRIV" />
Exported receiver accepts broadcasts from any app.
Malicious app sends a command broadcast.
Unauthorized action in app context.
Set exported=false or require a signature permission.
Don't export receivers without permission.
[ "android", "kotlin", "exported", "mobile" ]
{ "domain": "IoT", "input_source": "intent", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000361
PHP
Laravel
Business logic: negative quantity
A cart uses a client-supplied quantity without bounds.
A04:2021 - Insecure Design
API3:2023 - Broken Object Property Level Authorization
CWE-840
T1190 - Exploit Public-Facing Application
Medium
Intermediate
$cart->qty = $request->input("qty"); $cart->save(); // Vulnerable: negative\
$q = (int)$request->input("qty");\nif ($q <= 0 || $q > 100) abort(400); // Secure\n$cart->qty = $q; $cart->save();\
--- a/CartController.php\n+++ b/CartController.php\n@@ -1,3 +1,5 @@\n-$cart->qty = $request->input("qty"); $cart->save();\n+$q = (int)$request->input("qty");\n+if ($q <= 0 || $q > 100) abort(400);\n+$cart->qty = $q; $cart->save();\
Client qty not bounded.
qty=-5 => negative charge.
Revenue loss.
Validate qty server-side.
Validate business values.
[ "business-logic", "php", "laravel", "ecommerce" ]
{ "domain": "E-commerce", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000448
Rust
Actix
Insecure deserialization
Actix handler decodes untrusted bytes with a deserializer.
A08:2021 - Integrity Failures
CWE-502
T1190
Medium
Advanced
let v: MyStruct = ron::de::from_bytes(&body)?;
let v: MyStruct = serde_json::from_slice(&body)?; // strict schema
--- a/handler.rs +++ b/handler.rs @@ -1,2 +1,2 @@ -let v: MyStruct = ron::de::from_bytes(&body)?; +let v: MyStruct = serde_json::from_slice(&body)?;
Deserializing untrusted bytes.
Craft malicious payload.
Logic abuse / RCE.
Use strict schema deserializer.
Validate deserialized data.
[ "deserialization", "rust", "actix", "injection" ]
{ "domain": "Microservices", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000296
Scala
Play
Open redirect
A Play action redirects to a param without validation.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
def go = Action { req => Redirect(req.getQueryString("url").getOrElse("/")) // Vulnerable }
def go = Action { req => val u = req.getQueryString("url").filter(_.startsWith("/")) Redirect(u.getOrElse("/")) // Secure }
--- a/Links.scala +++ b/Links.scala @@ -1,3 +1,4 @@ -def go = Action { req => Redirect(req.getQueryString("url").getOrElse("/")) + val u = req.getQueryString("url").filter(_.startsWith("/")) + Redirect(u.getOrElse("/"))
Unvalidated redirect.
url=//evil.com phishing.
Phishing.
Allowlist relative.
Validate redirects.
[ "open-redirect", "scala", "play", "phishing" ]
{ "domain": "Authentication systems", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000363
PHP
Laravel
Verbose error display
APP_DEBUG=true in production leaks stack traces.
A05:2021 - Security Misconfiguration
CWE-209
T1190 - Exploit Public-Facing Application
Medium
Beginner
APP_DEBUG=true # Vulnerable: leaks in prod\
APP_DEBUG=false # Secure: off in prod\
--- a/.env\n+++ b/.env\n@@ -1,2 +1,2 @@\n-APP_DEBUG=true\n+APP_DEBUG=false\
Debug on in production.
Trigger error to read source.
Info disclosure.
APP_DEBUG=false.
Never debug in prod.
[ "info-leak", "php", "laravel", "config" ]
{ "domain": "Backend", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000480
Python
Flask
Logging injection via unsanitized input
Flask logs user input containing newlines, enabling log forging.
A09:2021 - Logging Failures
CWE-117
T1190
Low
Beginner
logger.info("user %s logged in", request.args.get("u"))
u = request.args.get("u", "").replace("\n", " ").replace("\r", " ") logger.info("user %s logged in", u)
--- a/views.py +++ b/views.py @@ -1,2 +1,3 @@ -logger.info("user %s logged in", request.args.get("u")) +u = request.args.get("u", "").replace("\n", " ").replace("\r", " ") +logger.info("user %s logged in", u)
Unsanitized log input.
Inject fake log lines.
Log integrity loss.
Sanitize log input.
Strip newlines from log data.
[ "logging", "flask", "python", "log-injection" ]
{ "domain": "Backend", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000139
Python
Flask
XML external entity in report generator
A Flask endpoint parses uploaded XML with ET.fromstring without disabling entities.
A05:2021 - Security Misconfiguration
CWE-611
T1190 - Exploit Public-Facing Application
High
Intermediate
import xml.etree.ElementTree as ET def parse(data): return ET.fromstring(data) # Vulnerable: external entities on by default
from defusedxml.ElementTree import fromstring # Secure import defusedxml def parse(data): return fromstring(data) # disables DTD/external entities
--- a/xmlparse.py +++ b/xmlparse.py @@ -1,4 +1,4 @@ -import xml.etree.ElementTree as ET -def parse(data): - return ET.fromstring(data) +from defusedxml.ElementTree import fromstring +def parse(data): + return fromstring(data)
Stdlib XML parser allows external entity resolution.
DOCTYPE with SYSTEM entity reads /etc/passwd.
File disclosure, SSRF.
Use defusedxml or disable DTDs.
Parse XML with defusedxml.
[ "xxe", "flask", "python", "xml" ]
{ "domain": "REST API", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000400
Kotlin
Android
Insecure deep link handling
A deep link handler trusts host input for navigation/actions.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
val action = intent.data?.getQueryParameter("action") // Vulnerable: trusted blindly\
val action = intent.data?.getQueryParameter("action")\nif (action !in setOf("view", "share")) return // Secure: allowlist\
--- a/DeepLink.kt\n+++ b/DeepLink.kt\n@@ -1,3 +1,4 @@\n-val action = intent.data?.getQueryParameter("action")\n+if (action !in setOf("view", "share")) return\
Untrusted deep link param.
Craft deeplink for unintended action.
Phishing/abuse.
Allowlist actions.
Validate deep link params.
[ "deep-link", "kotlin", "android", "phishing" ]
{ "domain": "Mobile", "input_source": "deeplink", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000247
Ruby
Rails
Weak secret token in secrets.yml
A Rails app commits a static secret_key_base.
A02:2021 - Cryptographic Failures
CWE-798
T1552.001 - Unsecured Credentials: Credentials In Files
High
Beginner
production: secret_key_base: "abc123static" # Vulnerable
production: secret_key_base: "<%= ENV["SECRET_KEY_BASE"] %>" # Secure: env
--- a/config/secrets.yml +++ b/config/secrets.yml @@ -1,3 +1,3 @@ -production: secret_key_base: "abc123static" +production: secret_key_base: "<%= ENV["SECRET_KEY_BASE"] %>"
Static secret in repo.
Forge signed cookies.
Auth bypass.
Load from env/secret.
Externalize secret_key_base.
[ "secrets", "rails", "ruby", "config" ]
{ "domain": "Backend", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000395
Kotlin
Android
SQL injection via content resolver
A content resolver query concatenates selection args.
A03:2021 - Injection
CWE-89
T1190 - Exploit Public-Facing Application
High
Intermediate
cr.query(uri, null, "name='" + name + "'", null, null) // Vulnerable\
cr.query(uri, null, "name=?", arrayOf(name), null) // Secure: selection arg\
--- a/Provider.kt\n+++ b/Provider.kt\n@@ -1,3 +1,3 @@\n-cr.query(uri, null, "name='" + name + "'", null, null)\n+cr.query(uri, null, "name=?", arrayOf(name), null)\
Concatenated selection.
name=' OR 1=1 leaks rows.
Data disclosure.
Use selection args.
Bind SQL/selection args.
[ "sqli", "kotlin", "android", "injection" ]
{ "domain": "Mobile", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000475
Python
FastAPI
Weak password policy
Signup does not enforce password complexity.
A07:2021 - Auth Failures
API2:2023
CWE-521
T1110
Medium
Beginner
def signup(pw: str): create_user(pw) # any pw
import re def signup(pw: str): if not re.match(r"^(?=.*[A-Z])(?=.*[0-9]).{8,}$", pw): raise HTTPException(400) create_user(pw)
--- a/auth.py +++ b/auth.py @@ -1,3 +1,5 @@ -def signup(pw: str): - create_user(pw) +import re +def signup(pw: str): + if not re.match(r"^(?=.*[A-Z])(?=.*[0-9]).{8,}$", pw): + raise HTTPException(400) + create_user(pw)
No password policy.
Weak/crackable passwords.
Account takeover.
Enforce complexity.
Strong password policy.
[ "passwords", "fastapi", "python", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000284
C++
STD
Null pointer dereference
A C++ function dereferences a pointer that may be null.
A03:2021 - Injection
CWE-476
T1203 - Exploitation for Client Execution
Medium
Beginner
void show(User* u) { std::cout << u->name; // Vulnerable: u may be null }
void show(User* u) { if (!u) return; // Secure: null check std::cout << u->name; }
--- a/show.cpp +++ b/show.cpp @@ -1,3 +1,4 @@ - std::cout << u->name; + if (!u) return; + std::cout << u->name;
Missing null check.
Pass null to crash.
DoS.
Check before deref.
Null-check inputs.
[ "null-deref", "cpp", "memory-safety" ]
{ "domain": "IoT", "input_source": "argv", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000088
Java
Spring Boot
Rounding error in interest calculation
A Spring service uses binary floating point for money, causing rounding drift.
A04:2021 - Insecure Design
CWE-682
T1190 - Exploit Public-Facing Application
Medium
Intermediate
public BigDecimal interest(double principal, double rate) { // Vulnerable: double for currency return BigDecimal.valueOf(principal * rate); }
public BigDecimal interest(BigDecimal principal, BigDecimal rate) { // Secure: BigDecimal throughout, explicit rounding return principal.multiply(rate) .setScale(2, RoundingMode.HALF_UP); }
--- a/InterestService.java +++ b/InterestService.java @@ -1,4 +1,6 @@ - return BigDecimal.valueOf(principal * rate); + return principal.multiply(rate) + .setScale(2, RoundingMode.HALF_UP);
Binary floating point cannot represent decimal currency exactly, introducing drift.
Repeated calculations accumulate cents of error, enabling arbitrage or loss.
Incorrect balances, financial discrepancy.
Use BigDecimal (or integer minor units) with explicit rounding for all money.
Never use float/double for currency; use BigDecimal with scale.
[ "fintech", "spring", "java", "rounding" ]
{ "domain": "Banking", "input_source": "server", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000397
Kotlin
Android
Insecure logging of secrets
An app logs sensitive data to logcat.
A09:2021 - Security Logging and Monitoring Failures
CWE-532
T1552 - Unsecured Credentials
Medium
Beginner
Log.d("auth", "token=$token") // Vulnerable: leaks to logcat\
// Never log secrets; use redacted identifiers\nLog.d("auth", "tokenSet=true") // Secure: no secret\
--- a/Auth.kt\n+++ b/Auth.kt\n@@ -1,3 +1,3 @@\n-Log.d("auth", "token=$token")\n+Log.d("auth", "tokenSet=true")\
Secrets in logs.
Read logcat for tokens.
Credential leak.
Don't log secrets.
Redact sensitive logs.
[ "logging", "kotlin", "android", "secrets" ]
{ "domain": "Mobile", "input_source": "device", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000322
Go
Gin
Verbose error leak in response
A Go handler returns raw error messages including internals.
A05:2021 - Security Misconfiguration
CWE-209
T1190 - Exploit Public-Facing Application
Low
Beginner
c.JSON(500, gin.H{"error": err.Error()}) // Vulnerable: leaks internals
c.JSON(500, gin.H{"error": "internal_error"}) // Secure: generic log.Printf("err: %v", err)
--- a/handler.go +++ b/handler.go @@ -1,2 +1,3 @@ -c.JSON(500, gin.H{"error": err.Error()}) +c.JSON(500, gin.H{"error": "internal_error"}) +log.Printf("err: %v", err)
Raw error to client.
Extract stack/paths from errors.
Info disclosure.
Generic errors to client.
Log detailed, return generic.
[ "info-leak", "go", "gin", "error-handling" ]
{ "domain": "Backend", "input_source": "server", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000037
Rust
Actix
Revealing error in HTTP response
An Actix handler returns internal error strings (including DB errors) to the client.
A05:2021 - Security Misconfiguration
CWE-209
T1190 - Exploit Public-Facing Application
Low
Beginner
async fn create(req: web::Json<Item>) -> impl Responder { match repo.insert(&req.0) { Ok(id) => HttpResponse::Ok().json(id), // Vulnerable: leaks DB error text Err(e) => HttpResponse::InternalServerError().body(e.to_string()), } }
async fn create(req: web::Json<Item>) -> impl Responder { match repo.insert(&req.0) { Ok(id) => HttpResponse::Ok().json(id), Err(e) => { log::error!("insert failed: {:?}", e); // server-only HttpResponse::InternalServerError().json(serde_json::json!({"error":"internal"})) ...
--- a/item.rs +++ b/item.rs @@ -4,3 +4,5 @@ - Err(e) => HttpResponse::InternalServerError().body(e.to_string()), + Err(e) => { log::error!("insert failed: {:?}", e); + HttpResponse::InternalServerError().json(json!({"error":"internal"})) }
Internal error details are returned verbatim, exposing schema and internals.
Trigger a DB error to learn table/column names and stack context.
Information disclosure that aids further attacks.
Log details server-side; return generic error messages to clients.
Return safe error codes; log the details where operators can see them.
[ "info-leak", "rust", "actix", "error-handling" ]
{ "domain": "REST API", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000342
C#
ASP.NET Core
Missing antiforgery on POST
A POST action has no antiforgery token validation.
A01:2021 - Broken Access Control
CWE-352
T1190 - Exploit Public-Facing Application
Medium
Beginner
[HttpPost("update")]\npublic IActionResult Update(Profile p) { repo.Save(p); return Ok(); } // Vulnerable: no CSRF\
[HttpPost("update")]\n[ValidateAntiForgeryToken] // Secure\npublic IActionResult Update(Profile p) { repo.Save(p); return Ok(); }\
--- a/ProfileController.cs\n+++ b/ProfileController.cs\n@@ -1,4 +1,5 @@\n+[ValidateAntiForgeryToken]\n [HttpPost("update")]\n public IActionResult Update(Profile p) { repo.Save(p); return Ok(); }\
No CSRF token on POST.
Cross-site POST forges update.
Unauthorized change.
Add antiforgery token.
Protect state changes.
[ "csrf", "csharp", "aspnet", "config" ]
{ "domain": "E-commerce", "input_source": "form_field", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000360
PHP
Laravel
XML external entity
A controller parses XML with external entity resolution on.
A05:2021 - Security Misconfiguration
CWE-611
T1190 - Exploit Public-Facing Application
High
Intermediate
$xml = simplexml_load_string($body, "SimpleXMLElement", LIBXML_NOENT); // Vulnerable: XXE\
libxml_disable_entity_loader(true);\n$xml = simplexml_load_string($body, "SimpleXMLElement", LIBXML_NONET); // Secure\
--- a/XmlController.php\n+++ b/XmlController.php\n@@ -1,3 +1,4 @@\n-$xml = simplexml_load_string($body, "SimpleXMLElement", LIBXML_NOENT);\n+libxml_disable_entity_loader(true);\n+$xml = simplexml_load_string($body, "SimpleXMLElement", LIBXML_NONET);\
External entities enabled.
DOCTYPE reads files / SSRF.
File disclosure.
Disable entities.
Harden XML parsing.
[ "xxe", "php", "laravel", "xml" ]
{ "domain": "REST API", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000451
Python
FastAPI
GraphQL introspection in prod
FastAPI GraphQL leaves introspection on in production.
A05:2021 - Misconfiguration
CWE-215
T1190
Low
Beginner
app.add_route("/graphql", graphql_view(schema))
app.add_route("/graphql", graphql_view(schema, introspection=DEBUG))
--- a/graphql.py +++ b/graphql.py @@ -1,2 +1,2 @@ -app.add_route("/graphql", graphql_view(schema)) +app.add_route("/graphql", graphql_view(schema, introspection=DEBUG))
Introspection exposed.
Map full schema for attacks.
Info disclosure.
Disable introspection in prod.
Limit GraphQL introspection.
[ "graphql", "fastapi", "python", "config" ]
{ "domain": "REST API", "input_source": "server", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000137
PHP
Laravel
File upload with executable extension
A Laravel upload stores .php files in a web-accessible dir, enabling RCE.
A04:2021 - Insecure Design
CWE-434
T1190 - Exploit Public-Facing Application
Critical
Intermediate
public function up(Request $r) { $r->file('f')->storeAs('public', $r->file('f')->getClientOriginalName()); // Vulnerable }
public function up(Request $r) { $f = $r->file('f'); if (!in_array($f->extension(), ['jpg','png','pdf'])) abort(415); // Secure $f->storeAs('private', Str::random(40).'.'.$f->extension()); }
--- a/UploadController.php +++ b/UploadController.php @@ -1,3 +1,5 @@ - $r->file('f')->storeAs('public', $r->file('f')->getClientOriginalName()); + if (!in_array($f->extension(), ['jpg','png','pdf'])) abort(415); + $f->storeAs('private', Str::random(40).'.'.$f->extension());
Untrusted extension stored in public path enables webshell.
Upload shell.php and request it for RCE.
Remote code execution.
Allowlist extensions; randomize names; store outside webroot.
Validate extension; store uploads outside webroot.
[ "file-upload", "laravel", "php", "rce" ]
{ "domain": "E-commerce", "input_source": "form_field", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000354
PHP
Laravel
IDOR on profile update
An update action uses a client-supplied user id.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-639
T1190 - Exploit Public-Facing Application
High
Beginner
$u = User::find($request->input("user_id")); $u->email = ...; // Vulnerable: arbitrary id\
$u = $request->user(); $u->email = ...; // Secure: current authenticated user\
--- a/ProfileController.php\n+++ b/ProfileController.php\n@@ -1,3 +1,3 @@\n-$u = User::find($request->input("user_id")); $u->email = ...;\n+$u = $request->user(); $u->email = ...;\
Client id not bound to session.
Edit any user by id.
Account takeover.
Use authenticated user.
Bind to session user.
[ "idor", "php", "laravel", "access-control" ]
{ "domain": "E-commerce", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000108
C++
Embedded
Unencrypted telemetry transmission
An IoT device sends sensor telemetry over plain HTTP, exposing it to interception.
A02:2021 - Cryptographic Failures
CWE-319
T1557 - Adversary-in-the-Middle
Medium
Beginner
void send_telemetry(const std::string& data) { // Vulnerable: plain HTTP http_post("http://collector/ingest", data); }
void send_telemetry(const std::string& data) { // Secure: HTTPS with cert pinning https_post("https://collector/ingest", data, COLLECTOR_PINNED_CERT); }
--- a/telemetry.cpp +++ b/telemetry.cpp @@ -2,4 +2,5 @@ - http_post("http://collector/ingest", data); + https_post("https://collector/ingest", data, COLLECTOR_PINNED_CERT);
Telemetry is transmitted without transport encryption, exposing data in transit.
On-path attacker reads sensor data or injects false telemetry.
Data interception/modification.
Use TLS with certificate pinning for all device communication.
Encrypt all device telemetry with TLS + cert pinning.
[ "iot", "cpp", "tls", "telemetry" ]
{ "domain": "IoT", "input_source": "network", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000182
PHP
Laravel
Open redirect in Laravel redirect()->to()
A Laravel controller redirects to user input without validation.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
public function go(Request $r) { return redirect()->to($r->input('url')); // Vulnerable }
public function go(Request $r) { $u = $r->input('url','/'); if (!str_starts_with($u,'/') || str_starts_with($u,'//')) $u='/'; // Secure return redirect()->to($u); }
--- a/LinkController.php +++ b/LinkController.php @@ -1,3 +1,5 @@ - return redirect()->to($r->input('url')); + $u = $r->input('url','/'); + if (!str_starts_with($u,'/') || str_starts_with($u,'//')) $u='/'; + return redirect()->to($u);
Unvalidated redirect target.
url=//evil.com phishing.
Phishing.
Allowlist relative paths.
Validate Laravel redirects.
[ "open-redirect", "laravel", "php", "phishing" ]
{ "domain": "Authentication systems", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000190
C#
ASP.NET Core
ViewBag XSS in Razor
An ASP.NET Core Razor view renders ViewBag content without encoding.
A03:2021 - Injection
CWE-79
T1059.007 - Command and Scripting Interpreter: JavaScript
Medium
Beginner
@* Vulnerable: raw HTML *@ <div>@Html.Raw(ViewBag.Comment)</div>
@* Secure: encoded *@ <div>@ViewBag.Comment</div>
--- a/Views/Home/Index.cshtml +++ b/Views/Home/Index.cshtml @@ -1,2 +1,2 @@ -<div>@Html.Raw(ViewBag.Comment)</div> +<div>@ViewBag.Comment</div>
Html.Raw disables encoding on user data.
Comment=<script>steal()</script> runs.
Stored XSS.
Use default encoded output; avoid Html.Raw on user data.
Avoid Html.Raw on user input.
[ "xss", "aspnet", "csharp", "razor" ]
{ "domain": "E-commerce", "input_source": "db", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000084
Go
gRPC
Unbounded gRPC message size (DoS)
A gRPC server accepts arbitrarily large messages with no MaxRecvMsgSize limit.
A04:2021 - Insecure Design
API4:2023 - Unrestricted Resource Consumption
CWE-770
T1499 - Endpoint Denial of Service
Medium
Intermediate
s := grpc.NewServer() // Vulnerable: default 4MB; raised nowhere, but no limit set pb.RegisterSvcServer(s, &Server{})
s := grpc.NewServer( grpc.MaxRecvMsgSize(4 * 1024 * 1024), grpc.MaxConcurrentStreams(100)) pb.RegisterSvcServer(s, &Server{})
--- a/server.go +++ b/server.go @@ -1,3 +1,5 @@ -s := grpc.NewServer() +s := grpc.NewServer( + grpc.MaxRecvMsgSize(4 * 1024 * 1024), + grpc.MaxConcurrentStreams(100))
No explicit upper bound on inbound message size or concurrency invites memory exhaustion.
Client streams huge payloads to exhaust server memory.
Denial of service.
Set MaxRecvMsgSize and MaxConcurrentStreams explicitly.
Bound gRPC message size and stream concurrency.
[ "dos", "grpc", "go", "resource-exhaustion" ]
{ "domain": "Microservices", "input_source": "rpc", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000187
Python
FastAPI
CORS allow credentials with wildcard origin
A FastAPI CORS config allows all origins with credentials.
A05:2021 - Security Misconfiguration
CWE-942
T1190 - Exploit Public-Facing Application
Medium
Beginner
app.add_middleware(CORSMiddleware, allow_origins=['*'], allow_credentials=True) # Vulnerable
app.add_middleware(CORSMiddleware, allow_origins=['https://app.example.com'], allow_credentials=True) # Secure
--- a/main.py +++ b/main.py @@ -1,3 +1,3 @@ - allow_origins=['*'], allow_credentials=True + allow_origins=['https://app.example.com'], allow_credentials=True
Wildcard origin with credentials.
Malicious site reads responses with victim cookies.
Cross-origin data theft.
Pin origins; never '*' with credentials.
Restrict CORS origins.
[ "cors", "fastapi", "python", "config" ]
{ "domain": "E-commerce", "input_source": "header", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000336
C#
ASP.NET Core
Open redirect
A returnUrl param is used directly in a redirect.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
return Redirect(returnUrl); // Vulnerable: unvalidated\
if (Url.IsLocalUrl(returnUrl)) return Redirect(returnUrl); // Secure\nreturn RedirectToAction("Index");\
--- a/AccountController.cs\n+++ b/AccountController.cs\n@@ -1,3 +1,4 @@\n-return Redirect(returnUrl);\n+if (Url.IsLocalUrl(returnUrl)) return Redirect(returnUrl);\n+return RedirectToAction("Index");\
Unvalidated redirect.
returnUrl=//evil.com phishing.
Phishing.
Use IsLocalUrl.
Validate redirects.
[ "open-redirect", "csharp", "aspnet", "phishing" ]
{ "domain": "Authentication systems", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000243
Ruby
Rails
Insecure comparison of session token
A Rails app compares tokens with == allowing timing attacks.
A02:2021 - Cryptographic Failures
CWE-208
T1600 - Weaken Encryption
Low
Intermediate
def valid?(t); t == session[:token]; end # Vulnerable: timing
def valid?(t) ActiveSupport::SecurityUtils.secure_compare(t, session[:token]) # Secure end
--- a/session.rb +++ b/session.rb @@ -1,2 +1,3 @@ -def valid?(t); t == session[:token]; end +def valid?(t) + ActiveSupport::SecurityUtils.secure_compare(t, session[:token]) +end
Non-constant-time comparison.
Brute-force token via timing.
Token recovery.
Use secure_compare.
Use constant-time comparison.
[ "crypto", "rails", "ruby", "timing" ]
{ "domain": "Authentication systems", "input_source": "cookie", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000436
Go
Gin
Race condition on balance
Transfer handler updates balance without locking.
A04:2021 - Insecure Design
API3:2023
CWE-362
T1190
High
Advanced
acc.Balance -= amt // concurrent double-spend
tx := db.Begin(); defer tx.Rollback() tx.Model(&acc).Where("balance >= ?", amt). Update("balance", gorm.Expr("balance - ?", amt)) tx.Commit() // atomic
--- a/transfer.go +++ b/transfer.go @@ -1,2 +1,5 @@ -acc.Balance -= amt +tx := db.Begin(); defer tx.Rollback() +tx.Model(&acc).Where("balance >= ?", amt). + Update("balance", gorm.Expr("balance - ?", amt)) +tx.Commit()
Unlocked shared mutation.
Double-spend via concurrent requests.
Financial loss.
Use DB transactions.
Protect financial state.
[ "race-condition", "fintech", "banking", "concurrency" ]
{ "domain": "Banking", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000429
YAML
Kubernetes
RBAC cluster-admin binding
A ServiceAccount is bound to cluster-admin.
A01:2021 - Broken Access Control
CWE-269
T1078 - Valid Accounts
Critical
Intermediate
kind: ClusterRoleBinding\nsubjects:\n- kind: ServiceAccount\n name: app\nroleRef:\n kind: ClusterRole\n name: cluster-admin # Vulnerable\
kind: RoleBinding\n# bind only the verbs needed in the namespace\nroleRef:\n kind: Role\n name: app-role # Secure: least privilege\
--- a/rbac.yaml\n+++ b/rbac.yaml\n@@ -1,8 +1,5 @@\n-kind: ClusterRoleBinding\nsubjects:\n- kind: ServiceAccount\n name: app\n-roleRef:\n kind: ClusterRole\n name: cluster-admin\n+kind: RoleBinding\n+roleRef:\n+ kind: Role\n+ name: app-role\
Over-privileged RBAC.
SA abused for cluster control.
Cluster compromise.
Least-privilege RBAC.
Minimize RBAC scope.
[ "kubernetes", "yaml", "rbac", "privilege" ]
{ "domain": "Kubernetes", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000052
Ruby
Rails
Mass assignment via update_attributes
A Rails action updates a model from the whole params hash, allowing role escalation.
A04:2021 - Insecure Design
API3:2023 - Broken Object Property Level Authorization
CWE-915
T1190 - Exploit Public-Facing Application
High
Beginner
def update @user = User.find(params[:id]) # Vulnerable: mass assignment of all params @user.update_attributes(params[:user]) end
def update @user = User.find(params[:id]) # Secure: permit only intended fields @user.update(user_params) end private def user_params params.require(:user).permit(:display_name, :bio, :avatar_url) end
--- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,4 +3,10 @@ - @user.update_attributes(params[:user]) + @user.update(user_params) +private +def user_params + params.require(:user).permit(:display_name, :bio, :avatar_url) +end
All request fields are bound to the model, including admin-only attributes like role.
POST user[role]=admin escalates privileges.
Privilege escalation.
Use strong parameters to allowlist assignable fields.
Always use strong parameters; never update from raw params.
[ "mass-assignment", "rails", "ruby", "auth" ]
{ "domain": "E-commerce", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000459
JavaScript
Express
No authorization on admin route
Express admin route lacks role middleware.
A01:2021 - Broken Access Control
API1:2023 - BOLA
CWE-862
T1190
Critical
Intermediate
app.delete("/admin/user/:id", (req, res) => repo.remove(req.params.id));
app.delete("/admin/user/:id", requireAdmin, (req, res) => repo.remove(req.params.id));
--- a/admin.js +++ b/admin.js @@ -1,3 +1,3 @@ -app.delete("/admin/user/:id", (req, res) => - repo.remove(req.params.id)); +app.delete("/admin/user/:id", requireAdmin, (req, res) => + repo.remove(req.params.id));
No role middleware.
Any user deletes accounts.
Privilege escalation.
Add role middleware.
Enforce admin authz.
[ "authorization", "express", "node", "broken-access-control" ]
{ "domain": "Authentication systems", "input_source": "path_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000417
YAML
Kubernetes
Container running as root
A Pod does not set runAsNonRoot / runAsUser.
A05:2021 - Security Misconfiguration
CWE-250
T1611 - Escape to Host
High
Beginner
securityContext: {} # Vulnerable: runs as root (uid 0)\
securityContext:\n runAsNonRoot: true\n runAsUser: 1000\n runAsGroup: 3000 # Secure\
--- a/deploy.yaml\n+++ b/deploy.yaml\n@@ -1,2 +1,5 @@\n-securityContext: {}\n+securityContext:\n+ runAsNonRoot: true\n+ runAsUser: 1000\n+ runAsGroup: 3000\
Root container.
Root in container eases escape.
Host compromise.
runAsNonRoot.
Non-root containers.
[ "kubernetes", "yaml", "privilege", "container" ]
{ "domain": "Kubernetes", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000149
Python
FastAPI
MCP tool lacks input validation (excessive agency)
A Model Context Protocol tool accepts free-form shell params from the agent without validation.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
LLM06:2025 - Excessive Agency
CWE-20
T1059 - Command and Scripting Interpreter
High
Advanced
@mcp.tool() def run_query(sql: str) -> str: # Vulnerable: agent-supplied SQL run as admin return db.admin_execute(sql)
@mcp.tool() @requires_permission('db:readonly') def run_query(sql: str, ctx: AuthCtx) -> str: if not _is_select(sql): raise ValueError('only SELECT') # Secure return db.readonly_execute(sql, tenant=ctx.tenant)
--- a/mcp_tools.py +++ b/mcp_tools.py @@ -1,4 +1,6 @@ -@mcp.tool() def run_query(sql: str) -> str: - return db.admin_execute(sql) +@mcp.tool() +@requires_permission('db:readonly') def run_query(sql: str, ctx: AuthCtx) -> str: + if not _is_select(sql): raise ValueError('only SELECT') + return db.readonly_execute(sql,...
Agent tool runs arbitrary SQL as admin with no validation or scoping.
A prompt-injected agent issues DROP TABLE via the tool.
Mass data loss via excessive agency.
Validate SQL (SELECT-only), scope by tenant, require permission.
Constrain agent tools; validate and scope; require permissions.
[ "mcp", "excessive-agency", "fastapi", "llm" ]
{ "domain": "Microservices", "input_source": "agent", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000117
PHP
Laravel
SQL injection via raw query
A Laravel controller uses a raw DB statement with interpolated input.
A03:2021 - Injection
CWE-89
T1190 - Exploit Public-Facing Application
High
Intermediate
public function search(Request $r) { $q = $r->input('q'); // Vulnerable return DB::select("SELECT * FROM users WHERE name = '$q'"); }
public function search(Request $r) { $q = $r->input('q'); // Secure: bindings return DB::select('SELECT * FROM users WHERE name = ?', [$q]); }
--- a/SearchController.php +++ b/SearchController.php @@ -2,5 +2,5 @@ - return DB::select("SELECT * FROM users WHERE name = '$q'"); + return DB::select('SELECT * FROM users WHERE name = ?', [$q]);
Raw SQL with concatenation.
q=' OR '1'='1 dumps rows.
Data disclosure.
Use parameter bindings.
Bind all params in raw queries.
[ "sqli", "laravel", "php", "injection" ]
{ "domain": "E-commerce", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000349
PHP
Laravel
Missing authorization on admin route
An admin route has no middleware check.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-862
T1190 - Exploit Public-Facing Application
Critical
Intermediate
Route::delete("/admin/user/{id}", [Admin::class, "delete"]); // Vulnerable: no middleware\
Route::delete("/admin/user/{id}", [Admin::class, "delete"])->middleware("can:admin"); // Secure\
--- a/routes/web.php\n+++ b/routes/web.php\n@@ -1,2 +1,2 @@\n-Route::delete("/admin/user/{id}", [Admin::class, "delete"]);\n+Route::delete("/admin/user/{id}", [Admin::class, "delete"])->middleware("can:admin");\
No authz middleware.
Any user deletes accounts.
Privilege escalation.
Add middleware.
Enforce admin authz.
[ "authorization", "php", "laravel", "broken-access-control" ]
{ "domain": "Authentication systems", "input_source": "path_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000024
Go
Gin
Insecure file upload (no type/size check)
A Gin upload handler writes the file to disk using the client filename with no validation.
A04:2021 - Insecure Design
CWE-434
T1190 - Exploit Public-Facing Application
High
Intermediate
func upload(c *gin.Context) { f, _ := c.FormFile("file") // Vulnerable: trusts client filename, no size/type check c.SaveUploadedFile(f, "/uploads/" + f.Filename) c.JSON(200, gin.H{"saved": f.Filename}) }
const maxBytes = 5 << 20 func upload(c *gin.Context) { f, err := c.FormFile("file") if err != nil { c.Status(400); return } if f.Size > maxBytes { c.Status(413); return } // Secure: generate safe name, restrict extension, store outside webroot if !strings.HasSuffix(f.Filename, ".png") { c.Status(415...
--- a/upload.go +++ b/upload.go @@ -1,6 +1,11 @@ +const maxBytes = 5 << 20 - c.SaveUploadedFile(f, "/uploads/" + f.Filename) + if f.Size > maxBytes || !strings.HasSuffix(f.Filename, ".png") { c.Status(400); return } + name := filepath.Join("/safe/uploads", uuid.NewString()+".png") + c.SaveUploadedFile(f, na...
Uploads accept arbitrary names/types/sizes, enabling overwrite, webshell drop, or disk exhaustion.
Upload shell.php with a crafted multipart name, then request it to achieve RCE.
RCE, storage exhaustion, or overwrite of existing files.
Validate size, MIME/extension allowlist, generate random server-side names, store outside webroot.
Allowlist types, cap size, randomize names, serve uploads with no execution context.
[ "file-upload", "gin", "go", "rce" ]
{ "domain": "E-commerce", "input_source": "form_field", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000036
Rust
Actix
Command injection via shell string
A Rust service builds a shell command from user input and runs it via sh -c.
A03:2021 - Injection
CWE-78
T1059.004 - Command and Scripting Interpreter: Unix Shell
Critical
Intermediate
use std::process::Command; fn convert(input: &str) -> String { // Vulnerable: input interpolated into shell let out = Command::new("sh") .arg("-c") .arg(format!("convert {} out.png", input)) .output() .unwrap(); String::from_utf8_lossy(&out.stdout).into_owned() }
use std::process::Command; fn convert(input: &str) -> std::io::Result<String> { // Secure: no shell, pass args as separate vector elements let out = Command::new("convert") .arg(input) .arg("out.png") .output()?; Ok(String::from_utf8_lossy(&out.stdout).into_owned()) }
--- a/convert.rs +++ b/convert.rs @@ -2,8 +2,7 @@ - let out = Command::new("sh").arg("-c") - .arg(format!("convert {} out.png", input)).output().unwrap(); + let out = Command::new("convert").arg(input).arg("out.png").output()?;
User input is passed to a shell via string interpolation, allowing metacharacter injection.
input = a.png; rm -rf / executes arbitrary commands on the host.
Remote code execution.
Avoid shells; pass arguments as a vector and validate inputs.
Use argument vectors, never sh -c with untrusted data; validate inputs.
[ "command-injection", "rust", "actix", "rce" ]
{ "domain": "Serverless", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000371
Rust
Actix
XSS via raw HTML response
An Actix handler returns user input as text/html without escaping.
A03:2021 - Injection
CWE-79
T1059.007 - Command and Scripting Interpreter: JavaScript
Medium
Beginner
HttpResponse::Ok().content_type("text/html").body(format!("<div>{}</div>", comment)) // Vulnerable\
let esc = html_escape::encode_text(&comment); // Secure: escape\nHttpResponse::Ok().content_type("text/html").body(format!("<div>{}</div>", esc))\
--- a/post.rs\n+++ b/post.rs\n@@ -1,3 +1,4 @@\n-HttpResponse::Ok().content_type("text/html").body(format!("<div>{}</div>", comment))\n+let esc = html_escape::encode_text(&comment);\n+HttpResponse::Ok().content_type("text/html").body(format!("<div>{}</div>", esc))\
Unescaped HTML in body.
comment=<script>steal()</script> runs.
XSS.
Escape output.
Escape user HTML.
[ "xss", "rust", "actix", "template" ]
{ "domain": "E-commerce", "input_source": "db", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000099
YAML
Kubernetes
Image pulled from unpinned tag (latest)
A Deployment references an image by mutable :latest tag, enabling supply-chain drift.
A08:2021 - Software and Data Integrity Failures
CWE-494
T1195.001 - Supply Chain Compromise: Compromise Software Dependencies
High
Beginner
spec: containers: - name: app image: registry/app:latest # Vulnerable: mutable tag
spec: containers: - name: app image: registry/app@sha256:9f86d0818... # Secure: digest-pinned imagePullPolicy: IfNotPresent
--- a/deploy.yaml +++ b/deploy.yaml @@ -3,4 +3,5 @@ - image: registry/app:latest + image: registry/app@sha256:9f86d0818... + imagePullPolicy: IfNotPresent
Mutable image tags let an attacker-controlled rebuild run as the same deployment.
Attacker pushes a malicious :latest; the next rollout runs it.
Supply-chain compromise of workloads.
Pin images by immutable digest and verify signatures (cosign).
Pin images by sha256 digest; sign and verify with cosign.
[ "kubernetes", "supply-chain", "yaml", "image" ]
{ "domain": "Microservices", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000306
Go
Gin
SQL injection in raw query
A Gin handler builds a SQL query by string formatting.
A03:2021 - Injection
CWE-89
T1190 - Exploit Public-Facing Application
High
Intermediate
q := fmt.Sprintf("SELECT * FROM u WHERE name = '%s'", name) rows, _ := db.Query(q) // Vulnerable
rows, _ := db.Query("SELECT * FROM u WHERE name = $1", name) // Secure: bound
--- a/handler.go +++ b/handler.go @@ -1,3 +1,2 @@ -q := fmt.Sprintf("SELECT * FROM u WHERE name = '%s'", name) -rows, _ := db.Query(q) +rows, _ := db.Query("SELECT * FROM u WHERE name = $1", name)
String formatting into SQL.
name=' OR 1=1 dumps rows.
Data disclosure.
Use bound parameters.
Bind all SQL params.
[ "sqli", "go", "gin", "injection" ]
{ "domain": "E-commerce", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000186
JavaScript
GraphQL
GraphQL depth bombing (DoS)
A GraphQL server has no query depth limit, allowing nested queries that exhaust CPU.
A04:2021 - Insecure Design
API4:2023 - Unrestricted Resource Consumption
CWE-770
T1499 - Endpoint Denial of Service
Medium
Intermediate
const server = new ApolloServer({ typeDefs, resolvers }); // Vulnerable: no depth limit
import { createComplexityLimitRule } from 'graphql-validation-complexity'; const server = new ApolloServer({ typeDefs, resolvers, validationRules: [createComplexityLimitRule(1000)] // Secure });
--- a/graphql/server.js +++ b/graphql/server.js @@ -1,2 +1,5 @@ -const server = new ApolloServer({ typeDefs, resolvers }); +import { createComplexityLimitRule } from 'graphql-validation-complexity'; +const server = new ApolloServer({ + typeDefs, resolvers, + validationRules: [createComplexityLimitRule(1000)] +});
No depth/complexity limit lets attackers craft expensive queries.
Deeply nested query consumes all CPU.
Denial of service.
Enforce query depth/complexity limits.
Limit GraphQL query depth/complexity.
[ "graphql", "dos", "javascript", "resource-exhaustion" ]
{ "domain": "REST API", "input_source": "query", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000327
C#
ASP.NET Core
Command injection via Process.Start
A controller runs a shell command with user input.
A03:2021 - Injection
CWE-78
T1059 - Command and Scripting Interpreter
High
Intermediate
Process.Start("cmd.exe", "/c ping " + host); // Vulnerable: shell\
if (!Regex.IsMatch(host, @"^[\w.-]+$")) return BadRequest();\nProcess.Start("ping", "-c1 " + host); // Secure: validate + arg\
--- a/PingController.cs\n+++ b/PingController.cs\n@@ -1,3 +1,4 @@\n-Process.Start("cmd.exe", "/c ping " + host);\n+if (!Regex.IsMatch(host, @"^[\w.-]+$")) return BadRequest();\n+Process.Start("ping", "-c1 " + host);\
Shell string with user input.
host=;del /F /Q * executes.
Command injection.
Validate + arg array.
Avoid shell interpolation.
[ "command-injection", "csharp", "aspnet", "rce" ]
{ "domain": "IoT", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000332
C#
ASP.NET Core
No rate limit on login
A login action has no throttling.
A07:2021 - Identification and Authentication Failures
API4:2023 - Unrestricted Resource Consumption
CWE-307
T1110 - Brute Force
Medium
Beginner
[HttpPost("login")]\npublic IActionResult Login(Login m) { return Ok(auth(m)); } // Vulnerable: no throttle\
[HttpPost("login")]\n[EnableRateLimiting("login")] // Secure\npublic IActionResult Login(Login m) { return Ok(auth(m)); }\
--- a/AuthController.cs\n+++ b/AuthController.cs\n@@ -1,4 +1,5 @@\n+[EnableRateLimiting("login")]\n [HttpPost("login")]\n public IActionResult Login(Login m) { return Ok(auth(m)); }\
No throttle on auth.
Brute force credentials.
Account takeover.
Rate limit login.
Throttle auth endpoints.
[ "rate-limiting", "csharp", "aspnet", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000151
Python
Flask
Header injection via Set-Cookie CRLF
A Flask route sets a cookie value from input without CRLF sanitization.
A03:2021 - Injection
CWE-93
T1190 - Exploit Public-Facing Application
Medium
Intermediate
@app.route('/set') def set_c(): theme = request.args.get('theme','light') resp = make_response('ok') resp.set_cookie('theme', theme) # Vulnerable if theme has CRLF return resp
@app.route('/set') def set_c(): theme = request.args.get('theme','light') if not re.fullmatch(r'[a-z]+', theme or ''): theme='light' # Secure resp = make_response('ok') resp.set_cookie('theme', theme) return resp
--- a/cookie.py +++ b/cookie.py @@ -3,5 +3,6 @@ - resp.set_cookie('theme', theme) + if not re.fullmatch(r'[a-z]+', theme or ''): theme='light' + resp.set_cookie('theme', theme)
Cookie value from input may contain CRLF, injecting headers.
theme=light%0d%0aSet-Cookie:admin=1 injects a header.
Header injection, response splitting.
Validate cookie values; strip CRLF.
Validate header/cookie values; strip CRLF.
[ "header-injection", "flask", "python", "crlf" ]
{ "domain": "REST API", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000293
Scala
Akka HTTP
Path traversal in static route
An Akka HTTP route serves files from a user path.
A01:2021 - Broken Access Control
CWE-22
T1190 - Exploit Public-Facing Application
High
Intermediate
path("files" / Segment) { name => getFromFile("/data/" + name) // Vulnerable: traversal }
path("files" / Segment) { name => val safe = Paths.get("/data").resolve(name).normalize() if (!safe.startsWith(Paths.get("/data"))) reject else getFromFile(safe.toFile) // Secure }
--- a/StaticRoutes.scala +++ b/StaticRoutes.scala @@ -1,3 +1,5 @@ - getFromFile("/data/" + name) + val safe = Paths.get("/data").resolve(name).normalize() + if (!safe.startsWith(Paths.get("/data"))) reject + else getFromFile(safe.toFile)
Unsanitized filename.
name=../../etc/passwd reads file.
File disclosure.
Confine to base dir.
Confine file paths.
[ "path-traversal", "scala", "akka", "file-read" ]
{ "domain": "Backend", "input_source": "path_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000041
JavaScript
Express
Prototype pollution via deep merge
An Express route deep-merges user JSON into a config object, allowing prototype pollution.
A03:2021 - Injection
CWE-1321
T1190 - Exploit Public-Facing Application
High
Advanced
function deepMerge(target, src) { for (const k in src) { if (typeof src[k] === 'object') target[k] = deepMerge(target[k]||{}, src[k]); else target[k] = src[k]; } return target; } app.post('/config', (req,res)=>{ config = deepMerge(config, req.body); res.json(config); });
function deepMerge(target, src) { for (const k of Object.keys(src)) { if (k === '__proto__' || k === 'constructor' || k === 'prototype') continue; if (src[k] && typeof src[k] === 'object' && !Array.isArray(src[k])) { target[k] = deepMerge(target[k] || {}, src[k]); } else target[k] = src[k]; } re...
--- a/merge.js +++ b/merge.js @@ -1,7 +1,8 @@ - for (const k in src) { + for (const k of Object.keys(src)) { + if (k === '__proto__' || k === 'constructor' || k === 'prototype') continue;
Recursive merge copies __proto__ keys, polluting Object.prototype for all objects.
Send {"__proto__":{"isAdmin":true}} to inject properties into every object.
Logic bypass, RCE in some frameworks, or DoS.
Reject __proto__/constructor/prototype keys; use a vetted merge utility.
Block prototype keys in any recursive merge of untrusted input.
[ "prototype-pollution", "express", "javascript", "injection" ]
{ "domain": "Microservices", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000194
Go
gRPC
gRPC method allows unauthenticated delete
A gRPC Delete method has no auth interceptor.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-306
T1190 - Exploit Public-Facing Application
Critical
Intermediate
func (s *S) Delete(ctx context.Context, r *pb.Id) (*pb.Empty, error) { return &pb.Empty{}, s.repo.Delete(r.Id) // Vulnerable }
func (s *S) Delete(ctx context.Context, r *pb.Id) (*pb.Empty, error) { if !isAdmin(ctx) { return nil, status.Error(codes.PermissionDenied, "forbidden") } // Secure return &pb.Empty{}, s.repo.Delete(r.Id) }
--- a/server.go +++ b/server.go @@ -1,3 +1,4 @@ - return &pb.Empty{}, s.repo.Delete(r.Id) + if !isAdmin(ctx) { return nil, status.Error(codes.PermissionDenied, "forbidden") } + return &pb.Empty{}, s.repo.Delete(r.Id)
No auth on destructive method.
Unauthenticated delete wipes data.
Data loss.
Enforce auth in interceptor/method.
Authorize destructive gRPC methods.
[ "grpc", "go", "authorization", "broken-access-control" ]
{ "domain": "Microservices", "input_source": "rpc", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000064
C
POSIX
Integer overflow in allocation size
A C program multiplies user-controlled counts without overflow checks before malloc.
A03:2021 - Injection
CWE-190
T1203 - Exploitation for Client Execution
High
Advanced
#include <stdlib.h> void *make(size_t n, size_t sz) { // Vulnerable: unchecked multiplication return malloc(n * sz); }
#include <stdlib.h> void *make(size_t n, size_t sz) { // Secure: checked multiplication size_t total; if (__builtin_mul_overflow(n, sz, &total)) return NULL; return malloc(total); }
--- a/alloc.c +++ b/alloc.c @@ -2,4 +2,6 @@ - return malloc(n * sz); + size_t total; + if (__builtin_mul_overflow(n, sz, &total)) return NULL; + return malloc(total);
Unchecked multiplication can wrap, allocating a tiny buffer for huge input.
n*sz wraps to a small value, then out-of-bounds write corrupts heap.
Heap overflow, potential code execution.
Use checked arithmetic (e.g. __builtin_mul_overflow) before allocating.
Check integer operations before using them as allocation sizes.
[ "integer-overflow", "c", "memory-safety" ]
{ "domain": "IoT", "input_source": "argv", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000285
C++
STD
Improper TLS certificate verification
A C++ TLS client disables peer verification.
A02:2021 - Cryptographic Failures
CWE-295
T1557 - Adversary-in-the-Middle
Critical
Advanced
ctx->set_verify_mode(boost::asio::ssl::verify_none); // Vulnerable
ctx->set_verify_mode(boost::asio::ssl::verify_peer); // Secure ctx->set_default_verify_paths();
--- a/tls.cpp +++ b/tls.cpp @@ -1,2 +1,3 @@ -ctx->set_verify_mode(boost::asio::ssl::verify_none); +ctx->set_verify_mode(boost::asio::ssl::verify_peer); +ctx->set_default_verify_paths();
Verification disabled.
MITM intercepts TLS.
Credential/data theft.
Enable peer verify.
Always verify TLS.
[ "tls", "cpp", "mitm" ]
{ "domain": "Banking", "input_source": "network", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000246
Ruby
Rails
Open redirect in redirect_to
A Rails action redirects to a param without validation.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
def go redirect_to params[:url] # Vulnerable end
def go url = params[:url] redirect_to (url if url&.start_with?("/")) || root_path # Secure end
--- a/links_controller.rb +++ b/links_controller.rb @@ -1,3 +1,4 @@ -def go redirect_to params[:url] + url = params[:url] + redirect_to (url if url&.start_with?("/")) || root_path
Unvalidated redirect target.
url=//evil.com phishing.
Phishing.
Allowlist relative paths.
Validate redirects.
[ "open-redirect", "rails", "ruby", "phishing" ]
{ "domain": "Authentication systems", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000384
Rust
Actix
File upload without type check
An upload stores any content type.
A04:2021 - Insecure Design
CWE-434
T1190 - Exploit Public-Facing Application
High
Intermediate
std::fs::write(format!("/up/{}", fname), data)?; // Vulnerable: any type\
if ct != "image/png" && ct != "image/jpeg" { return Err(...); } // Secure\nlet name = format!("{}.png", Uuid::new_v4());\nstd::fs::write(format!("/up/{}", name), data)?;\
--- a/upload.rs\n+++ b/upload.rs\n@@ -1,3 +1,5 @@\n-std::fs::write(format!("/up/{}", fname), data)?;\n+if ct != "image/png" && ct != "image/jpeg" { return Err(...); }\n+let name = format!("{}.png", Uuid::new_v4());\n+std::fs::write(format!("/up/{}", name), data)?;\
No type validation.
Upload .rs/.sh webshell.
RCE.
Allowlist types; randomize.
Validate uploads.
[ "file-upload", "rust", "actix", "rce" ]
{ "domain": "E-commerce", "input_source": "form_field", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000023
Go
Gin
Race condition in balance transfer
A Gin handler updates an account balance with a read-modify-write that is not atomic.
A04:2021 - Insecure Design
API3:2023 - Broken Object Property Level Authorization
CWE-362
T1190 - Exploit Public-Facing Application
High
Advanced
func transfer(c *gin.Context) { acct := load(c.Query("acct")) amt := parse(c.Query("amt")) // Vulnerable: non-atomic read-modify-write acct.Balance = acct.Balance - amt save(acct) c.JSON(200, acct) }
func transfer(c *gin.Context) { acctID := c.Query("acct") amt := parse(c.Query("amt")) // Secure: DB-level atomic update with constraint rows, err := db.Exec( `UPDATE accounts SET balance = balance - $1 WHERE id=$2 AND balance >= $1`, amt, acctID) if err != nil || rows == 0 { c.Stat...
--- a/transfer.go +++ b/transfer.go @@ -2,7 +2,10 @@ - acct.Balance = acct.Balance - amt - save(acct) + rows, err := db.Exec( + `UPDATE accounts SET balance = balance - $1 WHERE id=$2 AND balance >= $1`, amt, acctID) + if err != nil || rows == 0 { c.Status(409); return }
Concurrent requests interleave read-modify-write, allowing the same balance to be spent twice.
Send two near-simultaneous transfers; both pass the balance check before either writes.
Double-spend / inconsistent financial state.
Perform the update atomically in the database with a conditional constraint and transactions.
Use DB transactions and conditional updates; never trust in-memory read-modify-write for money.
[ "race-condition", "gin", "go", "banking" ]
{ "domain": "Banking", "input_source": "query_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000136
Go
Gin
Insecure cookie SameSite none with HTTP
A Gin handler sets SameSite=None without Secure, exposing CSRF.
A05:2021 - Security Misconfiguration
CWE-614
T1539 - Steal Web Session Cookie
Medium
Beginner
c.SetCookie("sid", t, 3600, "/", "", false, false) # Vulnerable: not Secure c.SetSameSite(http.SameSiteNoneMode)
c.SetSameSite(http.SameSiteLaxMode) # Secure c.SetCookie("sid", t, 3600, "/", "", true, true)
--- a/auth.go +++ b/auth.go @@ -1,3 +1,3 @@ -c.SetCookie("sid", t, 3600, "/", "", false, false) -c.SetSameSite(http.SameSiteNoneMode) +c.SetSameSite(http.SameSiteLaxMode) +c.SetCookie("sid", t, 3600, "/", "", true, true)
SameSite=None without Secure lets cookies ride insecure requests.
Network attacker reads the cookie over HTTP.
Session theft.
Use Secure + HttpOnly; prefer Lax unless cross-site needed.
Pair SameSite with Secure; prefer Lax.
[ "session", "gin", "go", "cookies" ]
{ "domain": "Authentication systems", "input_source": "cookie", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000320
Go
Gin
Unsafe reflection by name
A Go handler instantiates a type from a request param.
A03:2021 - Injection
CWE-470
T1190 - Exploit Public-Facing Application
High
Advanced
typ := reflect.TypeOf(structs[req.FormValue("t")]) // Vulnerable: arbitrary obj := reflect.New(typ).Interface()
ALLOWED := map[string]bool{"A": true, "B": true} if !ALLOWED[req.FormValue("t")] { c.AbortWithStatus(400); return } // Secure
--- a/handler.go +++ b/handler.go @@ -1,3 +1,4 @@ -typ := reflect.TypeOf(structs[req.FormValue("t")]) -obj := reflect.New(typ).Interface() +ALLOWED := map[string]bool{"A": true, "B": true} +if !ALLOWED[req.FormValue("t")] { c.AbortWithStatus(400); return }
Unrestricted reflection.
Pick unexpected type for abuse.
Logic abuse / RCE.
Allowlist reflectable types.
Restrict reflection.
[ "injection", "go", "gin", "reflection" ]
{ "domain": "Backend", "input_source": "form_field", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000177
Ruby
Rails
SQL injection via .order with params
A Rails controller orders by a raw request param, enabling injection.
A03:2021 - Injection
CWE-89
T1190 - Exploit Public-Facing Application
Medium
Intermediate
def index @users = User.order(params[:sort]) # Vulnerable: raw column end
ALLOWED = %w[name email created_at].freeze def index col = ALLOWED.include?(params[:sort]) ? params[:sort] : 'created_at' # Secure @users = User.order(col) end
--- a/users_controller.rb +++ b/users_controller.rb @@ -1,4 +1,5 @@ -def index @users = User.order(params[:sort]) + col = ALLOWED.include?(params[:sort]) ? params[:sort] : 'created_at' + @users = User.order(col)
Sort param inserted into ORDER BY without validation.
sort=CASE WHEN... performs blind SQLi.
Data disclosure.
Allowlist sortable columns.
Allowlist ORDER BY columns.
[ "sqli", "rails", "ruby", "injection" ]
{ "domain": "E-commerce", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000184
C
POSIX
TOCTOU on file permission check
A C program checks file ownership then opens it, allowing swap between checks.
A01:2021 - Broken Access Control
CWE-367
T1203 - Exploitation for Client Execution
High
Advanced
if (access(path, W_OK) == 0) { // Vulnerable: TOCTOU fd = open(path, O_WRONLY); write(fd, buf, n); }
fd = open(path, O_WRONLY); // Secure: open, then fstat on fd if (fd >= 0) { struct stat st; fstat(fd, &st); if (st.st_uid != getuid()) { close(fd); } else write(fd, buf, n); }
--- a/write.c +++ b/write.c @@ -1,5 +1,7 @@ -if (access(path, W_OK) == 0) { - fd = open(path, O_WRONLY); - write(fd, buf, n); +fd = open(path, O_WRONLY); +if (fd >= 0) { + struct stat st; fstat(fd, &st); + if (st.st_uid != getuid()) { close(fd); } else write(fd, buf, n); }
Check-then-open race lets an attacker swap the file.
Swap target with a symlink to a privileged file between access() and open().
Arbitrary file write.
Operate on the fd; fstat after open.
Avoid TOCTOU; use open + fstat.
[ "toctou", "c", "race-condition" ]
{ "domain": "IoT", "input_source": "file", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000050
Rust
Actix
Unbounded request body (DoS)
An Actix handler reads the entire request body with no size limit, enabling memory exhaustion.
A04:2021 - Insecure Design
API4:2023 - Unrestricted Resource Consumption
CWE-770
T1499 - Endpoint Denial of Service
Medium
Intermediate
async fn upload(mut body: web::Payload) -> impl Responder { // Vulnerable: no max size let bytes = body.to_bytes_limited(usize::MAX).await.unwrap(); process(&bytes); HttpResponse::Ok().finish() }
async fn upload(mut body: web::Payload) -> impl Responder { // Secure: cap at 1 MiB let bytes = match body.to_bytes_limited(1 << 20).await { Ok(b) => b, Err(_) => return HttpResponse::PayloadTooLarge().finish(), }; process(&bytes); HttpResponse::Ok().finish() }
--- a/upload.rs +++ b/upload.rs @@ -2,4 +2,7 @@ - let bytes = body.to_bytes_limited(usize::MAX).await.unwrap(); + let bytes = match body.to_bytes_limited(1 << 20).await { + Ok(b) => b, + Err(_) => return HttpResponse::PayloadTooLarge().finish(), + };
No limit is enforced on request body size, allowing attackers to exhaust memory.
Send a multi-gigabyte body to crash or slow the service for everyone.
Denial of service via resource exhaustion.
Enforce a strict maximum body size and reject oversized requests early.
Bound all inputs; enforce payload size limits at the edge and per-route.
[ "dos", "rust", "actix", "resource-exhaustion" ]
{ "domain": "Serverless", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000195
YAML
Kubernetes
Container with added Linux capabilities
A Pod adds CAP_SYS_ADMIN, enabling privilege escalation.
A05:2021 - Security Misconfiguration
CWE-250
T1611 - Escape to Host
Critical
Intermediate
securityContext: capabilities: add: ["SYS_ADMIN"] # Vulnerable
securityContext: capabilities: drop: ["ALL"] # Secure allowPrivilegeEscalation: false
--- a/pod.yaml +++ b/pod.yaml @@ -1,4 +1,4 @@ - add: ["SYS_ADMIN"] + drop: ["ALL"] + allowPrivilegeEscalation: false
Excess capabilities permit container escape.
SYS_ADMIN lets the container mount host filesystem.
Host compromise.
Drop all capabilities; add only what's required.
Drop capabilities; avoid SYS_ADMIN.
[ "kubernetes", "privilege", "yaml", "container" ]
{ "domain": "Microservices", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000461
Go
Gin
SSRF in proxy endpoint
Gin proxy fetches arbitrary user URLs.
A10:2021 - SSRF
CWE-918
T1190
High
Intermediate
resp, _ := http.Get(c.Query("url")) // SSRF
u, err := url.Parse(c.Query("url")) if err != nil || !allowlist[u.Host] { c.AbortWithStatus(403); return } resp, _ := http.Get(u.String())
--- a/proxy.go +++ b/proxy.go @@ -1,2 +1,4 @@ -resp, _ := http.Get(c.Query("url")) +u, err := url.Parse(c.Query("url")) +if err != nil || !allowlist[u.Host] { c.AbortWithStatus(403); return } +resp, _ := http.Get(u.String())
Unvalidated fetch URL.
Fetch cloud metadata.
Metadata theft.
Allowlist hosts.
Validate fetch targets.
[ "ssrf", "go", "gin", "rce" ]
{ "domain": "Cloud", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000471
Go
Gin
Hardcoded JWT secret in Go
Gin service uses hardcoded JWT signing secret.
A02:2021 - Cryptographic Failures
API2:2023
CWE-798
T1600
Critical
Intermediate
var jwtSecret = []byte("secret") // brute-forceable
var jwtSecret = []byte(os.Getenv("JWT_SECRET")) // env
--- a/auth.go +++ b/auth.go @@ -1,2 +1,2 @@ -var jwtSecret = []byte("secret") +var jwtSecret = []byte(os.Getenv("JWT_SECRET"))
Weak hardcoded secret.
Forge tokens.
Auth bypass.
Use env secret.
Externalize JWT secret.
[ "jwt", "go", "gin", "auth" ]
{ "domain": "Authentication systems", "input_source": "server", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000173
YAML
Kubernetes
Service account token automount enabled
A Pod mounts the default service account token, widening blast radius if compromised.
A05:2021 - Security Misconfiguration
CWE-250
T1078 - Valid Accounts
Medium
Beginner
spec: containers: - name: app image: app:1.0 # Vulnerable: default token automounted
spec: automountServiceAccountToken: false # Secure: opt-in only containers: - name: app image: app:1.0 env: - name: TOKEN valueFrom: secretKeyRef: { name: app-token, key: token }
--- a/pod.yaml +++ b/pod.yaml @@ -1,5 +1,6 @@ + automountServiceAccountToken: false containers: - name: app image: app:1.0
Default SA token automounted gives API access if the pod is compromised.
Compromised app uses the token to call the Kubernetes API.
Lateral movement in the cluster.
Disable automount; use scoped tokens.
Disable SA token automount by default.
[ "kubernetes", "rbac", "yaml", "secrets" ]
{ "domain": "Microservices", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000401
Swift
iOS
SQL injection in Core Data fetch
An iOS fetch uses a concatenated predicate format.
A03:2021 - Injection
CWE-89
T1190 - Exploit Public-Facing Application
High
Intermediate
let req = NSFetchRequest<User>(entityName: "User")\nreq.predicate = NSPredicate(format: "name == '\(name)'") // Vulnerable: format injection\
req.predicate = NSPredicate(format: "name == %@", name) // Secure: bound arg\
--- a/Store.swift\n+++ b/Store.swift\n@@ -1,4 +1,4 @@\n-let req = NSFetchRequest<User>(entityName: "User")\n-req.predicate = NSPredicate(format: "name == '\(name)'")\n+req.predicate = NSPredicate(format: "name == %@", name)\
Predicate format with interpolation.
name=' OR 1=1 bypasses.
Data disclosure.
Use %@ bound args.
Bind all predicates.
[ "sqli", "swift", "ios", "injection" ]
{ "domain": "Mobile", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000111
Java
Spring Boot
Open redirect via ModelAndView
A Spring controller returns a user-supplied URL in a redirect.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
@GetMapping("/out") public String out(@RequestParam String url) { return "redirect:" + url; // Vulnerable }
@GetMapping("/out") public String out(@RequestParam String url) { if (!url.startsWith("/")) return "redirect:/"; // Secure return "redirect:" + url; }
--- a/LinkController.java +++ b/LinkController.java @@ -2,4 +2,5 @@ - return "redirect:" + url; + if (!url.startsWith("/")) return "redirect:/"; + return "redirect:" + url;
Redirect target is unvalidated user input.
out?url=//evil.com phishes the user.
Phishing, credential theft.
Allowlist relative same-origin paths.
Validate redirect targets.
[ "open-redirect", "spring", "java", "phishing" ]
{ "domain": "Authentication systems", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000080
JavaScript
GraphQL
Broken object level auth in GraphQL resolver
A GraphQL resolver returns a user by id without checking the caller owns it.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-639
T1190 - Exploit Public-Facing Application
High
Intermediate
const resolvers = { Query: { user: (_, { id }) => db.users.find({ id }), // Vulnerable: no owner check } };
const resolvers = { Query: { user: (_, { id }, ctx) => { // Secure: scope to authenticated user if (id !== ctx.user.id && !ctx.user.isAdmin) throw new ForbiddenError('no access'); return db.users.find({ id }); } } };
--- a/graphql/resolvers.js +++ b/graphql/resolvers.js @@ -2,4 +2,8 @@ - user: (_, { id }) => db.users.find({ id }), + user: (_, { id }, ctx) => { + if (id !== ctx.user.id && !ctx.user.isAdmin) + throw new ForbiddenError('no access'); + return db.users.find({ id }); + }
The resolver trusts the requested id without verifying caller ownership/role.
Caller requests other users' ids to scrape PII.
Cross-user data disclosure.
Enforce object-level authorization in every resolver using the auth context.
Authorize in resolvers by owner/role from the auth context.
[ "idor", "graphql", "javascript", "access-control" ]
{ "domain": "E-commerce", "input_source": "args", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000445
Ruby
Rails
Weak JWT secret in Rails
Rails API uses a short, guessable JWT secret.
A07:2021 - Auth Failures
API2:2023
CWE-345
T1600
Critical
Advanced
secret = "secret123" # brute-forceable
secret = ENV["JWT_SECRET"] # 32+ random bytes
--- a/initializers/jwt.rb +++ b/initializers/jwt.rb @@ -1,2 +1,2 @@ -secret = "secret123" +secret = ENV["JWT_SECRET"]
Weak JWT secret.
Brute-force / crack signature.
Auth bypass.
Use strong random secret.
Long random JWT secret.
[ "jwt", "rails", "ruby", "auth" ]
{ "domain": "Authentication systems", "input_source": "server", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000175
Java
Spring Boot
Unbounded request size (upload DoS)
A Spring endpoint accepts any multipart size, exhausting disk.
A04:2021 - Insecure Design
API4:2023 - Unrestricted Resource Consumption
CWE-770
T1499 - Endpoint Denial of Service
Medium
Beginner
@PostMapping("/upload") public String up(@RequestParam MultipartFile f) { // Vulnerable: no size cap f.transferTo(new File("/data/" + f.getOriginalFilename())); return "ok"; }
@PostMapping("/upload") public String up(@RequestParam MultipartFile f) { if (f.getSize() > 5_000_000) return "too big"; // Secure if (!f.getContentType().startsWith("image/")) return "bad type"; f.transferTo(new File("/data/" + UUID.randomUUID())); return "ok"; }
--- a/UploadController.java +++ b/UploadController.java @@ -1,5 +1,7 @@ - f.transferTo(new File("/data/" + f.getOriginalFilename())); + if (f.getSize() > 5_000_000) return "too big"; + if (!f.getContentType().startsWith("image/")) return "bad type"; + f.transferTo(new File("/data/" + UUID.randomUUID()));
No size/type limits on upload.
Upload huge file to fill disk.
Denial of service.
Cap size; validate type; randomize name.
Limit uploads; validate type.
[ "dos", "spring", "java", "upload" ]
{ "domain": "E-commerce", "input_source": "form_field", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000464
C#
ASP.NET Core
SSRF in HttpClient
Controller fetches user-supplied URL.
A10:2021 - SSRF
CWE-918
T1190
High
Intermediate
var html = await client.GetStringAsync(url);
if (!Uri.TryCreate(url, UriKind.Absolute, out var u) || !ALLOWED_HOSTS.Contains(u.Host)) return BadRequest(); var html = await client.GetStringAsync(u);
--- a/ProxyController.cs +++ b/ProxyController.cs @@ -1,2 +1,4 @@ -var html = await client.GetStringAsync(url); +if (!Uri.TryCreate(url, UriKind.Absolute, out var u) || + !ALLOWED_HOSTS.Contains(u.Host)) return BadRequest(); +var html = await client.GetStringAsync(u);
Unvalidated fetch URL.
Fetch internal metadata.
Metadata theft.
Allowlist hosts.
Validate fetch targets.
[ "ssrf", "csharp", "aspnet", "rce" ]
{ "domain": "Cloud", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000368
Rust
Actix
Path traversal in file serve
An Actix handler serves a file from a user path.
A01:2021 - Broken Access Control
CWE-22
T1190 - Exploit Public-Facing Application
High
Intermediate
let path = format!("/data/{}", name); // Vulnerable: traversal\nactix_files::NamedFile::open(path)?.into_response(&req)\
let name = Path::new(&name).file_name().ok_or(404)?;\nlet path = Path::new("/data").join(name); // Secure: basename\nactix_files::NamedFile::open(path)?.into_response(&req)\
--- a/files.rs\n+++ b/files.rs\n@@ -1,4 +1,5 @@\n-let path = format!("/data/{}", name);\n-actix_files::NamedFile::open(path)?.into_response(&req)\n+let name = Path::new(&name).file_name().ok_or(404)?;\n+let path = Path::new("/data").join(name);\n+actix_files::NamedFile::open(path)?.into_response(&req)\
Unsanitized filename.
name=../../etc/passwd reads file.
File disclosure.
Basename + confine.
Confine file paths.
[ "path-traversal", "rust", "actix", "file-read" ]
{ "domain": "Backend", "input_source": "query_param", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000082
JavaScript
GraphQL
GraphQL batching abuse for brute force
A GraphQL endpoint accepts batched requests with no rate limit, defeating lockout.
A07:2021 - Identification and Authentication Failures
API4:2023 - Unrestricted Resource Consumption
CWE-307
T1110 - Brute Force
Medium
Intermediate
// accepts [{query: login}, ...] in one HTTP call app.post('/graphql', (req, res) => { const batch = Array.isArray(req.body) ? req.body : [req.body]; // Vulnerable: no per-batch rate limit Promise.all(batch.map(b => execute(b))).then(r => res.json(r)); });
const limiter = rateLimit({ windowMs: 15*60*1000, max: 20 }); app.post('/graphql', limiter, (req, res) => { const batch = Array.isArray(req.body) ? req.body : [req.body]; if (batch.length > 5) return res.status(413).end(); // Secure: cap batch Promise.all(batch.map(b => execute(b))).then(r => res.json(r)); });
--- a/graphql/server.js +++ b/graphql/server.js @@ -1,5 +1,7 @@ +const limiter = rateLimit({ windowMs: 15*60*1000, max: 20 }); +app.post('/graphql', limiter, (req, res) => { + if (batch.length > 5) return res.status(413).end();
Batched queries let an attacker try many credentials in a single request, bypassing per-request limits.
Send 1000 login mutations in one batch to brute force passwords.
Credential brute force / stuffing.
Limit batch size and apply per-IP/per-account rate limiting.
Cap GraphQL batch size; rate limit auth mutations.
[ "rate-limiting", "graphql", "javascript", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000423
YAML
Kubernetes
Capability NET_ADMIN added
A container adds dangerous Linux capabilities.
A05:2021 - Security Misconfiguration
CWE-250
T1611 - Escape to Host
High
Intermediate
securityContext:\n capabilities:\n add: ["NET_ADMIN", "SYS_ADMIN"] # Vulnerable\
securityContext:\n capabilities:\n drop: ["ALL"] # Secure: least privilege\
--- a/deploy.yaml\n+++ b/deploy.yaml\n@@ -1,5 +1,4 @@\n-securityContext:\n capabilities:\n add: ["NET_ADMIN", "SYS_ADMIN"]\n+securityContext:\n+ capabilities:\n+ drop: ["ALL"]\
Dangerous capabilities added.
Manipulate networking / host.
Container escape.
Drop ALL caps.
Minimal capabilities.
[ "kubernetes", "yaml", "capability", "container" ]
{ "domain": "Kubernetes", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000399
Kotlin
Android
Business logic: negative in-app purchase
A purchase flow accepts a negative quantity from client.
A04:2021 - Insecure Design
API3:2023 - Broken Object Property Level Authorization
CWE-840
T1190 - Exploit Public-Facing Application
Medium
Intermediate
order.qty = intent.getIntExtra("qty", 1) // Vulnerable: negative\
val qty = intent.getIntExtra("qty", 1)\nif (qty <= 0 || qty > 100) throw IllegalArgumentException("bad") // Secure\
--- a/Purchase.kt\n+++ b/Purchase.kt\n@@ -1,3 +1,4 @@\n-order.qty = intent.getIntExtra("qty", 1)\n+val qty = intent.getIntExtra("qty", 1)\n+if (qty <= 0 || qty > 100) throw IllegalArgumentException("bad")\
Client qty not bounded.
qty=-5 => negative charge.
Revenue loss.
Validate qty.
Validate business values.
[ "business-logic", "kotlin", "android", "ecommerce" ]
{ "domain": "Mobile", "input_source": "intent", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000004
Python
FastAPI
Missing authentication on admin endpoint
A FastAPI endpoint exposes administrative actions without any authentication dependency.
A01:2021 - Broken Access Control
API2:2023 - Broken Authentication
CWE-306
T1190 - Exploit Public-Facing Application
Critical
Beginner
from fastapi import FastAPI app = FastAPI() @app.delete('/admin/users/{uid}') def delete_user(uid: int): # Vulnerable: no auth dependency repository.remove_user(uid) return {'deleted': uid}
from fastapi import FastAPI, Depends, HTTPException from fastapi.security import HTTPBearer app = FastAPI() bearer = HTTPBearer() def require_admin(token=Depends(bearer)): claims = decode_token(token.credentials) if not claims.get('role') == 'admin': raise HTTPException(status_code=403, detail='forbid...
--- a/main.py +++ b/main.py @@ -1,8 +1,16 @@ +from fastapi import Depends, HTTPException +from fastapi.security import HTTPBearer +def require_admin(token=Depends(bearer)): + claims = decode_token(token.credentials) + if not claims.get('role') == 'admin': + raise HTTPException(status_code=403, detail='forb...
Authorization logic was never attached to the protected route.
Any unauthenticated caller hits DELETE /admin/users/1 and removes arbitrary accounts.
Privilege escalation to full administrative control and data loss.
Enforce authentication and role-based authorization via route dependencies or middleware.
Deny by default. Every sensitive route must declare an auth dependency.
[ "auth", "authorization", "fastapi", "python" ]
{ "domain": "REST API", "input_source": "path_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000425
YAML
Kubernetes
ServiceAccount token automount enabled
A Pod mounts the API token by default, widening blast radius.
A05:2021 - Security Misconfiguration
CWE-668
T1078 - Valid Accounts
Medium
Beginner
automountServiceAccountToken: true # Vulnerable: API token in pod\
automountServiceAccountToken: false # Secure: only if needed\
--- a/deploy.yaml\n+++ b/deploy.yaml\n@@ -1,2 +1,2 @@\n-automountServiceAccountToken: true\n+automountServiceAccountToken: false\
API token mounted unnecessarily.
Token theft -> API abuse.
Cluster compromise.
Disable automount.
Least privilege SA.
[ "kubernetes", "yaml", "token", "serviceaccount" ]
{ "domain": "Kubernetes", "input_source": "manifest", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000143
Python
Django
Debug mode enabled in production
A Django project runs with DEBUG=True in production, leaking stack traces.
A05:2021 - Security Misconfiguration
CWE-209
T1190 - Exploit Public-Facing Application
High
Beginner
# settings.py DEBUG = True # Vulnerable in prod
# settings.py import os DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True' # Secure: off by default if not DEBUG: ALLOWED_HOSTS = ['app.example.com']
--- a/settings.py +++ b/settings.py @@ -1,2 +1,5 @@ -DEBUG = True +import os +DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True' +if not DEBUG: + ALLOWED_HOSTS = ['app.example.com']
DEBUG=True exposes the full traceback and settings.
Trigger an error to read the stack and config.
Information disclosure.
Keep DEBUG off in production; set ALLOWED_HOSTS.
Never run DEBUG=True in production.
[ "config", "django", "python", "info-leak" ]
{ "domain": "Backend", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000312
Go
Gin
No rate limit on login
A Gin login has no throttling.
A07:2021 - Identification and Authentication Failures
API4:2023 - Unrestricted Resource Consumption
CWE-307
T1110 - Brute Force
Medium
Beginner
r.POST("/login", login) // Vulnerable: no throttle
r.POST("/login", rateLimiter(5, time.Minute), login) // Secure: middleware
--- a/routes.go +++ b/routes.go @@ -1,2 +1,2 @@ -r.POST("/login", login) +r.POST("/login", rateLimiter(5, time.Minute), login)
No throttle on auth.
Brute force credentials.
Account takeover.
Rate limit login.
Throttle auth endpoints.
[ "rate-limiting", "go", "gin", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000240
Java
Spring Boot
CORS allow-all with credentials
A Spring CORS config permits any origin together with credentials.
A05:2021 - Security Misconfiguration
CWE-942
T1190 - Exploit Public-Facing Application
Medium
Beginner
config.setAllowedOriginPatterns(Arrays.asList("*")); // Vulnerable config.setAllowCredentials(true);
config.setAllowedOrigins(Arrays.asList("https://app.example.com")); // Secure config.setAllowCredentials(true);
--- a/Cors.java +++ b/Cors.java @@ -1,3 +1,3 @@ -config.setAllowedOriginPatterns(Arrays.asList("*")); +config.setAllowedOrigins(Arrays.asList("https://app.example.com"));
Wildcard origin with credentials.
Malicious site reads responses with victim cookies.
Cross-origin data theft.
Pin origins; never * with credentials.
Restrict CORS origins.
[ "cors", "spring", "java", "config" ]
{ "domain": "E-commerce", "input_source": "header", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000113
JavaScript
Express
JWT secret hardcoded and weak
An Express app signs JWTs with a hardcoded, guessable secret.
A02:2021 - Cryptographic Failures
API2:2023 - Broken Authentication
CWE-798
T1600 - Weaken Encryption
High
Beginner
const jwt = require('jsonwebtoken'); const SECRET = 'secret'; // Vulnerable function sign(u){ return jwt.sign({u}, SECRET); }
const jwt = require('jsonwebtoken'); const SECRET = process.env.JWT_SECRET; // from env/secret manager function sign(u){ return jwt.sign({u}, SECRET, { algorithm:'HS256', expiresIn:'1h' }); }
--- a/auth.js +++ b/auth.js @@ -1,4 +1,4 @@ -const SECRET = 'secret'; +const SECRET = process.env.JWT_SECRET; -function sign(u){ return jwt.sign({u}, SECRET); } +function sign(u){ return jwt.sign({u}, SECRET, { algorithm:'HS256', expiresIn:'1h' }); }
A weak hardcoded secret lets attackers forge valid JWTs.
Attacker signs their own admin token with the known secret.
Privilege escalation, auth bypass.
Use a strong secret from env; set algorithm and expiry.
Never hardcode JWT secrets; use env + HS256 + expiry.
[ "jwt", "express", "javascript", "secrets" ]
{ "domain": "Authentication systems", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000215
Python
Django
Clickjacking protection disabled
A Django app removes the X-Frame-Options / clickjacking middleware.
A05:2021 - Security Misconfiguration
CWE-1021
T1185 - Browser Session Hijacking
Medium
Beginner
MIDDLEWARE = [m for m in MIDDLEWARE if "ClickjackingMiddleware" not in m] # Vulnerable
MIDDLEWARE = MIDDLEWARE + ["django.middleware.clickjacking.XFrameOptionsMiddleware"] # Secure
--- a/settings.py +++ b/settings.py @@ -1,3 +1,3 @@ -MIDDLEWARE = [m for m in MIDDLEWARE if "ClickjackingMiddleware" not in m] +MIDDLEWARE = MIDDLEWARE + ["django.middleware.clickjacking.XFrameOptionsMiddleware"]
Clickjacking middleware removed.
Frame the page to trick clicks.
UI redress.
Keep X-Frame-Options middleware; set DENY/SAMEORIGIN.
Enable clickjacking protection.
[ "clickjacking", "django", "python", "config" ]
{ "domain": "E-commerce", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000468
Ruby
Rails
Timing-unsafe token compare
Rails API compares tokens with ==.
A02:2021 - Cryptographic Failures
CWE-208
T1600
Low
Intermediate
def valid?(t); t == session[:csrf]; end
def valid?(t) ActiveSupport::SecurityUtils.secure_compare(t, session[:csrf]) end
--- a/csrf.rb +++ b/csrf.rb @@ -1,2 +1,3 @@ -def valid?(t); t == session[:csrf]; end +def valid?(t) + ActiveSupport::SecurityUtils.secure_compare(t, session[:csrf]) +end
Non-constant-time compare.
Timing attack on CSRF.
Token forgery.
Use secure_compare.
Constant-time compare.
[ "crypto", "rails", "ruby", "timing" ]
{ "domain": "Authentication systems", "input_source": "cookie", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000370
Rust
Actix
Hardcoded secret in source
A Rust service hardcodes an API key.
A02:2021 - Cryptographic Failures
CWE-798
T1552.001 - Unsecured Credentials: Credentials In Files
High
Beginner
const API_KEY: &str = "sk_live_7b6a5948"; // Vulnerable\
let api_key = std::env::var("API_KEY").expect("API_KEY"); // Secure: env\
--- a/config.rs\n+++ b/config.rs\n@@ -1,2 +1,2 @@\n-const API_KEY: &str = "sk_live_7b6a5948";\n+let api_key = std::env::var("API_KEY").expect("API_KEY");\
Secret in source.
Repo access reveals key.
Key compromise.
Use env/secret.
Externalize secrets.
[ "secrets", "rust", "actix", "config" ]
{ "domain": "Banking", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000343
C#
ASP.NET Core
Improper certificate validation (ServerCertificateCustomValidationCallback)
An HttpClient accepts any server certificate.
A02:2021 - Cryptographic Failures
CWE-295
T1557 - Adversary-in-the-Middle
Critical
Advanced
handler.ServerCertificateCustomValidationCallback = (m, c, ch, e) => true; // Vulnerable: accept all\
// Use default validation; do not override the callback\nusing var client = new HttpClient(); // Secure: validates chain\
--- a/Client.cs\n+++ b/Client.cs\n@@ -1,3 +1,3 @@\n-handler.ServerCertificateCustomValidationCallback = (m, c, ch, e) => true;\n+// Use default validation; do not override the callback\
Certificate validation disabled.
MITM intercepts TLS.
Credential/data theft.
Keep default validation.
Always verify TLS peers.
[ "tls", "csharp", "aspnet", "mitm" ]
{ "domain": "Banking", "input_source": "network", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000377
Rust
Actix
Weak random for token (rand::random default)
A token generator uses a weak RNG.
A02:2021 - Cryptographic Failures
CWE-338
T1600 - Weaken Encryption
High
Intermediate
let tok = rand::random::<u64>().to_string(); // Vulnerable if thread_rng weak\
use rand::rngs::OsRng;\nlet mut buf = [0u8; 32]; OsRng.fill_bytes(&mut buf); // Secure: OS CSPRNG\
--- a/token.rs\n+++ b/token.rs\n@@ -1,3 +1,4 @@\n-let tok = rand::random::<u64>().to_string();\n+use rand::rngs::OsRng;\n+let mut buf = [0u8; 32]; OsRng.fill_bytes(&mut buf);\
Weak RNG token.
Predict token.
Token forgery.
Use OsRng/getrandom.
Use CSPRNG for tokens.
[ "crypto", "rust", "actix", "tokens" ]
{ "domain": "Authentication systems", "input_source": "server", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000102
C
Embedded
Hardcoded WiFi credentials in firmware
An embedded IoT firmware stores WiFi credentials as string literals in flash.
A02:2021 - Cryptographic Failures
CWE-798
T1552.001 - Unsecured Credentials: Credentials In Files
High
Beginner
const char *SSID = "HomeNet"; const char *PSK = "password123"; // Vulnerable: hardcoded
char ssid[33], psk[64]; // Secure: load from secure element / provisioning at first boot if (load_credentials(ssid, psk) != 0) { enter_provisioning_mode(); }
--- a/wifi.c +++ b/wifi.c @@ -1,3 +1,6 @@ -const char *SSID = "HomeNet"; -const char *PSK = "password123"; +char ssid[33], psk[64]; +if (load_credentials(ssid, psk) != 0) { + enter_provisioning_mode(); +}
Credentials compiled into firmware are recoverable by dumping flash.
Attacker extracts the firmware and reads the WiFi PSK for network access.
Network compromise via recovered credentials.
Store credentials in a secure element; provision at first boot.
Never store secrets in firmware; use secure provisioning.
[ "iot", "c", "secrets", "firmware" ]
{ "domain": "IoT", "input_source": "source_code", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000298
Scala
Akka HTTP
No rate limit on login
An Akka HTTP login route has no throttling.
A07:2021 - Identification and Authentication Failures
API4:2023 - Unrestricted Resource Consumption
CWE-307
T1110 - Brute Force
Medium
Beginner
path("login") { post { entity(as[Login]) { l => complete(auth(l)) } } } // Vulnerable: no throttle
path("login") { post { throttle(5, 1.minute) { // Secure entity(as[Login]) { l => complete(auth(l)) } } } }
--- a/LoginRoute.scala +++ b/LoginRoute.scala @@ -1,3 +1,4 @@ -path("login") { post { entity(as[Login]) { l => complete(auth(l)) } } } +path("login") { post { throttle(5, 1.minute) { + entity(as[Login]) { l => complete(auth(l)) } } } }
No throttle on auth.
Brute force credentials.
Account takeover.
Throttle login.
Rate limit auth.
[ "rate-limiting", "scala", "akka", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000014
JavaScript
Express
NoSQL injection in MongoDB query
An Express route passes the raw request body into a MongoDB filter, enabling operator injection.
A03:2021 - Injection
API3:2023 - Broken Object Property Level Authorization
CWE-943
T1190 - Exploit Public-Facing Application
High
Intermediate
app.post('/login', (req, res) => { const { user, pass } = req.body; // Vulnerable: body used directly as query db.users.findOne({ user, pass }, (e, doc) => res.json(doc)); });
app.post('/login', (req, res) => { const user = String(req.body.user || ''); const pass = String(req.body.pass || ''); if (!user || !pass) return res.status(400).end(); // Secure: strict string values, no operators db.users.findOne({ user: user, pass: pass }, (e, doc) => res.json(doc)); });
--- a/routes.js +++ b/routes.js @@ -2,6 +2,8 @@ - db.users.findOne({ user, pass }, cb); + const user = String(req.body.user || ''); + const pass = String(req.body.pass || ''); + db.users.findOne({ user: user, pass: pass }, cb);
Untrusted JSON is used as a query object, so operators like $gt or $ne can be injected.
Send {"user":{"$ne":null},"pass":{"$ne":null}} to bypass authentication.
Authentication bypass and data disclosure.
Validate and cast inputs to expected scalar types; reject nested objects/operators.
Never pass raw request bodies into query builders; validate shape and types.
[ "nosql", "injection", "express", "javascript" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000319
Go
Gin
Deserialization of untrusted JSON with reflection
A Go handler decodes JSON into an interface{} enabling type confusion.
A08:2021 - Software and Data Integrity Failures
CWE-502
T1190 - Exploit Public-Facing Application
Medium
Advanced
var data interface{} json.Unmarshal(body, &data) // Vulnerable: loose typing
var data StrictDTO if err := json.Unmarshal(body, &data); err != nil { c.AbortWithStatus(400); return } // Secure: typed
--- a/handler.go +++ b/handler.go @@ -1,3 +1,4 @@ -var data interface{} -json.Unmarshal(body, &data) +var data StrictDTO +if err := json.Unmarshal(body, &data); err != nil { c.AbortWithStatus(400); return }
Untyped JSON decode.
Type confusion in downstream logic.
Logic abuse.
Use strict DTOs.
Type all JSON input.
[ "deserialization", "go", "gin", "injection" ]
{ "domain": "Microservices", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000269
C
POSIX
Race condition on shared file
A C program checks then opens a file (TOCTOU).
A01:2021 - Broken Access Control
CWE-367
T1203 - Exploitation for Client Execution
High
Advanced
if (access(path, R_OK) == 0) { fd = open(path, O_RDONLY); } // Vulnerable: TOCTOU
fd = open(path, O_RDONLY); if (fd >= 0) { struct stat st; fstat(fd, &st); } // Secure: fd-based
--- a/open.c +++ b/open.c @@ -1,3 +1,4 @@ -if (access(path, R_OK) == 0) { fd = open(path, O_RDONLY); } +fd = open(path, O_RDONLY); +if (fd >= 0) { struct stat st; fstat(fd, &st); }
Check-then-open race.
Swap file between access and open.
Arbitrary read.
Operate on fd.
Avoid TOCTOU with fd.
[ "toctou", "c", "race-condition" ]
{ "domain": "IoT", "input_source": "file", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000120
Kotlin
Android
WebView addJavascriptInterface abuse
An Android WebView exposes a Java object to JS, enabling native calls.
A04:2021 - Insecure Design
CWE-749
T1398 - Mobile Application Exploitation
High
Intermediate
web.addJavascriptInterface(NativeBridge(), "bridge") // Vulnerable web.loadUrl(intent.getStringExtra("url")!!)
if (Build.VERSION.SDK_INT >= 24) { web.settings.javaScriptEnabled = false // Secure } else web.removeJavascriptInterface("bridge") if (URL(url).host == "trusted.example.com") web.loadUrl(url)
--- a/MainActivity.kt +++ b/MainActivity.kt @@ -1,3 +1,5 @@ -web.addJavascriptInterface(NativeBridge(), "bridge") -web.loadUrl(intent.getStringExtra("url")!!) +if (Build.VERSION.SDK_INT >= 24) web.settings.javaScriptEnabled = false +else web.removeJavascriptInterface("bridge") +if (URL(url).host == "trusted.example.com...
A JS bridge on a WebView loading untrusted URLs allows native method calls.
Malicious page calls bridge.sensitiveMethod().
Native code execution in app context.
Disable JS bridge unless required; validate URLs.
Avoid addJavascriptInterface with untrusted content.
[ "android", "kotlin", "webview", "mobile" ]
{ "domain": "IoT", "input_source": "intent", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
SCP-000112
Java
Spring Boot
Insecure JWT alg none
A Spring JWT parser accepts the 'none' algorithm, forging tokens.
A07:2021 - Identification and Authentication Failures
API2:2023 - Broken Authentication
CWE-345
T1609 - Container Administration Command
Critical
Advanced
public Claims parse(String t) { // Vulnerable: none allowed return Jwts.parser().parseClaimsJwt(t).getBody(); }
public Claims parse(String t, Key k) { // Secure: pin algorithm return Jwts.parserBuilder().setSigningKey(k) .require("alg","HS256").build().parseClaimsJws(t).getBody(); }
--- a/Jwt.java +++ b/Jwt.java @@ -1,4 +1,5 @@ - return Jwts.parser().parseClaimsJwt(t).getBody(); + return Jwts.parserBuilder().setSigningKey(k) + .require("alg","HS256").build().parseClaimsJws(t).getBody();
No algorithm pinning lets attackers use alg=none.
Attacker sends a token with alg=none and arbitrary claims.
Full auth bypass.
Pin and verify the signing algorithm.
Never accept alg=none; pin algorithm.
[ "jwt", "spring", "java", "auth-bypass" ]
{ "domain": "Authentication systems", "input_source": "header", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000048
PHP
Laravel
Unescaped output in Blade template (XSS)
A Blade view uses {!! !!} to render user content, bypassing Laravel's auto-escaping.
A03:2021 - Injection
CWE-79
T1059.007 - Command and Scripting Interpreter: JavaScript
Medium
Beginner
<!-- profile.blade.php --> <div class="bio">{!! $user->bio !!}</div> {{-- Vulnerable: raw, no escaping --}}
<!-- profile.blade.php --> <div class="bio">{{ $user->bio }}</div> {{-- Secure: auto-escaped --}}
--- a/profile.blade.php +++ b/profile.blade.php @@ -1,2 +1,2 @@ -<div class="bio">{!! $user->bio !!}</div> +<div class="bio">{{ $user->bio }}</div>
Blade's raw echo ({!! !!}), which skips escaping, is used on untrusted data.
User sets bio to <script>steal()</script>, executed for every profile viewer.
Stored XSS, session theft.
Use escaped echo ({{ }}) for untrusted data; sanitize only when HTML is genuinely needed.
Default to escaped output; only use {!! !!} with vetted, sanitized HTML.
[ "xss", "laravel", "php", "blade" ]
{ "domain": "E-commerce", "input_source": "db", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000016
JavaScript
Express
Missing rate limiting on login
A login endpoint has no rate limiting, allowing unlimited credential guessing.
A07:2021 - Identification and Authentication Failures
API4:2023 - Unrestricted Resource Consumption
CWE-307
T1110 - Brute Force
Medium
Beginner
app.post('/login', async (req, res) => { const { user, pass } = req.body; const ok = await verify(user, pass); res.json({ ok }); });
const rateLimit = require('express-rate-limit'); const loginLimiter = rateLimit({ windowMs: 15 * 60 * 1000, max: 5, standardHeaders: true, legacyHeaders: false }); app.post('/login', loginLimiter, async (req, res) => { const { user, pass } = req.body; const ok = await verify(user, pass); res.json({ ok }); });
--- a/routes.js +++ b/routes.js @@ -1,3 +1,7 @@ +const rateLimit = require('express-rate-limit'); +const loginLimiter = rateLimit({ windowMs: 15*60*1000, max: 5 }); -app.post('/login', async (req, res) => { +app.post('/login', loginLimiter, async (req, res) => {
No throttling on an authentication endpoint permits automated brute-force/credential-stuffing.
Attacker scripts millions of password attempts against known usernames.
Account takeover via brute force or credential stuffing.
Apply per-IP and per-account rate limiting plus lockout/backoff and MFA.
Throttle auth endpoints; add lockout, CAPTCHA, and MFA for sensitive flows.
[ "rate-limiting", "express", "javascript", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000017
JavaScript
Express
Open redirect via unvalidated next parameter
A post-login redirect uses a user-supplied 'next' parameter without validation.
A01:2021 - Broken Access Control
CWE-601
T1566 - Phishing
Medium
Beginner
app.post('/login', (req, res) => { authenticate(req.body); // Vulnerable: arbitrary redirect target res.redirect(req.body.next || '/home'); });
function isSafeRedirect(target) { return typeof target === 'string' && target.startsWith('/') && !target.startsWith('//'); } app.post('/login', (req, res) => { authenticate(req.body); const next = req.body.next; res.redirect(isSafeRedirect(next) ? next : '/home'); });
--- a/routes.js +++ b/routes.js @@ -2,4 +2,9 @@ - res.redirect(req.body.next || '/home'); + function isSafeRedirect(t){return typeof t==='string'&&t.startsWith('/')&&!t.startsWith('//');} + const next = req.body.next; + res.redirect(isSafeRedirect(next) ? next : '/home');
Redirect target is taken from user input without confirming it is a same-origin relative path.
Phishing link uses next=//evil.com to send victims to a credential-harvesting clone after login.
Phishing, credential theft, and loss of user trust.
Allowlist internal paths only; reject absolute/protocol-relative URLs.
Validate redirect targets against an allowlist of same-origin relative paths.
[ "open-redirect", "express", "javascript", "phishing" ]
{ "domain": "Authentication systems", "input_source": "form_field", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000217
Python
FastAPI
Missing dependency in admin router (authz bypass)
A FastAPI admin route omits the admin-role dependency.
A01:2021 - Broken Access Control
API1:2023 - Broken Object Level Authorization
CWE-862
T1190 - Exploit Public-Facing Application
Critical
Advanced
@app.delete("/admin/user/{uid}") async def delete(uid: int): # Vulnerable: no admin check repo.remove(uid)
@app.delete("/admin/user/{uid}") async def delete(uid: int, admin: AdminUser = Depends(require_admin)): # Secure repo.remove(uid)
--- a/admin.py +++ b/admin.py @@ -1,4 +1,5 @@ -async def delete(uid: int): +async def delete(uid: int, admin: AdminUser = Depends(require_admin)): repo.remove(uid)
Admin dependency missing on destructive route.
Unauthenticated admin action.
Privilege escalation.
Attach role dependency.
Always enforce admin deps on admin routes.
[ "authorization", "fastapi", "python", "broken-access-control" ]
{ "domain": "Authentication systems", "input_source": "path_param", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000313
Go
Gin
Insecure JWT verification (none alg)
A Go JWT verifier allows the none algorithm.
A07:2021 - Identification and Authentication Failures
API2:2023 - Broken Authentication
CWE-345
T1600 - Weaken Encryption
Critical
Advanced
token, _ := jwt.Parse(t, func(t *jwt.Token) (interface{}, error) { return key, nil }) // Vulnerable: any alg
token, _ := jwt.Parse(t, func(t *jwt.Token) (interface{}, error) { if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("bad") } // Secure: pin return key, nil })
--- a/auth.go +++ b/auth.go @@ -1,3 +1,5 @@ -token, _ := jwt.Parse(t, func(t *jwt.Token) (interface{}, error) { return key, nil }) +token, _ := jwt.Parse(t, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("bad") } + return key, nil +})
No algorithm pinning.
Forge alg=none token.
Auth bypass.
Pin algorithm.
Forbid none.
[ "jwt", "go", "gin", "auth" ]
{ "domain": "Authentication systems", "input_source": "header", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000045
TypeScript
Next.js
GraphQL introspection enabled in production
A Next.js GraphQL endpoint leaves introspection on in production, exposing the full schema.
A05:2021 - Security Misconfiguration
CWE-215
T1190 - Exploit Public-Facing Application
Low
Beginner
const server = new ApolloServer({ schema, introspection: true, // Vulnerable: on in prod });
const server = new ApolloServer({ schema, introspection: process.env.NODE_ENV !== 'production', csrfPrevention: true, });
--- a/apollo.ts +++ b/apollo.ts @@ -2,3 +2,4 @@ - introspection: true, + introspection: process.env.NODE_ENV !== 'production', + csrfPrevention: true,
Introspection is not disabled in production, leaking the schema to attackers.
An attacker queries __schema to map every type/field and find unprotected ones.
Reconnaissance that accelerates targeted attacks.
Disable introspection in production and enable CSRF prevention.
Gate introspection to non-prod; enable CSRF prevention on GraphQL.
[ "graphql", "nextjs", "typescript", "config" ]
{ "domain": "REST API", "input_source": "schema", "auth_required": false }
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N
SCP-000290
C++
STD
Insecure deserialization (boost)
A C++ app deserializes untrusted bytes with boost::serialization.
A08:2021 - Software and Data Integrity Failures
CWE-502
T1190 - Exploit Public-Facing Application
Critical
Advanced
std::istringstream iss(data); boost::archive::text_iarchive ia(iss); ia >> obj; // Vulnerable: untrusted bytes
// Use a schema-validated JSON/Protobuf with strict parsing auto obj = parse_json_strict(data); // Secure
--- a/load.cpp +++ b/load.cpp @@ -1,4 +1,3 @@ -std::istringstream iss(data); -boost::archive::text_iarchive ia(iss); -ia >> obj; +auto obj = parse_json_strict(data);
Native deserialization of untrusted data.
Craft malicious archive for RCE.
Remote code execution.
Use safe serialization.
Validate deserialized data.
[ "deserialization", "cpp", "rce" ]
{ "domain": "Microservices", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SCP-000467
Go
Gin
Session fixation in Gin
Gin login does not rotate session id.
A07:2021 - Auth Failures
API2:2023
CWE-384
T1539
Medium
Beginner
session.Set("uid", uid) // same id
old := session.ID() session.Set("uid", uid) session.Save() _ = store.RegenID(old, session) // rotate
--- a/login.go +++ b/login.go @@ -1,2 +1,5 @@ -session.Set("uid", uid) +old := session.ID() +session.Set("uid", uid) +session.Save() +_ = store.RegenID(old, session)
No session rotation.
Fixation.
Account takeover.
Rotate session id.
Rotate session on auth.
[ "session", "go", "gin", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": true }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
SCP-000477
Rust
Actix
No rate limit on Actix login
Actix login has no throttling.
A07:2021 - Auth Failures
API4:2023
CWE-307
T1110
Medium
Beginner
.route("/login", web::post().to(login))
.route("/login", web::post().to(login)) .wrap(RateLimiter::new(5, 60))
--- a/routes.rs +++ b/routes.rs @@ -1,2 +1,3 @@ -.route("/login", web::post().to(login)) +.route("/login", web::post().to(login)) +.wrap(RateLimiter::new(5, 60))
No throttle on auth.
Brute force credentials.
Account takeover.
Rate limit login.
Throttle auth endpoints.
[ "rate-limiting", "actix", "rust", "auth" ]
{ "domain": "Authentication systems", "input_source": "request_body", "auth_required": false }
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N