diff --git "a/data/benchmarkjava_review.jsonl" "b/data/benchmarkjava_review.jsonl" new file mode 100644--- /dev/null +++ "b/data/benchmarkjava_review.jsonl" @@ -0,0 +1,22 @@ +{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02189", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n *
The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n *
The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/xpathi-00/BenchmarkTest02189\")\npublic class BenchmarkTest02189 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String param = request.getParameter(\"BenchmarkTest02189\");\n if (param == null) param = \"\";\n\n String bar = doSomething(request, param);\n\n try {\n java.io.FileInputStream file =\n new java.io.FileInputStream(\n org.owasp.benchmark.helpers.Utils.getFileFromClasspath(\n \"employees.xml\", this.getClass().getClassLoader()));\n javax.xml.parsers.DocumentBuilderFactory builderFactory =\n javax.xml.parsers.DocumentBuilderFactory.newInstance();\n // Prevent XXE\n builderFactory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n javax.xml.parsers.DocumentBuilder builder = builderFactory.newDocumentBuilder();\n org.w3c.dom.Document xmlDocument = builder.parse(file);\n javax.xml.xpath.XPathFactory xpf = javax.xml.xpath.XPathFactory.newInstance();\n javax.xml.xpath.XPath xp = xpf.newXPath();\n\n String expression = \"/Employees/Employee[@emplid='\" + bar + \"']\";\n org.w3c.dom.NodeList nodeList =\n (org.w3c.dom.NodeList)\n xp.compile(expression)\n .evaluate(xmlDocument, javax.xml.xpath.XPathConstants.NODESET);\n\n response.getWriter().println(\"Your query results are:
\");\n\n for (int i = 0; i < nodeList.getLength(); i++) {\n org.w3c.dom.Element value = (org.w3c.dom.Element) nodeList.item(i);\n response.getWriter().println(value.getTextContent() + \"
\");\n }\n } catch (javax.xml.xpath.XPathExpressionException\n | javax.xml.parsers.ParserConfigurationException\n | org.xml.sax.SAXException e) {\n response.getWriter()\n .println(\n \"Error parsing XPath input: '\"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(bar)\n + \"'\");\n throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = param;\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"xpathi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-643\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"xpathi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-643\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"xpathi\", \"expected_result_cwe\": \"CWE-643\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02189.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"7dad2393712ed1520ae660080c8e09461999eee81ebd6cf04a182d5674033bfe\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02189.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02457", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n *
The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n *
The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/xpathi-00/BenchmarkTest02457\")\npublic class BenchmarkTest02457 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheParameter(\"BenchmarkTest02457\");\n if (param == null) param = \"\";\n\n String bar = doSomething(request, param);\n\n try {\n java.io.FileInputStream file =\n new java.io.FileInputStream(\n org.owasp.benchmark.helpers.Utils.getFileFromClasspath(\n \"employees.xml\", this.getClass().getClassLoader()));\n javax.xml.parsers.DocumentBuilderFactory builderFactory =\n javax.xml.parsers.DocumentBuilderFactory.newInstance();\n // Prevent XXE\n builderFactory.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n javax.xml.parsers.DocumentBuilder builder = builderFactory.newDocumentBuilder();\n org.w3c.dom.Document xmlDocument = builder.parse(file);\n javax.xml.xpath.XPathFactory xpf = javax.xml.xpath.XPathFactory.newInstance();\n javax.xml.xpath.XPath xp = xpf.newXPath();\n\n String expression = \"/Employees/Employee[@emplid='\" + bar + \"']\";\n String result = xp.evaluate(expression, xmlDocument);\n\n response.getWriter().println(\"Your query results are: \" + result + \" This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/ldapi-00/BenchmarkTest02472\")\npublic class BenchmarkTest02472 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String[] values = request.getParameterValues(\"BenchmarkTest02472\");\n String param;\n if (values != null && values.length > 0) param = values[0];\n else param = \"\";\n\n String bar = doSomething(request, param);\n\n org.owasp.benchmark.helpers.LDAPManager ads = new org.owasp.benchmark.helpers.LDAPManager();\n try {\n response.setContentType(\"text/html;charset=UTF-8\");\n String base = \"ou=users,ou=system\";\n javax.naming.directory.SearchControls sc = new javax.naming.directory.SearchControls();\n sc.setSearchScope(javax.naming.directory.SearchControls.SUBTREE_SCOPE);\n String filter = \"(&(objectclass=person))(|(uid=\" + bar + \")(street={0}))\";\n Object[] filters = new Object[] {\"The streetz 4 Ms bar\"};\n\n javax.naming.directory.DirContext ctx = ads.getDirContext();\n javax.naming.directory.InitialDirContext idc =\n (javax.naming.directory.InitialDirContext) ctx;\n boolean found = false;\n javax.naming.NamingEnumeration This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/pathtraver-03/BenchmarkTest02569\")\npublic class BenchmarkTest02569 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02569\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02569\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02569\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n String fileName = null;\n java.io.FileOutputStream fos = null;\n\n try {\n fileName = org.owasp.benchmark.helpers.Utils.TESTFILES_DIR + bar;\n\n fos = new java.io.FileOutputStream(fileName);\n response.getWriter()\n .println(\n \"Now ready to write to file: \"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(fileName));\n\n } catch (Exception e) {\n System.out.println(\"Couldn't open FileOutputStream on file: '\" + fileName + \"'\");\n //\t\t\tSystem.out.println(\"File exception caught and swallowed: \" + e.getMessage());\n } finally {\n if (fos != null) {\n try {\n fos.close();\n fos = null;\n } catch (Exception e) {\n // we tried...\n }\n }\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar;\n String guess = \"ABC\";\n char switchTarget = guess.charAt(2);\n\n // Simple case statement that assigns param to bar on conditions 'A', 'C', or 'D'\n switch (switchTarget) {\n case 'A':\n bar = param;\n break;\n case 'B':\n bar = \"bobs_your_uncle\";\n break;\n case 'C':\n case 'D':\n bar = param;\n break;\n default:\n bar = \"bobs_your_uncle\";\n break;\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"pathtraver\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-22\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"pathtraver\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-22\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"pathtraver\", \"expected_result_cwe\": \"CWE-22\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02569.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"a3dfe0cf46f8aa6f7e69f71f1df7117fe58466b35eb931d3c728dca9f69dd023\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02569.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02572", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/ldapi-00/BenchmarkTest02572\")\npublic class BenchmarkTest02572 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02572\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02572\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02572\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n org.owasp.benchmark.helpers.LDAPManager ads = new org.owasp.benchmark.helpers.LDAPManager();\n try {\n response.setContentType(\"text/html;charset=UTF-8\");\n String base = \"ou=users,ou=system\";\n javax.naming.directory.SearchControls sc = new javax.naming.directory.SearchControls();\n sc.setSearchScope(javax.naming.directory.SearchControls.SUBTREE_SCOPE);\n String filter = \"(&(objectclass=person)(uid=\" + bar + \"))\";\n\n javax.naming.directory.DirContext ctx = ads.getDirContext();\n javax.naming.directory.InitialDirContext idc =\n (javax.naming.directory.InitialDirContext) ctx;\n boolean found = false;\n javax.naming.NamingEnumeration This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/xss-05/BenchmarkTest02608\")\npublic class BenchmarkTest02608 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02608\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02608\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02608\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n response.setHeader(\"X-XSS-Protection\", \"0\");\n response.getWriter().write(\"Parameter value: \" + bar);\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = param;\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"xss\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-79\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"xss\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-79\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"xss\", \"expected_result_cwe\": \"CWE-79\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02608.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"7999e879497173727b3fa2e95fa287d8261e5da421f8050b46bf28d195ef0ed3\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02608.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02613", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/cmdi-03/BenchmarkTest02613\")\npublic class BenchmarkTest02613 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02613\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02613\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02613\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n String cmd =\n org.owasp.benchmark.helpers.Utils.getInsecureOSCommandString(\n this.getClass().getClassLoader());\n String[] argsEnv = {bar};\n Runtime r = Runtime.getRuntime();\n try {\n Process p = r.exec(cmd, argsEnv, new java.io.File(System.getProperty(\"user.dir\")));\n org.owasp.benchmark.helpers.Utils.printOSCommandResults(p, response);\n } catch (IOException e) {\n System.out.println(\"Problem executing cmdi - TestCase\");\n response.getWriter()\n .println(org.owasp.esapi.ESAPI.encoder().encodeForHTML(e.getMessage()));\n return;\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar;\n String guess = \"ABC\";\n char switchTarget = guess.charAt(2);\n\n // Simple case statement that assigns param to bar on conditions 'A', 'C', or 'D'\n switch (switchTarget) {\n case 'A':\n bar = param;\n break;\n case 'B':\n bar = \"bobs_your_uncle\";\n break;\n case 'C':\n case 'D':\n bar = param;\n break;\n default:\n bar = \"bobs_your_uncle\";\n break;\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"cmdi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-78\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"cmdi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-78\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"cmdi\", \"expected_result_cwe\": \"CWE-78\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02613.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"ee0f005015b5a8afa0a4e7af66b603bee30d88caccf4b7bc7b3967bab7923621\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02613.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02624", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/trustbound-01/BenchmarkTest02624\")\npublic class BenchmarkTest02624 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02624\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02624\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02624\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n // javax.servlet.http.HttpSession.setAttribute(java.lang.String,java.lang.Object^)\n request.getSession().setAttribute(\"userid\", bar);\n\n response.getWriter()\n .println(\n \"Item: 'userid' with value: '\"\n + org.owasp.benchmark.helpers.Utils.encodeForHTML(bar)\n + \"' saved in session.\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"safe!\";\n java.util.HashMap This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/sqli-06/BenchmarkTest02656\")\npublic class BenchmarkTest02656 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n String queryString = request.getQueryString();\n String paramval = \"BenchmarkTest02656\" + \"=\";\n int paramLoc = -1;\n if (queryString != null) paramLoc = queryString.indexOf(paramval);\n if (paramLoc == -1) {\n response.getWriter()\n .println(\n \"getQueryString() couldn't find expected parameter '\"\n + \"BenchmarkTest02656\"\n + \"' in query string.\");\n return;\n }\n\n String param =\n queryString.substring(\n paramLoc\n + paramval\n .length()); // 1st assume \"BenchmarkTest02656\" param is last\n // parameter in query string.\n // And then check to see if its in the middle of the query string and if so, trim off what\n // comes after.\n int ampersandLoc = queryString.indexOf(\"&\", paramLoc);\n if (ampersandLoc != -1) {\n param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);\n }\n param = java.net.URLDecoder.decode(param, \"UTF-8\");\n\n String bar = doSomething(request, param);\n\n String sql = \"INSERT INTO users (username, password) VALUES ('foo','\" + bar + \"')\";\n\n try {\n java.sql.Statement statement =\n org.owasp.benchmark.helpers.DatabaseHelper.getSqlStatement();\n int count = statement.executeUpdate(sql, java.sql.Statement.RETURN_GENERATED_KEYS);\n org.owasp.benchmark.helpers.DatabaseHelper.outputUpdateComplete(sql, response);\n } catch (java.sql.SQLException e) {\n if (org.owasp.benchmark.helpers.DatabaseHelper.hideSQLErrors) {\n response.getWriter().println(\"Error processing request.\");\n } else throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar;\n\n // Simple ? condition that assigns param to bar on false condition\n int num = 106;\n\n bar = (7 * 42) - num > 200 ? \"This should never happen\" : param;\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"sqli\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-89\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"sqli\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-89\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"sqli\", \"expected_result_cwe\": \"CWE-89\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02656.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"bc933bf5913303a3526cbeab9714139334cafa6eebb9f5437a7a93f64dedda7b\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02656.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02662", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/crypto-03/BenchmarkTest02662\")\npublic class BenchmarkTest02662 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02662\");\n\n String bar = doSomething(request, param);\n\n // Code based on example from:\n // http://examples.javacodegeeks.com/core-java/crypto/encrypt-decrypt-file-stream-with-des/\n\n try {\n javax.crypto.Cipher c =\n javax.crypto.Cipher.getInstance(\n \"AES/CCM/NoPadding\", java.security.Security.getProvider(\"BC\"));\n\n // Prepare the cipher to encrypt\n javax.crypto.SecretKey key = javax.crypto.KeyGenerator.getInstance(\"AES\").generateKey();\n c.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n\n // encrypt and store the results\n byte[] input = {(byte) '?'};\n Object inputParam = bar;\n if (inputParam instanceof String) input = ((String) inputParam).getBytes();\n if (inputParam instanceof java.io.InputStream) {\n byte[] strInput = new byte[1000];\n int i = ((java.io.InputStream) inputParam).read(strInput);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n input = java.util.Arrays.copyOf(strInput, i);\n }\n byte[] result = c.doFinal(input);\n\n java.io.File fileTarget =\n new java.io.File(\n new java.io.File(org.owasp.benchmark.helpers.Utils.TESTFILES_DIR),\n \"passwordFile.txt\");\n java.io.FileWriter fw =\n new java.io.FileWriter(fileTarget, true); // the true will append the new data\n fw.write(\n \"secret_value=\"\n + org.owasp.esapi.ESAPI.encoder().encodeForBase64(result, true)\n + \"\\n\");\n fw.close();\n response.getWriter()\n .println(\n \"Sensitive value: '\"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(new String(input))\n + \"' encrypted and stored This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/crypto-03/BenchmarkTest02663\")\npublic class BenchmarkTest02663 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02663\");\n\n String bar = doSomething(request, param);\n\n try {\n java.util.Properties benchmarkprops = new java.util.Properties();\n benchmarkprops.load(\n this.getClass().getClassLoader().getResourceAsStream(\"benchmark.properties\"));\n String algorithm = benchmarkprops.getProperty(\"cryptoAlg1\", \"DESede/ECB/PKCS5Padding\");\n javax.crypto.Cipher c = javax.crypto.Cipher.getInstance(algorithm);\n\n // Prepare the cipher to encrypt\n javax.crypto.SecretKey key = javax.crypto.KeyGenerator.getInstance(\"DES\").generateKey();\n c.init(javax.crypto.Cipher.ENCRYPT_MODE, key);\n\n // encrypt and store the results\n byte[] input = {(byte) '?'};\n Object inputParam = bar;\n if (inputParam instanceof String) input = ((String) inputParam).getBytes();\n if (inputParam instanceof java.io.InputStream) {\n byte[] strInput = new byte[1000];\n int i = ((java.io.InputStream) inputParam).read(strInput);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n input = java.util.Arrays.copyOf(strInput, i);\n }\n byte[] result = c.doFinal(input);\n\n java.io.File fileTarget =\n new java.io.File(\n new java.io.File(org.owasp.benchmark.helpers.Utils.TESTFILES_DIR),\n \"passwordFile.txt\");\n java.io.FileWriter fw =\n new java.io.FileWriter(fileTarget, true); // the true will append the new data\n fw.write(\n \"secret_value=\"\n + org.owasp.esapi.ESAPI.encoder().encodeForBase64(result, true)\n + \"\\n\");\n fw.close();\n response.getWriter()\n .println(\n \"Sensitive value: '\"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(new String(input))\n + \"' encrypted and stored This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/pathtraver-03/BenchmarkTest02669\")\npublic class BenchmarkTest02669 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02669\");\n\n String bar = doSomething(request, param);\n\n String fileName = null;\n java.io.FileOutputStream fos = null;\n\n try {\n fileName = org.owasp.benchmark.helpers.Utils.TESTFILES_DIR + bar;\n\n fos = new java.io.FileOutputStream(fileName);\n response.getWriter()\n .println(\n \"Now ready to write to file: \"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(fileName));\n\n } catch (Exception e) {\n System.out.println(\"Couldn't open FileOutputStream on file: '\" + fileName + \"'\");\n //\t\t\tSystem.out.println(\"File exception caught and swallowed: \" + e.getMessage());\n } finally {\n if (fos != null) {\n try {\n fos.close();\n fos = null;\n } catch (Exception e) {\n // we tried...\n }\n }\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"alsosafe\";\n if (param != null) {\n java.util.List This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/hash-02/BenchmarkTest02677\")\npublic class BenchmarkTest02677 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02677\");\n\n String bar = doSomething(request, param);\n\n try {\n java.util.Properties benchmarkprops = new java.util.Properties();\n benchmarkprops.load(\n this.getClass().getClassLoader().getResourceAsStream(\"benchmark.properties\"));\n String algorithm = benchmarkprops.getProperty(\"hashAlg1\", \"SHA512\");\n java.security.MessageDigest md = java.security.MessageDigest.getInstance(algorithm);\n byte[] input = {(byte) '?'};\n Object inputParam = bar;\n if (inputParam instanceof String) input = ((String) inputParam).getBytes();\n if (inputParam instanceof java.io.InputStream) {\n byte[] strInput = new byte[1000];\n int i = ((java.io.InputStream) inputParam).read(strInput);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n input = java.util.Arrays.copyOf(strInput, i);\n }\n md.update(input);\n\n byte[] result = md.digest();\n java.io.File fileTarget =\n new java.io.File(\n new java.io.File(org.owasp.benchmark.helpers.Utils.TESTFILES_DIR),\n \"passwordFile.txt\");\n java.io.FileWriter fw =\n new java.io.FileWriter(fileTarget, true); // the true will append the new data\n fw.write(\n \"hash_value=\"\n + org.owasp.esapi.ESAPI.encoder().encodeForBase64(result, true)\n + \"\\n\");\n fw.close();\n response.getWriter()\n .println(\n \"Sensitive value '\"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(new String(input))\n + \"' hashed and stored This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/hash-02/BenchmarkTest02678\")\npublic class BenchmarkTest02678 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02678\");\n\n String bar = doSomething(request, param);\n\n try {\n java.util.Properties benchmarkprops = new java.util.Properties();\n benchmarkprops.load(\n this.getClass().getClassLoader().getResourceAsStream(\"benchmark.properties\"));\n String algorithm = benchmarkprops.getProperty(\"hashAlg2\", \"SHA5\");\n java.security.MessageDigest md = java.security.MessageDigest.getInstance(algorithm);\n byte[] input = {(byte) '?'};\n Object inputParam = bar;\n if (inputParam instanceof String) input = ((String) inputParam).getBytes();\n if (inputParam instanceof java.io.InputStream) {\n byte[] strInput = new byte[1000];\n int i = ((java.io.InputStream) inputParam).read(strInput);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n input = java.util.Arrays.copyOf(strInput, i);\n }\n md.update(input);\n\n byte[] result = md.digest();\n java.io.File fileTarget =\n new java.io.File(\n new java.io.File(org.owasp.benchmark.helpers.Utils.TESTFILES_DIR),\n \"passwordFile.txt\");\n java.io.FileWriter fw =\n new java.io.FileWriter(fileTarget, true); // the true will append the new data\n fw.write(\n \"hash_value=\"\n + org.owasp.esapi.ESAPI.encoder().encodeForBase64(result, true)\n + \"\\n\");\n fw.close();\n response.getWriter()\n .println(\n \"Sensitive value '\"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(new String(input))\n + \"' hashed and stored This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/weakrand-06/BenchmarkTest02708\")\npublic class BenchmarkTest02708 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02708\");\n\n String bar = doSomething(request, param);\n\n long l = new java.util.Random().nextLong();\n String rememberMeKey = Long.toString(l);\n\n String user = \"Logan\";\n String fullClassName = this.getClass().getName();\n String testCaseNumber =\n fullClassName.substring(\n fullClassName.lastIndexOf('.') + 1 + \"BenchmarkTest\".length());\n user += testCaseNumber;\n\n String cookieName = \"rememberMe\" + testCaseNumber;\n\n boolean foundUser = false;\n javax.servlet.http.Cookie[] cookies = request.getCookies();\n if (cookies != null) {\n for (int i = 0; !foundUser && i < cookies.length; i++) {\n javax.servlet.http.Cookie cookie = cookies[i];\n if (cookieName.equals(cookie.getName())) {\n if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {\n foundUser = true;\n }\n }\n }\n }\n\n if (foundUser) {\n response.getWriter().println(\"Welcome back: \" + user + \" This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/securecookie-00/BenchmarkTest02710\")\npublic class BenchmarkTest02710 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02710\");\n\n String bar = doSomething(request, param);\n\n byte[] input = new byte[1000];\n String str = \"?\";\n Object inputParam = param;\n if (inputParam instanceof String) str = ((String) inputParam);\n if (inputParam instanceof java.io.InputStream) {\n int i = ((java.io.InputStream) inputParam).read(input);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n str = new String(input, 0, i);\n }\n if (\"\".equals(str)) str = \"No cookie value supplied\";\n javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie(\"SomeCookie\", str);\n\n cookie.setSecure(false);\n cookie.setHttpOnly(true);\n cookie.setPath(request.getRequestURI()); // i.e., set path to JUST this servlet\n // e.g., /benchmark/sql-01/BenchmarkTest01001\n response.addCookie(cookie);\n\n response.getWriter()\n .println(\n \"Created cookie: 'SomeCookie': with value: '\"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(str)\n + \"' and secure flag set to: false\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = org.springframework.web.util.HtmlUtils.htmlEscape(param);\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"securecookie\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-614\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"securecookie\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-614\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"securecookie\", \"expected_result_cwe\": \"CWE-614\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02710.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"f30e31957b18d18cec7de465260bdb7e786f0e96b2f7dc50beab07223fd2f96b\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02710.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02711", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/securecookie-00/BenchmarkTest02711\")\npublic class BenchmarkTest02711 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02711\");\n\n String bar = doSomething(request, param);\n\n byte[] input = new byte[1000];\n String str = \"?\";\n Object inputParam = param;\n if (inputParam instanceof String) str = ((String) inputParam);\n if (inputParam instanceof java.io.InputStream) {\n int i = ((java.io.InputStream) inputParam).read(input);\n if (i == -1) {\n response.getWriter()\n .println(\n \"This input source requires a POST, not a GET. Incompatible UI for the InputStream source.\");\n return;\n }\n str = new String(input, 0, i);\n }\n if (\"\".equals(str)) str = \"No cookie value supplied\";\n javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie(\"SomeCookie\", str);\n\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setPath(request.getRequestURI()); // i.e., set path to JUST this servlet\n // e.g., /benchmark/sql-01/BenchmarkTest01001\n response.addCookie(cookie);\n\n response.getWriter()\n .println(\n \"Created cookie: 'SomeCookie': with value: '\"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(str)\n + \"' and secure flag set to: true\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = param;\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"securecookie\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-614\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"securecookie\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-614\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"securecookie\", \"expected_result_cwe\": \"CWE-614\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02711.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"65831fa3b1be50ad088972399c2ff54ef7fb84551c1c42c7a93545db00180b33\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02711.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02712", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/xss-05/BenchmarkTest02712\")\npublic class BenchmarkTest02712 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02712\");\n\n String bar = doSomething(request, param);\n\n response.setHeader(\"X-XSS-Protection\", \"0\");\n response.getWriter().write(\"Parameter value: \" + bar);\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"safe!\";\n java.util.HashMap This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/cmdi-03/BenchmarkTest02714\")\npublic class BenchmarkTest02714 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02714\");\n\n String bar = doSomething(request, param);\n\n String cmd =\n org.owasp.benchmark.helpers.Utils.getInsecureOSCommandString(\n this.getClass().getClassLoader());\n String[] argsEnv = {bar};\n Runtime r = Runtime.getRuntime();\n try {\n Process p = r.exec(cmd, argsEnv, new java.io.File(System.getProperty(\"user.dir\")));\n org.owasp.benchmark.helpers.Utils.printOSCommandResults(p, response);\n } catch (IOException e) {\n System.out.println(\"Problem executing cmdi - TestCase\");\n response.getWriter()\n .println(org.owasp.esapi.ESAPI.encoder().encodeForHTML(e.getMessage()));\n return;\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"\";\n if (param != null) {\n java.util.List This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/weakrand-06/BenchmarkTest02721\")\npublic class BenchmarkTest02721 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02721\");\n\n String bar = doSomething(request, param);\n\n try {\n long l = java.security.SecureRandom.getInstance(\"SHA1PRNG\").nextLong();\n String rememberMeKey = Long.toString(l);\n\n String user = \"SafeLogan\";\n String fullClassName = this.getClass().getName();\n String testCaseNumber =\n fullClassName.substring(\n fullClassName.lastIndexOf('.') + 1 + \"BenchmarkTest\".length());\n user += testCaseNumber;\n\n String cookieName = \"rememberMe\" + testCaseNumber;\n\n boolean foundUser = false;\n javax.servlet.http.Cookie[] cookies = request.getCookies();\n if (cookies != null) {\n for (int i = 0; !foundUser && i < cookies.length; i++) {\n javax.servlet.http.Cookie cookie = cookies[i];\n if (cookieName.equals(cookie.getName())) {\n if (cookie.getValue()\n .equals(request.getSession().getAttribute(cookieName))) {\n foundUser = true;\n }\n }\n }\n }\n\n if (foundUser) {\n response.getWriter().println(\"Welcome back: \" + user + \" This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/trustbound-01/BenchmarkTest02726\")\npublic class BenchmarkTest02726 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02726\");\n\n String bar = doSomething(request, param);\n\n // javax.servlet.http.HttpSession.setAttribute(java.lang.String,java.lang.Object^)\n request.getSession().setAttribute(\"userid\", bar);\n\n response.getWriter()\n .println(\n \"Item: 'userid' with value: '\"\n + org.owasp.benchmark.helpers.Utils.encodeForHTML(bar)\n + \"' saved in session.\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = param;\n if (param != null && param.length() > 1) {\n bar = param.substring(0, param.length() - 1);\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"trustbound\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-501\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"trustbound\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-501\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"trustbound\", \"expected_result_cwe\": \"CWE-501\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02726.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"4a3ed0b365445020289f03b038775cdb0af078dedc988736b56f8105b3592e4a\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02726.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02740", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n * This file is part of the Open Web Application Security Project (OWASP) Benchmark Project. For\n * details, please see https://owasp.org/www-project-benchmark/.\n *\n * The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms\n * of the GNU General Public License as published by the Free Software Foundation, version 2.\n *\n * The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n * PURPOSE. See the GNU General Public License for more details.\n *\n * @author Nick Sanidas\n * @created 2015\n */\npackage org.owasp.benchmark.testcode;\n\nimport java.io.IOException;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@WebServlet(value = \"/sqli-06/BenchmarkTest02740\")\npublic class BenchmarkTest02740 extends HttpServlet {\n\n private static final long serialVersionUID = 1L;\n\n @Override\n public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n doPost(request, response);\n }\n\n @Override\n public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n\n org.owasp.benchmark.helpers.SeparateClassRequest scr =\n new org.owasp.benchmark.helpers.SeparateClassRequest(request);\n String param = scr.getTheValue(\"BenchmarkTest02740\");\n\n String bar = doSomething(request, param);\n\n String sql = \"INSERT INTO users (username, password) VALUES ('foo','\" + bar + \"')\";\n\n try {\n java.sql.Statement statement =\n org.owasp.benchmark.helpers.DatabaseHelper.getSqlStatement();\n int count = statement.executeUpdate(sql);\n org.owasp.benchmark.helpers.DatabaseHelper.outputUpdateComplete(sql, response);\n } catch (java.sql.SQLException e) {\n if (org.owasp.benchmark.helpers.DatabaseHelper.hideSQLErrors) {\n response.getWriter().println(\"Error processing request.\");\n } else throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar;\n\n // Simple if statement that assigns param to bar on true condition\n int num = 196;\n if ((500 / 42) + num > 200) bar = param;\n else bar = \"This should never happen\";\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"sqli\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-89\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"sqli\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-89\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"sqli\", \"expected_result_cwe\": \"CWE-89\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02740.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"c6ae0ee13166dc706178828ae8d9bdbdd7461cedcd37b8f4ce35a764ac40aa59\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02740.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
\");\n\n } catch (javax.xml.xpath.XPathExpressionException\n | javax.xml.parsers.ParserConfigurationException\n | org.xml.sax.SAXException e) {\n response.getWriter()\n .println(\n \"Error parsing XPath input: '\"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(bar)\n + \"'\");\n throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"alsosafe\";\n if (param != null) {\n java.util.List
\"\n + \"Record found with name \"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(attr.get().toString())\n + \"
Address: \"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(attr2.get().toString())\n + \"
\");\n found = true;\n }\n }\n if (!found) {\n response.getWriter()\n .println(\n \"LDAP query results: nothing found for query: \"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(filter));\n }\n } catch (javax.naming.NamingException e) {\n throw new ServletException(e);\n } finally {\n try {\n ads.closeDirContext();\n } catch (Exception e) {\n throw new ServletException(e);\n }\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"\";\n if (param != null) {\n bar =\n new String(\n org.apache.commons.codec.binary.Base64.decodeBase64(\n org.apache.commons.codec.binary.Base64.encodeBase64(\n param.getBytes())));\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"ldapi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-90\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"ldapi\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-90\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"ldapi\", \"expected_result_cwe\": \"CWE-90\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02472.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"0e701ce82d7093d2655debe295bf364e44bab6298fa8c1eedab3a99d4a82f798\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02472.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02569", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\"\n + \"Record found with name \"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(attr.get().toString())\n + \"
Address: \"\n + org.owasp\n .esapi\n .ESAPI\n .encoder()\n .encodeForHTML(attr2.get().toString())\n + \"
\");\n found = true;\n }\n }\n if (!found) {\n response.getWriter()\n .println(\n \"LDAP query results: nothing found for query: \"\n + org.owasp.esapi.ESAPI.encoder().encodeForHTML(filter));\n }\n } catch (javax.naming.NamingException e) {\n throw new ServletException(e);\n } finally {\n try {\n ads.closeDirContext();\n } catch (Exception e) {\n throw new ServletException(e);\n }\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"alsosafe\";\n if (param != null) {\n java.util.List
\");\n\n } catch (java.security.NoSuchAlgorithmException\n | javax.crypto.NoSuchPaddingException\n | javax.crypto.IllegalBlockSizeException\n | javax.crypto.BadPaddingException\n | java.security.InvalidKeyException e) {\n response.getWriter()\n .println(\n \"Problem executing crypto - javax.crypto.Cipher.getInstance(java.lang.String,java.security.Provider) Test Case\");\n e.printStackTrace(response.getWriter());\n throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"\";\n if (param != null) bar = param.split(\" \")[0];\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"crypto\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-327\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"crypto\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-327\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"crypto\", \"expected_result_cwe\": \"CWE-327\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02662.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"a5256d29eaa1f6038c56a944ed9d589e75fdd261661157f85d920298d123636d\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02662.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02663", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\");\n\n } catch (java.security.NoSuchAlgorithmException\n | javax.crypto.NoSuchPaddingException\n | javax.crypto.IllegalBlockSizeException\n | javax.crypto.BadPaddingException\n | java.security.InvalidKeyException e) {\n response.getWriter()\n .println(\n \"Problem executing crypto - javax.crypto.Cipher.getInstance(java.lang.String,java.security.Provider) Test Case\");\n e.printStackTrace(response.getWriter());\n throw new ServletException(e);\n }\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = org.apache.commons.lang.StringEscapeUtils.escapeHtml(param);\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"crypto\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-327\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"crypto\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-327\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"crypto\", \"expected_result_cwe\": \"CWE-327\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02663.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"011b93cc1dddbdc90c846d4b2ad77c9c87141a6f0cd09c8bb1233fb5fd91a17f\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02663.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02669", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\");\n\n } catch (java.security.NoSuchAlgorithmException e) {\n System.out.println(\"Problem executing hash - TestCase\");\n throw new ServletException(e);\n }\n\n response.getWriter()\n .println(\n \"Hash Test java.security.MessageDigest.getInstance(java.lang.String) executed\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = param;\n if (param != null && param.length() > 1) {\n StringBuilder sbxyz68995 = new StringBuilder(param);\n bar = sbxyz68995.replace(param.length() - \"Z\".length(), param.length(), \"Z\").toString();\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"hash\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-328\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"hash\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-328\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"hash\", \"expected_result_cwe\": \"CWE-328\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02677.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"5a7f56ba0dab2c57068f7aca2a8d60d96fc7523293808b08d8e58044b41b5c90\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02677.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02678", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\");\n\n } catch (java.security.NoSuchAlgorithmException e) {\n System.out.println(\"Problem executing hash - TestCase\");\n throw new ServletException(e);\n }\n\n response.getWriter()\n .println(\n \"Hash Test java.security.MessageDigest.getInstance(java.lang.String) executed\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = \"\";\n if (param != null) {\n bar =\n new String(\n org.apache.commons.codec.binary.Base64.decodeBase64(\n org.apache.commons.codec.binary.Base64.encodeBase64(\n param.getBytes())));\n }\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"hash\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-328\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"hash\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-328\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"hash\", \"expected_result_cwe\": \"CWE-328\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02678.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"014c28bc6f5b933415766c634ab6d0cd2de58f90051e2053b623d32266900654\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02678.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02708", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\");\n\n } else {\n javax.servlet.http.Cookie rememberMe =\n new javax.servlet.http.Cookie(cookieName, rememberMeKey);\n rememberMe.setSecure(true);\n rememberMe.setHttpOnly(true);\n rememberMe.setPath(request.getRequestURI()); // i.e., set path to JUST this servlet\n // e.g., /benchmark/sql-01/BenchmarkTest01001\n request.getSession().setAttribute(cookieName, rememberMeKey);\n response.addCookie(rememberMe);\n response.getWriter()\n .println(\n user\n + \" has been remembered with cookie: \"\n + rememberMe.getName()\n + \" whose value is: \"\n + rememberMe.getValue()\n + \"
\");\n }\n\n response.getWriter().println(\"Weak Randomness Test java.util.Random.nextLong() executed\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = org.springframework.web.util.HtmlUtils.htmlEscape(param);\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"weakrand\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-330\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"weakrand\", \"classification\": \"benchmark_expected_vulnerable\", \"cwe\": \"CWE-330\", \"expected_vulnerability\": true, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"weakrand\", \"expected_result_cwe\": \"CWE-330\", \"expected_result_vulnerable\": true, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02708.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"1e8e464b8db864639164081de466b2ab72ebb42c39a661efc15f5e97e2706c70\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02708.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02710", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *
\");\n } else {\n javax.servlet.http.Cookie rememberMe =\n new javax.servlet.http.Cookie(cookieName, rememberMeKey);\n rememberMe.setSecure(true);\n rememberMe.setHttpOnly(true);\n rememberMe.setPath(request.getRequestURI()); // i.e., set path to JUST this servlet\n // e.g., /benchmark/sql-01/BenchmarkTest01001\n request.getSession().setAttribute(cookieName, rememberMeKey);\n response.addCookie(rememberMe);\n response.getWriter()\n .println(\n user\n + \" has been remembered with cookie: \"\n + rememberMe.getName()\n + \" whose value is: \"\n + rememberMe.getValue()\n + \"
\");\n }\n } catch (java.security.NoSuchAlgorithmException e) {\n System.out.println(\"Problem executing SecureRandom.nextLong() - TestCase\");\n throw new ServletException(e);\n }\n response.getWriter()\n .println(\"Weak Randomness Test java.security.SecureRandom.nextLong() executed\");\n } // end doPost\n\n private static String doSomething(HttpServletRequest request, String param)\n throws ServletException, IOException {\n\n String bar = org.springframework.web.util.HtmlUtils.htmlEscape(param);\n\n return bar;\n }\n}\n", "instruction": "Classify this OWASP BenchmarkJava v1.2 test case using the benchmark's expected-result label for its category. Return the expected vulnerability status and CWE, and cite relevant code evidence. Interpret a negative benchmark result only for the designated test case and category; do not claim that the whole file or application is generally secure.", "labels_json": "{\"benchmark_category\": \"weakrand\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-330\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "language": "Java", "output": "{\"benchmark_category\": \"weakrand\", \"classification\": \"benchmark_expected_not_vulnerable\", \"cwe\": \"CWE-330\", \"expected_vulnerability\": false, \"label_basis\": \"OWASP BenchmarkJava v1.2 expectedresults-1.2.csv row for this exact test case.\", \"label_scope\": \"The expected result applies to this benchmark test case and its designated category. A false result means the benchmark does not expect this specific test case to trigger the designated vulnerability; it is not a general claim that the file or application is safe.\"}", "provenance_json": "{\"ai_ml_terms_review\": \"No AI/ML-specific grant or restriction was located in the selected source header or GPL-2.0 text. The source permits copying and distribution subject to GPL-2.0 conditions; this is not a separate legal determination about model training or downstream model distribution.\", \"curation_modified_at\": \"2026-11-24\", \"curation_transformation\": \"The full Java source file is copied verbatim with its original GPLv2 header. Labels are copied from the matching expected-results CSV fields; code is not modified, compiled, or executed.\", \"expected_result_category\": \"weakrand\", \"expected_result_cwe\": \"CWE-330\", \"expected_result_vulnerable\": false, \"expected_results_file\": \"expectedresults-1.2.csv\", \"expected_results_sha256\": \"1809f6a690c6cf7dd6685df6ebe2eef8fe3ca93d19a7ca0ce45987ca4f5d78e1\", \"expected_results_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/expectedresults-1.2.csv\", \"selection_policy\": \"A small balanced review subset: one expected-vulnerable and one expected-not-vulnerable case from each of the 11 categories in the pinned v1.2 expected-results file. Cases were selected by explicit ID and included only after verifying their own GPLv2 header and exact source hash.\", \"source_commit\": \"10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17\", \"source_file\": \"src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02721.java\", \"source_license\": \"GPL-2.0-only\", \"source_license_basis\": \"The selected Java source file itself carries an explicit OWASP Benchmark GPL version 2 redistribution/modification notice.\", \"source_license_file\": \"LICENSES/OWASP-BENCHMARK-GPL-2.0.txt\", \"source_license_file_sha256\": \"c03cea027b4b40e4402fabd08557736727ec3d5bc54ad64ab6472de432198cad\", \"source_license_file_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/LICENSE\", \"source_repo\": \"OWASP-Benchmark/BenchmarkJava\", \"source_sha256\": \"eddf1069da360f0a612164bed500520b271944188c0471792d784017263058ec\", \"source_spdx\": \"GPL-2.0-only\", \"source_url\": \"https://raw.githubusercontent.com/OWASP-Benchmark/BenchmarkJava/10dfcc54ad02dcfcb358b0ba4a0fef8c919a6d17/src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02721.java\", \"source_version\": \"v1.2\"}", "source": "OWASP BenchmarkJava v1.2", "split": "benchmarkjava_review", "task_type": "classify_benchmark_security_case"}
+{"domain": "web_application_security", "id": "owasp-benchmarkjava-benchmarktest02726", "input": "/**\n * OWASP Benchmark Project v1.2\n *\n *