{"id": "SCP-000042", "language": "Java", "framework": "Spring Boot", "title": "Clickjacking - missing frame options", "description": "A Spring Boot app serves sensitive pages without X-Frame-Options / CSP frame-ancestors.", "owasp": "A05:2021 - Security Misconfiguration", "owasp_api": "", "owasp_llm": "", "cwe": "CWE-1021", "mitre_attack": "T1185 - Browser Session Hijacking", "severity": "Medium", "difficulty": "Beginner", "vulnerable_code": "@Configuration\npublic class WebConfig implements WebMvcConfigurer {\n // Vulnerable: no frame-protection headers\n}\n", "secure_code": "@Configuration\npublic class WebConfig implements WebMvcConfigurer {\n @Override\n public void addInterceptors(InterceptorRegistry reg) {\n reg.addInterceptor(new HandlerInterceptor() {\n public boolean preHandle(r, re, h) {\n r.setHeader(\"X-Frame-Options\", \"DENY\");\n r.setHeader(\"Content-Security-Policy\", \"frame-ancestors 'none'\");\n return true;\n }\n });\n }\n}\n", "patch": "--- a/WebConfig.java\n+++ b/WebConfig.java\n@@ -2,3 +2,12 @@\n+ public void addInterceptors(InterceptorRegistry reg) {\n+ reg.addInterceptor(new HandlerInterceptor() {\n+ public boolean preHandle(r,re,h){ r.setHeader(\"X-Frame-Options\",\"DENY\");\n+ r.setHeader(\"Content-Security-Policy\",\"frame-ancestors 'none'\"); return true; }\n+ });\n", "root_cause": "Responses lack frame-ancestors protections, allowing the page to be embedded in a malicious frame.", "attack": "Attacker overlays an invisible iframe of the target over a fake button (UI redress) to trigger actions.", "impact": "Unwanted actions performed by the victim (clickjacking).", "fix": "Set X-Frame-Options: DENY and CSP frame-ancestors 'none'.", "guideline": "Protect all sensitive pages against framing via CSP frame-ancestors.", "tags": ["clickjacking", "spring", "java", "headers"], "metadata": {"domain": "Banking", "input_source": "response", "auth_required": true}, "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N"} {"id": "SCP-000333", "language": "C#", "framework": "ASP.NET Core", "title": "Insecure JWT validation (no signature check)", "description": "A JWT is parsed without validating the signature.", "owasp": "A07:2021 - Identification and Authentication Failures", "owasp_api": "API2:2023 - Broken Authentication", "owasp_llm": "", "cwe": "CWE-345", "mitre_attack": "T1600 - Weaken Encryption", "severity": "Critical", "difficulty": "Advanced", "vulnerable_code": "var handler = new JwtSecurityTokenHandler();\\nvar t = handler.ReadJwtToken(token); // Vulnerable: no signature validation\\", "secure_code": "var t = handler.ValidateToken(token, new TokenValidationParameters {\\n ValidateIssuerSigningKey = true, IssuerSigningKey = key\\n}, out _); // Secure\\", "patch": "--- a/Auth.cs\\n+++ b/Auth.cs\\n@@ -1,3 +1,5 @@\\n-var t = handler.ReadJwtToken(token);\\n+var t = handler.ValidateToken(token, new TokenValidationParameters {\\n+ ValidateIssuerSigningKey = true, IssuerSigningKey = key\\n+}, out _);\\", "root_cause": "Signature not validated.", "attack": "Forge token with any payload.", "impact": "Auth bypass.", "fix": "Validate signature/issuer.", "guideline": "Always validate JWT signature.", "tags": ["jwt", "csharp", "aspnet", "auth"], "metadata": {"domain": "Authentication systems", "input_source": "header", "auth_required": true}, "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"} {"id": "SCP-000410", "language": "Swift", "framework": "iOS", "title": "Insecure JWT decode without signature", "description": "A JWT is decoded without verifying signature.", "owasp": "A07:2021 - Identification and Authentication Failures", "owasp_api": "API2:2023 - Broken Authentication", "owasp_llm": "", "cwe": "CWE-345", "mitre_attack": "T1600 - Weaken Encryption", "severity": "Critical", "difficulty": "Advanced", "vulnerable_code": "let t = try decode(jwt: token) // Vulnerable: no signature check\\", "secure_code": "let t = try decode(jwt: token, algorithms: [\"HS256\"], secret: key) // Secure: verifies\\", "patch": "--- a/Auth.swift\\n+++ b/Auth.swift\\n@@ -1,3 +1,3 @@\\n-let t = try decode(jwt: token)\\n+let t = try decode(jwt: token, algorithms: [\"HS256\"], secret: key)\\", "root_cause": "No signature validation.", "attack": "Forge token payload.", "impact": "Auth bypass.", "fix": "Verify signature.", "guideline": "Always validate JWT signature.", "tags": ["jwt", "swift", "ios", "auth"], "metadata": {"domain": "Mobile", "input_source": "header", "auth_required": true}, "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"} {"id": "SCP-000161", "language": "Python", "framework": "Flask", "title": "Verbose exception as JSON error", "description": "A Flask API returns the exception string to clients.", "owasp": "A05:2021 - Security Misconfiguration", "owasp_api": "", "owasp_llm": "", "cwe": "CWE-209", "mitre_attack": "T1190 - Exploit Public-Facing Application", "severity": "Low", "difficulty": "Beginner", "vulnerable_code": "@app.errorhandler(500)\ndef e(err):\n return jsonify({'error': str(err)}), 500 # Vulnerable", "secure_code": "@app.errorhandler(500)\ndef e(err):\n app.logger.error('server error: %s', err)\n return jsonify({'error': 'internal'}), 500 # Secure", "patch": "--- a/app.py\n+++ b/app.py\n@@ -1,3 +1,4 @@\n- return jsonify({'error': str(err)}), 500\n+ app.logger.error('server error: %s', err)\n+ return jsonify({'error': 'internal'}), 500", "root_cause": "Raw exception returned to client.", "attack": "Trigger error to learn internals.", "impact": "Info disclosure.", "fix": "Log server-side; return generic error.", "guideline": "Return safe errors.", "tags": ["info-leak", "flask", "python", "error"], "metadata": {"domain": "REST API", "input_source": "server", "auth_required": false}, "cvss_vector": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N"} {"id": "SCP-000094", "language": "Python", "framework": "FastAPI", "title": "Unvalidated FHIR Observation value", "description": "A FastAPI endpoint stores a FHIR Observation value without validating type/range, enabling injection.", "owasp": "A03:2021 - Injection", "owasp_api": "", "owasp_llm": "", "cwe": "CWE-20", "mitre_attack": "T1190 - Exploit Public-Facing Application", "severity": "Medium", "difficulty": "Intermediate", "vulnerable_code": "@app.post('/fhir/Observation')\ndef obs(o: dict):\n # Vulnerable: stores arbitrary value\n db.observations.insert_one(o)\n return {'ok': True}\n", "secure_code": "@app.post('/fhir/Observation')\ndef obs(o: ObservationModel):\n # Secure: pydantic validation of code/value/unit\n if not (0 <= o.valueQuantity.value <= 1000):\n raise HTTPException(422, 'out of range')\n db.observations.insert_one(o.dict())\n return {'ok': True}\n", "patch": "--- a/fhir_obs.py\n+++ b/fhir_obs.py\n@@ -1,5 +1,8 @@\n-def obs(o: dict):\n- db.observations.insert_one(o)\n+def obs(o: ObservationModel):\n+ if not (0 <= o.valueQuantity.value <= 1000):\n+ raise HTTPException(422, 'out of range')\n+ db.observations.insert_one(o.dict())\n", "root_cause": "Observation payload is stored without schema/range validation, allowing malformed or hostile data.", "attack": "Post an Observation with a script payload later rendered in a clinician dashboard (stored XSS).", "impact": "Data integrity loss, stored XSS in viewers.", "fix": "Validate FHIR resources against the profile (type, range, required fields).", "guideline": "Validate all FHIR resources server-side before persistence.", "tags": ["fhir", "fastapi", "python", "input-validation"], "metadata": {"domain": "Healthcare", "input_source": "request_body", "auth_required": true}, "cvss_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N"} {"id": "SCP-000248", "language": "Ruby", "framework": "Rails", "title": "Cross-site scripting in raw HTML", "description": "A Rails view renders a param with raw().", "owasp": "A03:2021 - Injection", "owasp_api": "", "owasp_llm": "", "cwe": "CWE-79", "mitre_attack": "T1059.007 - Command and Scripting Interpreter: JavaScript", "severity": "Medium", "difficulty": "Beginner", "vulnerable_code": "